Created
October 19, 2014 14:43
-
-
Save calorie/102710b69f659a7577f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mpi.h" | |
#include <stdio.h> | |
int | |
sync() | |
{ | |
int rank, val = 0; | |
MPI_Request request; | |
MPI_Status status; | |
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | |
if (rank == 1) { | |
MPI_Recv(&val, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &status); | |
} | |
if (rank == 0) { | |
val = 1; | |
MPI_Send(&val, 1, MPI_INT, 1, 0, MPI_COMM_WORLD); | |
} | |
return val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment