RNGSSELIB: Program library for random number generation. More generators, parallel streams of random numbers and Fortran compatibility - Barash, L.Yu; Shchur, L.N. (Computer physics communications, 2013)
In this update, we present the new version of the random number generator (RNG) library RNGSSELIB, which, in particular, contains fast SSE realizations of a number of modern and most reliable generators [1]. The new features are: (i) Fortran compatibility and examples of using the library in Fortran; (ii) new modern and reliable generators; (iii) the abilities to jump ahead inside a RNG sequence and to initialize up to 1019 independent random number streams with block splitting method. Program title: RNGSSELIB Catalogue identifier: AEIT_v2_0 Program summary URL:http://cpc.cs.qub.ac.uk/summaries/AEIT_v2_0.html Program obtainable from: CPC Program Library, Queen’s University, Belfast, N. Ireland Licensing provisions: Standard CPC license, http://cpc.cs.qub.ac.uk/licence/licence.html No. of lines in distributed program, including test data, etc.: 9299 No. of bytes in distributed program, including test data, etc.: 1768030 Distribution format: tar.gz Programming language: C, Fortran Computer: PC, laptop, workstation, or server with Intel or AMD processor Operating system: Unix, Windows RAM: 4 Mbytes Classification: 4.13 Does the new version supersede the previous version?: Yes Catalogue identifier of previous version: AEIT_v1_0 Journal reference of previous version: Comput. Phys. Comm. 182 (2011) 1518 Nature of problem: Any calculation requiring uniform pseudorandom number generator, in particular, Monte Carlo calculations. Any calculation requiring parallel streams of uniform pseudorandom numbers. Solution method: The library contains realizations of the following modern and reliable generators: MT19937 [2], MRG32K3A [3], LFSR113 [4], GM19, GM31, GM61 [1], and GM29, GM55, GQ58.1, GQ58.3, GQ58.4 [5, 6]. The library contains both the usual realizations and realizations based on the SSE command set. Usage of SSE commands allows for substantially improved performance of all generators. Also, the updated library contains the abilities to jump ahead inside a RNG sequence and to initialize independent random number streams with block splitting method for each of the RNGs. Reasons for new version:1.In order to implement Monte Carlo calculations, the implementation of independent streams of random numbers is necessary. Such an implementation of initializing random number streams with block splitting method is added to the new version for each of the RNGs. Jumping ahead inside a RNG sequence, which is necessary for the block splitting method, was also added for each of the RNGs.2.Users asked us to add Fortran compatibility to the library. Fortran compatibility and the examples of using the library in Fortran for each of the RNGs are included in this version.3.During the last few years, the method of random number generation based on using the ensemble of transformations of a two-dimensional torus was essentially improved [5, 6]. Important properties, such as high-dimensional equidistribution, were established for the RNGs of this type. The proper choice of parameters was determined, which resulted in the validity of the high-dimensional equidistribution property, and, correspondingly, the new high-quality RNGs GM29, GM55.4, GQ58.1, GQ58.3, and GQ58.4 were proposed. These RNGs are now included in the RNGSSELIB library. Summary of revisions:1.We added Fortran compatibility and examples of using the library in Fortran for each of the generators.2.New modern and reliable generators GM29, GM55.4, GQ58.1, GQ58.3, and GQ58.4, which were introduced in [5] were added to the library.3.The ability to jump ahead inside a RNG sequence and to initialize independent random number streams with block splitting method are added for each of the RNGs. Restrictions: For SSE realizations of the generators, the Intel or AMD CPU supporting SSE2 command set is required. In order to use the SSE realization for the lfsr113 generator, the CPU must support the SSE4.1 command set. Additional comments: The function call interface has been slightly modified compared to the previous version in order to support Fortran compatibility. For each of the generators, RNGSSELIB supports the following functions, where rng should be replaced by the particular name of the RNG: void rng_skipahead_(rng_state* state, unsigned long long offset); void rng_init_(rng_state* state); void rng_init_sequence_(rng_state* state,unsigned long long SequenceNumber); unsigned int rng_generate_(rng_state* state); float rng_generate_uniform_float_(rng_state* state); unsigned int rng_sse_generate_(rng_sse_state* state); void rng_get_sse_state_(rng_state* state,rng_sse_state* sse_state); void rng_print_state_(rng_state* state); void rng_print_sse_state_(rng_sse_state* state); There are a few peculiarities for some of the RNGs. For example, the function void mt19937_skipahead_(mt19937_state* state, unsigned long long a, unsigned b); skips ahead N=a⋅2b numbers, where N<2512, and the function void gm55_skipahead_(gm55_state* state, unsigned long long offset64, unsigned long long offset0); skips ahead N=264⋅   offset64+offset0 numbers. The detailed function call interface can be found in the header files of the include directory. The examples of using the library can be found in the examples directory. Table 1Initialization of pseudorandom streams for RNGs.Function initializing sequenceNumber of sequencesMaximal lengthgm19_init_sequence_10006⋅106gm29_init_short_sequence_1088⋅107gm29_init_medium_sequence_1068⋅109gm29_init_long_sequence_1048⋅1011gm31_init_short_sequence_1098⋅107gm31_init_medium_sequence_1078⋅109gm31_init_long_sequence_1058⋅1011gm55_init_short_sequence_10181010gm55_init_long_sequence_4⋅1091020gq58x1_init_short_sequence_1088⋅107gq58x1_init_medium_sequence_1068⋅109gq58x1_init_long_sequence_1048⋅1011gq58x3_init_short_sequence_2⋅1088⋅107gq58x3_init_medium_sequence_2⋅1068⋅109gq58x3_init_long_sequence_2⋅1048⋅1011gq58x4_init_short_sequence_3⋅1088⋅107gq58x4_init_medium_sequence_3⋅1068⋅109gq58x4_init_long_sequence_3⋅1048⋅1011gm61_init_sequence_1.8⋅10191010gm61_init_long_sequence_4⋅1093⋅1025lfsr113_init_sequence_3.8⋅10181010lfsr113_init_long_sequence_4⋅1091024mrg32k3a_init_sequence_10191038mt19937_init_sequence_101910130 Table 1 shows maximal number of sequences and maximal length of each sequence for each function initializing pseudorandom stream. The algorithms used to jump ahead in the RNG sequence and to initialize parallel streams of pseudorandom numbers are described in detail in [7] and in [8]. This work was partially supported by the Russian Foundation for Basic Research projects No. 12-07-13121 and 13-07-00570 and by the Supercomputing Center of Lomonosov Moscow State University [9]. Running time: Running time is of the order of 20 s for generating 109 pseudorandom numbers with a PC based on an Intel Core i7-940 CPU. Running time is analyzed in detail in [1] and in [5]. References:[1]L.Yu. Barash, L.N. Shchur, RNGSSELIB: Program library for random number generation, SSE2 realization, Computer Physics Communications, 182 (7) (2011) 1518–1527.[2]M. Matsumoto and T. Tishimura, Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator, ACM Trans. on Mod. and Comp. Simul. 8(1) (1998) 3–30.[3]P. L’Ecuyer, Good Parameter Sets for Combined Multiple Recursive Random Number Generators, Oper. Res. 47(1) (1999) 159–164.[4]P. L’Ecuyer, Tables of Maximally-Equidistributed Combined LFSR Generators, Math. of Comp., 68(255) (1999) 261–269.[5]L.Yu. Barash, Applying dissipative dynamical systems to pseudorandom number generation: Equidistribution property and statistical independence of bits at distances up to logarithm of mesh size, Europhysics Letters (EPL) 95 (2011) 10003.[6]L.Yu. Barash, Geometric and statistical properties of pseudorandom number generators based on multiple recursive transformations, Springer Proceedings in Mathematics and Statistics, Springer-Verlag, Berlin, Heidelberg, Vol. 23, (2012) 265–280.[7]L.Yu. Barash, L.N. Shchur, On the generation of parallel streams of pseudorandom numbers, Programmnaya inzheneriya, 1 (2013) 24–32 (in Russian).[8]L.Yu. Barash, L.N. Shchur, PRAND: GPU accelerated parallel random number generation library: Using most reliable algorithms and applying parallelism of modern GPUs and CPUs, submitted to Comp. Phys. Commun. (2013).[9]Vl.V. Voevodin, S.A. Zhumatiy, S.I. Sobolev, A.S. Antonov, P.A. Bryzgalov, D.A. Nikitenko, K.S. Stefanov, Vad.V. Voevodin, Practice of “Lomonosov” Supercomputer, Open Systems J., Moscow: Open Systems Publ., 7 (2012) (In Russian).