-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use threads with ROOT #1103
Use threads with ROOT #1103
Conversation
For ROOT 5 we must load all plugins before starting the threaded event processing. Therefore I added an option to turn on loading of all dictionaries up front. Also, ROOT requires us to call TThread::Initialize() in order to get ROOT to use internal mutexes.
…thod If you tell ROOT that it needs to be thread safe, it then expects all classes inheriting from TClassStreamer to implement the Generate() method. The method simply uses the copy constructor of the object to return a ‘new’ed version of the object.
We must follow ROOT’s rule which requires a dummy TThread instance be created in each operating system thread in order to create their own thread local storage. Given that we don’t know what thread a TBB task will be run, for right now we create a thread local static TThread on the function which is called from both the main thread and by TBB tasks in order to process events.
Instead of spreading around the different calls needed to setup ROOT for threading, all the methods are concentrated in InitRootHandlers. The EventProcessor then calls the correct virtual methods of the base class RootHandlers Service interface to handle the setup.
A new Pull Request was created by @Dr15Jones (Chris Jones) for CMSSW_7_0_THREADED_X. Use threads with ROOT It involves the following packages: FWCore/Utilities @smuzaffar, @Dr15Jones, @ktf, @nclopezo can you please review it and eventually sign? Thanks. |
+1 Passes all framework unit tests. Plus when combined with all other recent thread-safety commits and the recent ROOT fixes, helgrind does not find any 'true' race conditions when applied to a test which reads from one ROOT file and writes to another ROOT file while using 2 streams and 2 threads. |
This pull request is fully signed and it will be integrated in one of the next IBs unless changes or unless it breaks tests. |
Multi-threaded fixes -- Use threads with ROOT
Use InitRootHandlers to make all the necessary calls to ROOT to enable ROOT's "thread safe" mode. This includes telling ROOT early that we will be using threads and then on each thread creating a dummy instance of TThread. The actual order of calling is handled by EventProcessor by calling through to the appropriate virtual function of RootHandlers. Also, all classes which inherit from TClassStreamer need to have a proper Generate() method since it is now called to create a copy of that class for each thread.