X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ab6013dda2f80b21aff83d529738b048e508828f..29af76860c8d693917872c2a0ed3d2a4c7a0388f:/examples/smpi/sendrecv.c?ds=sidebyside diff --git a/examples/smpi/sendrecv.c b/examples/smpi/sendrecv.c index 7b11ce0bac..3f3aeeef27 100644 --- a/examples/smpi/sendrecv.c +++ b/examples/smpi/sendrecv.c @@ -1,26 +1,62 @@ #include "mpi.h" #include - -int main(int argc, char *argv[]) -{ -#define TAG_RCV 998 + +static int test(int myid, int numprocs) { +// The tags should match on the sender and receiver side. +// The distinction between sendtag and recvtag is mainly +// useful to make some other Recv or Send calls match the sendrecv. +#define TAG_RCV 999 #define TAG_SND 999 - int myid, numprocs, left, right; - int buffer[10], buffer2[10]; - MPI_Request request; + + +#define BUFLEN 10 + int left, right; + int buffer[BUFLEN], buffer2[BUFLEN]; + int i; MPI_Status status; - - MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD, &numprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &myid); - + + for (i=0;i