-// 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_Cancel() {
- cout << "test_MPI_Access_Cancel" << endl ;
+ debugStream << "test_MPI_Access_Cancel" << endl ;
// MPI_Init(&argc, &argv) ;
if ( size < 2 ) {
ostringstream strstream ;
strstream << "test_MPI_Access_Cancel must be runned with 2 procs" << endl ;
- cout << strstream.str() << endl ;
- CPPUNIT_FAIL( strstream.str() ) ;
+ cerr << strstream.str() << endl ;
+ //CPPUNIT_FAIL( strstream.str() ) ;
+ return;
}
- cout << "test_MPI_Access_Cancel" << myrank << endl ;
+ debugStream << "test_MPI_Access_Cancel" << 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 ) ;
if ( myrank >= 2 ) {
mpi_access.barrier() ;
int i , j ;
for ( j = 0 ; j < 3 ; j++ ) {
for ( i = 0 ; i < 10 ; i++ ) {
- cout << "test" << myrank << " ============================ i " << i
+ debugStream << "test" << myrank << " ============================ i " << i
<< "============================" << endl ;
if ( myrank == 0 ) {
if ( i < 5 ) {
intsendbuf[i] = i ;
sts = mpi_access.ISend(&intsendbuf[i],1,MPI_INT,target, RequestId[i]) ;
- cout << "test" << myrank << " Send MPI_INT RequestId " << RequestId[i]
+ debugStream << "test" << myrank << " Send MPI_INT RequestId " << RequestId[i]
<< endl ;
}
else {
doublesendbuf[i] = i ;
sts = mpi_access.ISend(&doublesendbuf[i],1,MPI_DOUBLE,target,
RequestId[i]) ;
- cout << "test" << myrank << " Send MPI_DOUBLE RequestId " << RequestId[i]
+ debugStream << "test" << myrank << " Send MPI_DOUBLE RequestId " << RequestId[i]
<< endl ;
}
}
sts = mpi_access.IProbe(target, source, tag, datatype, outcount,
flag ) ;
if ( flag ) {
- cout << "test" << myrank << " " << i << " IProbe target " << target
+ debugStream << "test" << myrank << " " << i << " IProbe target " << target
<< " source " << source << " tag " << tag
<< " outcount " << outcount << " flag " << flag << endl ;
}
else {
- cout << "test" << myrank << " flag " << flag << endl ;
+ debugStream << "test" << myrank << " flag " << flag << endl ;
sleep( 1 ) ;
}
if ( flag ) {
<< " recvbuf " << recvbuf << " KO" << endl
<< "======================================================"
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
- cout << "========================================================"
+ debugStream << "========================================================"
<< endl << "test" << myrank << " outcount " << outcount
<< " recvbuf " << recvbuf << " 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 ) {
ostringstream strstream ;
<< endl << "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() ;
}
if ( myrank != 0 ) {
int iprobe ;
for ( iprobe = 5 ; iprobe < 10 ; iprobe++ ) {
- cout << "test" << myrank << " ============================ iprobe "
+ debugStream << "test" << myrank << " ============================ iprobe "
<< iprobe << "============================" << endl ;
int source, tag, outcount ;
MPI_Datatype datatype ;
char msgerr[MPI_MAX_ERROR_STRING] ;
int lenerr ;
mpi_access.errorString(sts, msgerr, &lenerr) ;
- cout << "test" << myrank << " IProbe iprobe " << iprobe
+ debugStream << "test" << myrank << " IProbe iprobe " << iprobe
<< " target " << target << " probeflag " << probeflag
<< " tag " << tag << " outcount " << outcount << " datatype "
<< datatype << " lenerr " << lenerr << " " << msgerr << endl ;
<< endl
<< "=========================================================="
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
if ( !probeflag ) {
- //cout << "========================================================"
+ //debugStream << "========================================================"
// << endl << "test" << myrank << " IProbe KO(OK) iprobe " << iprobe
// << " probeflag " << probeflag << endl
// << "========================================================"
// << endl ;
}
else {
- cout << "test" << myrank << " " << iprobe << " IProbe target "
+ debugStream << "test" << myrank << " " << iprobe << " IProbe target "
<< target << " source " << source << " tag " << tag
<< " outcount " << outcount << " probeflag " << probeflag
<< endl ;
<< endl << "test" << myrank << " MPI_DOUBLE KO" << endl
<< "========================================================"
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
sts = mpi_access.cancel( source, tag, datatype, outcount, flag ) ;
if ( sts != MPI_SUCCESS || !flag ) {
mpi_access.errorString(sts, msgerr, &lenerr) ;
- cout << "======================================================"
+ debugStream << "======================================================"
<< endl << "test" << myrank << " lenerr " << lenerr << " "
<< msgerr << endl << "test" << myrank
<< " Cancel PendingIrecv KO flag " << flag << " iprobe "
//return 1 ;
}
else {
- cout << "======================================================"
+ debugStream << "======================================================"
<< endl << "test" << myrank
<< " Cancel PendingIrecv OK RequestId " << " flag "
<< flag << " iprobe " << iprobe << endl
int Reqtarget, Reqtag, Reqerror, Reqoutcount ;
mpi_access.status( RequestId[iprobe], Reqtarget, Reqtag, Reqerror,
Reqoutcount, true ) ;
- cout << "test" << myrank << " Status Reqtarget "<< Reqtarget
+ debugStream << "test" << myrank << " Status Reqtarget "<< Reqtarget
<< " Reqtag " << Reqtag << " Reqoutcount " << Reqoutcount
<< endl ;
int Reqflag ;
sts = mpi_access.cancel( RequestId[iprobe] , Reqflag ) ;
- cout << "test" << myrank << " " << iprobe
+ debugStream << "test" << myrank << " " << iprobe
<< " Cancel Irecv done Reqtarget " << Reqtarget
<< " Reqtag " << Reqtag << " Reqoutcount " << Reqoutcount
<< " Reqflag " << Reqflag << endl ;
<< iprobe << endl
<< "========================================================"
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
- cout << "========================================================"
+ debugStream << "========================================================"
<< endl << "test" << myrank
<< " Cancel Irecv OK RequestId " << RequestId[iprobe]
<< " Reqflag " << Reqflag << " iprobe " << iprobe << 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 || flag ) {
ostringstream strstream ;
<< " source " << source << " tag " << tag << endl
<< "==========================================================="
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
if ( !flag ) {
ostringstream strstream ;
strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
- mpi_access.check() ;
+ if(MPI_ACCESS_VERBOSE) mpi_access.check() ;
mpi_access.barrier() ;
// MPI_Finalize();
- cout << "test" << myrank << " OK" << endl ;
+ debugStream << "test" << myrank << " OK" << endl ;
return ;
}