Abstract
The RngStreams software package provides one viable solution to the problem of creating independent random number streams for simulations in parallel processing environments. Techniques are presented for effectively using RngStreams with C++ programs that are parallelized via OpenMP or MPI. Ways to access the backbone generator from RngStreams in R through the parallel and rstream packages are also described. The ideas in the paper are illustrated with both a simple running example and a Monte Carlo integration application.
Similar content being viewed by others
References
Anderson N, Titterington D (1970) Cross correlation between simultaneously generated sequences of pseudo-random uniform deviates. Stat Comput 16:11–15
Bock R, Lieberman M (1970) Fitting a response model for \(n\) dichotomously scored items. Psychometrika 35:179–197
Cenacchi G, De Matteis A (1970) Pseudo-random numbers for comparative monte carlo calculations. Numer Math 16:11–15
Chapman B, Jost G, van der Pas R (2001) Using OpenMP: portable shared memory parallel programming. MIT Press, Cambridge
De Matteis A, Pagnutti S (1988) Parallelization of random number generators and long-range correlation. Numer Math 53:595–608
De Matteis A, Pagnutti S (1990) Long-range correlation in linear and non-linear random number generators. Parallel Comput 14:207–210
Etacher K (1999) On the CRAY-system random number generator. Simulation 72:163–169
Eugster MJA, Knaus J, Porzelius C, Schmidberger M, Vicedo E (2011) Hands-on tutorial for parallel computing with R. Comput Stat 26:219–239
Gentle J (2003) Random number generation and Monte Carlo methods. Springer, New York
Haramoto H, Matsumoto M, Nishimura T, Panneton F, L’Ecuyer P (2008) Efficient jump ahead for \({\cal F}_2\)-linear random number generators. INFORMS J Comput 20:385–390
Hechenleitner B, Entacher C (2003) Pitfalls when using parallel streams in OMNeT++ simulations. In: Proceedings of inter-domain performance and simulation workshop. Salzburg, Austria, pp 11–20
Hill DRC (2010) Practical distribution of random streams for stochastic high performance computing. In: International conference on high performance computing and simulation (HPCS), pp 1–8
L’Ecuyer P (1990) Random numbers for simulation. Comm ACM 33:85–98
L’Ecuyer P (1996) Combined multiple recursive random number generators. Oper Res 44(5):816–822
L’Ecuyer P (1999) Good parameters and implementation for combined multiple recursive random number generators. Oper Res 47(1):159–164
L’Ecuyer P, Simard R (2007) Testu01: A C library for empirical testing of random number generators. ACM Trans Math Softw 33(4):22
L’Ecuyer P, Tezuka S (1991) Structural properties for two classes of random number generators. Math Comput 57(196):735–746
L’Ecuyer P, Simard R, Chen J, Kelton W (2001) An object-oriented random-number package with many long streams and substreams. Technical report, University of Montreal. http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c++/streams4.pdf
Lemieux C (2009) Monte Carlo and Quasi-Monte Carlo sampling. Springer, New York
Leydold J (2012) rstream: streams of random numbers. http://CRAN.R-project.org/package=rstream. R package version 1.3.2
Mascagni M, Srinivasan A (2000) Algorithm 806: Sprng: A scalable library for pseudorandom number generation. ACM Trans Math Softw 26(3):436–461
Matsumoto M, Nishimura T (1998) Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Trans Model. Comput. Simul. 8:3–30
Matsumoto M, Wada I, Kuramoto A, Ashihara H (2007) Common defects in initialization of pseudorandom number generators. ACM Trans Model Comput Simul 17(4):15
Quinn M (2003) Parallel programming in C with MPI and OpenMP. McGraw Hill, New York
Core Team R (2013) R: a language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. http://www.R-project.org/
Rizopoulos D (2006) ltm: an R package for latent variable modelling and item response theory analyses. J Stat Softw 17(5):1–25. http://www.jstatsoft.org/v17/i05/
Schmidberger M, Morgan M, Eddelbuettel D, Yu H, Tierney L, Mansmann U (2009) State of the art in parallel computing with R. J Stat Softw 31:1
Tierney L, Rossini AJ, Li N, Sevcikova H (2013) Snow: simple network of workstations. http://CRAN.R-project.org/package=snow. R package version 0.3-12
Urbanek S (2011) Multicore: parallel processing of R code on machines with multiple cores or CPUs. http://CRAN.R-project.org/package=multicore. R package version 0.1-7
Acknowledgments
Some of the computations were carried out on the Saguaro cluster at Arizona State University. The authors are grateful for comments from the anonymous referees that lead to improvements in the paper.
Author information
Authors and Affiliations
Corresponding author
Electronic supplementary material
Below is the link to the electronic supplementary material.
Rights and permissions
About this article
Cite this article
Karl, A.T., Eubank, R., Milovanovic, J. et al. Using RngStreams for parallel random number generation in C++ and R. Comput Stat 29, 1301–1320 (2014). https://doi.org/10.1007/s00180-014-0492-3
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00180-014-0492-3