-// Copyright (C) 2007-2013 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_ISend_IRecv_Length() {
- cout << "test_MPI_Access_ISend_IRecv_Length" << endl ;
+ debugStream << "test_MPI_Access_ISend_IRecv_Length" << endl ;
// MPI_Init(&argc, &argv) ;
if ( size < 2 ) {
ostringstream strstream ;
- strstream << "test_MPI_Access_ISend_IRecv_Length must be runned with 2 procs" << endl ;
- cout << strstream.str() << endl ;
- CPPUNIT_FAIL( strstream.str() ) ;
+ strstream << "test_MPI_Access_ISend_IRecv_Length must be run with 2 procs" << endl ;
+ cerr << strstream.str() << endl ;
+ //CPPUNIT_FAIL( strstream.str() ) ;
+ return;
}
- cout << "test_MPI_Access_ISend_IRecv_Length" << myrank << endl ;
+ debugStream << "test_MPI_Access_ISend_IRecv_Length" << 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
int RecvRequestId[maxreq] ;
int sts ;
int sendbuf[1000*(maxreq-1)] ;
- int recvbuf[maxreq-1][1000*(maxreq-1)] ;
+ int recvbuf[maxreq][1000*(maxreq-1)] ;
int i ;
for ( i = 0 ; i < 1000*(maxreq-1) ; i++ ) {
sendbuf[i] = i ;
for ( i = 0 ; i < maxreq ; i++ ) {
if ( myrank == 0 ) {
sts = mpi_access.ISend( sendbuf, 1000*i, 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( recvbuf[i], 1000*i, 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( RecvRequestId[j], flag ) ;
}
if ( flag ) {
- int target,source, tag, error, outcount ;
+ int target2,source, tag, error, outcount ;
if ( myrank == 0 ) {
- mpi_access.status( SendRequestId[j], target, tag, error, outcount,
+ mpi_access.status( SendRequestId[j], target2, tag, error, outcount,
true ) ;
- cout << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
- << ") : target " << target << " tag " << tag << " error " << error
+ debugStream << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
+ << ") : target " << target2 << " 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 ;
<< 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] << " recvbuf "
<< recvbuf[j][outcount-1] << " OK" << endl
}
}
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() ) ;
}
}
- mpi_access.check() ;
- cout << "test" << myrank << " WaitAll" << endl ;
+ if(MPI_ACCESS_VERBOSE) mpi_access.check() ;
+ debugStream << "test" << myrank << " WaitAll" << endl ;
if ( myrank == 0 ) {
mpi_access.waitAll(maxreq, SendRequestId) ;
mpi_access.deleteRequests(maxreq, SendRequestId) ;
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[maxreq] ;
int sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
- sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
if ( sendreqsize != 0 ) {
ostringstream strstream ;
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 ;
}
}
else {
int recvrequests[maxreq] ;
- int recvreqsize = mpi_access.sendRequestIds( target , maxreq , recvrequests ) ;
+ int recvreqsize = mpi_access.recvRequestIds( target , maxreq , recvrequests ) ;
if ( recvreqsize != 0 ) {
ostringstream strstream ;
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 ;
}
// MPI_Finalize();
- cout << "test" << myrank << " OK" << endl ;
+ debugStream << "test" << myrank << " OK" << endl ;
return ;
}