20 Int'l Conf. Foundations of Computer Science | FCS'11 | Algorithm Performance Deviates Per Millisecond Ran 24085 LFG 13367 MT 22795 Quantis (Single Thread) 61 Quantis (Multi Thread) 111 CUDA(LFG) 1.28e10 7 Table 2: Performance of different RNG algorithms. speed, with the Ran algorithm producing the most at 24085 deviates per millisecond. This is more than two orders of magnitude faster than the single threaded Quantis generator at about 61 32-bit deviates per millisecond. The lagged-Fibonacci generator on the CUDA GPU is another 2-3 orders of magnitude faster than the CPU algorithms. 6. Discussion & Conclusions Section 5 shows that all but the Unix rand pseudorandom algorithms pass the Extended Birthday spacing and Die Hard tests that we have implemented. These are well known algorithms and the results are common knowledge [3], hence it is unsurprising that the widely used Unix rand failed. This is further proof that this function should not be used. It has been suggested [3] that lagged-Fibonacci generators may erroneously fail the Birthday spacings test, but this does not appear to be the case for our implementation, which passes the test. Although these pseudo-random number generators pass most common and also more stringent tests implemented in this paper, this does not guarantee their true randomness in the face of tests yet to be adviced. Using physical phenomena, such as photon emitters like the one used in this paper or Intel’s on chip temperature variation random source, allows us to guarantee that the number is completely random and free from any bias. Although, the question remains how to test these hardware random sources and can we engineer a test that identifies only a truly random number? Performance of the generators was as expected [30], with the CUDA GPU LFG algorithm producing 1.28e10 7 random deviates per millisecond. The single threaded Quantis card algorithm produces only 61 32-bit deviates per millisecond and 111 deviates for the multi-threaded implementation. This is much slower than the theoretical maximum of 500 32-bit deviates from the 16MBits/s stream of random bits [32]. We attribute this latency to the fetch time from the card over the PCI bus and the conversion time to the specified data type. The speedup attained by introducing multiple threads is significant as this allows us to hide the time lost in the conversion process and by fetching the maximum number of bytes at each API call we minimise any latency that is associated in calling the Quantis card via the PCI bus. For Monte Carlo algorithms even the CPU pseudo random algorithms are the bottleneck in the simulation, hence the Quantis card is much too slow for these. A good compromise is to use the numbers produced by the Quantis card to seed a good pseudo-random number generator, thus ensuring that the seeds are statistically independent. If Intel succeeds in creating a truly random number generator producing 2.4 billion random bits per second [31], then this will significantly increase the reasons for using a hardware random source for random heavy algorithms. Until that point, long period pseudo-random number generators will continue to be the best choice for Monte Carlo algorithms. However, for low random frequency algorithms that depend on high quality random numbers, such as generation of cryptographic keys, current hardware generators are an excellent choice. We have found that when used in the correct situation the Quantis card is an invaluable resource to computer simulations. However, random number generation is very much an application specific field and we have shown that, when compared to conventional pseudorandom generators, the time it takes to produce a single random deviate with the Quantis card is several orders of magnitude slower. Furthermore, the generation with the Quantis card is inherently serial and does not benefit from parallelisation on either the CPU or GPU. However, we have discussed how this latency may be hidden when the program does not require random numbers often by using a separate thread that fetches the numbers from the Quantis device and prepares them for the main process to use as needed. Another method we have discussed is using the Quantis device to produce truly random seeds for a high-quality pseudo-random number generator. Graphics processing units offer a performance increase of about 2-3 orders of magnitude over the tested sequential CPU implementations. They have been shown [56] to be a powerful accelerator for Monte Carlo simulations that heavily depend on random numbers. However, developing high-performance code for GPUs is significantly more complex and time consuming than it is to write a sequential or even multi-threaded CPU implementation. In summary, the field of computer generated random number algorithms is one of ”horses for courses” - there is no single best algorithm that will satisfy all requirements. Before starting any project using Monte Carlo algorithms and for which the quality of the random numbers matters, it is therefore of great worth to carefully consider which algorithm to use. References [1] P. L’Ecuyer, “Software for uniform random number generation: distinguishing the good and the bad,” in Proc. 2001 Winter Simulation Conference, vol. 2, 2001, pp. 95–105. [2] R. P. Brent, “A fast vectorized implementation of wallace’s normal random number generator,” Australian National University, Tech. Rep., 1997. [3] G. Marsaglia, “Random Number generation,” florida Preprint, 1983. [4] ——, “A Current view of random number generators,” in Computer science and statistics: 16th symposium on the interface, Atlanta, Mar 1984, keynote address. [5] G. Marsaglia and L.-H. Tsay, “Matrices and the Structure of Random Number Sequences,” Linear algebra and its applications, vol. 67, pp. 147–156, 1985. [6] G. Marsaglia, A. Zaman, and W. W. Tsang, “Toward a universal random number generator,” Statistics and Probability Letters, vol. 9, no. 1, pp. 35–39, January 1987, florida State preprint.
Int'l Conf. Foundations of Computer Science | FCS'11 | 21 [7] P. D. Coddington, “Analysis of random number generators using monte carlo simulation,” J. Mod. Physics C, vol. 5, no. 3, pp. 547–560, 1994. [8] S. Cuccaro, M. Mascagni, and D. Pryor, “Techniques for testing the quality of parallel pseudo-random number generators,” in Proc. of the 7th SIAM Conf. on Parallel Processing for Scientific Computing,. Philadelphia, USA: SIAM, 1995, pp. 279–284. [9] K. Binder, Ed., Monte Carlo Methods in Statistical Physics, 2nd ed., ser. Topics in Current Physics. Springer-Verlag, 1986, number 7. [10] ——, Applications of the Monte Carlo Method in Statistical Physics, ser. Topics in Current Physics. Springer-Verlag, 1987. [11] R. Johnsonbaugh, Discrete Mathematics, 5th ed. Prentice Hall, 2001, no. ISBN 0-13-089008-1. [12] S. Srinivasan, S. Mathew, R. Ramanarayanan, F. Sheikh, M. Anders, H. Kaul, V. Erraguntla, R. Krishnamurthy, and G. Taylor, “2.4ghz 7mw all-digital pvt-variation tolerant true random number generator in 45nm cmos,” in VLSI Circuits (VLSIC), 2010 IEEE Symposium on, june 2010, pp. 203 –204. [13] L.-Y. Deng and H. Xu, “A system of high-dimensional, efficient, long-cycle and portable uniform random number generators,” ACM TOMACS, vol. 14, no. 4, pp. 299–309, 2003. [14] B. Schneier, Applied Cryptography, 2nd ed. Wiley, 1996, iSBN 0-471-11709-9. [15] A. Rukhin, J. Soto, J. Nechvatal, M. Smid, E. Barker, S. Leigh, M. Levenson, M. Vangel, D. Banks, A. Heckert, J. Dray, and S. Vo, “A statistical test suite for random and pseudorandom number generators for cryptographic applications,” U.S. National Institute of Standards and Technology,, Tech. Rep. NIST Special Publication 800-22,, April 2010. [16] W. Hormann, “The transformed rejection method for generating poisson random variables,” Insurance: Mathematics and Economics, vol. 12, no. 1, pp. 39–45, February 1993. [17] W. Press, B. Flannery, S. Teukolsky, and W. Vetterling, Numerical Recipes in C. Cambridge University Press, 1988, ch. 7, pp. 204– 241, random Numbers. [18] A. Menezes, P. van Oorschot, and S. Vanstone, Handbook of Applied Cryptography. CRC Press, Boca Raton, FL, 1996, ch. 5 - Pseudorandom bits and sequences, pp. 169–190. [19] E. Barker and J. Kelsey, “Recommendation for random number generation using deterministic random bit generators (revised),” U.S. National Institute of Standards and Technology, Tech. Rep. NIST Special Publication 800-90, March 2007. [20] P. Coddington, J. Mathew, and K. Hawick, “Interfaces and implementations of random number generators for java grande applications,” in Proc. High Performance Computing and Networks (HPCN), Europe 99, Amsterdam, April 1999. [21] M. Blum and S. Micali, “How to generate cryptographically strong sequences of pseudo-random bits,” SIAM J. Comput., vol. 13, pp. 850–864, November 1984. [Online]. Available: http://portal.acm.org/citation.cfm?id=2054.2068 [22] P. Coddington and A. Newall, “Japara - a java parallel random number generator library for high-performance computing,” The University of Adelaide, Tech. Rep. DHPC-144, 2004. [23] A. Newell, “Parallel random number generators in java,” Master’s thesis, Computer Science, Adelaide University, 2003. [24] K. A. Smith, S. F. Reddaway, and D. M. Scott, “Very high performance pseudo-random number generation on DAP,” Comp. Phys. Comms., vol. 37, pp. 239–244, 1985. [25] R. P. Brent, “Uniform random number generators for supercomputers,” in Proc. 5th Australian Supercomputer Conference, Melbourne, Australia, 1992. [26] W. Paul, D. W. Heermann, and R. C. Desai, “Implementation of a random number generator in OCCAM,” Dec 1989, mainz preprint 87/47, 749. [27] D. A. Bader, A. Chandramowlishwaran, and V. Agarwal, “On the design of fast pseudo-random number generators for the cell broadband engine and an application to risk analysis,” in Proc. 37th IEEE Int. Conf on Parallel Processing, 2008, pp. 520–527. [28] M. Giles, “Notes on CUDA implementation of random number genertors,” January 2009, oxford University. [29] W. Langdon, “A Fast High Quality Pseudo Random Number Generator for nVidia CUDA,” in Proc. ACM GECCO’09, 2009. [30] K. Hawick, A. Leist, D. Playne, and M. Johnson, “Speed and Portability issues for Random Number Generation on Graphical Processing Units with CUDA and other Processing Accelerators,” in Proc. Australasian Computer Science Conference (ACSC 2011), 2011. [31] G. Anthes, “The quest for randomness,” Comm. ACM, vol. 54, no. 4, pp. 13–15, April 2011. [32] ID Quantique White Paper, “Random Number Generation Using Quantum Physics,” ID Quantique SA, Switzerland, Tech. Rep. Version 3.0, April 2010, QUANTIS. [33] D. P. Landau and K. Binder, A Guide to Monte-Carlo Simulations in Statistical Physics. Cambridge University Press, 2009, vol. 3rd edition. [34] M. Niss, “History of the Lenz-Ising Model 1920-1950: From Ferromagnetic to Cooperative Phenomena,” Arch. Hist. Exact Sci., vol. 59, pp. 267–318, 2005. [35] E. Ising, “Beitrag zur Theorie des Ferromagnetismus,” Zeitschrift fuer Physik, vol. 31, p. 253258, 1925. [36] L. Onsager, “Crystal Statistics I. Two-Dimensional Model with an Order-Disorder Transition,” Phys.Rev., vol. 65, no. 3, pp. 117–149, Feb 1944. [37] R. B. Potts, “Some generalised order-disorder transformations,” Proc. Roy. Soc, pp. 106–109, 1951, received July. [38] N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, and E. Teller, “Equation of state calculations by fast computing machines,” J. Chem. Phys., vol. 21, no. 6, pp. 1087–1092, Jun 1953. [39] R. H. Swendsen and J.-S. Wang, “Nonuniversal critical dynamics in Monte-Carlo simulations,” Phys. Rev. Lett., vol. 58, no. 2, pp. 86–88, Jan 1987. [40] U. Wolff, “Comparison Between Cluster Monte Carlo Algorithms in the Ising Model,” Physics Letters B, vol. 228, no. 3, pp. 379– 382, September 1989. [41] E. Marinari and G. Parisi, “Simulated Tempering - a New Monte- Carlo Scheme,” Europhysics Letters, vol. 19, no. 6, pp. 451–458, July 1992. [42] W. Hastings, “Monte-Carlo Sampling Methods Using Markov Chains And Their Applications,” Biometrika, vol. 57, no. 1, pp. 97–107, 1970. [43] W. Jorgensen, “Perspective on ”Equation of state calculations by fast computing machines”,” Theoretical Chemistry Accounts, vol. 103, no. 3-4, pp. 225–227, February 2000. [44] S. Chib and E. Greenberg, “Understanding the Metropolis- Hastings Algorithm,” American Statistician, vol. 49, no. 4, pp. 327–335, November 1995. [45] A. Linke, D. W. Heermann, P. Altevogt, and M. Siegert, “Largescale simulation of the two-dimensional kinetic Ising model,” Physica A: Statistical Mechanics and its Applications, vol. 222, no. 1-4, pp. 205–209, December 1995. [46] K. Okano, L. Schülke, K. Yamagishi, and B. Zheng, “Universality and scaling in short-time critical dynamics,” Nuclear Physics B, vol. 485, no. 3, pp. 727–746, February 1997. [47] U. Fulco, L. Lucena, and G. Viswanathan, “Efficient search of critical points in Ising-like systems,” Physica A: Statistical Mechanics and its Applications, vol. 264, no. 1-2, pp. 171–179, February 1999. [48] F. Lima and D. Stauffer, “Ising model simulation in directed lattices and networks,” Physica A: Statistical Mechanics and its Applications, vol. 359, no. 1, pp. 423–429, January 2006. [49] M. Matsumoto and T. Nishimura, “Mersenne twistor: A 623diminsionally equidistributed uniform pseudorandom number generator,” ACM Transactions on Modeling and Computer Simulation, vol. 8 No 1., pp. 3–30, 1998. [50] D. Knuth, The Art of Computer Programming: Seminumerical Algorithms, 3rd ed. Addison-Wesley, 1997, vol. 2. [51] P. D. Coddington and S. H. Ko, “Techniques for empirical testing of parallel random number generators,” in Proc. International Conference on Supercomputing (ICS’98, 1998, dHPC-025. [52] G. Marsaglia, “Random numbers fall mainly in the planes,” Proc. Natl. Acad. Sci., vol. 61, no. 1, pp. 25–28, 1968. [53] W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery, Numerical Recipes - The Art of Scientific Computing, 3rd ed. Cambridge, 2007, iSBN 978-0-521-88407-5. [54] G. Marsaglia and W. W. Tsang, “Some Difficult-to-pass Tests of Randomness,” Journal of Statistical Software, vol. 7, no. 3, pp. 1–9, January 2002. [55] G. Marsaglia, “Diehard Battery Of Tests Of Randomness,” http: //www.stat.fsu.edu/pub/diehard/, 1995. [56] K. Hawick, A. Leist, and D. Playne, “Regular Lattice and Small- World Spin Model Simulations using CUDA and GPUs,” Int. J. Parallel Prog., vol. 39, no. CSTN-093, pp. 183–201, 2011.
- Page 1 and 2: Int'l Conf. Foundations of Computer
- Page 3 and 4: Int'l Conf. Foundations of Computer
- Page 9 and 10: Int'l Conf. Foundations of Computer
- Page 11 and 12: Int'l Conf. Foundations of Computer
- Page 13 and 14: Int'l Conf. Foundations of Computer
- Page 15 and 16: Int'l Conf. Foundations of Computer
- Page 17 and 18: Int'l Conf. Foundations of Computer
- Page 19: Int'l Conf. Foundations of Computer
- Page 23 and 24: Int'l Conf. Foundations of Computer
- Page 25 and 26: Int'l Conf. Foundations of Computer
- Page 27 and 28: Int'l Conf. Foundations of Computer
- Page 29 and 30: Int'l Conf. Foundations of Computer
- Page 31 and 32: Int'l Conf. Foundations of Computer
- Page 33 and 34: Int'l Conf. Foundations of Computer
- Page 35 and 36: Int'l Conf. Foundations of Computer
- Page 37 and 38: Int'l Conf. Foundations of Computer
- Page 39 and 40: Int'l Conf. Foundations of Computer
- Page 41 and 42: Int'l Conf. Foundations of Computer
- Page 43 and 44: Int'l Conf. Foundations of Computer
- Page 45 and 46: Int'l Conf. Foundations of Computer
- Page 47 and 48: Int'l Conf. Foundations of Computer
- Page 49 and 50: Int'l Conf. Foundations of Computer
- Page 51 and 52: Int'l Conf. Foundations of Computer
- Page 53 and 54: Int'l Conf. Foundations of Computer
- Page 55 and 56: Int'l Conf. Foundations of Computer
- Page 57 and 58: Int'l Conf. Foundations of Computer
- Page 59 and 60: Int'l Conf. Foundations of Computer
- Page 61 and 62: Int'l Conf. Foundations of Computer
- Page 63 and 64: Int'l Conf. Foundations of Computer
- Page 65 and 66: Int'l Conf. Foundations of Computer
- Page 67 and 68: Int'l Conf. Foundations of Computer
- Page 69 and 70: Int'l Conf. Foundations of Computer
- Page 71 and 72:
Int'l Conf. Foundations of Computer
- Page 73 and 74:
Int'l Conf. Foundations of Computer
- Page 75 and 76:
Int'l Conf. Foundations of Computer
- Page 77 and 78:
Int'l Conf. Foundations of Computer
- Page 79 and 80:
Int'l Conf. Foundations of Computer
- Page 81 and 82:
Int'l Conf. Foundations of Computer
- Page 83 and 84:
Int'l Conf. Foundations of Computer
- Page 85 and 86:
Int'l Conf. Foundations of Computer
- Page 87 and 88:
Int'l Conf. Foundations of Computer
- Page 89 and 90:
Int'l Conf. Foundations of Computer
- Page 91 and 92:
Int'l Conf. Foundations of Computer
- Page 93 and 94:
Int'l Conf. Foundations of Computer
- Page 95 and 96:
Int'l Conf. Foundations of Computer
- Page 97 and 98:
Int'l Conf. Foundations of Computer
- Page 99 and 100:
Int'l Conf. Foundations of Computer
- Page 101 and 102:
Int'l Conf. Foundations of Computer
- Page 103 and 104:
Int'l Conf. Foundations of Computer
- Page 105 and 106:
Int'l Conf. Foundations of Computer
- Page 107 and 108:
Int'l Conf. Foundations of Computer
- Page 109 and 110:
Int'l Conf. Foundations of Computer
- Page 111 and 112:
Int'l Conf. Foundations of Computer
- Page 113 and 114:
Int'l Conf. Foundations of Computer
- Page 115 and 116:
Int'l Conf. Foundations of Computer
- Page 117 and 118:
Int'l Conf. Foundations of Computer
- Page 119 and 120:
Int'l Conf. Foundations of Computer
- Page 121 and 122:
Int'l Conf. Foundations of Computer
- Page 123 and 124:
Int'l Conf. Foundations of Computer
- Page 125 and 126:
Int'l Conf. Foundations of Computer
- Page 127 and 128:
Int'l Conf. Foundations of Computer
- Page 129 and 130:
Int'l Conf. Foundations of Computer
- Page 131 and 132:
Int'l Conf. Foundations of Computer
- Page 133 and 134:
Int'l Conf. Foundations of Computer
- Page 135 and 136:
Int'l Conf. Foundations of Computer
- Page 137 and 138:
Int'l Conf. Foundations of Computer
- Page 139 and 140:
Int'l Conf. Foundations of Computer
- Page 141 and 142:
Int'l Conf. Foundations of Computer
- Page 143 and 144:
Int'l Conf. Foundations of Computer
- Page 145 and 146:
Int'l Conf. Foundations of Computer
- Page 147 and 148:
Int'l Conf. Foundations of Computer
- Page 149 and 150:
Int'l Conf. Foundations of Computer
- Page 151 and 152:
Int'l Conf. Foundations of Computer
- Page 153 and 154:
Int'l Conf. Foundations of Computer
- Page 155 and 156:
Int'l Conf. Foundations of Computer
- Page 157 and 158:
Int'l Conf. Foundations of Computer
- Page 159 and 160:
Int'l Conf. Foundations of Computer
- Page 161 and 162:
Int'l Conf. Foundations of Computer
- Page 163 and 164:
Int'l Conf. Foundations of Computer
- Page 165 and 166:
Int'l Conf. Foundations of Computer
- Page 167 and 168:
Int'l Conf. Foundations of Computer
- Page 169 and 170:
Int'l Conf. Foundations of Computer
- Page 171 and 172:
Int'l Conf. Foundations of Computer
- Page 173 and 174:
Int'l Conf. Foundations of Computer
- Page 175 and 176:
Int'l Conf. Foundations of Computer
- Page 177 and 178:
Int'l Conf. Foundations of Computer
- Page 179 and 180:
Int'l Conf. Foundations of Computer
- Page 181 and 182:
Int'l Conf. Foundations of Computer
- Page 183 and 184:
Int'l Conf. Foundations of Computer
- Page 185 and 186:
Int'l Conf. Foundations of Computer
- Page 187 and 188:
Int'l Conf. Foundations of Computer
- Page 189 and 190:
Int'l Conf. Foundations of Computer
- Page 191 and 192:
Int'l Conf. Foundations of Computer
- Page 193 and 194:
Int'l Conf. Foundations of Computer
- Page 195 and 196:
Int'l Conf. Foundations of Computer
- Page 197 and 198:
Int'l Conf. Foundations of Computer
- Page 199 and 200:
Int'l Conf. Foundations of Computer
- Page 201 and 202:
Int'l Conf. Foundations of Computer
- Page 203 and 204:
Int'l Conf. Foundations of Computer
- Page 205 and 206:
Int'l Conf. Foundations of Computer
- Page 207 and 208:
Int'l Conf. Foundations of Computer
- Page 209 and 210:
Int'l Conf. Foundations of Computer
- Page 211 and 212:
Int'l Conf. Foundations of Computer
- Page 213 and 214:
Int'l Conf. Foundations of Computer
- Page 215 and 216:
Int'l Conf. Foundations of Computer
- Page 217 and 218:
Int'l Conf. Foundations of Computer
- Page 219 and 220:
Int'l Conf. Foundations of Computer
- Page 221 and 222:
Int'l Conf. Foundations of Computer
- Page 223 and 224:
Int'l Conf. Foundations of Computer
- Page 225 and 226:
Int'l Conf. Foundations of Computer