Commit ab56a7ce authored by Panagiotis's avatar Panagiotis
Browse files

One more mpi example

parent a1f6d94a
#include <mpi.h>
int main(int argc, char *argv[])
{
int rank;
MPI_Status status;
MPI_Init(&argc, &argv); // initialize the environment
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
int x = 33;
MPI_Send(&x, 1, MPI_INT, 1, 123, MPI_COMM_WORLD);
}
if (rank == 1) {
int y;
MPI_Recv(&y, 1, MPI_INT, 0, 123, MPI_COMM_WORLD, &status);
}
MPI_Finalize();
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment