Class PiClu2
- java.lang.Object
-
- edu.rit.clu.monte.PiClu2
-
public class PiClu2 extends java.lang.ObjectClass PiClu2 is a cluster parallel program that calculates an approximate value for π using a Monte Carlo technique. The program generates a number of random points in the unit square (0,0) to (1,1) and counts how many of them lie within a circle of radius 1 centered at the origin. The fraction of the points within the circle is approximately π/4.Usage: java -Dpj.np=K edu.rit.clu.monte.PiClu2 seed N
K = Number of parallel processes
seed = Random seed
N = Number of random pointsThe computation is performed in parallel in multiple threads. The program uses class edu.rit.util.Random for its pseudorandom number generator. To improve performance, each process has its own pseudorandom number generator, and the program uses the reduction pattern to determine the count. The program uses the "sequence splitting" technique with the pseudorandom number generators to yield results identical to the sequential version. The program measures the computation's running time.
Class PiClu2 is a test program that omits the final message passing reduction.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidmain(java.lang.String[] args)Main program.
-
DMelt 3.0 © DataMelt by jWork.ORG