Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
first commit to add the mpich-test suite to smpi tesh suite. Obviously all tests...
[simgrid.git] / teshsuite / smpi / mpich-test / env / init.c
1 #include "mpi.h"
2 #include <stdio.h>
3 #include "test.h"
4
5 int main( int argc, char **argv )
6 {
7     int        flag;
8     MPI_Status status;
9     int        size, rank, partner, i;
10
11     for (i=0; i<2; i++ ) {
12         MPI_Initialized(&flag);
13         if(flag == 0)
14             MPI_Init(&argc,&argv);
15     }
16
17     MPI_Comm_size( MPI_COMM_WORLD, &size );
18     if (size != 2) {
19         printf( "Test must be run with 2 processes\n" );
20         MPI_Abort( MPI_COMM_WORLD, 1 );
21     }
22     MPI_Comm_rank( MPI_COMM_WORLD, &rank );
23     partner = (rank + 1) % size;
24     MPI_Sendrecv( MPI_BOTTOM, 0, MPI_INT, partner, 0,
25                   MPI_BOTTOM, 0, MPI_INT, partner, 0, 
26                   MPI_COMM_WORLD, &status );
27     if (rank == 0) printf( " No Errors\n" );
28     MPI_Finalize();
29     return 0;
30 }