The European Physical Journal Special Topics

, Volume 210, Issue 1, pp 53–71 | Cite as

Random number generators for massively parallel simulations on GPU

  • M. Manssen
  • M. Weigel
  • A. K. Hartmann


High-performance streams of (pseudo) random numbers are crucial for the efficient implementation of countless stochastic algorithms, most importantly, Monte Carlo simulations and molecular dynamics simulations with stochastic thermostats. A number of implementations of random number generators has been discussed for GPU platforms before and some generators are even included in the CUDA supporting libraries. Nevertheless, not all of these generators are well suited for highly parallel applications where each thread requires its own generator instance. For this specific situation encountered, for instance, in simulations of lattice models, most of the high-quality generators with large states such as Mersenne twister cannot be used efficiently without substantial changes. We provide a broad review of existing CUDA variants of random-number generators and present the CUDA implementation of a new massively parallel high-quality, high-performance generator with a small memory load overhead.


Graphic Processing Unit European Physical Journal Special Topic Shared Memory Global Memory None None 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Supplementary material (3.6 mb)
Supplementary material, approximately 3.63 MB.


  1. 1.
    A.K. Hartmann, A Practical Guide to Computer Simulations (World Scientific, Singapore, 2009)Google Scholar
  2. 2.
    J.E. Gentle, Random number generation and Monte Carlo methods, 2nd edn. (Springer, Berlin, 2003)Google Scholar
  3. 3.
    J. von Neumann, J. Res. Nat. Bur. Stand. 12, 36 (1951)MathSciNetGoogle Scholar
  4. 4.
    G. Marsaglia, J. Mod. Appl. Stat. Meth. 2, 2 (2003)Google Scholar
  5. 5.
    G. Marsaglia, DIEHARD Battery of Tests of Randomness,
  6. 6.
    P. L’Ecuyer, R. Simard, ACM Trans. Math. Softw. 33, 4 (2007)MathSciNetCrossRefGoogle Scholar
  7. 7.
    A.M. Ferrenberg, D.P. Landau, Y.J. Wong, Phys. Rev. Lett. 69, 3382 (1992)ADSCrossRefGoogle Scholar
  8. 8.
    G. Parisi, F. Rapuano, Phys. Lett. B 157, 301 (1985)MathSciNetADSCrossRefGoogle Scholar
  9. 9.
    A.E. Ferdinand, M.E. Fisher, Phys. Rev. 185, 832 (1969)ADSCrossRefGoogle Scholar
  10. 10.
    J.D. Owens, M. Houston, D. Luebke, et al., Proc. IEEE 96, 879 (2008)CrossRefGoogle Scholar
  11. 11.
    T. Preis, P. Virnau, W. Paul, et al., J. Comput. Phys. 228, 4468 (2009)ADSzbMATHCrossRefGoogle Scholar
  12. 12.
    J. Yin, D.P. Landau, Phys. Rev. E 80, 051117 (2009)ADSCrossRefGoogle Scholar
  13. 13.
    M. Weigel, Comput. Phys. Commun. 182, 1833 (2011)ADSCrossRefGoogle Scholar
  14. 14.
    E.E. Ferrero, J.P. De Francesco, N. Wolovick, et al., Comput. Phys. Commun. 183, 1578 (2012)ADSCrossRefGoogle Scholar
  15. 15.
    T. Yavors’kii, M. Weigel, Eur. Phys. J. Special Topics 210, 159 (2012)Google Scholar
  16. 16.
    J.A. van Meel, A. Arnold, D. Frenkel, et al., Mol. Simul. 34, 259 (2008)CrossRefGoogle Scholar
  17. 17.
    A.J. Anderson, C.D. Lorenz, A. Travesset, J. Comput. Phys. 227, 5342 (2008)ADSzbMATHCrossRefGoogle Scholar
  18. 18.
    D.B. Kirk, W.W. Hwu, Programming Massively Parallel Processors (Elsevier, Amsterdam, 2010)Google Scholar
  19. 19.
    R.P. Brent, in Proc. Fifth Australian Supercomputer Conference, 95–104 (Melbourne, 1992)Google Scholar
  20. 20.
    J.K. Salmon, M.A. Moraes, R.O. Dror, et al., in Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’11 (ACM, New York, NY, USA, 2011)Google Scholar
  21. 21.
    M. Matsumoto, T. Nishimura, ACM Trans. Model. Comput. Simul. 8, 3 (1998)zbMATHCrossRefGoogle Scholar
  22. 22.
    NVIDIA Corporation, CUDA Toolkit 4.1 CURAND Guide (2012)Google Scholar
  23. 23.
    L. Howes, D.B. Thomas, in GPU Gems 3 (Addison-Wesley, Boston, 2007), p. 805Google Scholar
  24. 24.
    E. Alerstam, T. Svensson, S. Andersson-Engels, J. Biomed. Opt. 13, 060504 (2008)ADSCrossRefGoogle Scholar
  25. 25.
    M. Weigel, J. Comp. Phys. 231, 3064 (2012)ADSzbMATHCrossRefGoogle Scholar
  26. 26.
    M. Saito, M. Matsumoto, Variants of Mersenne Twister Suitable for Graphic Processors (2010), preprint [arXiv:1005.4973]Google Scholar
  27. 27.
    V. Demchik, Comput. Phys. Commun. 182, 692 (2011)MathSciNetADSzbMATHCrossRefGoogle Scholar
  28. 28.
    N. Nandapalan, R.P. Brent, L.M. Murray, et al., Lect. Notes Comput. Sc. 7203, 609 (2012)CrossRefGoogle Scholar
  29. 29.
    T. Bradley, J. du Toit, R. Tong, et al., in Hwu, ed., GPU Gems: Emerald Edition (Morgan Kaufman, Amsterdam, 2011), p. 231Google Scholar
  30. 30.
    G. Marsaglia, J. Stat. Softw. 8, 1 (2003)Google Scholar
  31. 31.
    D.E. Knuth, The Art of Computer Programming, Volume 2: Seminumerical Algorithms, 3rd edn. (Addison-Wesley, Upper Saddle River, NJ, 1997)Google Scholar
  32. 32.
    P. L’Ecuyer, Math. Comput. 68, 249 (1999)MathSciNetADSzbMATHCrossRefGoogle Scholar
  33. 33.
    W.H. Press, S.A. Teukolsky, W.T. Vetterling, et al., Numerical Recipes: The Art of Scientific Computing, 3rd edn. (Cambridge University Press, Cambridge, 2007)Google Scholar
  34. 34.
    M. Weigel, Phys. Rev. E 84, 036709 (2011)ADSCrossRefGoogle Scholar
  35. 35.
    J. Kelling, G.Ódor, Phys. Rev. E 84, 061150 (2011)ADSCrossRefGoogle Scholar
  36. 36.
    G. Marsaglia, A. Zaman, Ann. Appl. Probab. 1, 462 (1991)MathSciNetzbMATHCrossRefGoogle Scholar
  37. 37.
    M. Lüscher, Comput. Phys. Commun. 79, 100 (1994)ADSzbMATHCrossRefGoogle Scholar
  38. 38.
    F. Belletti, M. Cotallo, A. Cruz, et al., Comput. Phys. Commun. 178, 208 (2008)ADSCrossRefGoogle Scholar
  39. 39.
    G. Marsaglia, A. Zaman, W. Wan Tsang, Stat. Probabil. Lett. 9, 35 (1990)zbMATHCrossRefGoogle Scholar
  40. 40.
    F. Panneton, P.L’Ecuyer, ACM Trans. Model. Comput. Simul. 15, 346 (2005)CrossRefGoogle Scholar
  41. 41.
    R.P. Brent, ANZIAM Journal 48, C188 (2007)Google Scholar
  42. 42.
    W.A. Stein, Sage Mathematics Software, The Sage Development Team (2011)Google Scholar
  43. 43.
    V.Shoup, NTL: A library for doing number theory (2008)Google Scholar
  44. 44.
    W.Trappe, L.C.Washington, Introduction to Cryptography with Coding Theory, 1st edn. (Prentice Hall, 2002)Google Scholar
  45. 45.
    P. Hellekalek, S. Wegenkittl, ACM Trans. Model. Comput. Simul. 13, 322 (2003)CrossRefGoogle Scholar

Copyright information

© EDP Sciences and Springer 2012

Authors and Affiliations

  • M. Manssen
    • 1
  • M. Weigel
    • 2
    • 3
  • A. K. Hartmann
    • 1
  1. 1.Institute of PhysicsUniversity of OldenburgOldenburgGermany
  2. 2.Applied Mathematics Research CentreCoventry UniversityCoventryUK
  3. 3.Institut für PhysikJohannes Gutenberg-Universität MainzMainzGermany

Personalised recommendations