Details
- Reviewers
tlatham kreps jback - Commits
- rEVTGEN05f01ef02000: Introduced function to set seed.
All tests run flawlessly. Outputs will change within statistical uncertainties as we now set the seed by hand for each event.
Diff Detail
- Repository
- rEVTGEN evtgen
- Branch
- SetRandomSeed
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 317 Build 317: arc lint + arc unit
Event Timeline
test/testDecayModel.cc | ||
---|---|---|
460 | OK, so will multithreading generate multiple events simultaneously when it encounters this loop, and we therefore need to ensure that each event (thread) has its own unique random seed to avoid generating duplicate events? |
test/testDecayModel.cc | ||
---|---|---|
460 | Yes, the idea is that each thread will generate a batch of events, Seeding with the event number will guarantee that we don't duplicate events and furthermore that the results should be identical regardless of the number of threads used. This will allow us to properly test that we aren't encountering any race conditions because if we do we should find that the results change when going from a single thread to multiple threads. |
EvtGenBase/EvtRandom.hh | ||
---|---|---|
37 | So I gather that we still need this EvtRandom.hh class to use static methods since there will only be one "instance" of this that will be used by all threads (which will each use unique random number seeds)? |
EvtGenBase/EvtRandom.hh | ||
---|---|---|
37 | We will have a static thread_local instance of the random engine. That means one instance per thread. Therefore we still need these methods to be static. By setting the seed for each event we ensure that the outcome for each event is the same irrespective of the number of threads and of the thread it is simulated in. |