Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
modifiy alltoall test to cover all 3 algorithms currently implemented in smpi
authorAugustin Degomme <degomme@idpann.imag.fr>
Tue, 30 Oct 2012 11:14:53 +0000 (12:14 +0100)
committerAugustin Degomme <degomme@idpann.imag.fr>
Tue, 30 Oct 2012 14:42:07 +0000 (15:42 +0100)
teshsuite/smpi/mpich-test/coll/coll13.c
teshsuite/smpi/mpich-test/coll/coll13.std [new file with mode: 0644]
teshsuite/smpi/mpich-test/coll/runtests

index 2bbb4e3..28e656d 100644 (file)
@@ -19,11 +19,11 @@ int main( int argc, char *argv[] )
 {
     int rank, size;
     int chunk = 4096;
 {
     int rank, size;
     int chunk = 4096;
-    int i;
+    int i,j;
     int *sb;
     int *rb;
     int *sb;
     int *rb;
-    int status, gstatus;
-
+    int status, gstatus, endstatus;
+    endstatus=0;
     MPI_Init(&argc,&argv);
     MPI_Comm_rank(MPI_COMM_WORLD,&rank);
     MPI_Comm_size(MPI_COMM_WORLD,&size);
     MPI_Init(&argc,&argv);
     MPI_Comm_rank(MPI_COMM_WORLD,&rank);
     MPI_Comm_size(MPI_COMM_WORLD,&size);
@@ -41,44 +41,74 @@ int main( int argc, char *argv[] )
            MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
        }
     }
            MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
        }
     }
-
-    sb = (int *)malloc(size*chunk*sizeof(int));
-    if ( !sb ) {
-       perror( "can't allocate send buffer" );
-       MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
-    }
-    rb = (int *)malloc(size*chunk*sizeof(int));
-    if ( !rb ) {
-       perror( "can't allocate recv buffer");
-       free(sb);
-       MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
+     
+    
+    /*
+    SMPI addition : we want to test all three alltoall algorithms, thus we use three diffrent sizes
+    this is the code that handles these cases
+    if (sendsize < 200 && size > 12) {
+      retval =
+          smpi_coll_tuned_alltoall_bruck(sendbuf, sendcount, sendtype,
+                                         recvbuf, recvcount, recvtype,
+                                         comm);
+    } else if (sendsize < 3000) {
+      retval =
+          smpi_coll_tuned_alltoall_basic_linear(sendbuf, sendcount,
+                                                sendtype, recvbuf,
+                                                recvcount, recvtype, comm);
+    } else {
+      retval =
+          smpi_coll_tuned_alltoall_pairwise(sendbuf, sendcount, sendtype,
+                                            recvbuf, recvcount, recvtype,
+                                            comm);
     }
     }
-    for ( i=0 ; i < size*chunk ; ++i ) {
-       sb[i] = rank + 1;
-       rb[i] = 0;
-    }
-
-    /* fputs("Before MPI_Alltoall\n",stdout); */
+    
+    
+    */
+    
+    
+    int sizes [3] ={ 4096, 64, 32};
+    for ( j=0 ; j < 3 ; j++ ) {
+      sb = (int *)malloc(size*sizes[j]*sizeof(int));
+      if ( !sb ) {
+        perror( "can't allocate send buffer" );
+        MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
+      }
+      rb = (int *)malloc(size*sizes[j]*sizeof(int));
+      if ( !rb ) {
+        perror( "can't allocate recv buffer");
+        free(sb);
+        MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
+      }
+      for ( i=0 ; i < size*sizes[j] ; ++i ) {
+        sb[i] = rank + 1;
+        rb[i] = 0;
+      }
 
 
-    /* This should really send MPI_CHAR, but since sb and rb were allocated
+      /* fputs("Before MPI_Alltoall\n",stdout); */
+      MPI_Barrier(MPI_COMM_WORLD );
+      /* This should really send MPI_CHAR, but since sb and rb were allocated
        as chunk*size*sizeof(int), the buffers are large enough */
        as chunk*size*sizeof(int), the buffers are large enough */
-    status = MPI_Alltoall(sb,chunk,MPI_INT,rb,chunk,MPI_INT,
-                         MPI_COMM_WORLD);
+      status = MPI_Alltoall(sb,sizes[j],MPI_INT,rb,sizes[j],MPI_INT,
+                            MPI_COMM_WORLD);
 
 
-    /* fputs("Before MPI_Allreduce\n",stdout); */
-    MPI_Allreduce( &status, &gstatus, 1, MPI_INT, MPI_SUM, 
-                  MPI_COMM_WORLD );
+      /* fputs("Before MPI_Allreduce\n",stdout); */
+      MPI_Allreduce( &status, &gstatus, 1, MPI_INT, MPI_SUM, 
+                    MPI_COMM_WORLD );
 
 
+      MPI_Barrier(MPI_COMM_WORLD );
     /* fputs("After MPI_Allreduce\n",stdout); */
     /* fputs("After MPI_Allreduce\n",stdout); */
+      if (rank == 0 && gstatus != 0) endstatus ++;
+
+      free(sb);
+      free(rb);
+    }
+    
     if (rank == 0) {
     if (rank == 0) {
-       if (gstatus == 0) printf( " No Errors\n" );
-       else 
-           printf("all_to_all returned %d\n",gstatus);
+      if (endstatus == 0) printf( " No Errors\n" );
+      else 
+        printf("all_to_all returned %d erros\n",endstatus);
     }
     }
-
-    free(sb);
-    free(rb);
-
     MPI_Finalize();
 
     return(EXIT_SUCCESS);
     MPI_Finalize();
 
     return(EXIT_SUCCESS);
diff --git a/teshsuite/smpi/mpich-test/coll/coll13.std b/teshsuite/smpi/mpich-test/coll/coll13.std
new file mode 100644 (file)
index 0000000..2d4993a
--- /dev/null
@@ -0,0 +1,2 @@
+You requested to use 14 processes, but there is only 5 processes in your hostfile...
+ No Errors
index 65c4908..9cb6cf8 100755 (executable)
@@ -116,7 +116,7 @@ RunTest coll11 4
 RunTest coll12 4
 
 # coll13 is very picky about arguments
 RunTest coll12 4
 
 # coll13 is very picky about arguments
-RunTest coll13 4
+RunTest coll13 14
 
 RunTest longuser 4
 
 
 RunTest longuser 4