COP4338 Lab 6 solution


Original Work ?


5/5 - (3 votes)

Write an MPI program, countprimes which will count the number of prime numbers in the numbers
from 1 to n inclusive where n is a long integer. The value for n which should be set in the program
using a constant should be 50,000.

Each process will test its share of the cases.

Each process should print out any primes that it finds in a readable manner indicating which process
found it and the actual prime number found.

The master process should end with printing a total for the count of the number of primes and the
total amount of time taken to find all the primes.

Please follow the following instructions carefully before submitting your work:

Before submission, make sure you clean up the directories so that no miscellaneous files are kept
around in the submission. (Grade would be deducted if useless files are found in the homework
directories.) Include the source code and the Makefile in the submission. Your Makefile can assume
that the path to the MPI compiler is found in the path.

The file to be submitted should be named as ‘

If the program does not compile using MPICC and do something useful when it runs it will not earn any