2 * Program to test that the "synchronous send" semantics
3 * of point to point communications in MPI is (probably) satisfied.
4 * This is done by starting two synchronous sends and then testing that
5 * they do not complete until the matchine receives are issued.
13 /* Amount of time in seconds to wait for the receipt of the second Ssend
19 /* Prototypes for picky compilers */
20 void Generate_Data ( int *, int );
22 void Generate_Data(buffer, buff_size)
28 for (i = 0; i < buff_size; i++)
32 int main( int argc, char **argv )
34 int rank; /* My Rank (0 or 1) */
39 char *Current_Test = NULL;
43 MPI_Init(&argc, &argv);
44 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
47 Test_Init("issendinit", rank);
48 Generate_Data(buffer, SIZE);
49 Current_Test = (char*)"Ssend_init waits for recv";
50 MPI_Recv( buffer, 0, MPI_INT, dest, 0, MPI_COMM_WORLD, &status );
51 MPI_Send( buffer, 0, MPI_INT, dest, 0, MPI_COMM_WORLD );
52 MPI_Ssend_init( buffer, act_size, MPI_INT, dest, 1, MPI_COMM_WORLD,
54 MPI_Ssend_init( buffer, act_size, MPI_INT, dest, 2, MPI_COMM_WORLD,
59 while (MPI_Wtime() - t0 < MAX_TIME) {
60 MPI_Test( &r[0], &flag, &status );
62 Test_Failed(Current_Test);
67 Test_Passed(Current_Test);
68 MPI_Wait( &r[1], &status );
69 MPI_Sendrecv( MPI_BOTTOM, 0, MPI_INT, dest, 13,
70 MPI_BOTTOM, 0, MPI_INT, dest, 13,
71 MPI_COMM_WORLD, &status );
72 MPI_Wait( &r[0], &status );
73 MPI_Request_free( &r[0] );
74 MPI_Request_free( &r[1] );
77 int rval = Summarize_Test_Results(); /* Returns number of tests;
84 } else if (rank == dest) {
85 MPI_Send( buffer, 0, MPI_INT, src, 0, MPI_COMM_WORLD );
86 MPI_Recv( buffer, 0, MPI_INT, src, 0, MPI_COMM_WORLD, &status );
87 MPI_Recv( buffer, act_size, MPI_INT, src, 2, MPI_COMM_WORLD, &status );
88 MPI_Sendrecv( MPI_BOTTOM, 0, MPI_INT, src, 13,
89 MPI_BOTTOM, 0, MPI_INT, src, 13,
90 MPI_COMM_WORLD, &status );
91 MPI_Recv( buffer, act_size, MPI_INT, src, 1, MPI_COMM_WORLD, &status );
96 fprintf(stderr, "*** This program uses exactly 2 processes! ***\n");
97 MPI_Abort( MPI_COMM_WORLD, 1 );