X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cd9affe6152d6bbec19a72ea6fe26ab9407b51b7..fff5fbf696a8eaf8a7f230c4e15c763db690bcc3:/teshsuite/smpi/isp/umpire/irecv-deadlock.c diff --git a/teshsuite/smpi/isp/umpire/irecv-deadlock.c b/teshsuite/smpi/isp/umpire/irecv-deadlock.c new file mode 100644 index 0000000000..c1a16fe059 --- /dev/null +++ b/teshsuite/smpi/isp/umpire/irecv-deadlock.c @@ -0,0 +1,52 @@ +/* -*- Mode: C; -*- */ +/* Creator: Bronis R. de Supinski (bronis@llnl.gov) Fri Mar 17 2000 */ +/* no-error.c -- do some MPI calls without any errors */ + +#include +#include "mpi.h" + +#define buf_size 128 + +int +main (int argc, char **argv) +{ + int nprocs = -1; + int rank = -1; + char processor_name[128]; + int namelen = 128; + int buf0[buf_size]; + int buf1[buf_size]; + MPI_Status status; + MPI_Request req; + + /* init */ + MPI_Init (&argc, &argv); + MPI_Comm_size (MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank (MPI_COMM_WORLD, &rank); + MPI_Get_processor_name (processor_name, &namelen); + printf ("(%d) is alive on %s\n", rank, processor_name); + fflush (stdout); + + MPI_Barrier (MPI_COMM_WORLD); + + if (nprocs < 2) + { + printf ("not enough tasks\n"); + } + else + { + int dest = (rank == nprocs - 1) ? (0) : (rank + 1); + int src = (rank == 0) ? (nprocs - 1) : (rank - 1); + memset (buf0, rank, buf_size); + MPI_Irecv (buf0, buf_size, MPI_INT, src, 0, MPI_COMM_WORLD, &req); + MPI_Wait(&req,&status); + MPI_Send (buf0, buf_size, MPI_INT, dest, 0, MPI_COMM_WORLD); + } + + MPI_Barrier (MPI_COMM_WORLD); + + MPI_Finalize (); + printf ("(%d) Finished normally\n", rank); +} + +/* EOF */