PRIME
Make an MPI version of Prime Count Program


PRIME is a version of the prime summing program that we have seen earlier. Your task is to make an MPI version of it. If you become interested in this problem, then your secondary task can be to make an efficient MPI version of it.

The original program counts the primes from 2 to 100,000. The program you are to start with still has this behavior. However, to help you make an MPI version, the program has broken up the computation into P subloops.

The program should be reasonably easy to convert to MPI. Each process can figure out its subinterval just based on its ID number. The only communication comes at the end, when each process must send its sum back to process 0 to be totaled. This can be done with an MPI_REDUCE call.


Source Code:

Completed Source Code:

Here are "completed" versions of the programs.

Script for Execution on the FSU HPC Cluster:

Before using MPI on the FSU_HPC cluster, you must first set up the appropriate environment. You can do this by typing

        module load gnu-openmpi
      

Once you have set up the environment, you should compile your program, using one of the following:

to create your executable program. Now you can use the msub command to submit a script to run your program.


Last revised on 21 October 2011.