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
Test inter process random state transfers #29384
Conversation
This is used to allow inter-process communication of the random number state.
This provides a RandomNumberGenerator object that can easily be used with the TestProcessor to drive the random numbers in a test or for a non-cmsRun process.
Created a test that uses SharedMemory package to have a module within cmsRun pass random state to and from another EDProducer run in an external process.
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-29384/14495
|
A new Pull Request was created by @Dr15Jones (Chris Jones) for master. It involves the following packages: DataFormats/Common @makortel, @smuzaffar, @cmsbuild, @Dr15Jones can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins. |
RandomNumberGeneratorState& operator=(RandomNumberGeneratorState&&) = default; | ||
|
||
std::vector<unsigned long> state_; | ||
long seed_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would encapsulation of the member data make sense here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a 'real' data format since it never is put in a Principal. It is really an internal detail of how the processes communicate. I put it here since I needed a ROOT dictionary to be generated and this class will be used by the FWCore test as well as the upcoming generator code. That is why I just used a struct.
edm::LuminosityBlockIndex iLumi) { | ||
edm::Service<edm::RandomNumberGenerator> gen; | ||
//NOTE: root serialize requires a `void*` not a `void const*` even though it doesn't modify the object | ||
randSerializer_.serialize(const_cast<edm::RandomNumberGeneratorState&>(iState)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change ROOTSerializer
to take void const*
? (in a later PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can. The underlying problem is ROOT's code which uses the 'void*' instead of the 'void const*'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can. The underlying problem is ROOT's code which uses the 'void*' instead of the 'void const*'.
I guessed that would be the case. At least the const_cast
would then be isolated and hidden from the rest...
This follows how the RandomNumberGeneratorService treats RanecuEngine when doing replay.
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-29384/14497
|
Pull request #29384 was updated. @makortel, @smuzaffar, @cmsbuild, @Dr15Jones can you please check and sign again. |
+1 |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
please test |
The tests are being triggered in jenkins. |
+1 |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1 |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @silviodonato, @dpiparo (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
Backport from cms-sw#29384. Additional changes: - FWCore/Integration/bin/interprocess_random.cc: L72,100: disable macro CMS_SA_ALLOW. - FWCore/Services/test/BuildFile.xml: L16-20: copy the tag for entire unit test "testFWCoreServicesCatch2". - FWCore/Services/test/test_catch2_ExternalRandomNumberGeneratorService.cc: L8: uncomment "#define CATCH_CONFIG_MAIN".
PR description:
Adds a test to show how to use a EDProducer in cmsRun to drive a different EDProducer in a stand alone process where random engine state is passed back and forth.
PR validation:
The code compiles and framework unit tests pass.