|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.smp.monte.PiSmp2
public class PiSmp2
Class PiSmp2 is an SMP 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.nt=K edu.rit.smp.monte.PiSmp2 seed N
K = Number of parallel threads
seed = Random seed
N = Number of random points
The computation is performed in parallel in multiple threads. To improve performance, each thread has its own pseudorandom number generator, and the program uses the reduction pattern to determine the count. The program measures the computation's running time.
| Method Summary | |
|---|---|
static void |
main(String[] args)
Main program. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void main(String[] args)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||