Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
must-example.c 531 B
#include <mpi.h>
#include <stdio.h>
int main (int argc, char** argv)
{
int rank, size, buf[8];
MPI_Init(&argc,&argv);
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
MPI_Comm_size (MPI_COMM_WORLD, &size);
MPI_Datatype type;
MPI_Type_contiguous(2, MPI_INTEGER, &type);
MPI_Recv(buf, 2, MPI_INT, size-rank-1, 123, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
MPI_Send(buf, 2, type, size-rank-1, 123, MPI_COMM_WORLD);
printf ("Hello, I am rank %d of %d.\n", rank, size);
MPI_Finalize ();
return 0;
}