Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

University of California Irvine MPI Based C Program Project

University of California Irvine MPI Based C Program Project

University of California Irvine MPI Based C Program Project

Description

For this assignment, you start from scratch. You may want to copy and use some code and makefile from previous assignments. Included is the previous reference code and MPI lecture notes.

Create two deliverables:

-Cyclicpassing.c

-Makefile (this should have a target to compile your program into an MPI executable named main.out

In the file cyclicPassing.c, write an MPI-based C program in which each rank does the following:

Create an int array of length 10 (call it outv).

oThe first 5 entries should be rank.

oThe last 5 entries should be rank+10.

Create another int array of length 10 (call it inv). Its contents don’t matter because they will be overwritten in a moment.

Use MPI to exchange data with neighboring ranks as follows:

oSend the first 5 entries of outv to the rank of index rank-1.

oSend the last 5 entries of outv to the rank of index rank+1.

oReceive a message of length 5 from the rank of index rank-1. Store this array in the first 5 entries of inv.

oReceive a message of length 5 from the rank of index rank+1. Store this array in the last 5 entries of inv.

oThere are no ranks with index -1 or index size, so you should wrap around. The first rank (index 0) and the last rank (index size-1) should take the places of one another’s missing neighbor rank (see example).

Pause execution for 0.05*rank seconds.

oThis makes the higher-numbered ranks pause a little longer, which should ensure that the upcoming print statements appear in the expected order.

oYou can easily pause execution with the sleep function provided by #include <unistd.h>

Print the rank index and outv on one line.

Print the rank index and inv on another line.

oYou may format this output nicely for readability. For example, I put a blank line after each inv array line so the arrays of the same rank are visually grouped.

If you put your arrays on the heap, free the memory.

Test your code. You don’t need to prove that you tested it, but you should do it anyway.

Here is an output example if there are four ranks:

Here’s the same output with arrows highlighting the messages sent by rank 1 to ranks 0 and 2.

Here’s the same output again with arrows highlighting the wrap-around messages between ranks 0 and size-1 (3 in this case).

MPI API functions used

MPI_Init: sets up MPI threads so that they can communicate (man page (Links to an external site.))

MPI_Comm_rank: get the process id for the MPI rank calling this function (man page (Links to an external site.))

MPI_Comm_size: get the number of MPI processes (man page (Links to an external site.))

MPI_Finalize: always call this from all MPI ranks before finishing the program (man page (Links to an external site.))

Websites for different MPI implementations

MPICH: https://www.mpich.org (Links to an external site.)

MVAPICH: https://mvapich.cse.ohio-state.edu (Links to an external site.)

OpenMPI: https://mvapich.cse.ohio-state.edu (Links to an external site.)

MPI Tutorials

https://mpitutorial.com/tutorials/

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20