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

changes to random number seeding of workers in MT mode #160

Merged
merged 3 commits into from
Mar 26, 2020

Conversation

goodenou
Copy link
Contributor

The random number seeds for the worker run managers are seeded by the MT run manager. 10k seeds are created at a time by a MixMax engine. The initial seed for this generator is set by the fcl parameter 'initialSeed'. The number of seeds needed for the run, and thus the events that will be processed, does not need to be known at run start time. The seed algorithm will create seeds in batches of 10k seeds until there are no events left to process.

@FNALbuild
Copy link
Collaborator

Hi @goodenou,
You have proposed changes to files in these packages:

  • Validation
  • Mu2eG4

which require these tests: build.

FNALbuild is explained here.

@kutschke
Copy link
Collaborator

@FNALbuild run build test

@kutschke kutschke requested a review from resnegfk March 22, 2020 21:41
@kutschke kutschke self-assigned this Mar 22, 2020
@kutschke kutschke self-requested a review March 22, 2020 21:41
@FNALbuild
Copy link
Collaborator

⌛ The following tests have been triggered for ref 421b9c2: build

@FNALbuild
Copy link
Collaborator

☀️
The build test passed at ref 421b9c2. Total build time: 724.265388 seconds.

For more details, please check here.

@@ -67,5 +67,8 @@ services.SeedService.maxUniqueEngines : 20
# physics.producers.g4run.SDConfig.enableAllSDs : true
physics.producers.g4run.SDConfig.enableSD : [tracker, calorimeter, calorimeterRO, CRV, virtualdetector, stoppingtarget ]
physics.producers.g4run.physics.BirksConsts : { G4_POLYSTYRENE : 0.07943 } // {string : mm/MeV }

services.GeometryService.simulatedDetector.tool_type : "Mu2e"

physics.producers.g4run.physics.physicsListName : "QGSP_BERT"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lisa. Please check with Ray. Do we need to keep both

./Validation/fcl/potSimMT.fcl
./Validation/fcl/potSim.fcl

and
./Mu2eG4/fcl/g4test_potMT.fcl
./Mu2eG4/fcl/g4test_pot.fcl

If we can I would like to delete the latter two.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made /Mu2eG4/fcl/g4test_pot*fcl for my own testing. I can delete these if you want.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you no longer need them, delete them.

If you still need them, can you implement them by starting from #include the file from Validation?

Let me know what you plan to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have deleted them.

@@ -185,6 +185,7 @@ Mu2eG4MT: {
g4run : {
@table::mu2eg4runDefaultSingleStage
module_type : "Mu2eG4MT"
initialSeed : 8
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to discuss this. I would like to drive 100% of the seeding from the SeedService unless there is a compelling reason not to. Does the master thread use the global instance of the CLHEP HepRandomEngine? If so then seeding it is already taken care of at the call to createEngine in the module c'tor. At least it used to be in the single threaded world.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the Seed Service, but we cannot use the Random Number Engine Service in Mu2eG4MT_module.cc because it is a Shared Module. I have altered the code to use the Seed Service. The MTRunManager now gets a seed from the Seed Service. It uses this seed in its MixMax random number generator to generate seeds for the worker random number generators.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the change. Did you push it? The last commit I see is 3 days ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just pushed the change.

Mu2eG4/inc/Mu2eG4Config.hh Outdated Show resolved Hide resolved
Mu2eG4/inc/Mu2eG4MTRunManager.hh Show resolved Hide resolved
Mu2eG4/inc/Mu2eG4WorkerRunManager.hh Show resolved Hide resolved
Mu2eG4/src/Mu2eG4MTRunManager.cc Show resolved Hide resolved
Mu2eG4/src/Mu2eG4MTRunManager.cc Show resolved Hide resolved
Mu2eG4/inc/Mu2eG4MTRunManager.hh Outdated Show resolved Hide resolved
Validation/fcl/potSimMT.fcl Outdated Show resolved Hide resolved
@goodenou
Copy link
Contributor Author

goodenou commented Mar 22, 2020 via email

@kutschke
Copy link
Collaborator

kutschke commented Mar 23, 2020 via email

@kutschke
Copy link
Collaborator

kutschke commented Mar 23, 2020 via email

@goodenou
Copy link
Contributor Author

I did the following validation tests: 5k ceSimReco events and 1k potSim events. The agreement between the master branch and my branch was perfect for the non-MT versions of the code. For the MT versions, there were some differences that may be interesting. The pdfs showing the plots are at /mu2e/app/users/goodenou/MT_RNG2_plots/

@kutschke
Copy link
Collaborator

@FNALbuild run build test

@kutschke
Copy link
Collaborator

@FNALbuild run build test

@kutschke
Copy link
Collaborator

kutschke commented Mar 24, 2020 via email

@FNALbuild
Copy link
Collaborator

⌛ The following tests have been triggered for ref b532f22: build

@FNALbuild
Copy link
Collaborator

☀️
The build test passed at ref b532f22. Total build time: 724.796580 seconds.

For more details, please check here.

@kutschke
Copy link
Collaborator

kutschke commented Mar 24, 2020 via email

@goodenou
Copy link
Contributor Author

goodenou commented Mar 24, 2020 via email

@goodenou
Copy link
Contributor Author

goodenou commented Mar 24, 2020 via email

@kutschke
Copy link
Collaborator

I am sure that wars will be started because of autocorrect.

The error bars look like sqrt(N) to me. Note that there are only about 13000 entries inside the boundary of this plot. What gets into this plot? I bet that all of the SimParticles stopped or produced in this region are low energy electrons, positrons and photons. There might be 1 or 2 muons in there. Also remember that the 3 "start xyz DS" and the 3 "end xyz DS" plots are not cut on the other variables.

If you still have the art files for these, define a DS region with cuts on all 3 x,y,z variables; use the ranges of xyz used for the plots. Then make a histograms of the number of StepPointMCs per event that start in that region. Then make a scatter plot of x vs z for values of y in the range.

@kutschke kutschke merged commit f9ef02f into Mu2e:master Mar 26, 2020
@goodenou goodenou deleted the MT_RNG2 branch December 17, 2020 17:52
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.

3 participants