X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ab6013dda2f80b21aff83d529738b048e508828f..230fa34f4a17a2db4f026deb39fb3fcdae178876:/examples/smpi/sendrecv.c diff --git a/examples/smpi/sendrecv.c b/examples/smpi/sendrecv.c index 7b11ce0bac..cb97aa43a6 100644 --- a/examples/smpi/sendrecv.c +++ b/examples/smpi/sendrecv.c @@ -1,26 +1,68 @@ +/* Copyright (c) 2009, 2010. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + #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