int main(int argc, char *argv[]) { int errs = 0; int rank, size, source, dest; int minsize = 2, count; MPI_Comm comm; MTestDatatype sendtype, recvtype; MTest_Init(&argc, &argv); /* The following illustrates the use of the routines to * run through a selection of communicators and datatypes. * Use subsets of these for tests that do not involve combinations * of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral(&comm, minsize, 1)) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank(comm, &rank); MPI_Comm_size(comm, &size); source = 0; dest = size - 1; MTEST_DATATYPE_FOR_EACH_COUNT(count) { while (MTestGetDatatypes(&sendtype, &recvtype, count)) { errs += test(comm, rank, source, dest, &sendtype, &recvtype); MTestFreeDatatype(&sendtype); MTestFreeDatatype(&recvtype); } } MTestFreeComm(&comm); } /* Part #2: simple large size test - contiguous and noncontiguous */ if (sizeof(void *) > 4) { /* Only if > 32-bit architecture */ MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); source = 0; dest = size - 1; MTestGetDatatypes(&sendtype, &recvtype, LARGE_CNT_CONTIG); errs += test(MPI_COMM_WORLD, rank, source, dest, &sendtype, &recvtype); do { MTestFreeDatatype(&sendtype); MTestFreeDatatype(&recvtype); MTestGetDatatypes(&sendtype, &recvtype, LARGE_CNT_NONCONTIG); } while (strstr(MTestGetDatatypeName(&sendtype), "vector") == NULL); errs += test(MPI_COMM_WORLD, rank, source, dest, &sendtype, &recvtype); MTestFreeDatatype(&sendtype); MTestFreeDatatype(&recvtype); } MTest_Finalize(errs); MPI_Finalize(); return 0; }
int main( int argc, char *argv[] ) { int errs = 0, err; int rank, size, root; int minsize = 2, count; MPI_Comm comm; MTestDatatype sendtype, recvtype; MTest_Init( &argc, &argv ); /* The following illustrates the use of the routines to run through a selection of communicators and datatypes. Use subsets of these for tests that do not involve combinations of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ 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_Errhandler_set( comm, MPI_ERRORS_RETURN ); /* The max value of count must be very large to ensure that we reach the long message algorithms */ for (count = 1; count < 2800; count = count * 4) { while (MTestGetDatatypes( &sendtype, &recvtype, count )) { for (root=0; root<size; root++) { if (rank == root) { sendtype.InitBuf( &sendtype ); err = MPI_Bcast( sendtype.buf, sendtype.count, sendtype.datatype, root, comm ); if (err) { errs++; MTestPrintError( err ); } } else { recvtype.InitBuf( &recvtype ); err = MPI_Bcast( recvtype.buf, recvtype.count, recvtype.datatype, root, comm ); if (err) { errs++; fprintf( stderr, "Error with communicator %s and datatype %s\n", MTestGetIntracommName(), MTestGetDatatypeName( &recvtype ) ); MTestPrintError( err ); } err = MTestCheckRecv( 0, &recvtype ); if (err) { errs += errs; } } } MTestFreeDatatype( &recvtype ); MTestFreeDatatype( &sendtype ); } } MTestFreeComm( &comm ); } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
int main( int argc, char *argv[] ) { int errs = 0, err; int rank, size, source, dest; int minsize = 2, count; MPI_Comm comm; MPI_Win win; MPI_Aint extent; MPI_Group wingroup, neighbors; MTestDatatype sendtype, recvtype; MTest_Init( &argc, &argv ); /* The following illustrates the use of the routines to run through a selection of communicators and datatypes. Use subsets of these for tests that do not involve combinations of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank( comm, &rank ); MPI_Comm_size( comm, &size ); source = 0; dest = size - 1; for (count = 1; count < 65000; count = count * 2) { while (MTestGetDatatypes( &sendtype, &recvtype, count )) { /* Make sure that everyone has a recv buffer */ recvtype.InitBuf( &recvtype ); MPI_Type_extent( recvtype.datatype, &extent ); MPI_Win_create( recvtype.buf, recvtype.count * extent, (int)extent, MPI_INFO_NULL, comm, &win ); MPI_Win_get_group( win, &wingroup ); if (rank == source) { /* To improve reporting of problems about operations, we change the error handler to errors return */ MPI_Win_set_errhandler( win, MPI_ERRORS_RETURN ); sendtype.InitBuf( &sendtype ); /* Neighbor is dest only */ MPI_Group_incl( wingroup, 1, &dest, &neighbors ); err = MPI_Win_start( neighbors, 0, win ); if (err) { errs++; if (errs < 10) { MTestPrintError( err ); } } MPI_Group_free( &neighbors ); err = MPI_Put( sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, recvtype.count, recvtype.datatype, win ); if (err) { errs++; MTestPrintError( err ); } err = MPI_Win_complete( win ); if (err) { errs++; if (errs < 10) { MTestPrintError( err ); } } } else if (rank == dest) { MPI_Group_incl( wingroup, 1, &source, &neighbors ); MPI_Win_post( neighbors, 0, win ); MPI_Group_free( &neighbors ); MPI_Win_wait( win ); /* This should have the same effect, in terms of transfering data, as a send/recv pair */ err = MTestCheckRecv( 0, &recvtype ); if (err) { errs += errs; } } else { /* Nothing; the other processes need not call any MPI routines */ ; } MPI_Win_free( &win ); MTestFreeDatatype( &sendtype ); MTestFreeDatatype( &recvtype ); MPI_Group_free( &wingroup ); } } MTestFreeComm( &comm ); } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
int main( int argc, char **argv ) { int errs = 0, err; int rank, size, source, dest; int minsize = 2, count; MPI_Comm comm; MPI_Win win; MPI_Aint extent; MTestDatatype sendtype, recvtype; int onlyInt = 0; MTest_Init( &argc, &argv ); /* Check for a simple choice of communicator and datatypes */ if (getenv( "MTEST_SIMPLE" )) onlyInt = 1; while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank( comm, &rank ); MPI_Comm_size( comm, &size ); source = 0; dest = size - 1; for (count = 1; count < 65000; count = count * 2) { while (MTestGetDatatypes( &sendtype, &recvtype, count )) { MTestPrintfMsg( 1, "Putting count = %d of sendtype %s receive type %s\n", count, MTestGetDatatypeName( &sendtype ), MTestGetDatatypeName( &recvtype ) ); /* Make sure that everyone has a recv buffer */ recvtype.InitBuf( &recvtype ); MPI_Type_extent( recvtype.datatype, &extent ); MPI_Win_create( recvtype.buf, recvtype.count * extent, extent, MPI_INFO_NULL, comm, &win ); /* To improve reporting of problems about operations, we change the error handler to errors return */ MPI_Win_set_errhandler( win, MPI_ERRORS_RETURN ); /* At this point, we have all of the elements that we need to begin the multiple fence and put tests */ /* Fence 1 */ err = MPI_Win_fence( MPI_MODE_NOPRECEDE, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } /* Source puts */ if (rank == source) { sendtype.InitBuf( &sendtype ); err = MPI_Put( sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, recvtype.count, recvtype.datatype, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } } /* Fence 2 */ err = MPI_Win_fence( 0, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } /* dest checks data, then Dest puts */ if (rank == dest) { err = MTestCheckRecv( 0, &recvtype ); if (err) { if (errs++ < MAX_PERR) { PrintRecvedError( "fence 2", &sendtype, &recvtype ); } } sendtype.InitBuf( &sendtype ); err = MPI_Put( sendtype.buf, sendtype.count, sendtype.datatype, source, 0, recvtype.count, recvtype.datatype, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } } /* Fence 3 */ err = MPI_Win_fence( 0, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } /* src checks data, then Src and dest puts*/ if (rank == source) { err = MTestCheckRecv( 0, &recvtype ); if (err) { if (errs++ < MAX_PERR) { PrintRecvedError( "fence 3", &sendtype, &recvtype ); } } sendtype.InitBuf( &sendtype ); err = MPI_Put( sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, recvtype.count, recvtype.datatype, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } } if (rank == dest) { sendtype.InitBuf( &sendtype ); err = MPI_Put( sendtype.buf, sendtype.count, sendtype.datatype, source, 0, recvtype.count, recvtype.datatype, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } } /* Fence 4 */ err = MPI_Win_fence( MPI_MODE_NOSUCCEED, win ); if (err) { if (errs++ < MAX_PERR) MTestPrintError(err); } /* src and dest checks data */ if (rank == source) { err = MTestCheckRecv( 0, &recvtype ); if (err) { if (errs++ < MAX_PERR) { PrintRecvedError( "src fence4", &sendtype, &recvtype ); } } } if (rank == dest) { err = MTestCheckRecv( 0, &recvtype ); if (err) { if (errs++ < MAX_PERR) { PrintRecvedError( "dest fence4", &sendtype, &recvtype ); } } } MPI_Win_free( &win ); MTestFreeDatatype( &sendtype ); MTestFreeDatatype( &recvtype ); /* Only do one datatype in the simple case */ if (onlyInt) break; } /* Only do one count in the simple case */ if (onlyInt) break; } MTestFreeComm(&comm); /* Only do one communicator in the simple case */ if (onlyInt) break; } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
int main( int argc, char *argv[] ) { int errs = 0, err; int rank, size, root; int minsize = 2, count; MPI_Comm comm; MTestDatatype sendtype, recvtype; MTest_Init( &argc, &argv ); /* The following illustrates the use of the routines to run through a selection of communicators and datatypes. Use subsets of these for tests that do not involve combinations of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank( comm, &rank ); MPI_Comm_size( comm, &size ); count = 1; MTEST_DATATYPE_FOR_EACH_COUNT(count) { /* To shorten test time, only run the default version of datatype tests * for comm world and run the minimum version for other communicators. */ if (comm != MPI_COMM_WORLD) { MTestInitMinDatatypes(); } while (MTestGetDatatypes( &sendtype, &recvtype, count )) { for (root=0; root<size; root++) { if (rank == root) { sendtype.InitBuf( &sendtype ); err = MPI_Bcast( sendtype.buf, sendtype.count, sendtype.datatype, root, comm ); if (err) { errs++; MTestPrintError( err ); } } else { recvtype.InitBuf( &recvtype ); err = MPI_Bcast( recvtype.buf, recvtype.count, recvtype.datatype, root, comm ); if (err) { errs++; fprintf( stderr, "Error with communicator %s and datatype %s\n", MTestGetIntracommName(), MTestGetDatatypeName( &recvtype ) ); MTestPrintError( err ); } err = MTestCheckRecv( 0, &recvtype ); if (err) { errs += errs; } } } MTestFreeDatatype( &recvtype ); MTestFreeDatatype( &sendtype ); } } MTestFreeComm( &comm ); } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
int main( int argc, char *argv[] ) { int errs = 0, err; int rank, size, source, dest; int minsize = 2, count; MPI_Comm comm; MPI_Status status; MTestDatatype sendtype, recvtype; MTest_Init( &argc, &argv ); /* The following illustrates the use of the routines to run through a selection of communicators and datatypes. Use subsets of these for tests that do not involve combinations of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank( comm, &rank ); MPI_Comm_size( comm, &size ); source = 0; dest = size - 1; /* 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 )) { if (rank == source) { sendtype.InitBuf( &sendtype ); err = MPI_Send( sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, comm ); if (err) { errs++; MTestPrintError( err ); } MTestFreeDatatype( &sendtype ); } else if (rank == dest) { recvtype.InitBuf( &recvtype ); err = MPI_Recv( recvtype.buf, recvtype.count, recvtype.datatype, source, 0, comm, &status ); if (err) { errs++; fprintf( stderr, "Error with communicator %s and datatype %s\n", MTestGetIntracommName(), MTestGetDatatypeName( &recvtype ) ); MTestPrintError( err ); } err = MTestCheckRecv( &status, &recvtype ); if (err) { errs += errs; } MTestFreeDatatype( &recvtype ); } } } MTestFreeComm( &comm ); } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
int main( int argc, char *argv[] ) { int errs = 0, err; int rank, size, source, dest; int minsize = 2, count, nmsg, maxmsg; MPI_Comm comm; MTestDatatype sendtype, recvtype; MTest_Init( &argc, &argv ); /* The following illustrates the use of the routines to run through a selection of communicators and datatypes. Use subsets of these for tests that do not involve combinations of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank( comm, &rank ); MPI_Comm_size( comm, &size ); source = 0; dest = size - 1; /* 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 < MAX_COUNT; count = count * 2) { while (MTestGetDatatypes( &sendtype, &recvtype, count )) { int nbytes; MPI_Type_size( sendtype.datatype, &nbytes ); /* We may want to limit the total message size sent */ if (nbytes > MAX_MSG_SIZE) { /* We do not need to free, as we haven't initialized any of the buffers (?) */ continue; } maxmsg = MAX_COUNT - count; MTestPrintfMsg( 1, "Sending count = %d of sendtype %s of total size %d bytes\n", count, MTestGetDatatypeName( &sendtype ), nbytes*count ); /* Make sure that everyone has a recv buffer */ recvtype.InitBuf( &recvtype ); if (rank == source) { sendtype.InitBuf( &sendtype ); for (nmsg=1; nmsg<maxmsg; nmsg++) { err = MPI_Send( sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, comm); if (err) { errs++; if (errs < 10) { MTestPrintError( err ); } } } } else if (rank == dest) { for (nmsg=1; nmsg<maxmsg; nmsg++) { err = MPI_Recv( recvtype.buf, recvtype.count, recvtype.datatype, source, 0, comm, MPI_STATUS_IGNORE); if (err) { errs++; if (errs < 10) { MTestPrintError( err ); } } 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, message iteration %d of %d\n", MTestGetDatatypeName( &recvtype ), MTestGetDatatypeName( &sendtype ), count, nmsg, maxmsg ); recvtype.printErrors = 1; (void)MTestCheckRecv( 0, &recvtype ); } errs += err; } } } MTestFreeDatatype( &recvtype ); MTestFreeDatatype( &sendtype ); } } MTestFreeComm( &comm ); } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
int main( int argc, char *argv[] ) { int errs = 0, err; int rank, size, source, dest; int minsize = 2, count; MPI_Comm comm; MPI_Win win; MPI_Aint extent; MTestDatatype sendtype, recvtype; MTest_Init( &argc, &argv ); /* The following illustrates the use of the routines to run through a selection of communicators and datatypes. Use subsets of these for tests that do not involve combinations of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank( comm, &rank ); MPI_Comm_size( comm, &size ); source = 0; dest = size - 1; for (count = 1; count < 65000; count = count * 2) { while (MTestGetDatatypes( &sendtype, &recvtype, count )) { MTestPrintfMsg( 1, "Putting count = %d of sendtype %s receive type %s\n", count, MTestGetDatatypeName( &sendtype ), MTestGetDatatypeName( &recvtype ) ); /* Make sure that everyone has a recv buffer */ recvtype.InitBuf( &recvtype ); MPI_Type_extent( recvtype.datatype, &extent ); MPI_Win_create( recvtype.buf, recvtype.count * extent, extent, MPI_INFO_NULL, comm, &win ); MPI_Win_fence( 0, win ); if (rank == source) { /* To improve reporting of problems about operations, we change the error handler to errors return */ MPI_Win_set_errhandler( win, MPI_ERRORS_RETURN ); sendtype.InitBuf( &sendtype ); err = MPI_Put( sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, recvtype.count, recvtype.datatype, win ); if (err) { errs++; if (errs < 10) { MTestPrintError( err ); } } err = MPI_Win_fence( 0, win ); if (err) { errs++; if (errs < 10) { MTestPrintError( err ); } } } else if (rank == dest) { MPI_Win_fence( 0, win ); /* This should have the same effect, in terms of transfering data, as a send/recv pair */ err = MTestCheckRecv( 0, &recvtype ); if (err) { if (errs < 10) { printf( "Data in target buffer did not match for destination datatype %s (put with source datatype %s)\n", MTestGetDatatypeName( &recvtype ), MTestGetDatatypeName( &sendtype ) ); /* Redo the test, with the errors printed */ recvtype.printErrors = 1; (void)MTestCheckRecv( 0, &recvtype ); } errs += err; } } else { MPI_Win_fence( 0, win ); } MPI_Win_free( &win ); MTestFreeDatatype( &sendtype ); MTestFreeDatatype( &recvtype ); } } MTestFreeComm(&comm); } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
int main(int argc, char *argv[]) { int errs = 0, err; int rank, size, source, dest; int minsize = 2, count; MPI_Comm comm; MPI_Win win; MPI_Aint extent; MTestDatatype sendtype, recvtype; MTest_Init(&argc, &argv); /* The following illustrates the use of the routines to * run through a selection of communicators and datatypes. * Use subsets of these for tests that do not involve combinations * of communicators, datatypes, and counts of datatypes */ while (MTestGetIntracommGeneral(&comm, minsize, 1)) { if (comm == MPI_COMM_NULL) continue; /* Determine the sender and receiver */ MPI_Comm_rank(comm, &rank); MPI_Comm_size(comm, &size); source = 0; dest = size - 1; MTEST_DATATYPE_FOR_EACH_COUNT(count) { while (MTestGetDatatypes(&sendtype, &recvtype, count)) { /* Make sure that everyone has a recv buffer */ recvtype.InitBuf(&recvtype); MPI_Type_extent(recvtype.datatype, &extent); MPI_Win_create(recvtype.buf, recvtype.count * extent, (int) extent, MPI_INFO_NULL, comm, &win); MPI_Win_fence(0, win); if (rank == source) { sendtype.InitBuf(&sendtype); /* To improve reporting of problems about operations, we * change the error handler to errors return */ MPI_Win_set_errhandler(win, MPI_ERRORS_RETURN); /* MPI_REPLACE on accumulate is almost the same * as MPI_Put; the only difference is in the * handling of overlapping accumulate operations, * which are not tested here */ err = MPI_Accumulate(sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, recvtype.count, recvtype.datatype, MPI_REPLACE, win); if (err) { errs++; if (errs < 10) { printf("Accumulate types: send %s, recv %s\n", MTestGetDatatypeName(&sendtype), MTestGetDatatypeName(&recvtype)); MTestPrintError(err); } } err = MPI_Win_fence(0, win); if (err) { errs++; if (errs < 10) { MTestPrintError(err); } } } else if (rank == dest) { MPI_Win_fence(0, win); /* This should have the same effect, in terms of * transfering data, as a send/recv pair */ err = MTestCheckRecv(0, &recvtype); if (err) { errs += err; } } else { MPI_Win_fence(0, win); } MPI_Win_free(&win); MTestFreeDatatype(&sendtype); MTestFreeDatatype(&recvtype); } } MTestFreeComm(&comm); } MTest_Finalize(errs); MPI_Finalize(); return 0; }
int main(int argc, char *argv[]) { int errs = 0; int rank, size; int minsize = 2, count; MPI_Comm comm; MPI_Win win; MPI_Aint lb, extent; MTestDatatype sendtype, recvtype; MTest_Init(&argc, &argv); while (MTestGetIntracommGeneral(&comm, minsize, 1)) { if (comm == MPI_COMM_NULL) continue; MPI_Comm_rank(comm, &rank); MPI_Comm_size(comm, &size); int source = 0; MTEST_DATATYPE_FOR_EACH_COUNT(count) { while (MTestGetDatatypes(&sendtype, &recvtype, count)) { recvtype.printErrors = 1; recvtype.InitBuf(&recvtype); MPI_Type_get_extent(recvtype.datatype, &lb, &extent); MPI_Win_create(recvtype.buf, lb + recvtype.count * extent, (int) extent, MPI_INFO_NULL, comm, &win); if (rank == source) { int dest; sendtype.InitBuf(&sendtype); MPI_Win_lock_all(0, win); for (dest = 0; dest < size; dest++) if (dest != source) { MPI_Accumulate(sendtype.buf, sendtype.count, sendtype.datatype, dest, 0, recvtype.count, recvtype.datatype, MPI_REPLACE, win); } MPI_Win_unlock_all(win); MPI_Barrier(comm); char *resbuf = (char *) calloc(lb + extent * recvtype.count, sizeof(char)); /*wait for the destinations to finish checking and reinitializing the buffers */ MPI_Barrier(comm); MPI_Win_lock_all(0, win); for (dest = 0; dest < size; dest++) if (dest != source) { MPI_Get_accumulate(sendtype.buf, sendtype.count, sendtype.datatype, resbuf, recvtype.count, recvtype.datatype, dest, 0, recvtype.count, recvtype.datatype, MPI_REPLACE, win); } MPI_Win_unlock_all(win); MPI_Barrier(comm); free(resbuf); } else { int err; MPI_Barrier(comm); MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win); err = MTestCheckRecv(0, &recvtype); if (err) errs++; recvtype.InitBuf(&recvtype); MPI_Win_unlock(rank, win); /*signal the source that checking and reinitialization is done */ MPI_Barrier(comm); MPI_Barrier(comm); MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win); err = MTestCheckRecv(0, &recvtype); if (err) errs++; MPI_Win_unlock(rank, win); } MPI_Win_free(&win); MTestFreeDatatype(&sendtype); MTestFreeDatatype(&recvtype); } } MTestFreeComm(&comm); } MTest_Finalize(errs); MPI_Finalize(); return 0; }
int main(int argc, char *argv[]) { int errs = 0, err; int rank, size; int count; MPI_Comm comm; MPI_Request req; MTestDatatype sendtype, recvtype; MTest_Init(&argc, &argv); comm = MPI_COMM_WORLD; 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); MTEST_DATATYPE_FOR_EACH_COUNT(count) { 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; } 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); MPI_Finalize(); return 0; }