Skip to content
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 SerialTaskQueues to protect shared resources (8_1) #15667

Merged
merged 10 commits into from Aug 31, 2016

Conversation

Dr15Jones
Copy link
Contributor

Replaced the use of std::recursive_mutexes with SerialTaskQueues when serializing modules to protect a shared resource. This allows the framework to only schedule a TBB task to run when that resource is free thereby opening up thread to do other work while the resource is in use.

This satisfies phase 1.75 of the threaded framework development plan.

This is a side-port from CMSSW_8_1_DEVEL_X

Unit test checks that no modules are run concurrently in a job where we only have legacy and one modules using shared resources.
-added move based functions
-pushAndWait will rethrow an exception thrown in the lambda
-added numberOfQueues() to be used by SharedResourcesAcquirer
Switched from using std::mutex to SerialTaskQueueChain to handle serialization when acquiring a shared resource.
The SharedResourcesAcquirer now primarily holds a SerialTaskQueueChain and only holds mutexes for sharing between the Source and the DelayedReader. The SharedResourcesAcquirer are built to always contain at least one SerialTaskQueueChain since we no longer have a per module mutex and instead depends on having at least one queue.
This initial implementation uses the SerialTaskQueueChain in a synchronous fashion. Future changes will move to asynchronous usage.
We also need to ignore the case where the result returns a very small number, i.e. one with 'e-' in its value.
The decrementing of the ref count on the waiting task must be done after the exception is set in order to avoid the case where the wait_for_all is released and we return from pushAndWait before the value is assigned to the now gone away stack variable.
No longer do a SerialTaskQueueChain::pushAndWait when we are requested to run a legacy or one module as part of a data prefetch. Now the task can return immediately and the module will be run once the its task reaches the head of the queue. This required moving the use of the SerialTaskQueueChain to the task launched after the prefetch has completed.
The mutexes were only used for an InputSource. Now the InputSource gets an explicit mutex along with its SharedResourcesAcquirer.
Now the signal is emitted right after the post prefetch task has started rather than just right before we are going to run the module.
Need to be sure all Services are active on a thread before emitting a signal since a Service listening to the signal may attempt to get another Service during that call.
Since the TriggerResults producer can always run concurrently, we need to relax the fraction of running 2 modules simultaneously from <0.01 to <0.02. This should avoid a false positive without missing a true failure.
@cmsbuild
Copy link
Contributor

A new Pull Request was created by @Dr15Jones (Chris Jones) for CMSSW_8_1_X.

It involves the following packages:

FWCore/Concurrency
FWCore/Framework
IOPool/Input

@cmsbuild, @smuzaffar, @Dr15Jones, @davidlange6 can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @wddgit, @wmtan this is something you requested to watch as well.
@slava77, @smuzaffar you are the release manager for this.

cms-bot commands are list here #13028

@Dr15Jones
Copy link
Contributor Author

please test

@Dr15Jones
Copy link
Contributor Author

+1

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 30, 2016

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/14841/console

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_8_1_X IBs after it passes the integration tests. This pull request requires discussion in the ORP meeting before it's merged. @slava77, @davidlange6, @smuzaffar

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

@davidlange6
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit e284b8f into cms-sw:CMSSW_8_1_X Aug 31, 2016
@Dr15Jones Dr15Jones deleted the runModuleAsync_nonDevel branch September 12, 2016 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants