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

Random generator service for FastSim #21714

Merged
merged 7 commits into from
Jan 11, 2018
Merged

Conversation

civanch
Copy link
Contributor

@civanch civanch commented Dec 14, 2017

Recently it was discovered, that some of components of FastSim calls CLHEP default directly instead of access to the generator via CMSSW Service. Potentially, this may provide data race and/or non-reproducibility of results in MT mode, because the default CLHEP engine is static. Due to this problem we stack with migration to the recent CLHEP 4.2.0.0

Currently, known places in FastSim where CLHEP or Geant4 calls to engine are used : HF shower library, FTF nuclear interaction, CTTPS forward simulation.

FastSim has utility which access CMSSW Service correctly. In this clean-up a thread save method to initialise random engine is added using FullSim approach, so in all sampling, even in Geant4 components, the same random generator will be used. Current default for FastSim is TRandom3 but any other may be configured. Additionally, the inline methods of this utility are modified to reduce number of "if" and to use common interface to Gauss and Poisson sampling.

The payment for this fix - direct dependence of FastSim/Utilities on Geant4. Note, that FastSim already depends on Geant4 directly and indirectly, I do not think that this dependence make a problem. Also random number sequence will be different, so many differences should be seen in FastSim WFs.

@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @civanch (Vladimir Ivantchenko) for master.

It involves the following packages:

FastSimulation/Utilities

@cmsbuild, @ssekmen, @civanch, @mdhildreth, @lveldere can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @matt-komm this is something you requested to watch as well.
@davidlange6, @slava77, @fabiocos you are the release manager for this.

cms-bot commands are listed here

@civanch
Copy link
Contributor Author

civanch commented Dec 14, 2017

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 14, 2017

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/25094/console Started: 2017/12/14 17:37

@civanch
Copy link
Contributor Author

civanch commented Dec 14, 2017

Hi, @Dr15Jones, you may be want to comment on this PR?

@davidlange6
Copy link
Contributor

this doesn't make sense- we don't need to go through G4 to get random numbers in CMS..

@Dr15Jones
Copy link
Contributor

@davidlange6 It appears to me that with this pull request, the random numbers come from CMS via the RandomNumberGenerator service. The G4 part is just passing the CMS random engine to G4 to use since, under the hood, fastsim is calling G4 components which need a random number.

@civanch
Copy link
Contributor Author

civanch commented Dec 14, 2017

@davidlange6 , internally, HF Shower library use G4 methods and FastSim FTF nuclear generator in tracker use Geant4 model. Potentially, there may be other consumers of Geant4.

@ssekmen
Copy link
Contributor

ssekmen commented Dec 14, 2017

Indeed, this is the G4 usage we have now (although the FTP nuclear interactions are currently not actively used).

@davidlange6
Copy link
Contributor

davidlange6 commented Dec 14, 2017 via email

@civanch
Copy link
Contributor Author

civanch commented Dec 14, 2017

What about FamosProducer? The same line of code may be moved there.

This may work but I am not 100% sure. The choice of Utility was done for reason, that other Producers may use the same FastSimUtility , so it is more safe (number of plugins in FastSim sequence is big enough and may be some also use random numbers). A solution would be to include the same line in all producers we have for today (which use random numbers).

@davidlange6
Copy link
Contributor

davidlange6 commented Dec 14, 2017 via email

@ssekmen
Copy link
Contributor

ssekmen commented Dec 14, 2017

I don't think FamosProducer is more central compared to FastSimulation/Utilities, which is already used by many fastsim modules.
If a new plugin in SimG4Core is easier to keep under control, this is also ok.

@civanch
Copy link
Contributor Author

civanch commented Dec 14, 2017

@Dr15Jones , a basic question: are we sure that all FastSim plugins are in the same streamID? If not, how we should handle this? This is a general question also for FullSim where we in one plugin smear interaction point and in Oscar generate hits.

@Dr15Jones
Copy link
Contributor

Plugins called from the same module instance for the same event will be on the same thread and will therefore have the same stream ID. As long as G4 is using a thread_local to hold the random engine, everything will be fine.

@civanch
Copy link
Contributor Author

civanch commented Dec 14, 2017

In that case, may be FamosProducer is a correct solution? Making extra empty producer in SimG4Core not a problem, but at the same time, may be easily forgotten by FastSim developers inside their unit tests and other evolutions.

@cmsbuild
Copy link
Contributor

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. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2)

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-21714/25242/summary.html

@slava77 comparisons for the following workflows were not done due to missing matrix map:

  • /build/cmsbld/jenkins-workarea/workspace/compare-root-files-short-matrix/results/JR-comparison/PR-21714/1325.7_TTbar_13_94XNanoAODINPUT+TTbar_13_94XNanoAODINPUT+NANOEDMMC2017

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 7 differences found in the comparisons
  • DQMHistoTests: Total files compared: 26
  • DQMHistoTests: Total histograms compared: 2773742
  • DQMHistoTests: Total failures: 34941
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2738632
  • DQMHistoTests: Total skipped: 169
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 1.07999999994 KiB( 22 files compared)
  • Checked 110 log files, 9 edm output root files, 26 DQM output files

@fabiocos
Copy link
Contributor

@civanch There was also a residual comment about the MaterialEffects package, where the geant4 dependency is still there. Could you please comment?

@fabiocos
Copy link
Contributor

please test workflow 135.1

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 10, 2018

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/25353/console Started: 2018/01/10 11:46

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@civanch
Copy link
Contributor Author

civanch commented Jan 10, 2018

@fabiocos , since long we have an alternative FastSim hadronic model for nuclear interaction in tracker, which based on FTF Geant4 model. For that we introduced FastSim dependence on Geant4. From my point of view, this model is technically much better than the default FastSim model. I have in mind adding more Geant4 based models for FastSim.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-21714/25353/summary.html

@slava77 comparisons for the following workflows were not done due to missing matrix map:

  • /build/cmsbld/jenkins/workspace/compare-root-files-short-matrix/results/JR-comparison/PR-21714/1325.7_TTbar_13_94XNanoAODINPUT+TTbar_13_94XNanoAODINPUT+NANOEDMMC2017
  • /build/cmsbld/jenkins/workspace/compare-root-files-short-matrix/results/JR-comparison/PR-21714/135.1_TTbar_13+TTbarFS_13+HARVESTUP15FS+MINIAODMCUP15FS

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 7 differences found in the comparisons
  • DQMHistoTests: Total files compared: 26
  • DQMHistoTests: Total histograms compared: 2775243
  • DQMHistoTests: Total failures: 34963
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2740111
  • DQMHistoTests: Total skipped: 169
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0 KiB( 0 files compared)
  • Checked 110 log files, 9 edm output root files, 26 DQM output files

@fabiocos
Copy link
Contributor

+1

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.

6 participants