Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / teshsuite / smpi / mpich3-test / pt2pt / icsend.c
index ae196ef..9981846 100644 (file)
 static char MTEST_Descrip[] = "Simple test of intercommunicator send and receive";
 */
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     int leftGroup, buf, rank, remote_size, i;
     MPI_Comm comm;
     MPI_Status status;
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
-    while (MTestGetIntercomm( &comm, &leftGroup, 4 )) {
-        if (comm == MPI_COMM_NULL) continue;
+    while (MTestGetIntercomm(&comm, &leftGroup, 4)) {
+        if (comm == MPI_COMM_NULL)
+            continue;
 
-       if (leftGroup) {
-           MPI_Comm_rank( comm, &rank );
-           buf = rank;
-           MPI_Send( &buf, 1, MPI_INT, 0, 0, comm );
-       }
-       else {
-           MPI_Comm_remote_size( comm, &remote_size );
-           MPI_Comm_rank( comm, &rank );
-           if (rank == 0) {
-               for (i=0; i<remote_size; i++) {
-                   buf = -1;
-                   MPI_Recv( &buf, 1, MPI_INT, i, 0, comm, &status );
-                   if (buf != i) {
-                       errs++;
-                       fprintf( stderr, "buf = %d, should be %d\n", buf, i );
-                   }
-               }
-           }
-       }
-       /* Now, reverse it and send back */
-       if (!leftGroup) {
-           MPI_Comm_rank( comm, &rank );
-           buf = rank;
-           MPI_Send( &buf, 1, MPI_INT, 0, 0, comm );
-       }
-       else {
-           MPI_Comm_remote_size( comm, &remote_size );
-           MPI_Comm_rank( comm, &rank );
-           if (rank == 0) {
-               for (i=0; i<remote_size; i++) {
-                   buf = -1;
-                   MPI_Recv( &buf, 1, MPI_INT, i, 0, comm, &status );
-                   if (buf != i) {
-                       errs++;
-                       fprintf( stderr, "buf = %d, should be %d\n", buf, i );
-                   }
-               }
-           }
-       }
+        if (leftGroup) {
+            MPI_Comm_rank(comm, &rank);
+            buf = rank;
+            MPI_Send(&buf, 1, MPI_INT, 0, 0, comm);
+        }
+        else {
+            MPI_Comm_remote_size(comm, &remote_size);
+            MPI_Comm_rank(comm, &rank);
+            if (rank == 0) {
+                for (i = 0; i < remote_size; i++) {
+                    buf = -1;
+                    MPI_Recv(&buf, 1, MPI_INT, i, 0, comm, &status);
+                    if (buf != i) {
+                        errs++;
+                        fprintf(stderr, "buf = %d, should be %d\n", buf, i);
+                    }
+                }
+            }
+        }
+        /* Now, reverse it and send back */
+        if (!leftGroup) {
+            MPI_Comm_rank(comm, &rank);
+            buf = rank;
+            MPI_Send(&buf, 1, MPI_INT, 0, 0, comm);
+        }
+        else {
+            MPI_Comm_remote_size(comm, &remote_size);
+            MPI_Comm_rank(comm, &rank);
+            if (rank == 0) {
+                for (i = 0; i < remote_size; i++) {
+                    buf = -1;
+                    MPI_Recv(&buf, 1, MPI_INT, i, 0, comm, &status);
+                    if (buf != i) {
+                        errs++;
+                        fprintf(stderr, "buf = %d, should be %d\n", buf, i);
+                    }
+                }
+            }
+        }
         MTestFreeComm(&comm);
     }
 
-    MTest_Finalize( errs );
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
 }