Skip to main content
Log in

An OpenCL library for parallel random number generators

  • Published:
The Journal of Supercomputing Aims and scope Submit manuscript

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.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Brent RP (2004) Note on Marsaglia’s xorshift random number generators. J Stat Softw 11(5):1–4

    Article  Google Scholar 

  2. Demchik V (2014) Pseudorandom numbers generation for Monte Carlo simulations on GPUs: OpenCL approach. In: Numerical computations with GPUs, Springer, pp 245–271

  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. Goresky M, Klapper A (2003) Efficient multiply-with-carry random number generators with maximal period. ACM Trans Model Comput Simul 13(4):310–321

    Article  MATH  Google Scholar 

  5. Jenkins RJ (1996) ISAAC. In: Gollmann D (ed) International workshop on fast software encryption. Springer, Berlin, pp 41–49

    Chapter  Google Scholar 

  6. L’Ecuyer P (1999) Good parameters and implementations for combined multiple recursive random number generators. Oper Res 47(1):159–164

    Article  MATH  Google Scholar 

  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–260

    Article  MathSciNet  MATH  Google Scholar 

  8. L’Ecuyer P, Simard R (2007) TestU01: A C library for empirical testing of random number generators. ACM Trans Math Softw 33(4):22

    Article  MathSciNet  MATH  Google Scholar 

  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–689

  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. 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–17

    Article  MathSciNet  Google Scholar 

  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–71

    Article  Google Scholar 

  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. Marsaglia G (2003) Xorshift RNGs. J Stat Softw 8(14):1–6

    Article  Google Scholar 

  15. Marsaglia G (2009) 64-bit KISS RNGs. https://www.thecodingforums.com/threads/64-bit-kiss-rngs.673657. Accessed 20 Sept 2018

  16. Marsaglia G, Tsay LH (1985) Matrices and the structure of random number sequences. Linear Algebra Appl 67:147–156

    Article  MathSciNet  MATH  Google Scholar 

  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–30

    Article  MATH  Google Scholar 

  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. 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–101

  20. Nikolaisen IU (2011) Bose-einstein condensation in trapped bosons: a quantum monte carlo analysis using OpenCL and GPU programming. Master’s thesis

  21. O’Neill ME (2014) PCG: a family of simple fast space-efficient statistically good algorithms for random number generation. ACM Transactions on Mathematical Software

  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–16

    Article  MathSciNet  MATH  Google Scholar 

  23. Press WH, Teukolsky SA, Vetterling WT, Flannery BP (1992) Numerical recipes in C: Plee art of scientific computing. Cambridge

  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–12

  25. Scarpino M (2011) OpenCL in action. Manning Publications, Westampton

    Google Scholar 

  26. Stone JE, Gohara D, Shi G (2010) OpenCL: a parallel programming standard for heterogeneous computing systems. Comput Sci Eng 12(3):66–73

    Article  Google Scholar 

  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. Vigna S (2016) An experimental exploration of Marsaglia’s xorshift generators, scrambled. ACM Trans Math Softw 42(4):30

    Article  MathSciNet  MATH  Google Scholar 

  29. Widynski B (2017) Middle square Weyl sequence RNG. arXiv preprint arXiv:170400358

Download references

Acknowledgements

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

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Tadej Ciglarič.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Ciglarič, T., Češnovar, R. & Štrumbelj, E. An OpenCL library for parallel random number generators. J Supercomput 75, 3866–3881 (2019). https://doi.org/10.1007/s11227-019-02756-2

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11227-019-02756-2

Keywords

Navigation