From 79402db9829440108ff06f587b21c86bf8b945db Mon Sep 17 00:00:00 2001 From: abn Date: Thu, 22 Oct 2015 15:22:14 +0200 Subject: [PATCH] MPIAccessDEC tests cleanup. --- src/ParaMEDMEM/MPIAccessDEC.cxx | 11 ++-- src/ParaMEDMEMTest/MPIAccessDECTest.hxx | 6 ++ .../ParaMEDMEMTest_InterpKernelDEC.cxx | 4 ++ src/ParaMEDMEMTest/test_AllToAllDEC.cxx | 18 +++--- src/ParaMEDMEMTest/test_AllToAllTimeDEC.cxx | 50 +++++++-------- src/ParaMEDMEMTest/test_AllToAllvDEC.cxx | 36 +++++------ src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx | 62 +++++++++---------- .../test_AllToAllvTimeDoubleDEC.cxx | 58 ++++++++--------- 8 files changed, 129 insertions(+), 116 deletions(-) diff --git a/src/ParaMEDMEM/MPIAccessDEC.cxx b/src/ParaMEDMEM/MPIAccessDEC.cxx index 942dc79d8..f8a0e1002 100644 --- a/src/ParaMEDMEM/MPIAccessDEC.cxx +++ b/src/ParaMEDMEM/MPIAccessDEC.cxx @@ -902,10 +902,13 @@ namespace ParaMEDMEM { if ( WithWait ) { - cout << "CheckSent" << _my_rank << " " << i << "./" << nSendRequest - << " SendRequestId " << ArrayOfSendRequests[i] << " MPITarget " - << _MPI_access->MPITarget(ArrayOfSendRequests[i]) << " MPITag " - << _MPI_access->MPITag(ArrayOfSendRequests[i]) << " Wait :" << endl ; + if (SendTrace) + { + cout << "CheckSent" << _my_rank << " " << i << "./" << nSendRequest + << " SendRequestId " << ArrayOfSendRequests[i] << " MPITarget " + << _MPI_access->MPITarget(ArrayOfSendRequests[i]) << " MPITag " + << _MPI_access->MPITag(ArrayOfSendRequests[i]) << " Wait :" << endl ; + } sts = _MPI_access->wait( ArrayOfSendRequests[i] ) ; } else diff --git a/src/ParaMEDMEMTest/MPIAccessDECTest.hxx b/src/ParaMEDMEMTest/MPIAccessDECTest.hxx index 80655b565..5afb6e5d7 100644 --- a/src/ParaMEDMEMTest/MPIAccessDECTest.hxx +++ b/src/ParaMEDMEMTest/MPIAccessDECTest.hxx @@ -27,6 +27,12 @@ #include #include "mpi.h" +// (ABN]: too many text output in the MPIAccesTest - this renders +// the analysis complicated: +#define MPI_ACCESS_VERBOSE 0 +#define debugStream \ + if (!MPI_ACCESS_VERBOSE) {} \ + else std::cout class MPIAccessDECTest : public CppUnit::TestFixture { diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index 2350a88c8..9ca93d3d6 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -1910,6 +1910,10 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() delete target_group; delete source_group; delete dec; + if(partialComm != MPI_COMM_NULL) + comm.commFree(&partialComm); + comm.groupFree(&grp); + comm.groupFree(&group_world); MPI_Barrier(MPI_COMM_WORLD); } diff --git a/src/ParaMEDMEMTest/test_AllToAllDEC.cxx b/src/ParaMEDMEMTest/test_AllToAllDEC.cxx index f5e702845..7b0825607 100644 --- a/src/ParaMEDMEMTest/test_AllToAllDEC.cxx +++ b/src/ParaMEDMEMTest/test_AllToAllDEC.cxx @@ -48,14 +48,14 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess mpi_access ) { int lenerr ; if ( sts != MPI_SUCCESS ) { mpi_access.errorString(sts, msgerr, &lenerr) ; - cout << "test" << myrank << " lenerr " << lenerr << " " + debugStream << "test" << myrank << " lenerr " << lenerr << " " << msgerr << endl ; ostringstream strstream ; strstream << "===========================================================" << endl << "test_AllToAllDEC" << myrank << " KO" << endl << "===========================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } return ; @@ -63,7 +63,7 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess mpi_access ) { void MPIAccessDECTest::test_AllToAllDEC( bool Asynchronous ) { - cout << "test_AllToAllDEC" << endl ; + debugStream << "test_AllToAllDEC" << endl ; // MPI_Init(&argc, &argv) ; @@ -79,11 +79,11 @@ void MPIAccessDECTest::test_AllToAllDEC( bool Asynchronous ) { << " (nbprocs >=2)" << endl << "test must be runned with more than 1 proc and less than 12 procs" << endl ; - cout << strstream.str() << endl ; + cerr << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } - cout << "test_AllToAllDEC" << myrank << endl ; + debugStream << "test_AllToAllDEC" << myrank << endl ; ParaMEDMEM::CommInterface interface ; std::set sourceprocs; @@ -133,7 +133,7 @@ void MPIAccessDECTest::test_AllToAllDEC( bool Asynchronous ) { } int nSendReq = mpi_access->sendRequestIdsSize() ; - cout << "test_AllToAllDEC" << myrank << " final SendRequestIds " << nSendReq << " SendRequests" + debugStream << "test_AllToAllDEC" << myrank << " final SendRequestIds " << nSendReq << " SendRequests" << endl ; if ( nSendReq ) { int *ArrayOfSendRequests = new int[nSendReq] ; @@ -147,11 +147,11 @@ void MPIAccessDECTest::test_AllToAllDEC( bool Asynchronous ) { ostringstream strstream ; strstream << "test_AllToAllDEC" << myrank << " final RecvRequestIds " << nRecvReq << " RecvRequests # 0 Error" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } else { - cout << "test_AllToAllDEC" << myrank << " final RecvRequestIds " << nRecvReq + debugStream << "test_AllToAllDEC" << myrank << " final RecvRequestIds " << nRecvReq << " RecvRequests = 0 OK" << endl ; } @@ -164,7 +164,7 @@ void MPIAccessDECTest::test_AllToAllDEC( bool Asynchronous ) { // MPI_Finalize(); - cout << "test_AllToAllDEC" << myrank << " OK" << endl ; + debugStream << "test_AllToAllDEC" << myrank << " OK" << endl ; return ; } diff --git a/src/ParaMEDMEMTest/test_AllToAllTimeDEC.cxx b/src/ParaMEDMEMTest/test_AllToAllTimeDEC.cxx index a46114e8c..2f50e66a0 100644 --- a/src/ParaMEDMEMTest/test_AllToAllTimeDEC.cxx +++ b/src/ParaMEDMEMTest/test_AllToAllTimeDEC.cxx @@ -53,14 +53,14 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) int lenerr ; if ( sts != MPI_SUCCESS ) { mpi_access->errorString(sts, msgerr, &lenerr) ; - cout << "test_AllToAllTimeDEC" << myrank << " lenerr " << lenerr << " " + debugStream << "test_AllToAllTimeDEC" << myrank << " lenerr " << lenerr << " " << msgerr << endl ; ostringstream strstream ; strstream << "===========================================================" << "test_AllToAllTimeDEC" << myrank << " KO" << "===========================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } return ; @@ -68,7 +68,7 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { - cout << "test_AllToAllTimeDEC" << endl ; + debugStream << "test_AllToAllTimeDEC" << endl ; // MPI_Init(&argc, &argv) ; @@ -84,13 +84,13 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { << " (nbprocs >=2)" << endl << "test must be runned with more than 1 proc and less than 12 procs" << endl ; - cout << strstream.str() << endl ; + cerr << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } // int Asynchronous = atoi(argv[1]); - cout << "test_AllToAllTimeDEC" << myrank << " Asynchronous " << Asynchronous << endl ; + debugStream << "test_AllToAllTimeDEC" << myrank << " Asynchronous " << Asynchronous << endl ; ParaMEDMEM::CommInterface interface ; std::set sourceprocs; @@ -113,9 +113,9 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { MyMPIAccessDEC->setTimeInterpolator( LinearTimeInterp ) ; MPIAccess * mpi_access = MyMPIAccessDEC->getMPIAccess() ; - cout << "test_AllToAllTimeDEC" << myrank << " Barrier :" << endl ; + debugStream << "test_AllToAllTimeDEC" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; - cout << "test_AllToAllTimeDEC" << myrank << " Barrier done" << endl ; + debugStream << "test_AllToAllTimeDEC" << myrank << " Barrier done" << endl ; #define maxproc 11 #define maxreq 10000 @@ -141,7 +141,7 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { // MyMPIAccessDEC->NextTime( nextdeltatime ) ; } MyMPIAccessDEC->setTime( time , nextdeltatime ) ; - cout << "test_AllToAllTimeDEC" << myrank << "=====TIME " << time << "=====DELTATIME " + debugStream << "test_AllToAllTimeDEC" << myrank << "=====TIME " << time << "=====DELTATIME " << nextdeltatime << "=====MAXTIME " << maxtime << " ======" << endl ; int * sendbuf = new int[datamsglength*size] ; // int * sendbuf = (int *) malloc(sizeof(int)*datamsglength*size) ; @@ -156,13 +156,13 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { recvbuf, recvcount , MPI_INT ) ; chksts( sts , myrank , mpi_access ) ; - // cout << "test_AllToAllTimeDEC" << myrank << " recvbuf before CheckSent" ; + // debugStream << "test_AllToAllTimeDEC" << myrank << " recvbuf before CheckSent" ; // for ( i = 0 ; i < datamsglength*size ; i++ ) { - // cout << " " << recvbuf[i] ; + // debugStream << " " << recvbuf[i] ; // } - // cout << endl ; + // debugStream << endl ; - // cout << "test_AllToAllTimeDEC" << myrank << " sendbuf " << sendbuf << endl ; + // debugStream << "test_AllToAllTimeDEC" << myrank << " sendbuf " << sendbuf << endl ; // MyMPIAccessDEC->CheckSent() ; int nRecvReq = mpi_access->recvRequestIdsSize() ; @@ -176,22 +176,22 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { int nReq = mpi_access->recvRequestIds( nRecvReq, ArrayOfRecvRequests ) ; mpi_access->waitAll( nReq , ArrayOfRecvRequests ) ; delete [] ArrayOfRecvRequests ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } - // cout << "test_AllToAllTimeDEC" << myrank << " recvbuf" << endl ; + // debugStream << "test_AllToAllTimeDEC" << myrank << " recvbuf" << endl ; bool badrecvbuf = false ; for ( i = 0 ; i < datamsglength*size ; i++ ) { if ( recvbuf[i] != (i/datamsglength)*1000000 + myrank*1000 + myrank*datamsglength+(i%datamsglength) ) { badrecvbuf = true ; - cout << "test_AllToAllTimeDEC" << myrank << " recvbuf[" << i << "] " + debugStream << "test_AllToAllTimeDEC" << myrank << " recvbuf[" << i << "] " << recvbuf[i] << " # " << (i/datamsglength)*1000000 + myrank*1000 + myrank*datamsglength+(i%datamsglength) << endl ; } else if ( badrecvbuf ) { - cout << "test_AllToAllTimeDEC" << myrank << " recvbuf[" << i << "] " + debugStream << "test_AllToAllTimeDEC" << myrank << " recvbuf[" << i << "] " << recvbuf[i] << " == " << (i/datamsglength)*1000000 + myrank*1000 + myrank*datamsglength+(i%datamsglength) << endl ; } @@ -202,13 +202,13 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { << "test_AllToAllTimeDEC" << myrank << " badrecvbuf" << endl << "=============================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } delete [] recvbuf ; } - cout << "test_AllToAllTimeDEC" << myrank << " final CheckSent" << endl ; + debugStream << "test_AllToAllTimeDEC" << myrank << " final CheckSent" << endl ; sts = MyMPIAccessDEC->checkSent() ; if ( sts != MPI_SUCCESS ) { ostringstream strstream ; @@ -216,12 +216,12 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { << "test_AllToAllTimeDEC" << myrank << " final CheckSent ERROR" << endl << "================================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } int nSendReq = mpi_access->sendRequestIdsSize() ; - cout << "test_AllToAllTimeDEC" << myrank << " final SendRequestIds " << nSendReq << " SendRequests" + debugStream << "test_AllToAllTimeDEC" << myrank << " final SendRequestIds " << nSendReq << " SendRequests" << endl ; if ( nSendReq ) { int *ArrayOfSendRequests = new int[nSendReq] ; @@ -238,17 +238,17 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { << " RecvRequests # 0 Error" << endl << "===============================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } else { - cout << "test_AllToAllTimeDEC" << myrank << " RecvRequestIds " << nRecvReq + debugStream << "test_AllToAllTimeDEC" << myrank << " RecvRequestIds " << nRecvReq << " RecvRequests = 0 OK" << endl ; } - cout << "test_AllToAllTimeDEC" << myrank << " Barrier :" << endl ; + debugStream << "test_AllToAllTimeDEC" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; - cout << "test_AllToAllTimeDEC" << myrank << " Barrier done" << endl ; + debugStream << "test_AllToAllTimeDEC" << myrank << " Barrier done" << endl ; delete sourcegroup ; delete targetgroup ; @@ -257,7 +257,7 @@ void MPIAccessDECTest::test_AllToAllTimeDEC( bool Asynchronous ) { // MPI_Finalize(); - cout << "test_AllToAllTimeDEC" << myrank << " OK" << endl ; + debugStream << "test_AllToAllTimeDEC" << myrank << " OK" << endl ; return ; } diff --git a/src/ParaMEDMEMTest/test_AllToAllvDEC.cxx b/src/ParaMEDMEMTest/test_AllToAllvDEC.cxx index f0ec8e292..490b40437 100644 --- a/src/ParaMEDMEMTest/test_AllToAllvDEC.cxx +++ b/src/ParaMEDMEMTest/test_AllToAllvDEC.cxx @@ -52,14 +52,14 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess mpi_access ) { int lenerr ; if ( sts != MPI_SUCCESS ) { mpi_access.errorString(sts, msgerr, &lenerr) ; - cout << "test_AllToAllvDEC" << myrank << " lenerr " << lenerr << " " + debugStream << "test_AllToAllvDEC" << myrank << " lenerr " << lenerr << " " << msgerr << endl ; ostringstream strstream ; strstream << "===========================================================" << "test_AllToAllvDEC" << myrank << " KO" << "===========================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } return ; @@ -67,7 +67,7 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess mpi_access ) { void MPIAccessDECTest::test_AllToAllvDEC( bool Asynchronous ) { - cout << "test_AllToAllvDEC" << endl ; + debugStream << "test_AllToAllvDEC" << endl ; // MPI_Init(&argc, &argv) ; @@ -83,13 +83,13 @@ void MPIAccessDECTest::test_AllToAllvDEC( bool Asynchronous ) { << " (nbprocs >=2)" << endl << "test must be runned with more than 1 proc and less than 12 procs" << endl ; - cout << strstream.str() << endl ; + cerr << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } // int Asynchronous = atoi(argv[1]); - cout << "test_AllToAllvDEC" << myrank << endl ; + debugStream << "test_AllToAllvDEC" << myrank << endl ; ParaMEDMEM::CommInterface interface ; std::set sourceprocs; @@ -139,35 +139,35 @@ void MPIAccessDECTest::test_AllToAllvDEC( bool Asynchronous ) { MyMPIAccessDEC->allToAllv( sendbuf, sendcounts , sdispls , MPI_INT , recvbuf, recvcounts , rdispls , MPI_INT ) ; - // cout << "test_AllToAllvDEC" << myrank << " recvbuf before CheckSent" ; + // debugStream << "test_AllToAllvDEC" << myrank << " recvbuf before CheckSent" ; // for ( i = 0 ; i < datamsglength*size ; i++ ) { - // cout << " " << recvbuf[i] ; + // debugStream << " " << recvbuf[i] ; // } - // cout << endl ; + // debugStream << endl ; - // cout << "test_AllToAllvDEC" << myrank << " sendbuf " << sendbuf << endl ; + // debugStream << "test_AllToAllvDEC" << myrank << " sendbuf " << sendbuf << endl ; // MyMPIAccessDEC->CheckSent() ; int nRecvReq = mpi_access->recvRequestIdsSize() ; - // cout << "test_AllToAllvDEC" << myrank << " WaitAllRecv " << nRecvReq << " Requests" << endl ; + // debugStream << "test_AllToAllvDEC" << myrank << " WaitAllRecv " << nRecvReq << " Requests" << endl ; int *ArrayOfRecvRequests = new int[nRecvReq] ; int nReq = mpi_access->recvRequestIds( nRecvReq, ArrayOfRecvRequests ) ; mpi_access->waitAll( nReq , ArrayOfRecvRequests ) ; mpi_access->deleteRequests( nReq , ArrayOfRecvRequests ) ; delete [] ArrayOfRecvRequests ; - // cout << "test_AllToAllvDEC" << myrank << " recvbuf" ; + // debugStream << "test_AllToAllvDEC" << myrank << " recvbuf" ; // for ( i = 0 ; i < datamsglength*size ; i++ ) { - // cout << " " << recvbuf[i] ; + // debugStream << " " << recvbuf[i] ; // } - // cout << endl ; + // debugStream << endl ; } - // cout << "test_AllToAllvDEC" << myrank << " final CheckSent" << endl ; + // debugStream << "test_AllToAllvDEC" << myrank << " final CheckSent" << endl ; // MyMPIAccessDEC->CheckSent() ; int nSendReq = mpi_access->sendRequestIdsSize() ; - cout << "test_AllToAllvDEC" << myrank << " final SendRequestIds " << nSendReq << " SendRequests" + debugStream << "test_AllToAllvDEC" << myrank << " final SendRequestIds " << nSendReq << " SendRequests" << endl ; if ( nSendReq ) { int *ArrayOfSendRequests = new int[nSendReq] ; @@ -181,11 +181,11 @@ void MPIAccessDECTest::test_AllToAllvDEC( bool Asynchronous ) { ostringstream strstream ; strstream << "test_AllToAllvDEC" << myrank << " final RecvRequestIds " << nRecvReq << " RecvRequests # 0 Error" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } else { - cout << "test_AllToAllvDEC" << myrank << " final RecvRequestIds " << nRecvReq + debugStream << "test_AllToAllvDEC" << myrank << " final RecvRequestIds " << nRecvReq << " RecvRequests = 0 OK" << endl ; } @@ -202,7 +202,7 @@ void MPIAccessDECTest::test_AllToAllvDEC( bool Asynchronous ) { // MPI_Finalize(); - cout << "test_AllToAllvDEC" << myrank << " OK" << endl ; + debugStream << "test_AllToAllvDEC" << myrank << " OK" << endl ; return ; } diff --git a/src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx b/src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx index 78d8d47c0..bd6f4b541 100644 --- a/src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx +++ b/src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx @@ -57,14 +57,14 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) int lenerr ; if ( sts != MPI_SUCCESS ) { mpi_access->errorString(sts, msgerr, &lenerr) ; - cout << "test_AllToAllvTimeDEC" << myrank << " lenerr " << lenerr << " " + debugStream << "test_AllToAllvTimeDEC" << myrank << " lenerr " << lenerr << " " << msgerr << endl ; ostringstream strstream ; strstream << "===========================================================" << "test_AllToAllvTimeDEC" << myrank << " KO" << "===========================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } return ; @@ -72,7 +72,7 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINative ) { - cout << "test_AllToAllvTimeDEC" << endl ; + debugStream << "test_AllToAllvTimeDEC" << endl ; // MPI_Init(&argc, &argv) ; @@ -88,7 +88,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat << " (nbprocs >=2)" << endl << "test must be runned with more than 1 proc and less than 12 procs" << endl ; - cout << strstream.str() << endl ; + cerr << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } @@ -98,7 +98,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat // UseMPI_Alltoallv = atoi(argv[2]) ; // } - cout << "test_AllToAllvTimeDEC" << myrank << " Asynchronous " << Asynchronous + debugStream << "test_AllToAllvTimeDEC" << myrank << " Asynchronous " << Asynchronous << " UseMPI_Alltoallv " << UseMPI_Alltoallv << endl ; ParaMEDMEM::CommInterface interface ; @@ -122,9 +122,9 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat MyMPIAccessDEC->setTimeInterpolator( LinearTimeInterp , 0.5 ) ; MPIAccess * mpi_access = MyMPIAccessDEC->getMPIAccess() ; - cout << "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; - cout << "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ; #define maxproc 11 #define maxreq 10000 @@ -174,7 +174,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat // MyMPIAccessDEC->NextTime( nextdeltatime ) ; } MyMPIAccessDEC->setTime( timeLoc , nextdeltatime ) ; - cout << "test_AllToAllvTimeDEC" << myrank << "=====TIME " << time << "=====DELTATIME " + debugStream << "test_AllToAllvTimeDEC" << myrank << "=====TIME " << time << "=====DELTATIME " << nextdeltatime << "=====MAXTIME " << maxtime << " ======" << endl ; int * sendbuf = new int[datamsglength*size] ; // int * sendbuf = (int *) malloc(sizeof(int)*datamsglength*size) ; @@ -199,7 +199,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat aRecvTimeMessage, recvtimecounts , rtimedispls , mpi_access->timeType() , *comm ) ; // for ( j = 0 ; j < size ; j++ ) { - // cout << "test_AllToAllvTimeDEC" << myrank << " TimeMessage received " << j << " " + // debugStream << "test_AllToAllvTimeDEC" << myrank << " TimeMessage received " << j << " " // << aRecvTimeMessage[j] << endl ; // } delete aSendTimeMessage ; @@ -215,13 +215,13 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat chksts( sts , myrank , mpi_access ) ; } - // cout << "test_AllToAllvTimeDEC" << myrank << " recvbuf before CheckSent" ; + // debugStream << "test_AllToAllvTimeDEC" << myrank << " recvbuf before CheckSent" ; // for ( i = 0 ; i < datamsglength*size ; i++ ) { - // cout << " " << recvbuf[i] ; + // debugStream << " " << recvbuf[i] ; // } - // cout << endl ; + // debugStream << endl ; - // cout << "test_AllToAllvTimeDEC" << myrank << " sendbuf " << sendbuf << endl ; + // debugStream << "test_AllToAllvTimeDEC" << myrank << " sendbuf " << sendbuf << endl ; // MyMPIAccessDEC->CheckSent() ; int nRecvReq = mpi_access->recvRequestIdsSize() ; @@ -235,11 +235,11 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat int nReq = mpi_access->recvRequestIds( nRecvReq, ArrayOfRecvRequests ) ; mpi_access->waitAll( nReq , ArrayOfRecvRequests ) ; delete [] ArrayOfRecvRequests ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } - // cout << "test_AllToAllvTimeDEC" << myrank << " check of recvbuf" << endl ; + // debugStream << "test_AllToAllvTimeDEC" << myrank << " check of recvbuf" << endl ; bool badrecvbuf = false ; for ( i = 0 ; i < size ; i++ ) { int j ; @@ -249,13 +249,13 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat if ( recvbuf[index] != (index/datamsglength)*1000000 + myrank*1000 + myrank*datamsglength+(index%datamsglength) ) { badrecvbuf = true ; - cout << "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] " + debugStream << "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] " << recvbuf[index] << " # " << (index/datamsglength)*1000000 + myrank*1000 + myrank*datamsglength+(index%datamsglength) << endl ; } else if ( badrecvbuf ) { - cout << "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] " + debugStream << "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] " << recvbuf[index] << " == " << (index/datamsglength)*1000000 + myrank*1000 + myrank*datamsglength+(index%datamsglength) << endl ; @@ -263,7 +263,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat } else if ( recvbuf[index] != -1 ) { badrecvbuf = true ; - cout << "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] " + debugStream << "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] " << recvbuf[index] << " # -1" << endl ; } } @@ -274,17 +274,17 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat << "test_AllToAllvTimeDEC" << myrank << " badrecvbuf" << endl << "=============================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } delete [] recvbuf ; } - cout << "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; - cout << "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ; - cout << "test_AllToAllvTimeDEC" << myrank << " CheckFinalSent" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " CheckFinalSent" << endl ; sts = MyMPIAccessDEC->checkFinalSent() ; if ( sts != MPI_SUCCESS ) { ostringstream strstream ; @@ -292,11 +292,11 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat << "test_AllToAllvTimeDEC" << myrank << " final CheckSent ERROR" << endl << "================================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } - cout << "test_AllToAllvTimeDEC" << myrank << " CheckFinalRecv" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " CheckFinalRecv" << endl ; sts = MyMPIAccessDEC->checkFinalRecv() ; if ( sts != MPI_SUCCESS ) { ostringstream strstream ; @@ -304,7 +304,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat << "test_AllToAllvTimeDEC" << myrank << " CheckFinalRecv ERROR" << endl << "================================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } @@ -316,22 +316,22 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat << " RecvRequests # 0 Error" << endl << "===============================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } else { - cout << "test_AllToAllvTimeDEC" << myrank << " RecvRequestIds " << nRecvReq + debugStream << "test_AllToAllvTimeDEC" << myrank << " RecvRequestIds " << nRecvReq << " RecvRequests = 0 OK" << endl ; } time_t endtime = time(NULL) ; - cout << "test_AllToAllvTimeDEC" << myrank << " begintime " << begintime << " endtime " << endtime + debugStream << "test_AllToAllvTimeDEC" << myrank << " begintime " << begintime << " endtime " << endtime << " elapse " << endtime-begintime << " " << maxtime/deltatime[myrank] << " calls to AllToAll" << endl ; - cout << "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; - cout << "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ; + debugStream << "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ; delete sourcegroup ; delete targetgroup ; @@ -351,7 +351,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat endtime = time(NULL) ; - cout << "test_AllToAllvTimeDEC" << myrank << " OK begintime " << begintime << " endtime " << endtime + debugStream << "test_AllToAllvTimeDEC" << myrank << " OK begintime " << begintime << " endtime " << endtime << " elapse " << endtime-begintime << " " << maxtime/deltatime[myrank] << " calls to AllToAll" << endl ; diff --git a/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx b/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx index f69c44285..01b7bd685 100644 --- a/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx +++ b/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx @@ -55,14 +55,14 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) int lenerr ; if ( sts != MPI_SUCCESS ) { mpi_access->errorString(sts, msgerr, &lenerr) ; - cout << "test" << myrank << " lenerr " << lenerr << " " + debugStream << "test" << myrank << " lenerr " << lenerr << " " << msgerr << endl ; ostringstream strstream ; strstream << "===========================================================" << "test" << myrank << " KO" << "===========================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } return ; @@ -70,7 +70,7 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { - cout << "test_AllToAllvTimeDoubleDEC" << endl ; + debugStream << "test_AllToAllvTimeDoubleDEC" << endl ; // MPI_Init(&argc, &argv) ; @@ -86,13 +86,13 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << " (nbprocs >=2)" << endl << "test must be runned with more than 1 proc and less than 12 procs" << endl ; - cout << strstream.str() << endl ; + cerr << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } // int Asynchronous = atoi(argv[1]) ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " Asynchronous " << Asynchronous << endl ; + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " Asynchronous " << Asynchronous << endl ; ParaMEDMEM::CommInterface interface ; std::set sourceprocs; @@ -115,7 +115,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { MyMPIAccessDEC->setTimeInterpolator( LinearTimeInterp ) ; MPIAccess * mpi_access = MyMPIAccessDEC->getMPIAccess() ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " Barrier :" << endl ; + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; #define maxproc 11 @@ -170,34 +170,34 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { } } MyMPIAccessDEC->setTime( timeLoc[myrank] , nextdeltatime[myrank] ) ; - cout << "test" << myrank << "=====TIME " << timeLoc[myrank] << "=====DELTATIME " + debugStream << "test" << myrank << "=====TIME " << timeLoc[myrank] << "=====DELTATIME " << nextdeltatime[myrank] << "=====MAXTIME " << maxtime[myrank] << " ======" << endl ; double * sendbuf = new double[datamsglength*size] ; // double * sendbuf = (double *) malloc(sizeof(double)*datamsglength*size) ; double * recvbuf = new double[datamsglength*size] ; int j ; - //cout << "test_AllToAllvTimeDoubleDEC" << myrank << " sendbuf" ; + //debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " sendbuf" ; for ( target = 0 ; target < size ; target++ ) { for ( j = 0 ; j < datamsglength ; j++ ) { //sendbuf[j] = myrank*10000 + (j/datamsglength)*100 + j ; sendbuf[target*datamsglength+j] = myrank*1000000 + target*10000 + (timeLoc[myrank]/deltatime[myrank])*100 + j ; - //cout << " " << (int ) sendbuf[target*datamsglength+j] ; + //debugStream << " " << (int ) sendbuf[target*datamsglength+j] ; recvbuf[target*datamsglength+j] = -1 ; } - //cout << endl ; + //debugStream << endl ; } int sts = MyMPIAccessDEC->allToAllvTime( sendbuf, sendcounts , sdispls , MPI_DOUBLE , recvbuf, recvcounts , rdispls , MPI_DOUBLE ) ; chksts( sts , myrank , mpi_access ) ; -// cout << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf before CheckSent" ; +// debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf before CheckSent" ; // for ( i = 0 ; i < datamsglength*size ; i++ ) { -// cout << " " << recvbuf[i] ; +// debugStream << " " << recvbuf[i] ; // } -// cout << endl ; +// debugStream << endl ; int nRecvReq = mpi_access->recvRequestIdsSize() ; if ( nRecvReq != 0 ) { @@ -211,11 +211,11 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { int nReq = mpi_access->recvRequestIds( nRecvReq, ArrayOfRecvRequests ) ; mpi_access->waitAll( nReq , ArrayOfRecvRequests ) ; delete [] ArrayOfRecvRequests ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } -// cout << "test_AllToAllvTimeDoubleDEC" << myrank << " check of recvbuf" << endl ; +// debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " check of recvbuf" << endl ; bool badrecvbuf = false ; for ( target = 0 ; target < size ; target++ ) { int j ; @@ -225,21 +225,21 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { if ( fabs(recvbuf[index] - (target*1000000 + myrank*10000 + (timeLoc[target]/deltatime[target])*100 + j)) > 101) { badrecvbuf = true ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " target " << target << " timeLoc[target] " + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " target " << target << " timeLoc[target] " << timeLoc[target] << " recvbuf[" << index << "] " << (int ) recvbuf[index] << " # " << (int ) (target*1000000 + myrank*10000 + (timeLoc[target]/deltatime[target])*100 + j) << endl ; } else if ( badrecvbuf ) { - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] " + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] " << recvbuf[index] << " ~= " << (int ) (target*1000000 + myrank*10000 + (timeLoc[target]/deltatime[target])*100 + j) << endl ; } } else if ( recvbuf[index] != -1 ) { badrecvbuf = true ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] " + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] " << recvbuf[index] << " # -1" << endl ; } } @@ -250,16 +250,16 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << "test_AllToAllvTimeDoubleDEC" << myrank << " badrecvbuf" << endl << "==================================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } delete [] recvbuf ; } - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " Barrier :" << endl ; + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalSent" << endl ; + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalSent" << endl ; sts = MyMPIAccessDEC->checkFinalSent() ; if ( sts != MPI_SUCCESS ) { ostringstream strstream ; @@ -267,11 +267,11 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalSent ERROR" << endl << "=================================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalRecv" << endl ; + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalRecv" << endl ; sts = MyMPIAccessDEC->checkFinalRecv() ; if ( sts != MPI_SUCCESS ) { ostringstream strstream ; @@ -279,7 +279,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalRecv ERROR" << endl << "================================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } @@ -291,20 +291,20 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << " RecvRequests # 0 Error" << endl << "===============================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } else { - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " RecvRequestIds " << nRecvReq + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " RecvRequestIds " << nRecvReq << " RecvRequests = 0 OK" << endl ; } time_t endtime = time(NULL) ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " begintime " << begintime << " endtime " << endtime + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " begintime " << begintime << " endtime " << endtime << " elapse " << endtime-begintime << " " << maxtime[myrank]/deltatime[myrank] << " calls to AllToAll" << endl ; - cout << "test" << myrank << " Barrier :" << endl ; + debugStream << "test" << myrank << " Barrier :" << endl ; mpi_access->barrier() ; delete sourcegroup ; @@ -325,7 +325,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { endtime = time(NULL) ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " OK begintime " << begintime << " endtime " << endtime + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " OK begintime " << begintime << " endtime " << endtime << " elapse " << endtime-begintime << " " << maxtime[myrank]/deltatime[myrank] << " calls to AllToAll" << endl ; -- 2.39.2