Reference no: EM13889886
Question: Trying more than two weeks but not getting corect program due date is already over.please hel me anyone
For this project, the students are to use MS Visual Studio to program and run a simple multi-process console program using MPI in visual C++. The MPI libraries can be downloaded and added to visual C++ project on the project property tab. There are many available MPI libraries online, such as MS HPC, MPICH etc. The installation/configuration steps can also be found on the internet, usually from the library provider websites, as computer science master students, this should not be an issue.
The goal of this project is for student to learn the basic implementation of multi-process programming in parallel computing with MPI and using the knowledge learned from the course to decompose a relative complex computation problem into smaller parallel problems.
The student is required to design their own decomposition logic on the given problem, such as the number of processes produced, how and where to pass the result from one process to another etc.
Write a parallel program with MPI that supports the following computation.
1). It generates five processes P0, P1, P2, P3, and P4.
2). Main process gets a number n from key board, then initiates MPI.
3) Process Pi (i=0, 1,2,3) uses n to call the following two functions.
a) function prime(int n) finds the smallest prime number q that q=8m+(2i+1) >n for some integer m. Note a prime number p is an integer that is not product of two integers less than p.
B) function twin(int n) finds the least twin number (q, q+2) that q=8m+(2i+1)> n for some integer m. A pair (q,q+2) is a twin if both q and q+2 are prime numbers.
4) P4 gets all four results from the other four processes and returns the least prime number and twin.
For example, if n=10, P0 returns 11 and (11,13), P1 returns 13 and (17, 19), P2 returns 17 and (17, 19), and P3 returns 19 and (29,31). Finally, P4 returns 11 and (11,13).