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
Rebase of the CMSSW_7_1_THREADED_X branch on top of CMSSW_7_1_X #3461
Commits on Apr 24, 2014
-
The variable remainingEvents_ may be read by multiple threads simulta…
…nously so must be atomic
Configuration menu - View commit details
-
Copy full SHA for 20c7b96 - Browse repository at this point
Copy the full SHA 20c7b96View commit details -
First version to actually process multiple events concurrently
This version uses a TBB task per Stream to process Events with a mutex used to protect the Source in a critical section. This is sufficient to test the thread safety of the framework internals.
Configuration menu - View commit details
-
Copy full SHA for 4dc580d - Browse repository at this point
Copy the full SHA 4dc580dView commit details -
Propagate exceptions thrown during processing to the main thread
The EventProcessor now uses the new C++11 std::exception_ptr, std::current_exception() and std:rethrow_exception() to capture a thrown exception in a thread processing an event and then transfer that exception to the main thread to be rethrown. We use an std::atomic to provide thread safe update of the std::exception_ptr member data in the case of multiple processing threads having an exception. In such a case, only one of the exceptions will be kept.
Configuration menu - View commit details
-
Copy full SHA for 7c80d45 - Browse repository at this point
Copy the full SHA 7c80d45View commit details -
Added classes to managed resources shared by multiple modules
The SharedResourcesRegistry is the centralized place where resources are registered and where the framework can get SharedResourcesAcquirer instances. These two classes work together to allow safe sharing of non-thread safe resources between modules. A unit test is included to test the two classes.
Configuration menu - View commit details
-
Copy full SHA for af13a91 - Browse repository at this point
Copy the full SHA af13a91View commit details -
Switched to using recursive_mutex and moved SharedResourcesAcquirer.h…
… to interface In order to more easily accommodate unscheduled execution, I switched from using a mutex to a recursive_mutex. This will be less performant since the locks will be held longer than might be needed but it is easier to implement initially. A more performant way would be to release the locks temporarily while we are doing a ‘edm::Event::getBy*’ call.
Configuration menu - View commit details
-
Copy full SHA for 4c388eb - Browse repository at this point
Copy the full SHA 4c388ebView commit details -
Made legacy modules thread safe
Now uses a std::mutex to guarantee a module instance is only processing one event at a time. Also uses a edm::SharedResourcesAcquirer to get the legacy resource and therefore guarantee only one legacy module is running at a time.
Configuration menu - View commit details
-
Copy full SHA for 26ba0da - Browse repository at this point
Copy the full SHA 26ba0daView commit details -
Use the SharedResourcesAcquirer when a ‘one’ type module declares a S…
…haredResource All ‘one’ style base classes now hold a SharedResourcesAcquirer and use a new virtual function ‘createAcquirer()’ which by default returns an empty SharedResourcesAcquirer instance. If the module declares the use of a ‘SharedResource’ then the ‘createAcquirer()’ method will be overridden and return an instance with the needed resources. To facility this, edm::one::imll::SharedResourcesUser had to be changed to a templated class.
Configuration menu - View commit details
-
Copy full SHA for fa25861 - Browse repository at this point
Copy the full SHA fa25861View commit details -
Need to explicitly instantiate the SharedResourcesUser templated class
The SharedResourcesUser class was just changed to a template. As with the other implementor types, this needs to be explicitly instantiated.
Configuration menu - View commit details
-
Copy full SHA for 7212d2b - Browse repository at this point
Copy the full SHA 7212d2bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 969d359 - Browse repository at this point
Copy the full SHA 969d359View commit details -
Configuration menu - View commit details
-
Copy full SHA for b91697d - Browse repository at this point
Copy the full SHA b91697dView commit details -
Make access to EventSetup thread safe
Use a global mutex to serialize access to all EventSetup modules and sources. This is overkill but guarantees that if any two modules/sources are sharing a non-thread safe resource we don’t have a problem. Changed two of the mutable to std::atomics since they are read/written outside of the critical section guarded by the mutex.
Configuration menu - View commit details
-
Copy full SHA for 03bd5b5 - Browse repository at this point
Copy the full SHA 03bd5b5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 16d250c - Browse repository at this point
Copy the full SHA 16d250cView commit details -
Added a special resource for DelayedReader
To allow a DelayedReader to synchronize with itself we want to use a SharedResourcesAcquirer. However, the normal procedure of declaring a resource and then only after all resources have been declared do we get an acquirer isn’t appropriate for this case. Therefore we provide a special resource just for this case.
Configuration menu - View commit details
-
Copy full SHA for e46dbe0 - Browse repository at this point
Copy the full SHA e46dbe0View commit details -
DelayedReader can now use a SharedResourcesAcquirer
If a DelayedReader needs to synchronize with itself (and possibly with the Source) the inheriting class can override the sharedResources_() method. The method is used when data products are requested from the DelayedReader. If the Source also needs to synchronize with the DelayedReader the inheriting class can override resourceSharedWithDelayedReader_() and return a SharedResourcesAcquirer which uses the same resource as the DelayedReader. The EventProcessor will acquire the resource before calling methods on the Source.
Configuration menu - View commit details
-
Copy full SHA for 541d15f - Browse repository at this point
Copy the full SHA 541d15fView commit details -
Use new InputSource and DelayedReader APIs to synchronize
Given that we can’t be reading from the InputSource at the same time as we fill a branch via the RootDelayedReader, we implement the new APIs to allow both the PoolSource and the RootDelayedReader to share a ‘resource’.
Configuration menu - View commit details
-
Copy full SHA for d509d5a - Browse repository at this point
Copy the full SHA d509d5aView commit details -
clear the event selector in a thread safe manner
Moved the sentry used to clear the event selector at the end of each event processing to be within the mutex. This makes sure all updates on that object are done in the same critical section.
Configuration menu - View commit details
-
Copy full SHA for 00c920b - Browse repository at this point
Copy the full SHA 00c920bView commit details -
Configuration menu - View commit details
-
Copy full SHA for a05c90d - Browse repository at this point
Copy the full SHA a05c90dView commit details -
Tell ROOT we are going to use multiple threads
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.
Configuration menu - View commit details
-
Copy full SHA for 45d32b4 - Browse repository at this point
Copy the full SHA 45d32b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 00f5984 - Browse repository at this point
Copy the full SHA 00f5984View commit details -
Classes inheriting from TClassStreamer must implement the Generate me…
…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.
Configuration menu - View commit details
-
Copy full SHA for cf9a21a - Browse repository at this point
Copy the full SHA cf9a21aView commit details -
ROOT requires a dummy TThread object be instantiated in each thread
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.
Configuration menu - View commit details
-
Copy full SHA for 092fffe - Browse repository at this point
Copy the full SHA 092fffeView commit details -
Have InitRootHandlers handle setting up ROOT for threading
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.
Configuration menu - View commit details
-
Copy full SHA for 22bc087 - Browse repository at this point
Copy the full SHA 22bc087View commit details -
Do not fast copy ROOT files if using multiple threads
Disabled fast copying of ROOT files when we have multiple threads and multiple Streams. This must be done since fast copying requires the output file to record all the events from the input in the same order as stored in the input. This is not guaranteed when we do multiple threads.
Configuration menu - View commit details
-
Copy full SHA for 7daf72d - Browse repository at this point
Copy the full SHA 7daf72dView commit details -
Fail at run time if Service uses an obsolete signal.
The threaded framework requires Services to switch to a new collection of signals. To allow easier migration, the obsolete signals have been replaced with a class which causes an Exception to be thrown if their connect method is called. Had to change one unit test which was making use of the old signals.
Configuration menu - View commit details
-
Copy full SHA for d7db4bb - Browse repository at this point
Copy the full SHA d7db4bbView commit details -
RandomNumberGeneratorService Threaded
Modifications to make the random number generator service work with the multithreaded Framework. The interface now requires a StreamID or LuminosityBlockIndex argument to the getEngine function. For each module, there will an engine for each stream and also each concurrent luminosity block instead of being just one per module. This is necessary to prevent data races. The service now uses the new callbacks for the threaded Framework. This required extensive revisions to the internals of the service and also to the related unit tests. If all modules use the new getEngine interface, the service will support multiple threads, forking (but not multiple threads and forking in the same job), and replay. Temporarily the old interface still works while clients are transitioned to the new interface. But modules using the old interface must be ONE or LEGACY type modules (not GLOBAL OR STREAM). If any modules use the old interface, then both replay and multiprocess forking will be broken.
Configuration menu - View commit details
-
Copy full SHA for 693abf7 - Browse repository at this point
Copy the full SHA 693abf7View commit details -
Configuration menu - View commit details
-
Copy full SHA for abb7059 - Browse repository at this point
Copy the full SHA abb7059View commit details -
Fix unit tests for Random Numbers. This is for the threaded
branch only. Affects unit tests only. Reference files needed updating plus minor cleanup. The change that caused this problem was cleanly merged from the 7_0_X branch, but I did not notice the unit test reference files needed to be different on the threaded branch. One conflicted and the other did not exist in 7_0_X.
Configuration menu - View commit details
-
Copy full SHA for 1bd77d2 - Browse repository at this point
Copy the full SHA 1bd77d2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2bc2f92 - Browse repository at this point
Copy the full SHA 2bc2f92View commit details -
Modify behavior of modules using shared resources
With this change, modules that use the no argument form of the usesResource function will not run at the same time as any other module that has declared any shared resource or used the no argument usesResource function.
Configuration menu - View commit details
-
Copy full SHA for 8e09348 - Browse repository at this point
Copy the full SHA 8e09348View commit details -
Optimize registerSharedResource function
Replace a linear search for legacy resources by a data member that counts them. Also use the std::make_shared function instead of new.
Configuration menu - View commit details
-
Copy full SHA for 943bb42 - Browse repository at this point
Copy the full SHA 943bb42View commit details -
Updated file to newer ROOT format
The file contains one histogram used during reconstruction. Unfortunately, the file was written so long ago that ROOT's schema for the classes has changed. This is a problem for the threaded framework since ROOT 5 updates schema in a thread-unsafe manner when it opens a file and sees a new-to-it schema. By creating a new file containing the same information we can successfully preload the new class schemas (since they match the C++ code) at job initialization time. ROOT 6 is supposed to fix this problem.
Configuration menu - View commit details
-
Copy full SHA for c5aff1c - Browse repository at this point
Copy the full SHA c5aff1cView commit details -
Configuration menu - View commit details
-
Copy full SHA for ca3185b - Browse repository at this point
Copy the full SHA ca3185bView commit details -
Force creating of ROOT Streamers at begin of job
The code which constructs ROOT Streamers is not thread safe. Unfortunately, Streamers normally get created the first time they are needed which would be too late for our case. This change forces all Streamers to be created, even if we do not need them for this job.
Configuration menu - View commit details
-
Copy full SHA for 325de45 - Browse repository at this point
Copy the full SHA 325de45View commit details -
Force creation of TStreamerInfos at TFile open time
The global container of TStreamerInfos is not thread-safe. Therefore the ROOT team advised to create all TStreamerInfos needed for a job up front. We already create all TStreamerInfos for schemas corresponding to the present class layouts. However, a TFile can contain old schemas and will wants to create their TStreamerInfos the first time the class is read from the file. For our purposes, that is too late and therefore we need to force ROOT to create them at file open time.
Configuration menu - View commit details
-
Copy full SHA for d74bf3e - Browse repository at this point
Copy the full SHA d74bf3eView commit details -
Fix unit test failure. In test diff ignore text some class is printing
std::out in its constructor.
Configuration menu - View commit details
-
Copy full SHA for 81cf685 - Browse repository at this point
Copy the full SHA 81cf685View commit details -
Fix tab vs space issues in code
Changed all tabs to be spaces to avoid problems between editors.
Configuration menu - View commit details
-
Copy full SHA for 82e2ce0 - Browse repository at this point
Copy the full SHA 82e2ce0View commit details -
Use ROOT’s Cint Mutex to protect access to CINT structures
When requested to load a dictionary, we have to manipulate some Cint data structures to say what file it comes from. When used in a threaded environment, ROOT requires a lock be taken before accessing these structures.
Configuration menu - View commit details
-
Copy full SHA for 8fa9cd1 - Browse repository at this point
Copy the full SHA 8fa9cd1View commit details -
Keep ROOT from optimizing Streamers
ROOT will optimize Streamers such that adjoining member data of the same basic type are written/read together. Sometimes ROOT decides this optimization should not be applied and de-optimizes the Streamer. Unfortunately, the decision to de-optimize comes very late and can happen during the event loop and cause a data race. Therefore we tell ROOT, for now, to never optimize.
Configuration menu - View commit details
-
Copy full SHA for 6fb4009 - Browse repository at this point
Copy the full SHA 6fb4009View commit details -
Fix problem when 7_1_X was merged into 7_1_THREADED_X. There was a conflict and some necessary changes were not merged. This is causing compilation to fail in 7_1_THREADED_X.
Configuration menu - View commit details
-
Copy full SHA for 4f7a373 - Browse repository at this point
Copy the full SHA 4f7a373View commit details -
Ignore new ROOT error message about TH1 nbins <=0
When we switched to ROOT 5.34.17 a new warning message appeared when TH1 is passed nbins <= 0. Since ROOT already sets the value to nbins=1 we can ignore this warning.
Configuration menu - View commit details
-
Copy full SHA for ed60a83 - Browse repository at this point
Copy the full SHA ed60a83View commit details -
Remove getEngine() function from random service
In the random number generator service, remove the getEngine function which takes no arguments. This function is replaced by new getEngine functions that take either a StreamID or a LuminosityBlockIndex as an argument. This comes after a long migration of all clients to the new interface. The new interace is designed to work with the multithreaded Framework. (Note that this also fixes a compilation error that resulted after a similar pull request was automatically merged from 7_1_X)
Configuration menu - View commit details
-
Copy full SHA for ac16f5f - Browse repository at this point
Copy the full SHA ac16f5fView commit details -
Ignore new nbinsy warning from ROOT
ROOT 5.34.17 has added additional warnings which we convert to exceptions. The warning about nbinsy <=0 is irrelevant since ROOT has a reasonable behavior in this case. Therefore, we want to ignore this warning.
Configuration menu - View commit details
-
Copy full SHA for 5459475 - Browse repository at this point
Copy the full SHA 5459475View commit details -
No longer force all Streamers to exist early
The new thread-safety changes to ROOT make the need to try to force all Streamers into existence early unnecessary.
Configuration menu - View commit details
-
Copy full SHA for 9c66691 - Browse repository at this point
Copy the full SHA 9c66691View commit details -
Forced to take ROOT internal mutex lock to avoid deadlock
ROOT locks the same mutex before loading a shared library and in statics embedded in shared libaries. In the middle the operating system takes a lock to protect the shared library data structures. Therefore to avoid deadlock problems we must take the same ROOT lock before loading any shared libraries since we do not know apriori if the shared library being loaded links to a library which will take the lock at load time.
Configuration menu - View commit details
-
Copy full SHA for 56a7570 - Browse repository at this point
Copy the full SHA 56a7570View commit details -
Use R__LOCKGUARD2 instead of R__LOCKGUARD
To avoid having the first lock order incorrect because the Cint lock is not yet created when PluginManager first calls R__LOCKGUARD, I switched to R__LOCKGUARD2 which will create that Cint lock if ROOT has decided that locks should be made but hasn't yet made them.
Configuration menu - View commit details
-
Copy full SHA for 7fa242a - Browse repository at this point
Copy the full SHA 7fa242aView commit details -
Do not force creation of StreamerInfos at ROOT file opening
Forcing the creating of StreamerInfos at file open is no longer needed and it causes problems when we have done a 'drop on input' for a file and the items dropped can not be schema evolved. In that case the original code would cause an exception and it would kill the job. This change allows us to properly handle 'drop on input'.
Configuration menu - View commit details
-
Copy full SHA for 99f8c49 - Browse repository at this point
Copy the full SHA 99f8c49View commit details -
Removed TrackPropagation/Geant4e from Threaded branch
The Geant4e based propagator is not presently thread safe. To avoid problems with the static analyzer we are removing it from the threaded branch. If the code is made thread safe, we will add it back.
Configuration menu - View commit details
-
Copy full SHA for de76e6b - Browse repository at this point
Copy the full SHA de76e6bView commit details -
Removed PolyFit3DParametrizedMagneticField from Threaded branch
The PolyFit3DParametrizedMagneticField is not presently thread safe. To avoid problems with the static analyzer we are removing it from the threaded branch. If the code is made thread safe, we will add it back.
Configuration menu - View commit details
-
Copy full SHA for a725a99 - Browse repository at this point
Copy the full SHA a725a99View commit details -
Remove DQM service from configurations
The DQM service is not thread-safe and must be removed from configurations until it is changed.
Configuration menu - View commit details
-
Copy full SHA for f2c4969 - Browse repository at this point
Copy the full SHA f2c4969View commit details -
removed use of TkDetMap from configurations
The TkDetMap service is not thread-safe and violates CMSSW coding rules and must be removed from configurations until it is changed. Modules dependent upon TkDetMap have also been removed from configurations.
Configuration menu - View commit details
-
Copy full SHA for fa306b4 - Browse repository at this point
Copy the full SHA fa306b4View commit details