Class PrimeCountFunctionHyb
- java.lang.Object
-
- edu.rit.hyb.prime.PrimeCountFunctionHyb
-
public class PrimeCountFunctionHyb extends java.lang.ObjectClass PrimeCountFunctionHyb is a hybrid parallel program that calculates the prime counting function π(x). π(x) is the number of primes less than or equal to x. The program uses a list of 32-bit primes stored in a file. The prime file must be generated by the Prime32File program. To find the primes, the program calculates a series of sieves. Each sieve consists of one million numbers.The program runs with one process per node and multiple threads per process. The program uses the master-worker pattern for load balancing. Each process in the program is an independent worker process. Each worker process calculates a series of groups of sieves, as assigned by the master thread. Within each group of sieves, the threads of the worker process calculate the individual sieves in parallel.
The groups of sieves are determined by the pj.schedule property specified on the command line; the default is to divide the sieves evenly among the worker processes (i.e. no load balancing). For further information about the pj.schedule property, see class PJProperties.
Within each group of sieves, the individual sieves are partitioned among the threads of the worker process using the parallel loop schedule specified by the last command line argument. If this argument is missing, the default is to divide the individual sieves evenly among the threads (i.e. no load balancing). For further information, see the parse() method in class IntegerSchedule.
Usage: java -Dpj.np=Kp -Dpj.nt=Kt [ -Dpj.schedule=procschedule ] edu.rit.hyb.prime.PrimeCountFunctionHyb x primefile [ thrschedule ]
Kp = Number of parallel processes
Kt = Number of parallel threads per process
procschedule = Load balancing schedule for processes
x = Argument of prime counting function, 0 <= x <= 263-1
primefile = Prime file name
thrschedule = Load balancing schedule for threadsThe computation is performed in parallel in multiple processors. The program measures the total running time.
-
-
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