Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • Allpix Squared Allpix Squared
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 20
    • Issues 20
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Allpix SquaredAllpix Squared
  • Allpix SquaredAllpix Squared
  • Merge requests
  • !338

Wrapper class for TRef

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Simon Spannagel requested to merge multithreading_wrapper into multithreading Aug 10, 2020
  • Overview 42
  • Commits 55
  • Pipelines 12
  • Changes 25

This MR contains an attempt to work around the limitations we have to deal with when using TRef objects in massively multithreaded environments (c.f. https://root-forum.cern.ch/t/copying-trefs-and-accessing-tref-data-from-multiple-threads/29417/13).

The idea is relatively straightforward: we introduce a wrapper class which holds both the TRef object and an actual pointer. Whenever accessing the object we just return the pointer instead of querying the TRef object. The latter is only updated via contructor, set() member or the copy constructor used to store and load these objects to/from ROOT files. The pointer is stored via reinterpret_cast as uintptr_t type because ROOT's IO facilities do not seem to be capable of storing raw pointers to file.

This principle works fine and it has been demonstrated that in a "manual" approach (i.e. only loading/storing the TRef object with additional function calls when writing/reading to/from file) this works perfectly fine and scales without problem to 96 cores (tested on 2x AMD EPYC 7402). It however is not very nice from a usability perspective: analysis scripts would have to call the (non-intuitive) loadHistory() function when reading trees from file in order to be able to access the object history. Therefore this MR tries to integrate this behavior by overloading the copy constructor to avoid having to call additional member functions manually. However, only similar performance to the original code just using TRefs is achieved and I still have to understand why.

@kwolters ideas and/or comments would be very welcome.

The current code base contains some cout statements to better understand the lifetime of TRefs and Objects, for performance measurements these should of course be removed.

Edited Aug 13, 2020 by Simon Spannagel
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: multithreading_wrapper