From: Augustin Degomme Date: Tue, 30 Oct 2012 11:14:53 +0000 (+0100) Subject: modifiy alltoall test to cover all 3 algorithms currently implemented in smpi X-Git-Tag: v3_9_rc1~91^2~143 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/486587c19e54ae326e99404dbfb5b27d12679c54 modifiy alltoall test to cover all 3 algorithms currently implemented in smpi --- diff --git a/teshsuite/smpi/mpich-test/coll/coll13.c b/teshsuite/smpi/mpich-test/coll/coll13.c index 2bbb4e39c1..28e656df93 100644 --- a/teshsuite/smpi/mpich-test/coll/coll13.c +++ b/teshsuite/smpi/mpich-test/coll/coll13.c @@ -19,11 +19,11 @@ int main( int argc, char *argv[] ) { int rank, size; int chunk = 4096; - int i; + int i,j; 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); @@ -41,44 +41,74 @@ int main( int argc, char *argv[] ) 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 */ - 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); */ + if (rank == 0 && gstatus != 0) endstatus ++; + + free(sb); + free(rb); + } + 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); diff --git a/teshsuite/smpi/mpich-test/coll/coll13.std b/teshsuite/smpi/mpich-test/coll/coll13.std new file mode 100644 index 0000000000..2d4993a20e --- /dev/null +++ b/teshsuite/smpi/mpich-test/coll/coll13.std @@ -0,0 +1,2 @@ +You requested to use 14 processes, but there is only 5 processes in your hostfile... + No Errors diff --git a/teshsuite/smpi/mpich-test/coll/runtests b/teshsuite/smpi/mpich-test/coll/runtests index 65c4908f02..9cb6cf8fa1 100755 --- a/teshsuite/smpi/mpich-test/coll/runtests +++ b/teshsuite/smpi/mpich-test/coll/runtests @@ -116,7 +116,7 @@ RunTest coll11 4 RunTest coll12 4 # coll13 is very picky about arguments -RunTest coll13 4 +RunTest coll13 14 RunTest longuser 4