Intel® C++ Compiler Classic Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
Parallel Computation Support
One of the basic requirements for the random number sequences generated by the engines is their mutual independence and lack of inter-correlation. Even if you want random number samplings to be correlated, such correlation should be controllable. The Short Vector Random Number Generator (SVRNG) library provides two techniques: skip-ahead and leap-frog.
- Skip-ahead
-
The skip-ahead method splits the original sequence into k non-overlapping blocks, where k is the number of independent sequences. Each of the sequences generates random numbers only from the corresponding block of contiguous random numbers.
- Leap-frog
-
The leap-frog method splits the original sequence into k disjoint subsequences in such a way that the first stream would generate the random numbers x1, xk+1, x2k+1, x3k+1, ..., the second stream would generate the random numbers x2, xk+2, x2k+2, x3k+2, ..., and, finally, the k-th stream would generate the random numbers xk, x2k, x3k, .... The multi-dimensional uniformity properties of each subsequence deteriorate seriously as k grows so this method is only useful if k is less than about 25.
The following sequence outlines the typical usage model for creating independent sequences of random numbers in a parallel computation environment:
- Create the original engine
- Create a copy of the original engine in each thread
- Apply one of techniques above to re-initialize the individual engines to provide an independent sequence on each thread
For detailed information on the use of SVRNG intrinsics in a parallel computation environment see the Random Streams and RNGs in Parallel Computation section of the Notes for Intel® oneAPI Math Kernel Library Vector Statistics document listed in Intrinsics for the Short Vector Random Number Generator Library.
Note: Currently skip-ahead and leap-frog methods are supported by the rand0, rand, mcg31m1, and mcg59 engines. The skip-ahead and leap-frog methods of splitting a stream are not yet implemented for the mt19937 engine, but mt19937 naturally provides parallel support during initialization. See the MT19937 section of the Notes for Intel® oneAPI Math Kernel Library Vector Statistics document listed in the introduction. . |
- svrng_copy_engine
Allocates memory for a new engine and copies over all parameters - svrng_skipahead_engine
Re-initialize engine parameters for use of the skip-ahead method - svrng_leapfrog_engine
Re-initialize engine parameters for use of the leap-frog method