Documentation of 'edu.rit.smp.monte.PiSmp' Java class
PiSmp
edu.rit.smp.monte

Class PiSmp



  • public class PiSmp
    extends java.lang.Object
    Class PiSmp 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.PiSmp seed N
    K = Number of parallel threads
    seed = Random seed
    N = Number of random points

    The computation is performed in parallel in multiple threads. All threads share the same pseudorandom number generator and counter. The program measures the computation's running time.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void main(java.lang.String[] args)
      Main program.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • main

        public static void main(java.lang.String[] args)
                         throws java.lang.Exception
        Main program.
        Throws:
        java.lang.Exception

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.