X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c81c99a491282f76757c2673961e3cdee6853539..2bb3a0d042a8a1deb91c18dba0cbdf42237413d4:/teshsuite/smpi/mpich3-test/pt2pt/sendself.c diff --git a/teshsuite/smpi/mpich3-test/pt2pt/sendself.c b/teshsuite/smpi/mpich3-test/pt2pt/sendself.c index 528627207b..5803f9ca4c 100644 --- a/teshsuite/smpi/mpich3-test/pt2pt/sendself.c +++ b/teshsuite/smpi/mpich3-test/pt2pt/sendself.c @@ -12,130 +12,121 @@ static char MTEST_Descrip[] = "Test of sending to self (with a preposted receive)"; */ -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { int errs = 0, err; int rank, size; int count; - MPI_Comm comm; - MPI_Request req; + MPI_Comm comm; + MPI_Request req; MTestDatatype sendtype, recvtype; - MTest_Init( &argc, &argv ); + MTest_Init(&argc, &argv); comm = MPI_COMM_WORLD; - MPI_Comm_rank( comm, &rank ); - MPI_Comm_size( comm, &size ); + MPI_Comm_rank(comm, &rank); + MPI_Comm_size(comm, &size); /* To improve reporting of problems about operations, we - change the error handler to errors return */ - MPI_Comm_set_errhandler( comm, MPI_ERRORS_RETURN ); - - for (count = 1; count < 65000; count = count * 2) { - while (MTestGetDatatypes( &sendtype, &recvtype, count )) { - - sendtype.InitBuf( &sendtype ); - recvtype.InitBuf( &recvtype ); - - err = MPI_Irecv( recvtype.buf, recvtype.count, - recvtype.datatype, rank, 0, comm, &req ); - if (err) { - errs++; - if (errs < 10) { - MTestPrintError( err ); - } - } - - err = MPI_Send( sendtype.buf, sendtype.count, - sendtype.datatype, rank, 0, comm); - if (err) { - errs++; - if (errs < 10) { - MTestPrintError( err ); - } - } - err = MPI_Wait( &req, MPI_STATUS_IGNORE ); - err = MTestCheckRecv( 0, &recvtype ); - if (err) { - if (errs < 10) { - printf( "Data in target buffer did not match for destination datatype %s and source datatype %s, count = %d\n", - MTestGetDatatypeName( &recvtype ), - MTestGetDatatypeName( &sendtype ), - count ); - recvtype.printErrors = 1; - (void)MTestCheckRecv( 0, &recvtype ); - } - errs += err; - } + * change the error handler to errors return */ + MPI_Comm_set_errhandler(comm, MPI_ERRORS_RETURN); - err = MPI_Irecv( recvtype.buf, recvtype.count, - recvtype.datatype, rank, 0, comm, &req ); - if (err) { - errs++; - if (errs < 10) { - MTestPrintError( err ); - } - } - - err = MPI_Ssend( sendtype.buf, sendtype.count, - sendtype.datatype, rank, 0, comm); - if (err) { - errs++; - if (errs < 10) { - MTestPrintError( err ); - } - } - err = MPI_Wait( &req, MPI_STATUS_IGNORE ); - err = MTestCheckRecv( 0, &recvtype ); - if (err) { - if (errs < 10) { - printf( "Data in target buffer did not match for destination datatype %s and source datatype %s, count = %d\n", - MTestGetDatatypeName( &recvtype ), - MTestGetDatatypeName( &sendtype ), - count ); - recvtype.printErrors = 1; - (void)MTestCheckRecv( 0, &recvtype ); - } - errs += err; - } + MTEST_DATATYPE_FOR_EACH_COUNT(count) { + while (MTestGetDatatypes(&sendtype, &recvtype, count)) { - err = MPI_Irecv( recvtype.buf, recvtype.count, - recvtype.datatype, rank, 0, comm, &req ); - if (err) { - errs++; - if (errs < 10) { - MTestPrintError( err ); - } - } - - err = MPI_Rsend( sendtype.buf, sendtype.count, - sendtype.datatype, rank, 0, comm); - if (err) { - errs++; - if (errs < 10) { - MTestPrintError( err ); - } - } - err = MPI_Wait( &req, MPI_STATUS_IGNORE ); - err = MTestCheckRecv( 0, &recvtype ); - if (err) { - if (errs < 10) { - printf( "Data in target buffer did not match for destination datatype %s and source datatype %s, count = %d\n", - MTestGetDatatypeName( &recvtype ), - MTestGetDatatypeName( &sendtype ), - count ); - recvtype.printErrors = 1; - (void)MTestCheckRecv( 0, &recvtype ); - } - errs += err; - } + sendtype.InitBuf(&sendtype); + recvtype.InitBuf(&recvtype); - MTestFreeDatatype( &sendtype ); - MTestFreeDatatype( &recvtype ); - } + err = MPI_Irecv(recvtype.buf, recvtype.count, recvtype.datatype, rank, 0, comm, &req); + if (err) { + errs++; + if (errs < 10) { + MTestPrintError(err); + } + } + + err = MPI_Send(sendtype.buf, sendtype.count, sendtype.datatype, rank, 0, comm); + if (err) { + errs++; + if (errs < 10) { + MTestPrintError(err); + } + } + err = MPI_Wait(&req, MPI_STATUS_IGNORE); + err = MTestCheckRecv(0, &recvtype); + if (err) { + if (errs < 10) { + printf + ("Data in target buffer did not match for destination datatype %s and source datatype %s, count = %d\n", + MTestGetDatatypeName(&recvtype), MTestGetDatatypeName(&sendtype), count); + recvtype.printErrors = 1; + (void) MTestCheckRecv(0, &recvtype); + } + errs += err; + } + + err = MPI_Irecv(recvtype.buf, recvtype.count, recvtype.datatype, rank, 0, comm, &req); + if (err) { + errs++; + if (errs < 10) { + MTestPrintError(err); + } + } + + err = MPI_Ssend(sendtype.buf, sendtype.count, sendtype.datatype, rank, 0, comm); + if (err) { + errs++; + if (errs < 10) { + MTestPrintError(err); + } + } + err = MPI_Wait(&req, MPI_STATUS_IGNORE); + err = MTestCheckRecv(0, &recvtype); + if (err) { + if (errs < 10) { + printf + ("Data in target buffer did not match for destination datatype %s and source datatype %s, count = %d\n", + MTestGetDatatypeName(&recvtype), MTestGetDatatypeName(&sendtype), count); + recvtype.printErrors = 1; + (void) MTestCheckRecv(0, &recvtype); + } + errs += err; + } + + err = MPI_Irecv(recvtype.buf, recvtype.count, recvtype.datatype, rank, 0, comm, &req); + if (err) { + errs++; + if (errs < 10) { + MTestPrintError(err); + } + } + + err = MPI_Rsend(sendtype.buf, sendtype.count, sendtype.datatype, rank, 0, comm); + if (err) { + errs++; + if (errs < 10) { + MTestPrintError(err); + } + } + err = MPI_Wait(&req, MPI_STATUS_IGNORE); + err = MTestCheckRecv(0, &recvtype); + if (err) { + if (errs < 10) { + printf + ("Data in target buffer did not match for destination datatype %s and source datatype %s, count = %d\n", + MTestGetDatatypeName(&recvtype), MTestGetDatatypeName(&sendtype), count); + recvtype.printErrors = 1; + (void) MTestCheckRecv(0, &recvtype); + } + errs += err; + } + + MTestFreeDatatype(&sendtype); + MTestFreeDatatype(&recvtype); + } } - MTest_Finalize( errs ); + MTest_Finalize(errs); MPI_Finalize(); return 0; }