










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
During the course of work of the Parallel and Distributed Computing we learn the core of the programming. The main points disucss in these lecture slides are:Point-To-Point Communication, Pair of Processes, Receiving Process, Deadlock, Distributing Data, Collective Communications, Distribute Data for Parallel Use, Uses Variation, Concepts of Scatter, Receive Code
Typology: Slides
1 / 18
This page cannot be seen from the preview
Don't miss anything!











int MPI_Recv (
void *message, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status
)
Sending Process Receiving Process
Program Memory
System Buffer
System Buffer
Program Memory
MPI_Send (^) MPI_Recv
CS 491 – Parallel and Distributed Computing 8
float a, b, c; int id; MPI_Status status; …
if (id == 0) { MPI_Recv (&b, 1, MPI_FLOAT, 1, 0, MPI_COMM_WORLD, &status); MPI_Send (&a, 1, MPI_FLOAT, 1, 0, MPI_COMM_WORLD); c = (a + b) / 2.0; } else if (id == 1) { MPI_Recv (&a, 1, MPI_FLOAT, 0, 0, MPI_COMM_WORLD, &status); MPI_Send (&b, 1, MPI_FLOAT, 0, 0, MPI_COMM_WORLD); c = (a + b) / 2.0; }
if (ID == j) { … Receive from i … } … if (ID == i) { … Send to j … } …
Receive is before Send. Why does this work?
CS 491 – Parallel and Distributed Computing (^) Docsity.com^13
Scatter the vectors among N processors as zpart, xpart, and ypart.
Gather the results back to the root processor when completed.
Calls can return as soon as their participation is complete.
Broadcast the coefficients to all processors.
int MPI_Gather(void* sendbuf,
int sendcount,
MPI_Datatype sendtype,
void* recvbuf,
int recvcount,
MPI_Datatype recvtype,
int root,
MPI_Comm comm)
CS 491 – Parallel and Distributed Computing (^) Docsity.com^16
int MPI_Scatterv(void* sendbuf,
int *sendcounts,
int *displs,
MPI_Datatype sendtype,
void* recvbuf,
int recvcount,
MPI_Datatype recvtype,
int root, MPI_Comm comm)
CS 491 – Parallel and Distributed Computing (^) Docsity.com^17