-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#define ENABLE_FORCED_FAILURES
using namespace std;
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
void MPIAccessTest::test_MPI_Access_Time() {
- cout << "test_MPI_Access_Time" << endl ;
+ debugStream << "test_MPI_Access_Time" << endl ;
// MPI_Init(&argc, &argv) ;
if ( size < 2 ) {
ostringstream strstream ;
- strstream << "test_MPI_Access_Time must be runned with 2 procs" << endl ;
- cout << strstream.str() << endl ;
- CPPUNIT_FAIL( strstream.str() ) ;
+ strstream << "test_MPI_Access_Time must be run with 2 procs" << endl ;
+ cerr << strstream.str() << endl ;
+ //CPPUNIT_FAIL( strstream.str() ) ;
+ return;
}
- cout << "test_MPI_Access_Time" << myrank << endl ;
+ debugStream << "test_MPI_Access_Time" << myrank << endl ;
- ParaMEDMEM::CommInterface interface ;
+ MEDCoupling::CommInterface interface ;
- ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;
+ MEDCoupling::MPIProcessorGroup* group = new MEDCoupling::MPIProcessorGroup(interface) ;
- ParaMEDMEM::MPIAccess mpi_access( group ) ;
+ MEDCoupling::MPIAccess mpi_access( group ) ;
#define maxreq 10
if ( myrank >= 2 ) {
- cout << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->Barrier" << endl ;
+ debugStream << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->Barrier" << endl ;
mpi_access.barrier() ;
- cout << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->Barrier" << endl ;
+ debugStream << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->Barrier" << endl ;
delete group ;
- cout << "test_MPI_Access_Time" << myrank << " OK" << endl ;
+ debugStream << "test_MPI_Access_Time" << myrank << " OK" << endl ;
return ;
}
int sendbuf[maxreq] ;
int recvbuf[maxreq] ;
int i = 0 ;
- ParaMEDMEM::TimeMessage aSendTimeMsg[maxreq] ;
- ParaMEDMEM::TimeMessage aRecvTimeMsg[maxreq] ;
+ MEDCoupling::TimeMessage aSendTimeMsg[maxreq] ;
+ MEDCoupling::TimeMessage aRecvTimeMsg[maxreq] ;
double t ;
double dt = 1. ;
double maxt = 10. ;
sts = mpi_access.ISend( &aSendTimeMsg[i] , 1 ,
mpi_access.timeType() , target ,
SendTimeRequestId[i]) ;
- cout << "test" << myrank << " ISend RequestId " << SendTimeRequestId[i]
+ debugStream << "test" << myrank << " ISend RequestId " << SendTimeRequestId[i]
<< " tag " << mpi_access.sendMPITag(target) << endl ;
sendbuf[i] = i ;
sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,target, SendRequestId[i]) ;
- cout << "test" << myrank << " ISend RequestId " << SendRequestId[i]
+ debugStream << "test" << myrank << " ISend RequestId " << SendRequestId[i]
<< " tag " << mpi_access.sendMPITag(target) << endl ;
}
else {
sts = mpi_access.IRecv( &aRecvTimeMsg[i] , 1 ,
mpi_access.timeType() , target ,
RecvTimeRequestId[i]) ;
- cout << "test" << myrank << " IRecv RequestId " << RecvTimeRequestId[i]
+ debugStream << "test" << myrank << " IRecv RequestId " << RecvTimeRequestId[i]
<< " tag " << mpi_access.recvMPITag(target) << endl ;
sts = mpi_access.IRecv(&recvbuf[i],1,MPI_INT,target, RecvRequestId[i]) ;
- cout << "test" << myrank << " IRecv RequestId " << RecvRequestId[i]
+ debugStream << "test" << myrank << " IRecv RequestId " << RecvRequestId[i]
<< " tag " << mpi_access.recvMPITag(target) << endl ;
}
int j ;
mpi_access.test( RecvTimeRequestId[j], flag ) ;
}
if ( flag ) {
- int target,source, tag, error, outcount ;
+ int source, tag, error, outcount ;
if ( myrank == 0 ) {
mpi_access.status( SendTimeRequestId[j], target, tag, error, outcount,
true ) ;
- cout << "test" << myrank << " Test(Send TimeRequestId " << SendTimeRequestId[j]
+ debugStream << "test" << myrank << " Test(Send TimeRequestId " << SendTimeRequestId[j]
<< ") : target " << target << " tag " << tag << " error " << error
<< " flag " << flag << aSendTimeMsg[j] << endl ;
}
else {
mpi_access.status( RecvTimeRequestId[j], source, tag, error, outcount,
true ) ;
- cout << "test" << myrank << " Test(Recv TimeRequestId "
+ debugStream << "test" << myrank << " Test(Recv TimeRequestId "
<< RecvTimeRequestId[j] << ") : source " << source << " tag " << tag
<< " error " << error << " outcount " << outcount
<< " flag " << flag << aRecvTimeMsg[j] << endl ;
<< " RecvTimeRequestId " << RecvTimeRequestId[j] << endl
<< "==========================================================="
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
- cout << "==========================================================="
+ debugStream << "==========================================================="
<< endl << "test" << myrank << " outcount " << outcount
<< " RecvTimeRequestId " << RecvTimeRequestId[j] << " OK" << endl
<< "==========================================================="
mpi_access.test( RecvRequestId[j], flag ) ;
}
if ( flag ) {
- int target,source, tag, error, outcount ;
+ int source, tag, error, outcount ;
if ( myrank == 0 ) {
mpi_access.status( SendRequestId[j], target, tag, error, outcount,
true ) ;
- cout << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
+ debugStream << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
<< ") : target " << target << " tag " << tag << " error " << error
<< " flag " << flag << endl ;
}
else {
mpi_access.status( RecvRequestId[j], source, tag, error, outcount,
true ) ;
- cout << "test" << myrank << " Test(Recv RequestId "
+ debugStream << "test" << myrank << " Test(Recv RequestId "
<< RecvRequestId[j] << ") : source " << source << " tag " << tag
<< " error " << error << " outcount " << outcount
<< " flag " << flag << endl ;
<< outcount << " recvbuf " << recvbuf[j] << " KO" << endl
<< "==========================================================="
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
- cout << "==========================================================="
+ debugStream << "==========================================================="
<< endl << "test" << myrank << " outcount " << outcount
<< " RequestId " << RecvRequestId[j] << " OK" << endl
<< "==========================================================="
char msgerr[MPI_MAX_ERROR_STRING] ;
int lenerr ;
mpi_access.errorString(sts, msgerr, &lenerr) ;
- cout << "test" << myrank << " lenerr " << lenerr << " "
+ debugStream << "test" << myrank << " lenerr " << lenerr << " "
<< msgerr << endl ;
if ( sts != MPI_SUCCESS ) {
<< "test" << myrank << " KO"
<< "==========================================================="
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
i = i + 1 ;
}
- mpi_access.check() ;
+ if(MPI_ACCESS_VERBOSE) mpi_access.check() ;
if ( myrank == 0 ) {
mpi_access.waitAll(maxreq, SendTimeRequestId) ;
mpi_access.deleteRequests(maxreq, SendTimeRequestId) ;
mpi_access.waitAll(maxreq, RecvRequestId) ;
mpi_access.deleteRequests(maxreq, RecvRequestId) ;
}
- mpi_access.check() ;
+ if(MPI_ACCESS_VERBOSE) mpi_access.check() ;
if ( myrank == 0 ) {
int sendrequests[2*maxreq] ;
strstream << "=========================================================" << endl
<< "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
<< "=========================================================" << endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
- cout << "=========================================================" << endl
+ debugStream << "=========================================================" << endl
<< "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
<< "=========================================================" << endl ;
}
strstream << "=========================================================" << endl
<< "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
<< "=========================================================" << endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
- cout << "=========================================================" << endl
+ debugStream << "=========================================================" << endl
<< "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
<< "=========================================================" << endl ;
}
}
- cout << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->Barrier" << endl ;
+ debugStream << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->Barrier" << endl ;
mpi_access.barrier() ;
- cout << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->Barrier" << endl ;
+ debugStream << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->Barrier" << endl ;
delete group ;
// MPI_Finalize();
- cout << "test_MPI_Access_Time" << myrank << " OK" << endl ;
+ debugStream << "test_MPI_Access_Time" << myrank << " OK" << endl ;
return ;
}