Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'v3_8_x'
[simgrid.git] / teshsuite / smpi / mpich-test / pt2pt / ssendtest2.c
1 /*
2  * Test from oertel@ZIB-Berlin.DE 
3  */
4
5 /*
6  * Test of MPI_Ssend on MPI implementation on Cray T3D
7  *
8  * Process dest should receive numbers 1,...,10 but
9  * receives 274878030344 instead !!!
10  *
11  * Test program works correctly with MPI_Ssend replaced by MPI_Send!
12  *
13  *
14  * Compiler options: /mpp/bin/cc -Tcray-t3d -g -X2 -I"directory of mpi.h"
15  *
16  * Output of run with option -mpiversion:
17
18 ssendt3d -mpiversion
19 MPI model implementation 1.00.11., T3D Device Driver, Version 0.0
20 MPI model implementation 1.00.11., T3D Device Driver, Version 0.0
21 Configured with -arch=cray_t3d -device=t3d -opt=-g -ar_nolocal -make=gmake
22 Configured with -arch=cray_t3d -device=t3d -opt=-g -ar_nolocal -make=gmake
23 Received 274878008072
24 Received 274878008072
25 Received 274878008072
26 Received 274878008072
27 Received 274878008072
28 Received 274878008072
29 Received 274878008072
30 Received 274878008072
31 Received 274878008072
32 Received 274878008072
33
34  */
35
36 #include <stdio.h>
37 #include "mpi.h"
38
39
40 #if defined(NEEDS_STDLIB_PROTOTYPES)
41 #include "protofix.h"
42 #endif
43
44 #define SIZE 10
45
46 static int src  = 0;
47 static int dest = 1;
48
49 int main( int argc, char **argv )
50 {
51     int rank; /* My Rank (0 or 1) */
52     int i, ivalue;
53     MPI_Status Stat;
54
55     MPI_Init(&argc, &argv);
56     MPI_Comm_rank( MPI_COMM_WORLD, &rank);
57
58     if (rank == src) {
59
60         for (i=1; i<=SIZE; i++)
61         {
62             MPI_Ssend( &i, 1, MPI_INT, dest, 2000, MPI_COMM_WORLD);
63         }
64
65     } else if (rank == dest) {
66  
67         for (i=1; i<=SIZE; i++)
68         {
69             MPI_Recv( &ivalue, 1, MPI_INT, src, 2000, MPI_COMM_WORLD, &Stat);
70             printf("Received %d\n", ivalue); fflush(stdout);
71         }
72     }
73  
74     MPI_Barrier( MPI_COMM_WORLD);
75     MPI_Finalize();
76  
77     return 0;
78 }