Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add mpich3 test suite, to replace older one.
[simgrid.git] / teshsuite / smpi / mpich-test / pt2pt / isendtest.c
1 /*
2    MPICH 1.0.8 on Intel Paragons is alleged to have failed this test.
3    (Original code from 
4     From: weber@zam212.zam.kfa-juelich.de (M.Weber)
5     Reply-To: M.Weber@kfa-juelich.de
6    modified slightly to meet our test rules.)
7  */
8 #include <stdio.h>
9 #include "mpi.h"
10 #define SIZE 100
11 /* SIZE 16 worked on Paragon */
12
13 #if defined(NEEDS_STDLIB_PROTOTYPES)
14 #include "protofix.h"
15 #endif
16
17 int main( int argc, char *argv[])
18 {
19   int num_procs,my_id,flag;
20   int buf[SIZE][SIZE];
21   MPI_Status status;
22   MPI_Request handle;
23
24   MPI_Init(&argc,&argv);
25   MPI_Comm_size(MPI_COMM_WORLD,&num_procs);
26   MPI_Comm_rank(MPI_COMM_WORLD,&my_id);
27   
28   if ( my_id == 1 ) {
29      MPI_Isend (buf, SIZE*SIZE, MPI_INT, 0, 0, MPI_COMM_WORLD, &handle );
30
31      flag = 0;
32      while (flag == 0) {
33         MPI_Test (&handle, &flag, &status);
34         printf("%d Wait for completition flag = %d handle = %ld ....\n",
35                my_id, flag, (long) handle);
36      }
37   }
38   else if (my_id == 0 ) {
39      MPI_Recv (buf, SIZE*SIZE, MPI_INT, 1, 0, MPI_COMM_WORLD, &status );
40   }
41
42   printf("%d Done ....\n",my_id);
43
44   MPI_Finalize();
45   return 0;
46 }
47
48