#include #include #include #include int main(int argc, char *argv[]) { int rank, nodes; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank); MPI_Comm_size(MPI_COMM_WORLD,&nodes); printf("I'm %d/%d %d\n", rank, nodes, getpid()); int ret; MPI_Status status; MPI_Request req1, req2; char c = 0; if (rank == 0) { MPI_Isend(&c, 1, MPI_CHAR, 1, 0, MPI_COMM_WORLD, &req1); MPI_Isend(&c, 1, MPI_CHAR, 2, 0, MPI_COMM_WORLD, &req2); MPI_Wait(&req1, &status); MPI_Wait(&req2, &status); } else { MPI_Recv(&c, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD, &status); } MPI_Finalize(); return 0; }