-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 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
#define ENABLE_FORCED_FAILURES
using namespace std;
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
void MPIAccessTest::test_MPI_Access_Cyclic_ISend_IRecv() {
- cout << "test_MPI_Access_Cyclic_ISend_IRecv" << endl ;
+ debugStream << "test_MPI_Access_Cyclic_ISend_IRecv" << endl ;
// MPI_Init(&argc, &argv) ;
MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;
if ( size < 3 ) {
- cout << "test_MPI_Access_Cyclic_ISend_IRecv must be runned with 3 procs" << endl ;
- CPPUNIT_FAIL("test_MPI_Access_Cyclic_ISend_IRecv must be runned with 3 procs") ;
+ cerr << "test_MPI_Access_Cyclic_ISend_IRecv must be runned with 3 procs" << endl ;
+ //CPPUNIT_FAIL("test_MPI_Access_Cyclic_ISend_IRecv must be runned with 3 procs") ;
+ return;
}
- cout << "test_MPI_Access_Cyclic_ISend_IRecv" << myrank << endl ;
+ debugStream << "test_MPI_Access_Cyclic_ISend_IRecv" << 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 maxsend 100
sendbuf[i] = i ;
sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,alltarget[myrank],
SendRequestId[i]) ;
- cout << "test" << myrank << " Send RequestId " << SendRequestId[i]
+ debugStream << "test" << myrank << " Send RequestId " << SendRequestId[i]
<< " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
}
for ( i = 0 ; i < maxsend ; i++ ) {
recvbuf[i] = -1 ;
sts = mpi_access.IRecv(&recvbuf[i],1,MPI_INT,allsource[myrank],
RecvRequestId[i]) ;
- cout << "test" << myrank << " Recv RequestId " << RecvRequestId[i]
+ debugStream << "test" << myrank << " Recv RequestId " << RecvRequestId[i]
<< " tag " << mpi_access.recvMPITag(allsource[myrank]) << 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() ) ;
}
int j ;
for (j = 0 ; j <= i ; j++) {
int flag ;
if ( j < i ) {
- cout << "test" << myrank << " " << j << " -> Test-Send("<< SendRequestId[j]
+ debugStream << "test" << myrank << " " << j << " -> Test-Send("<< SendRequestId[j]
<< ")" << endl ;
mpi_access.test( SendRequestId[j], flag ) ;
if ( flag ) {
int target, tag, error, outcount ;
mpi_access.status( SendRequestId[j], target, tag, error, outcount,
true ) ;
- cout << "test" << myrank << " Send RequestId " << SendRequestId[j]
+ debugStream << "test" << myrank << " Send RequestId " << SendRequestId[j]
<< " target " << target << " tag " << tag << " error " << error
<< endl ;
mpi_access.deleteRequest( SendRequestId[j] ) ;
}
}
- cout << "test" << myrank << " " << j << " -> Test-Recv("<< SendRequestId[j]
+ debugStream << "test" << myrank << " " << j << " -> Test-Recv("<< SendRequestId[j]
<< ")" << endl ;
mpi_access.test( RecvRequestId[j], flag ) ;
if ( flag ) {
int source, tag, error, outcount ;
mpi_access.status( RecvRequestId[j], source, tag, error, outcount,
true ) ;
- cout << "test" << myrank << " Recv RequestId" << j << " "
+ debugStream << "test" << myrank << " Recv RequestId" << j << " "
<< RecvRequestId[j] << " source " << source << " tag " << tag
<< " error " << error << " outcount " << outcount << endl ;
if ( (outcount != 1) | (recvbuf[j] != j) ) {
<< outcount << " recvbuf[ " << j << " ] " << recvbuf[j] << " KO"
<< endl << "====================================================="
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
}
sendbuf[i+1] = i + 1 ;
sts = mpi_access.ISend(&sendbuf[i+1],1,MPI_INT,alltarget[myrank],
SendRequestId[i+1]) ;
- cout << "test" << myrank << " Send RequestId " << SendRequestId[i+1]
+ debugStream << "test" << myrank << " Send RequestId " << SendRequestId[i+1]
<< " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
}
}
sendbuf[i] = i ;
sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,alltarget[myrank],
SendRequestId[i]) ;
- cout << "test" << myrank << " Send RequestId " << SendRequestId[i]
+ debugStream << "test" << myrank << " Send RequestId " << SendRequestId[i]
<< " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
}
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() ;
+ if(MPI_ACCESS_VERBOSE) mpi_access.check() ;
}
int flag ;
mpi_access.deleteRequests(maxsend,SendRequestId) ;
mpi_access.waitAll(maxsend,RecvRequestId) ;
mpi_access.deleteRequests(maxsend,RecvRequestId) ;
- mpi_access.check() ;
+ if(MPI_ACCESS_VERBOSE) mpi_access.check() ;
mpi_access.testAll(maxsend,SendRequestId,flag) ;
if ( !flag ) {
ostringstream strstream ;
strstream << "=========================================================" << endl
<< "test" << myrank << " TestAllSendflag " << flag << " KO" << endl
<< "=========================================================" << endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
- cout << "=========================================================" << endl
+ debugStream << "=========================================================" << endl
<< "test" << myrank << " TestAllSendflag " << flag << " OK" << endl
<< "=========================================================" << endl ;
}
strstream << "=========================================================" << endl
<< "test" << myrank << " TestAllRecvflag " << flag << " KO" << endl
<< "=========================================================" << endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
- cout << "=========================================================" << endl
+ debugStream << "=========================================================" << endl
<< "test" << myrank << " TestAllRecvflag " << flag << " OK" << endl
<< "=========================================================" << endl ;
}
strstream << "=========================================================" << endl
<< "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
<< "=========================================================" << endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
int source, tag, error, outcount ;
mpi_access.status(sendrequests[0], source, tag, error, outcount, true) ;
- cout << "test" << myrank << " RequestId " << sendrequests[0]
+ debugStream << "test" << myrank << " RequestId " << sendrequests[0]
<< " source " << source << " tag " << tag << " error " << error
<< " outcount " << outcount << 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 ;
}
// MPI_Finalize();
- cout << "test" << myrank << " OK" << endl ;
+ debugStream << "test" << myrank << " OK" << endl ;
return ;
}