Chapter 9: Monte Carlo method
Abstract
This chapter goes through several examples of a Monte Carlo algorithm to show how to generate random number sequences and perform parallel reduction.
Keywords
Reduction; Random number generation; CURAND; Accuracy of reduction; Accuracy due to FMA instructions
A book on high performance and parallel computing is not complete without an example that shows how to compute π. Instead of using the classic example of numerical integration of the function , we use a Monte Carlo method.
Calculating π using a Monte Carlo method is quite simple. In a unit square, we generate a sequence of N points ,
Get CUDA Fortran for Scientists and Engineers, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.