Skip to main content

Pseudorandom Numbers Generation for Monte Carlo Simulations on GPUs: OpenCL Approach

  • Chapter
  • First Online:
Numerical Computations with GPUs

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 119.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 159.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Kirkpatrick, S., Stoll, E.P.: A very fast shift-register sequence random number generator. J. Comput. Phys. 40, 517–526 (1981)

    Article  MATH  MathSciNet  Google Scholar 

  2. 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)

    Article  Google Scholar 

  3. 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)

    Google Scholar 

  4. 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

  5. L’Ecuyer, P.: Uniform random number generators. In: Lovric, M. (ed.) International Encyclopedia of Statistical Science, pp. 1625–1630. Springer, Berlin/Heidelberg (2011)

    Google Scholar 

  6. Demchik, V.: Pseudo-random number generators for Monte Carlo simulations on ATI Graphics Processing Units. Comput. Phys. Commun. 182, 692–705 (2011)

    Article  MATH  MathSciNet  Google Scholar 

  7. Lehmer, D.: Mathematical methods in large-scale computing units. Annu. Comput. Lab. Harvard Univ. 26, 141–146 (1951)

    MathSciNet  Google Scholar 

  8. Park, S., Miller, K.: Randoms number generators: good ones are hard to find. Commun. ACM 31(10), 1192–1201 (1988)

    Article  MathSciNet  Google Scholar 

  9. Tausworthe, R.: Random numbers generated by linear Recurrence Modulo Two. Math. Comput. 19, 201–209 (1965)

    Article  MATH  MathSciNet  Google Scholar 

  10. Lewis, T., Payne, W.: Generalized feedback shift register pseudorandom number algorithm. J. ACM 20, 456–468 (1973)

    Article  MATH  Google Scholar 

  11. NVIDIA, Corporation: CURAND Library: Programming Guide, p. 123. http://docs.nvidia.com/cuda/curand/index.html (2013). Cited 6 Feb 2014

  12. Saito, M., Matsumoto, M.: Variants of Mersenne Twister Suitable for Graphic Processors. ACM Trans. Math. Softw. 39(2), 12:1–12:20 (2012)

    Google Scholar 

  13. 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)

    Google Scholar 

  14. 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

  15. Bell, N., Hoberock, J.: Thrust: a productivity-oriented library for CUDA. http://docs.nvidia.com/cuda/thrust/ (2013). Cited 6 Feb 2014

  16. The NAG Library. The Numerical Algorithms Group (NAG), Oxford. http://www.nag.com/ (2013). Cited 6 Feb 2014

  17. Gao, Sh., Peterson, G.: GASPRNG: GPU accelerated scalable parallel random number generator library. Comput. Phys. Commun. 184(4), 1241–1249 (2013)

    Article  Google Scholar 

  18. Bauke, H.: TRNG: Tina’s Random Number Generator Library. http://numbercrunch.de/trng/ (2013). Cited 6 Feb 2014

  19. 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

  20. Dammertz, H., Schied, C., Lensch, H.: Massively parallel random number generators. In: GPU Technology Conference. http://mprng.sourceforge.net/ (2010). Cited 6 Feb 2014

  21. 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)

    Google Scholar 

  22. 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

  23. 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

  24. 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

  25. 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

  26. Munshi, A. (ed.): The OpenCL 1.0 Specification. Khronos OpenCL Working Group and others (2008)

    Google Scholar 

  27. Scarpino, M.: OpenCL in Action: How to Accelerate Graphics and Computation, 434 pp. Manning, Shelter Island (2012)

    Google Scholar 

  28. Tay, R.: OpenCL Parallel Programming Development Cookbook, 302 pp. Packt Publishing, Mumbai (2013)

    Google Scholar 

  29. Advanced Micro Devices, Inc.: AMD Accelerated Parallel Processing OpenCL Programming Guide (2013)

    Google Scholar 

  30. Comparison of Nvidia graphics processing units. http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units. Cited 6 Feb 2014.

  31. Demchik, V., Gulov, A.: Increasing precision of uniform pseudorandom number generators. arXiv:1401.8230 [cs.MS], pp. 1–4 (2014)

    Google Scholar 

  32. Knuth, D.: The Art of Computer Programming, vol. 2: Seminumerical Algorithms, 624 pp. Addison-Wesley, Reading (1969)

    Google Scholar 

  33. 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

  34. 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

  35. 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

  36. 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

  37. Manssen, M., Weigel, M., Hartmann, A.K.: Random number generators for massively parallel simulations on GPU. Eur. Phys. J. ST 210, 53–71 (2012)

    Article  Google Scholar 

  38. Marsaglia, G.: Xorshift RNGs. J. Stat. Softw. 8(14), 1–6 (2003)

    Google Scholar 

  39. Brent, R.: Note on Marsaglia’s Xorshift random number generators. J. Stat. Softw. 11(5), 1–5 (2004)

    Google Scholar 

  40. Panneton, F., L’Ecuyer, P.: On the Xorshift random number generators. ACM Trans. Model. Comput. Simul. 15(4), 346–361 (2005)

    Article  Google Scholar 

  41. Brent, R.: Some long-period random number generators using shifts and xors. ANZIAM J. 48, C188–C202 (2006)

    MathSciNet  Google Scholar 

  42. von Neumann, J.: Various techniques used in connection with random digits. Natl. Bur. Stand. Appl. Math. Ser. 12, 36–38 (1951)

    Google Scholar 

  43. Gentle, J.: Random Number Generation and Monte Carlo Methods, 399 pp. Springer, Berlin (2003)

    Google Scholar 

  44. Niederreiter, H.: Random Number Generation and Quasi-Monte Carlo Methods, 241 pp. SIAM, Philadelphia (1992)

    Book  Google Scholar 

  45. 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)

    Article  Google Scholar 

  46. 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)

    Chapter  Google Scholar 

  47. 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

Download references

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

Authors

Corresponding author

Correspondence to Vadim Demchik .

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics