Using Pseudo-random number repeatably in a fine-grain multithreaded simulation

Dmitry Savin, PhD student

Problem description

Particle transport Monte Carlo simulations are a key tool for High Energy Physics experiments, including the LHC experiments at CERN. All Monte Carlo (MC) simulations depend vitally on Pseudo-Random Number Generators (PRNGs) used to sample many distributions.


Each LHC experiments generates 5-10 Billion sampled physics events a year using around 10^18 sampled values from PRNGs. PRNGs take 1-5% of CPU time. PRNGs used must possess very large periods, fast execution, the ability to create a large number of streams, and very good correlation properties between streams and sampled values. It must be possible to reproduce a simulated event any time, for reexamination or debugging.


The transition from event-level parallelism in Geant4 to dynamical multithreading in GeantV requires associating the random generator states not with the threads but with the tracks, which are shuffled between "baskets" based on their type and energy. Maintaining reproducibility after such transition requires a drastic change in the way the random generators are used. We suggest solutions based on Scalable Pseudo Random Number Generators and on pedigrees introduced in Cilk Plus, which are first tested in Geant4.

Methods & motivation

  1. Scalable Parallel Pseudo Random Number Generators Library [2]
    Motivation: For independent simulation of several particles it is necessary to create independent random number streams, which must be spawn in a deterministic way to ensure reproducibility.
    Description: Parallel Pseudo Random Number Generators Library implements several random number generators (48 bit Linear Congruential, 64 bit Linear Congruential, modified Additive Lagged Fibonacci, Multiplicative Lagged Fibonacci, Combined Multiple Recursive, and Prime Modulus Linear Congruential) which have large periods and big numbers of streams. It also enables the spawning of new streams while ensuring their independence.


  1. Counter-based Pseudo Random Number Generators [3]

Motivation: Most pseudorandom number generators (PRNGs) scale

poorly to massively parallel high-performance computation because they are designed as sequentially dependent state transformations. Independent, keyed transformations of counters produce a large alternative class of PRNGs that require little memory for state and can be easily forwarded.

Description: Counter-based PRNGs consist of an increment for the transition function transition function and a hash function for the output function. Using a well-established cryptography function like AES or Threefish ensures good quality of the pseudo random numbers stream, while simpler functions like Philox give better performance.


  1. Pedigree-based Pseudo Random Number Generators [1]

Motivation: In an application with a very big number of dynamic threads that use only a few random numbers SPRNG may be inefficient. Random number generation based on the spawn pedigree allows to overcome this hurdle.

Description: Pedigrees store the deterministic state independent of order of operations that represents the spawn history. This state can be used for a counter-based generator to produce independent random number streams.




Timeline

April 20 – May 30 (Before the official coding time):

May 30 – June 26 (Official coding period starts):

June 26 – July 30:

June 30 – July 24:

Associate additional PRNG information with track in a geant4 simulation:

July 24 – July 28:

July 28 – August 21:

Write and run tests to assess the suitability of each generator for geant4:

References

  1. Deterministic parallel random-number generation for dynamic-multithreading platforms, Charles E. Leiserson et al.

  2. M. Mascagni and A. Srinivasan (2000), "Algorithm 806: SPRNG: A Scalable Library for Pseudorandom Number Generation," ACM Transactions on Mathematical Software, 26: 436-461.

  3. J. K. Salmon, M. A. Moraes, R. O. Dror, and D. E. Shaw, “Parallel Random Numbers: As Easy as 1, 2, 3” in Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis on - SC ’11, 2011, pp 1-12.