Advertisement

An OpenCL library for parallel random number generators

  • Tadej CiglaričEmail author
  • Rok Češnovar
  • Erik Štrumbelj
Article
  • 24 Downloads

Abstract

We present a library of 22 pseudo-random number generators on the GPU. The library is implemented in OpenCL and all generators are tested using the TestU01 and PractRand libraries. We evaluated the efficiency of all generators on five different computing devices. Among the generators that pass all tests, Tyche-i was the fastest on most devices and on average. Tyche-i and several other generators from our library can be used to generate random numbers several times faster than generators from existing libraries.

Keywords

Pseudo-random number generation Parallelization GPU OpenCL TestU01 PractRand 

Notes

Acknowledgements

Our research was partially supported by the Slovenian Research Agency (ARRS project grant L1-7542 and research core funding P5-0410).

References

  1. 1.
    Brent RP (2004) Note on Marsaglia’s xorshift random number generators. J Stat Softw 11(5):1–4CrossRefGoogle Scholar
  2. 2.
    Demchik V (2014) Pseudorandom numbers generation for Monte Carlo simulations on GPUs: OpenCL approach. In: Numerical computations with GPUs, Springer, pp 245–271Google Scholar
  3. 3.
    Doty-Humphrey C (2018) PractRand: C++ library of pseudo-random number generators and statistical tests for RNGs. http://pracrand.sourceforge.net/PractRand.txt. Accessed 20 Dec 2018
  4. 4.
    Goresky M, Klapper A (2003) Efficient multiply-with-carry random number generators with maximal period. ACM Trans Model Comput Simul 13(4):310–321CrossRefzbMATHGoogle Scholar
  5. 5.
    Jenkins RJ (1996) ISAAC. In: Gollmann D (ed) International workshop on fast software encryption. Springer, Berlin, pp 41–49CrossRefGoogle Scholar
  6. 6.
    L’Ecuyer P (1999) Good parameters and implementations for combined multiple recursive random number generators. Oper Res 47(1):159–164CrossRefzbMATHGoogle Scholar
  7. 7.
    L’Ecuyer P (1999) Tables of linear congruential generators of different sizes and good lattice structure. Math Comput Am Math Soc 68(225):249–260MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    L’Ecuyer P, Simard R (2007) TestU01: A C library for empirical testing of random number generators. ACM Trans Math Softw 33(4):22MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    L’Ecuyer P, Touzin R (2000) Fast combined multiple recursive generators with multipliers of the form a=\(\pm \)2 q\(\pm \)2 r. In: Joines JA, Barton RR, Kang K, Fishwick PA (eds) Proceedings of the 32nd Conference on Winter Simulation, Society for Computer Simulation International, pp 683–689Google Scholar
  10. 10.
    L’Ecuyer P, Munger D, Kemerchou N (2015) clRNG: A random number API with multiple streams for OpenCL. Report. http://www.iro.umontreal.ca/~lecuyer/myftp/papers/clrng-api.pdf. Accessed 20 Sept 2018
  11. 11.
    L’Ecuyer P, Munger D, Oreshkin B, Simard R (2017) Random numbers for parallel computers: requirements and methods, with emphasis on GPUs. Math Comput Simul 135:3–17MathSciNetCrossRefGoogle Scholar
  12. 12.
    Manssen M, Weigel M, Hartmann AK (2012) Random number generators for massively parallel simulations on GPU. Eur Phys J Spec Top 210(1):53–71CrossRefGoogle Scholar
  13. 13.
    Marsaglia G (1999) Random numbers for C: End, at last?. http://www.cse.yorku.ca/~oz/marsaglia-rng.html. Accessed 20 Sept 2018
  14. 14.
    Marsaglia G (2003) Xorshift RNGs. J Stat Softw 8(14):1–6CrossRefGoogle Scholar
  15. 15.
    Marsaglia G (2009) 64-bit KISS RNGs. https://www.thecodingforums.com/threads/64-bit-kiss-rngs.673657. Accessed 20 Sept 2018
  16. 16.
    Marsaglia G, Tsay LH (1985) Matrices and the structure of random number sequences. Linear Algebra Appl 67:147–156MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Matsumoto M, Nishimura T (1998) Mersenne Twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Trans Model Comput Simul 8(1):3–30CrossRefzbMATHGoogle Scholar
  18. 18.
    Matsumoto M, Nishimura T (2011) Tiny Mersenne twister. http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index.html. Accessed 20 Sept 2018
  19. 19.
    Neves S, Araujo F (2011) Fast and small nonlinear pseudorandom number generators for computer simulation. In: Wyrzykowski R, Dongarra J, Karczewski K, Waśniewski J (eds) International Conference on Parallel Processing and Applied Mathematics, Springer, pp 92–101Google Scholar
  20. 20.
    Nikolaisen IU (2011) Bose-einstein condensation in trapped bosons: a quantum monte carlo analysis using OpenCL and GPU programming. Master’s thesisGoogle Scholar
  21. 21.
    O’Neill ME (2014) PCG: a family of simple fast space-efficient statistically good algorithms for random number generation. ACM Transactions on Mathematical SoftwareGoogle Scholar
  22. 22.
    Panneton F, L’ecuyer P, Matsumoto M (2006) Improved long-period generators based on linear recurrences modulo 2. ACM Trans Math Softw 32(1):1–16MathSciNetCrossRefzbMATHGoogle Scholar
  23. 23.
    Press WH, Teukolsky SA, Vetterling WT, Flannery BP (1992) Numerical recipes in C: Plee art of scientific computing. CambridgeGoogle Scholar
  24. 24.
    Salmon JK, Moraes MA, Dror RO, Shaw DE (2011) Parallel random numbers: as easy as 1, 2, 3. In: Lathrop S, Costa J, Kramer W (eds) 2011 International Conference for High Performance Computing, Networking, Storage and Analysis (SC), IEEE, pp 1–12Google Scholar
  25. 25.
    Scarpino M (2011) OpenCL in action. Manning Publications, WestamptonGoogle Scholar
  26. 26.
    Stone JE, Gohara D, Shi G (2010) OpenCL: a parallel programming standard for heterogeneous computing systems. Comput Sci Eng 12(3):66–73CrossRefGoogle Scholar
  27. 27.
    Thomas DB (2014) The mwc64x random number generator. http://cas.ee.ic.ac.uk/people/dt10/research/rngs-gpu-mwc64x.html. Accessed 23 Dec 2018
  28. 28.
    Vigna S (2016) An experimental exploration of Marsaglia’s xorshift generators, scrambled. ACM Trans Math Softw 42(4):30MathSciNetCrossRefzbMATHGoogle Scholar
  29. 29.
    Widynski B (2017) Middle square Weyl sequence RNG. arXiv preprint arXiv:170400358

Copyright information

© Springer Science+Business Media, LLC, part of Springer Nature 2019

Authors and Affiliations

  1. 1.Faculty of Computer and Information ScienceUniversity of LjubljanaLjubljanaSlovenia

Personalised recommendations