2 /* Creator: Jeffrey Vetter (j-vetter@llnl.gov) Mon Nov 1 1999 */
3 /* lost-request.c -- overwrite a request and essentially lose a synch point */
7 "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/lost-request-waitall.c,v 1.1.1.1 2000/08/23 17:28:26 vetter Exp $";
17 int mydelay () /* about 6 seconds */
21 for (i = 0; i < 3000000; i++)
23 val = getpid (); /* about 2.06 usecs on snow */
29 main (int argc, char **argv)
35 MPI_Comm comm = MPI_COMM_WORLD;
36 char processor_name[128];
40 MPI_Request req, req0, req1;
41 MPI_Status status, status0, status1;
43 MPI_Status astatus[10];
46 MPI_Init (&argc, &argv);
47 MPI_Comm_size (comm, &nprocs);
48 MPI_Comm_rank (comm, &rank);
49 MPI_Get_processor_name (processor_name, &namelen);
50 printf ("(%d) is alive on %s\n", rank, processor_name);
53 memset (buf0, 0, buf_size);
54 memset (buf1, 1, buf_size);
56 /* 0 sends 1 two messages, but the request gets overwritten */
60 MPI_Isend (buf0, buf_size, MPI_INT, 1, tag1, comm, &(areq[0]));
61 MPI_Isend (buf1, buf_size, MPI_INT, 1, tag2, comm, &(areq[1]));
62 /* do some work here */
64 MPI_Waitall (2, areq, astatus);
68 MPI_Irecv (buf0, buf_size, MPI_INT, 0, tag1, comm, &req);
69 MPI_Irecv (buf1, buf_size, MPI_INT, 0, tag2, comm, &req); /* overwrite req */
70 /* do some work here and get confused */
71 MPI_Wait (&req, &status);
80 printf ("(%d) Finished normally\n", rank);