-// 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 MPIAccessDECTest::test_AllToAllvTimeDoubleDECSynchronousPointToPoint() {
test_AllToAllvTimeDoubleDEC( false ) ;
test_AllToAllvTimeDoubleDEC( true ) ;
}
-static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) {
+static void chksts( int sts , int myrank , MEDCoupling::MPIAccess * mpi_access ) {
char msgerr[MPI_MAX_ERROR_STRING] ;
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 ;
void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) {
- cout << "test_AllToAllvTimeDoubleDEC" << endl ;
+ debugStream << "test_AllToAllvTimeDoubleDEC" << endl ;
// MPI_Init(&argc, &argv) ;
strstream << "usage :" << endl
<< "mpirun -np <nbprocs> test_AllToAllTimeDEC" << endl
<< " (nbprocs >=2)" << endl
- << "test must be runned with more than 1 proc and less than 12 procs"
+ << "test must be run 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 ;
+ MEDCoupling::CommInterface interface ;
std::set<int> sourceprocs;
std::set<int> targetprocs;
int i ;
targetprocs.insert(i);
}
- ParaMEDMEM::MPIProcessorGroup* sourcegroup = new ParaMEDMEM::MPIProcessorGroup(interface,sourceprocs) ;
- ParaMEDMEM::MPIProcessorGroup* targetgroup = new ParaMEDMEM::MPIProcessorGroup(interface,targetprocs) ;
+ MEDCoupling::MPIProcessorGroup* sourcegroup = new MEDCoupling::MPIProcessorGroup(interface,sourceprocs) ;
+ MEDCoupling::MPIProcessorGroup* targetgroup = new MEDCoupling::MPIProcessorGroup(interface,targetprocs) ;
// TimeInterpolator * aLinearInterpDEC = new LinearTimeInterpolator( 0 ) ;
MPIAccessDEC * MyMPIAccessDEC = new MPIAccessDEC( *sourcegroup , *targetgroup ,
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
}
}
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 ,
+ 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 ) {
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 ;
- for ( j = 0 ; j < datamsglength ; j++ ) {
- int index = target*datamsglength+j ;
- if ( j < recvcounts[target] ) {
+ for ( int jj = 0 ; jj < datamsglength ; jj++ ) {
+ int index = target*datamsglength+jj ;
+ if ( jj < recvcounts[target] ) {
if ( fabs(recvbuf[index] - (target*1000000 + myrank*10000 +
- (timeLoc[target]/deltatime[target])*100 + j)) > 101) {
+ (timeLoc[target]/deltatime[target])*100 + jj)) > 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)
+ myrank*10000 + (timeLoc[target]/deltatime[target])*100 + jj)
<< 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 ;
+ myrank*10000 + (timeLoc[target]/deltatime[target])*100 + jj) << endl ;
}
}
else if ( recvbuf[index] != -1 ) {
badrecvbuf = true ;
- cout << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] "
+ debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] "
<< recvbuf[index] << " # -1" << endl ;
}
}
<< "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 ;
<< "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 ;
<< "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalRecv ERROR"
<< endl << "================================================================"
<< endl ;
- cout << strstream.str() << endl ;
+ debugStream << strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
<< " 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 ;
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 ;