Abstract
General principles of pseudorandom numbers production for Monte Carlo simulations on GPUs are discussed by creating an OpenCL open-source library of pseudorandom number generators PRNGCL. The library contains implementation of a number of the most popular uniform generators. The most popular pseudorandom number generators for Monte Carlo simulations and libraries for GPUs are reviewed. Some tricks for generators implementation on GPUs with OpenCL framework are considered. The performance results of implemented generators on several AMD and NVIDIA GPUs are presented.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Kirkpatrick, S., Stoll, E.P.: A very fast shift-register sequence random number generator. J. Comput. Phys. 40, 517–526 (1981)
Ferrenberg, A.M., Landau, D.P., Wong, Y.J.: Monte Carlo simulations: hidden errors from “good” random number generators. Phys. Rev. Lett. 69, 3382–3384 (1992)
Janke, W.: Pseudo random numbers: generation and quality checks. In: Grotendorst, J., Marx, D., Muramatsu, A. (eds.) Quantum Simulations of Complex Many-Body Systems, vol. 10, p. 447. John von Neumann Institute for Computing, Julich (2002)
Salmon, J., Moraes, M., Dror, R., Shaw, D.: Parallel random numbers: as easy as 1, 2, 3. In: International Conference for High Performance Computing, Networking, Storage and Analysis (SC), pp. 1–12. http://www.deshawresearch.com/resources_random123.html (2011). Cited 6 Feb 2014
L’Ecuyer, P.: Uniform random number generators. In: Lovric, M. (ed.) International Encyclopedia of Statistical Science, pp. 1625–1630. Springer, Berlin/Heidelberg (2011)
Demchik, V.: Pseudo-random number generators for Monte Carlo simulations on ATI Graphics Processing Units. Comput. Phys. Commun. 182, 692–705 (2011)
Lehmer, D.: Mathematical methods in large-scale computing units. Annu. Comput. Lab. Harvard Univ. 26, 141–146 (1951)
Park, S., Miller, K.: Randoms number generators: good ones are hard to find. Commun. ACM 31(10), 1192–1201 (1988)
Tausworthe, R.: Random numbers generated by linear Recurrence Modulo Two. Math. Comput. 19, 201–209 (1965)
Lewis, T., Payne, W.: Generalized feedback shift register pseudorandom number algorithm. J. ACM 20, 456–468 (1973)
NVIDIA, Corporation: CURAND Library: Programming Guide, p. 123. http://docs.nvidia.com/cuda/curand/index.html (2013). Cited 6 Feb 2014
Saito, M., Matsumoto, M.: Variants of Mersenne Twister Suitable for Graphic Processors. ACM Trans. Math. Softw. 39(2), 12:1–12:20 (2012)
Saito, M., Matsumoto, M.: A deviation of CURAND: standard pseudorandom number generator in CUDA for GPGPU. In: Proceedings of 10th International Conference on Monte Carlo and Quasi-Monte Carlo Methods in Scientific Computing (2012)
Saito, M., Matsumoto, M.: Variants of Mersenne Twister Suitable for Graphic Processors. arXiv:1005.4973 [cs.MS], pp. 1–23. http://www.math.sci.hiroshima-u.ac.jp/~%20m-mat/MT/MTGP/index.html (2013). Cited 6 Feb 2014
Bell, N., Hoberock, J.: Thrust: a productivity-oriented library for CUDA. http://docs.nvidia.com/cuda/thrust/ (2013). Cited 6 Feb 2014
The NAG Library. The Numerical Algorithms Group (NAG), Oxford. http://www.nag.com/ (2013). Cited 6 Feb 2014
Gao, Sh., Peterson, G.: GASPRNG: GPU accelerated scalable parallel random number generator library. Comput. Phys. Commun. 184(4), 1241–1249 (2013)
Bauke, H.: TRNG: Tina’s Random Number Generator Library. http://numbercrunch.de/trng/ (2013). Cited 6 Feb 2014
Barash, L., Shchur, L.: PRAND: GPU accelerated parallel random number generation library: using most reliable algorithms and applying parallelism of modern GPUs and CPUs. arXiv:1307.5869 [physics.comp-ph], pp. 1–24. http://www.comphys.ru/barash/prand.tar.gz (2013). Cited 6 Feb 2014
Dammertz, H., Schied, C., Lensch, H.: Massively parallel random number generators. In: GPU Technology Conference. http://mprng.sourceforge.net/ (2010). Cited 6 Feb 2014
Szalkowski, D., Stpiczynski, P.: Template library for multi-GPU pseudorandom number recursion-based generators. In: IEEE Federated Conference on Computer Science and Information Systems (FedCSIS), pp. 515–519 (2013)
Passerat-Palmbach, J., Mazel, C., Bachelet, B., Hill, D.R.C.: Shoverand: a model-driven framework to easily generate random numbers on GP-GPU. In: Proceedings of International Conference on High Performance Computing and Simulation (HPCS), pp. 41–48. https://github.com/jHackTheRipper/ShoveRand (2011). Cited 6 Feb 2014
Arampatzis, G., Athanasopoulos, A.: Random Number Generator – Parallel Streams in OpenCL. http://mira.math.udel.edu/ParallelKMC/doku.php?id=projects:opencl_prng (2011). Cited 6 Feb 2014
Nikolaisen, I.: Bose-Einstein condensation in trapped bosons: a quantum Monte Carlo analysis using OpenCL and GPU programming. Masteroppgave, University of Oslo. https://bitbucket.org/ivarun/ranluxcl/overview (2011). Cited 6 Feb 2014
Thomas, D., Howes, L., Luk, W.: A comparison of CPUs, GPUs, FPGAs, and massively parallel processor arrays for random number generation. In: Proceedings of FPGA, pp. 63–72. http://cas.ee.ic.ac.uk/people/dt10/research/rngs-gpu.html (2009). Cited 6 Feb 2014
Munshi, A. (ed.): The OpenCL 1.0 Specification. Khronos OpenCL Working Group and others (2008)
Scarpino, M.: OpenCL in Action: How to Accelerate Graphics and Computation, 434 pp. Manning, Shelter Island (2012)
Tay, R.: OpenCL Parallel Programming Development Cookbook, 302 pp. Packt Publishing, Mumbai (2013)
Advanced Micro Devices, Inc.: AMD Accelerated Parallel Processing OpenCL Programming Guide (2013)
Comparison of Nvidia graphics processing units. http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units. Cited 6 Feb 2014.
Demchik, V., Gulov, A.: Increasing precision of uniform pseudorandom number generators. arXiv:1401.8230 [cs.MS], pp. 1–4 (2014)
Knuth, D.: The Art of Computer Programming, vol. 2: Seminumerical Algorithms, 624 pp. Addison-Wesley, Reading (1969)
Marsaglia, G.: DIEHARD: a battery of tests of randomness. Technical report, Florida State University. http://www.stat.fsu.edu/pub/diehard/ (1996). Cited 6 Feb 2014
Rukhin, A., et al.: A Statistical Test Suite for the Validation of Random Number Generators and Pseudo Random Number Generators for Cryptographic Applications. NIST special publication 800-22, 131 pp. http://csrc.nist.gov/groups/ST/toolkit/rng/ (2010). Cited 6 Feb 2014
Brown, R., Eddelbuettel, D., Bauer, D.: DIEHARDER: A Random Number Test Suite. http://www.phy.duke.edu/~rgb/General/dieharder.php (2009). Cited 6 Feb 2014
L’Ecuyer, P., Simard, R.: TestU01: a C library for empirical testing of random number generators. ACM Trans. Math. Softw. 33, 1–40 (2007) [article 22]. http://www.iro.umontreal.ca/~simardr/testu01/tu01.html. Cited 6 Feb 2014
Manssen, M., Weigel, M., Hartmann, A.K.: Random number generators for massively parallel simulations on GPU. Eur. Phys. J. ST 210, 53–71 (2012)
Marsaglia, G.: Xorshift RNGs. J. Stat. Softw. 8(14), 1–6 (2003)
Brent, R.: Note on Marsaglia’s Xorshift random number generators. J. Stat. Softw. 11(5), 1–5 (2004)
Panneton, F., L’Ecuyer, P.: On the Xorshift random number generators. ACM Trans. Model. Comput. Simul. 15(4), 346–361 (2005)
Brent, R.: Some long-period random number generators using shifts and xors. ANZIAM J. 48, C188–C202 (2006)
von Neumann, J.: Various techniques used in connection with random digits. Natl. Bur. Stand. Appl. Math. Ser. 12, 36–38 (1951)
Gentle, J.: Random Number Generation and Monte Carlo Methods, 399 pp. Springer, Berlin (2003)
Niederreiter, H.: Random Number Generation and Quasi-Monte Carlo Methods, 241 pp. SIAM, Philadelphia (1992)
Nandapalan, N., Brent, R., Murray, L., Rendell, A.: High-performance pseudo-random number generation on graphics processing units. Parallel Process. Appl. Math. 7203, 609–618 (2012)
Bradley, T., du Toit, J., Giles, M., Tong, R., Woodhams, P.: Parallelisation techniques for random number generators. In: Hwu, W.-M. (ed.) GPU Gems: Emerald Edition, pp. 231–246. Morgan Kaufmann, Amsterdam (2011)
Beebe, N.: A Bibliography of Pseudorandom Number Generation, Sampling, Selection, Distribution, and Testing, 631 pp. ftp://ftp.math.utah.edu/public_html/pub/tex/bib/prng.ps.gz (2013). Cited 6 Feb 2014
Acknowledgements
Author thanks to my colleagues and friends Alexey Strelchenko for providing benchmarks for PRNGCL library on high-end NVIDIA GPUs, Natalia Kolomoyets, Alexey Gulov and Yevgen Syetov for essential help with the text preparation.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Demchik, V. (2014). Pseudorandom Numbers Generation for Monte Carlo Simulations on GPUs: OpenCL Approach. In: Kindratenko, V. (eds) Numerical Computations with GPUs. Springer, Cham. https://doi.org/10.1007/978-3-319-06548-9_12
Download citation
DOI: https://doi.org/10.1007/978-3-319-06548-9_12
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-06547-2
Online ISBN: 978-3-319-06548-9
eBook Packages: Computer ScienceComputer Science (R0)