In order to successfully complete this assignment you must do the required reading, watch the provided videos and complete all instructions. The embedded survey form must be entirely filled out and submitted on or before 11:59pm on Tuesday March 23. Students must come to class the next day prepared to discuss the material covered in this assignment.
In OpenMP we synchronize threads using #pragma omp barrier
; in CUDA we can synchronize threads between blocks using the __synchronize()
function.
✅ QUESTION: What is an equivalent process synchronizing function in MPI?
Put your answer here.
The MPI_send
and MPI_recv
functions are "blocking" meaning they do not complete until the message has been passed. MPI_send
waits for a conformation from the receiving core and MPI_recv
will wait until it gets the message it is looking for. These effectively are types of locks and can cause MPI programs to DEADLOCK.
An alternative to these function are MPI_isend
and MPI_irecv
. These functions will not block execution of the program. Meaning that MPI_isend
will send off a message and assume the recipient will get it. And MPI_irecv
will look to see if a message is coming in and if not continue the program while returning a kind of message not found error.
MPI_send
MPI_recv
MPI_isend
MPI_irecv
MPI_Bcast
✅ QUESTION: Give an example, when you might want to use MPI_isend
and/or MPI_irecv
instead of the typical MPI_send
and MPI_recv
.
Put your answer here.
Think of broadcasting as syncing a variable on one machine with all other machines. A kind of global copy.
int MPI_Bcast( void *buffer,
int count,
MPI_Datatype datatype,
int root,
MPI_Comm comm )
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
int rank;
int buf;
const int root=0;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(rank == root) {
buf = 777;
}
printf("[%d]: Before Bcast, buf is %d\n", rank, buf);
/* everyone calls bcast, data is taken from root and ends up in everyone's buf */
MPI_Bcast(&buf, 1, MPI_INT, root, MPI_COMM_WORLD);
printf("[%d]: After Bcast, buf is %d\n", rank, buf);
MPI_Finalize();
return 0;
}
✅ QUESTION: Give an example about when you might want to use the MPI_Bcast
function?
Put your answer here.
Please fill out the form that appears when you run the code below. You must completely fill this out in order to receive credits for the assignment!
If you have trouble with the embedded form, please make sure you log on with your MSU google account at googleapps.msu.edu and then click on the direct link above.
✅ Assignment-Specific QUESTION: What is an equivalent process synchronizing function in MPI?
Put your answer to the above question here
✅ QUESTION: Summarize what you did in this assignment.
Put your answer to the above question here
✅ QUESTION: What questions do you have, if any, about any of the topics discussed in this assignment after working through the jupyter notebook?
Put your answer to the above question here
✅ QUESTION: How well do you feel this assignment helped you to achieve a better understanding of the above mentioned topic(s)?
Put your answer to the above question here
✅ QUESTION: What was the most challenging part of this assignment for you?
Put your answer to the above question here
✅ QUESTION: What was the least challenging part of this assignment for you?
Put your answer to the above question here
✅ QUESTION: What kind of additional questions or support, if any, do you feel you need to have a better understanding of the content in this assignment?
Put your answer to the above question here
✅ QUESTION: Do you have any further questions or comments about this material, or anything else that's going on in class?
Put your answer to the above question here
✅ QUESTION: Approximately how long did this pre-class assignment take?
Put your answer to the above question here
from IPython.display import HTML
HTML(
"""
<iframe
src="https://cmse.msu.edu/cmse401-pc-survey"
width="100%"
height="500px"
frameborder="0"
marginheight="0"
marginwidth="0">
Loading...
</iframe>
"""
)
To get credit for this assignment you must fill out and submit the above survey from on or before the assignment due date.
Written by Dr. Dirk Colbry, Michigan State University
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.