Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • R Rec
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 289
    • Issues 289
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Jira
    • Jira
  • Merge requests 61
    • Merge requests 61
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • LHCbLHCb
  • Rec
  • Issues
  • #18
Closed
Open
Issue created May 11, 2018 by Gerhard Raven@gravenDeveloper0 of 1 checklist item completed0/1 checklist item

MVA generated code is not thread-safe (Follow-up from "PrLongLivedTracking: remove use of `static` in MLP")

The following discussion from !1053 (merged) should be addressed:

  • @graven started a discussion:

    Aside: PrLongLivedTracking is not reproducible 'as is' when run multithreaded. The number of tracks produced varies from run to run. As the code it self looks thread-safe (after I changed the counters to the new Gaudi counters), I tried the following:

    @@ -485,7 +492,12 @@ LHCb::Tracks PrLongLivedTracking::operator()(const LHCb::Tracks& InputTracks) co
             m_debugTool->tuneFinalMVA( track.track(), trueTrack, vals);
           }
     
    -      const double mvaVal = m_mvaReader->GetMvaValue( vals );
    +      auto mva = [&](auto& v) {
    +         std::lock_guard<std::mutex> guard(mvaMx);
    +         return m_mvaReader->GetMvaValue( v );
    +      };
    +
    +      const double mvaVal = mva( vals );
           track.setMVAVal( mvaVal );
     
           foundBestCand = foundBestCand || mvaVal > 0.05;
    

    where mvaMx is a mutex defined in the global scope. And lo-and-behold, the result becomes reproducible. So the TMVA generated code is not thread-safe in more ways... (how can just asking the evaluate an (already initialized) MVA be not thread-safe???)

Assignee
Assign to
Time tracking