Question: COSC 6360: Parallel Computing Programming Projecl #2 Basic MPI Programming Objective: The purpose of this programming project is to become familiar with the MPI API

 COSC 6360: Parallel Computing Programming Projecl \#2 Basic MPI Programming Objective:

COSC 6360: Parallel Computing Programming Projecl \#2 Basic MPI Programming Objective: The purpose of this programming project is to become familiar with the MPI API and write basic communication programs. This can be accomplished by developing simple computer programs that use the MPI parallel communications library. Part A: Checking Prime Numbers (25 poinis) 1. Initialize MPI 2. Get the sizc of MPI COMM WORI.D communicator and rank of the current processics). 3. Declare and fill an array of 100,000 elements with random positive integers 4. Ilave process 0 to send and distribute the elements of the array as evenly as possible among all other processes. Each process will receive its subarray. 5. Each process will check every element in its subarray and determine whether the element is a prime number or not and accordingly, increment a counter if the rumber is a prime. At the end, euch process will send process 0 the total number of prime numbers identified in its own subarray. Process 0 will receive the counts of prime numbers from all processes and will print messages indicating which process has found how many prime numbers. At the end, process 0 will also print the tolal number of prime numbers found in ald 100,000 elements. Save your program with a lilename as prog2a ia or prog2ai.epp. Note: To work on this assignment, you need to know how to use the random number generator finction. Remember, in the first project we used the random number generator function in the computation of PI. You also need to know how to test whether a positive integer is a prime number or not. A prime number is a number which is only divisible by 1 or by the number itself. If any number other than 1 or the number itself divides the number evenly (i.e. with a remainder of 0 ), then the number is not a prime number. For any given number n, you muy try to divide the number by 2,3,,n1 and see whether it is divisible. A more efficient solution is to try to divide n by 2,3,4,,n. You may find many code examples online. Be sure to include the souree in your "readme" file or mention the source as a comment in your program if you copy code from any online sources

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!