Programming and Computer Software

, Volume 43, Issue 3, pp 145–160 | Cite as

Employing AVX vectorization to improve the performance of random number generators

Article
  • 48 Downloads

Abstract

By the example of the RNGAVXLIB random number generator library, this paper considers some approaches to employing AVX vectorization for calculation speedup. The RNGAVXLIB library contains AVX implementations of modern generators and the routines allowing one to initialize up to 1019 independent random number streams. The AVX implementations yield exactly the same pseudorandom sequences as the original algorithms do, while being up to 40 times faster than the ANSI C implementations.

References

  1. 1.
    Beach, K.S.D., Lee, P.A., and Monthoux, P., Fieldinduced antiferromagnetism in the Kondo insulator, Phys. Rev. Lett., 2004, vol. 92, no.2.Google Scholar
  2. 2.
    Binder, K. and Heerman, D.W., Monte Carlo Simulation in Statistical Physics: An Introduction, Springer, 2010, 5th ed.CrossRefGoogle Scholar
  3. 3.
    Landau, D.P. and Binder, K., A Guide to Monte–Carlo Simulations in Statistical Physics, Cambridge Univ. Press, 2000.MATHGoogle Scholar
  4. 4.
    Pieper, S.C. and Wiring, R.B., Quantum Monte–Carlo calculations of light nuclei, Ann. Rev. Nucl. Part. Sci., 2001, vol. 51, pp. 53–90.CrossRefGoogle Scholar
  5. 5.
    Luchow, A. and Anderson, J.B., Monte–Carlo methods in electronic structures for large molecules, Ann. Rev. Phys. Chem., 2000, vol. 51, pp. 501–526.CrossRefGoogle Scholar
  6. 6.
    Bizzarri, A.R., Neutron scattering and molecular dynamics simulation: A conjugate approach to investigate the dynamics of electron transfer proteins, J. Phys.: Cond. Mat., 2004, vol. 16, no. 4, pp. R83–R110.Google Scholar
  7. 7.
    Lehmer, D.H., Mathematical methods in large-scale computing units, Proc. Second Symp. on Large-Scale Digital Calculating Machinery, Cambridge, 1951, pp. 141–146.Google Scholar
  8. 8.
    Coveyou, R.R. and MacPherson, R.D., Fourier analysis of uniform random number generators, J. Assoc. Comput. Mach., 1967, vol. 14, pp. 100–119.MathSciNetCrossRefMATHGoogle Scholar
  9. 9.
    Marsaglia, G., Random numbers fall mainly in the planes, Proc. Nat. Acad. Sci. USA, 1968, vol. 61, pp. 25–28.MathSciNetCrossRefMATHGoogle Scholar
  10. 10.
    Golomb, S.W., Shift Register Sequences, San Francisco: Holden-Day, 1967.MATHGoogle Scholar
  11. 11.
    Shchur, L.N., On the quality of random number generators with taps, Comput. Phys. Commun., 1999, nos. 121–122, pp. 83–85.MathSciNetCrossRefGoogle Scholar
  12. 12.
    Ferrenberg, A.M., Landau, D.P., and Wong, Y.J., Monte–Carlo simulations: Hidden errors from “good” random number generators, Phys. Rev. Lett., 1992, vol. 69, no.23.Google Scholar
  13. 13.
    Selke, W., Talapov, A.L., and Shchur, L.N., Clusterflipping Monte–Carlo algorithm and correlation in “good” random number generators, JETP Lett., 1993, vol. 58, p.665.MathSciNetGoogle Scholar
  14. 14.
    Grassberger, P., On correlations in “good” random number generators, Phys. Lett. A, 1993, vol. 181, pp. 43–46.CrossRefGoogle Scholar
  15. 15.
    Vattulainen, I., Ala-Nissila, T., and Kankaala, K., Physical tests for random numbers in simulations, Phys. Rev. Lett., 1994, vol. 73, pp. 2513–2516.CrossRefGoogle Scholar
  16. 16.
    Schmid, F. and Wilding, N.B., Errors in Monte–Carlo simulations using shift register random number generators, Int. J. Modern Phys. C, 1995, vol. 6, pp. 781–797.CrossRefGoogle Scholar
  17. 17.
    Shchur, L.N., Heringa, J.R., and Bloete, H.W.J., Simulations of a directed random-walk model: The effect of pseudo-random-number-correlations, Physica A, 1997, vol. 241, pp. 579–592.CrossRefGoogle Scholar
  18. 18.
    Shchur, L.N. and Bloete, H.W.J., Cluster Monte–Carlo: Scaling of systematic errors in 2D Ising model, Phys. Rev. E, 1997, vol. 55, pp. R4905–R4908.CrossRefGoogle Scholar
  19. 19.
    L’Ecuyer, P., Random number generation, in Handbook on Simulation, Banks, J., Ed., Wiley, 1998, pp. 93–137.CrossRefGoogle Scholar
  20. 20.
    L’Ecuyer, P. and Simard, R., TestU01: A C library for empirical testing of random number generators, ACM TOMS, 2007, vol. 33, no.4.Google Scholar
  21. 21.
    Matsumoto, M. and Nishimura, T., Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator, ACM Trans. Mod. Comp. Simul, 1998, vol. 8, no. 1, pp. 3–30.CrossRefMATHGoogle Scholar
  22. 22.
    L’Ecuyer, P., Good parameter sets for combined multiple recursive random number generators, Oper. Res, 1999, vol. 47, no. 1, pp. 159–164.CrossRefMATHGoogle Scholar
  23. 23.
    L’Ecuyer, P., Maximally equidistributed combined Tausworthe generators, Math. Comp., 1996, vol. 65, no. 213, pp. 203–213.MathSciNetCrossRefMATHGoogle Scholar
  24. 24.
    L’Ecuyer, P., Tables of maximally-equidistributed combined LFSR generators, Math. Comp., 1999, vol. 68, no. 255, pp. 261–269.MathSciNetCrossRefMATHGoogle Scholar
  25. 25.
    Barash, L.Yu., Applying dissipative dynamical systems to pseudorandom number generation: Equidistribution property and statistical independence of bits at distances up to logarithm of mesh size, Europhys. Lett., 2011, vol. 95, pp. 10003–10008.CrossRefGoogle Scholar
  26. 26.
    Barash, L. and Shchur, L.N., Periodic orbits of the ensemble of Sinai–Arnold cat maps and pseudorandom number generation, Phys. Rev. E 2006, vol. 73, 036701.MathSciNetCrossRefGoogle Scholar
  27. 27.
    Barash, L. and Shchur, L.N., RNGSSELIB: Program library for random number generation, SSE2 realization, Comput. Phys. Commun., 2011, vol. 182, no. 7, pp. 1518–1527.MathSciNetCrossRefMATHGoogle Scholar
  28. 28.
    Barash, L.Yu. and Shchur, L.N., Hyperbolic toral automorphisms and pseudorandom number generators: Implementations based on SSE instructions, Trudy Seminara po vychislitel’nym tekhnologiyam v estestvennykh naukakh, vyp. 1. Vychislitel’naya fizika (Proc. Workshop on Computational Technologies in Natural Sciences, Series 1: Computational Physics), Nazirov, R.R, Ed., Moscow: Izd. KDU, 2009, pp. 14–29.Google Scholar
  29. 29.
    Barash, L.Yu., Geometric and statistical properties of pseudorandom number generators based on multiple recursive transformations, Springer Proceedings in Mathematics and Statistics, Springer, 2012, vol. 23, pp. 265–280.MathSciNetCrossRefMATHGoogle Scholar
  30. 30.
    Barash, L.Yu. and Shchur, L.N., RNGSSELIB: Program library for random number generation. More generators, parallel streams of random numbers, and Fortran compatibility, Comput. Phys. Commun., 2013, vol. 184, no. 10, pp. 2367–2369.CrossRefGoogle Scholar
  31. 32.
    L’Ecuyer, P., Uniform Random Number Generation, Ann. Oper. Res., 1994, vol. 53, pp. 77–120.MathSciNetCrossRefMATHGoogle Scholar
  32. 33.
    Salmon, J.K., Moraes, M.A., Dror, R.O., and Show, D.E., Parallel random numbers: As easy as 1, 2, 3, Proc. Int. Conf. High Performance Computing, Networking, Storage, and Analysis, New York, 2011, pp. 1–12.Google Scholar
  33. 34.
    Manssen, M., Weigel, M., and Hartmann, A.K., Random number generators for massively parallel simulations on GPU, Eur. Phys. J.: Spec. Top., 2012, vol. 210, no. 1, pp. 53–71.Google Scholar
  34. 35.
    Guskova, M.S., Barash, L.Yu., and Shchur, L.N., RNGAVXLIB: Program library for random number generation, AVX realization, Comput. Phys. Commun., 2016, vol. 200, pp. 402–405.CrossRefMATHGoogle Scholar
  35. 36.
    Intel 64 and IA-32 Architectures Software Developer’s Manual, vol. 2 (2A, 2B, 2C). https://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html.Google Scholar
  36. 37.
    Barash, L.Yu. and Shchur, L.N., About generation of parallel streams of pseudorandom numbers, Program. Inzheneriya, 2013, no. 1, pp. 24–32.Google Scholar
  37. 38.
    Galassi, M., et al., GNU Scientific Library Reference Manual, Network Theory Ltd., 2009, 3rd ed.Google Scholar
  38. 39.
    Intel Math Kernel Library Reference Manual, 2007. https://www.intel.com/cd/software/products/emea//rus/358888.htm.Google Scholar
  39. 40.
    Mascagni, M. and Srinivasan, A., Algorithm 806: SPRNG: A scalable library for pseudorandom number generation, ACM Trans. Math. Software, 2000, vol. 26, pp. 436–461.CrossRefGoogle Scholar
  40. 41.
    Bauke, H., Tina’s random number generator library, 2011. http://www.numbercrunch.de/trng.Google Scholar
  41. 42.
    Barash, L.Yu. and Shchur, L.N., Generating random numbers and parallel random number streams for Monte–Carlo calculations, Model. Anal. Inf. Sist., 2012, vol. 19, no. 2, pp. 145–162.Google Scholar
  42. 43.
    Bauke, H. and Mertens, S., Random numbers for large-scale distributed Monte–Carlo simulations, Phys. Rev. E, 2007.Google Scholar
  43. 44.
    Shchur, L.N. and Butera, P., The RANLUX generator: Resonances in a random walk test, Int. J. Mod. Phys, 1998, vol. 4, no. 9, pp. 607–624.CrossRefGoogle Scholar

Copyright information

© Pleiades Publishing, Ltd. 2017

Authors and Affiliations

  • L. Yu. Barash
    • 1
    • 2
  • M. S. Guskova
    • 2
    • 3
  • L. N. Shchur
    • 1
    • 2
    • 3
  1. 1.Landau Institute for Theoretical PhysicsChernogolovkaRussia
  2. 2.Science Center in ChernogolovkaChernogolovkaRussia
  3. 3.National Research University Higher School of EconomicsMoscowRussia

Personalised recommendations