Lecture 10: 15.10.2018

Programming for Distributed Memory with MPI.

Given an array of positive integers, v[ ] of size N, consider the problem of testing the primality of all values in v[ ] using a set of P processes (assume that N is divisible by P). Starting from mpi_prime.c, write a program that takes advantage of the MPI programming model to count the number of primes that exist in v[ ]. Consider that N and v[ ] are initialized by process 0 with a call to function load_vector() and that a number can be tested for primality with a call to function is_prime().