Salome HOME
projects
/
tools
/
medcoupling.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adapt for C++17
[tools/medcoupling.git]
/
src
/
ParaMEDMEMTest
/
test_AllToAllvTimeDEC.cxx
diff --git
a/src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx
b/src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx
index 78d8d47c0cf74e808e58a3ec1cececb30079d8ff..a35a1117a1e871e1b763f95a6350412ef1bf60b8 100644
(file)
--- a/
src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx
+++ b/
src/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
15
CEA/DEN, EDF R&D
+// Copyright (C) 2007-20
20
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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-40,7
+40,7
@@
#define ENABLE_FORCED_FAILURES
using namespace std;
#define ENABLE_FORCED_FAILURES
using namespace std;
-using namespace
ParaMEDMEM
;
+using namespace
MEDCoupling
;
void MPIAccessDECTest::test_AllToAllvTimeDECSynchronousNative() {
test_AllToAllvTimeDEC( false , true ) ;
void MPIAccessDECTest::test_AllToAllvTimeDECSynchronousNative() {
test_AllToAllvTimeDEC( false , true ) ;
@@
-52,19
+52,19
@@
void MPIAccessDECTest::test_AllToAllvTimeDECAsynchronousPointToPoint() {
test_AllToAllvTimeDEC( true , false ) ;
}
test_AllToAllvTimeDEC( true , false ) ;
}
-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) ;
char msgerr[MPI_MAX_ERROR_STRING] ;
int lenerr ;
if ( sts != MPI_SUCCESS ) {
mpi_access->errorString(sts, msgerr, &lenerr) ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " lenerr " << lenerr << " "
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " lenerr " << lenerr << " "
<< msgerr << endl ;
ostringstream strstream ;
strstream << "==========================================================="
<< "test_AllToAllvTimeDEC" << myrank << " KO"
<< "==========================================================="
<< endl ;
<< msgerr << endl ;
ostringstream strstream ;
strstream << "==========================================================="
<< "test_AllToAllvTimeDEC" << myrank << " KO"
<< "==========================================================="
<< endl ;
-
cout
<< strstream.str() << endl ;
+
debugStream
<< strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
return ;
CPPUNIT_FAIL( strstream.str() ) ;
}
return ;
@@
-72,7
+72,7
@@
static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access )
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINative ) {
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINative ) {
-
cout
<< "test_AllToAllvTimeDEC" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << endl ;
// MPI_Init(&argc, &argv) ;
// MPI_Init(&argc, &argv) ;
@@
-86,9
+86,9
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
strstream << "usage :" << endl
<< "mpirun -np <nbprocs> test_AllToAllTimeDEC" << endl
<< " (nbprocs >=2)" << endl
strstream << "usage :" << endl
<< "mpirun -np <nbprocs> test_AllToAllTimeDEC" << endl
<< " (nbprocs >=2)" << endl
- << "test must be run
ned
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 ;
<< endl ;
- c
out
<< strstream.str() << endl ;
+ c
err
<< strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
CPPUNIT_FAIL( strstream.str() ) ;
}
@@
-98,10
+98,10
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
// UseMPI_Alltoallv = atoi(argv[2]) ;
// }
// UseMPI_Alltoallv = atoi(argv[2]) ;
// }
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " Asynchronous " << Asynchronous
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " Asynchronous " << Asynchronous
<< " UseMPI_Alltoallv " << UseMPI_Alltoallv << endl ;
<< " UseMPI_Alltoallv " << UseMPI_Alltoallv << endl ;
-
ParaMEDMEM
::CommInterface interface ;
+
MEDCoupling
::CommInterface interface ;
std::set<int> sourceprocs;
std::set<int> targetprocs;
int i ;
std::set<int> sourceprocs;
std::set<int> targetprocs;
int i ;
@@
-112,8
+112,8
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
targetprocs.insert(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.5 ) ;
MPIAccessDEC * MyMPIAccessDEC = new MPIAccessDEC( *sourcegroup , *targetgroup ,
// TimeInterpolator * aLinearInterpDEC = new LinearTimeInterpolator( 0.5 ) ;
MPIAccessDEC * MyMPIAccessDEC = new MPIAccessDEC( *sourcegroup , *targetgroup ,
@@
-122,9
+122,9
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
MyMPIAccessDEC->setTimeInterpolator( LinearTimeInterp , 0.5 ) ;
MPIAccess * mpi_access = MyMPIAccessDEC->getMPIAccess() ;
MyMPIAccessDEC->setTimeInterpolator( LinearTimeInterp , 0.5 ) ;
MPIAccess * mpi_access = MyMPIAccessDEC->getMPIAccess() ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ;
mpi_access->barrier() ;
mpi_access->barrier() ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ;
#define maxproc 11
#define maxreq 10000
#define maxproc 11
#define maxreq 10000
@@
-174,7
+174,7
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
// MyMPIAccessDEC->NextTime( nextdeltatime ) ;
}
MyMPIAccessDEC->setTime( timeLoc , nextdeltatime ) ;
// MyMPIAccessDEC->NextTime( nextdeltatime ) ;
}
MyMPIAccessDEC->setTime( timeLoc , nextdeltatime ) ;
-
cout << "test_AllToAllvTimeDEC" << myrank << "=====TIME " << time
<< "=====DELTATIME "
+
debugStream << "test_AllToAllvTimeDEC" << myrank << "=====TIME " << timeLoc
<< "=====DELTATIME "
<< nextdeltatime << "=====MAXTIME " << maxtime << " ======" << endl ;
int * sendbuf = new int[datamsglength*size] ;
// int * sendbuf = (int *) malloc(sizeof(int)*datamsglength*size) ;
<< nextdeltatime << "=====MAXTIME " << maxtime << " ======" << endl ;
int * sendbuf = new int[datamsglength*size] ;
// int * sendbuf = (int *) malloc(sizeof(int)*datamsglength*size) ;
@@
-199,7
+199,7
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
aRecvTimeMessage, recvtimecounts , rtimedispls ,
mpi_access->timeType() , *comm ) ;
// for ( j = 0 ; j < size ; j++ ) {
aRecvTimeMessage, recvtimecounts , rtimedispls ,
mpi_access->timeType() , *comm ) ;
// for ( j = 0 ; j < size ; j++ ) {
- //
cout
<< "test_AllToAllvTimeDEC" << myrank << " TimeMessage received " << j << " "
+ //
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " TimeMessage received " << j << " "
// << aRecvTimeMessage[j] << endl ;
// }
delete aSendTimeMessage ;
// << aRecvTimeMessage[j] << endl ;
// }
delete aSendTimeMessage ;
@@
-210,18
+210,18
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
delete [] sendbuf ;
}
else {
delete [] sendbuf ;
}
else {
- int sts = MyMPIAccessDEC->allToAllvTime( sendbuf, sendcounts , sdispls , MPI_INT ,
+ int sts
2
= MyMPIAccessDEC->allToAllvTime( sendbuf, sendcounts , sdispls , MPI_INT ,
recvbuf, recvcounts , rdispls , MPI_INT ) ;
recvbuf, recvcounts , rdispls , MPI_INT ) ;
- chksts( sts , myrank , mpi_access ) ;
+ chksts( sts
2
, myrank , mpi_access ) ;
}
}
- //
cout
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf before CheckSent" ;
+ //
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf before CheckSent" ;
// for ( i = 0 ; i < datamsglength*size ; i++ ) {
// for ( i = 0 ; i < datamsglength*size ; i++ ) {
- //
cout
<< " " << recvbuf[i] ;
+ //
debugStream
<< " " << recvbuf[i] ;
// }
// }
- //
cout
<< endl ;
+ //
debugStream
<< endl ;
- //
cout
<< "test_AllToAllvTimeDEC" << myrank << " sendbuf " << sendbuf << endl ;
+ //
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " sendbuf " << sendbuf << endl ;
// MyMPIAccessDEC->CheckSent() ;
int nRecvReq = mpi_access->recvRequestIdsSize() ;
// MyMPIAccessDEC->CheckSent() ;
int nRecvReq = mpi_access->recvRequestIdsSize() ;
@@
-235,27
+235,26
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
int nReq = mpi_access->recvRequestIds( nRecvReq, ArrayOfRecvRequests ) ;
mpi_access->waitAll( nReq , ArrayOfRecvRequests ) ;
delete [] ArrayOfRecvRequests ;
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() ) ;
}
CPPUNIT_FAIL( strstream.str() ) ;
}
- //
cout
<< "test_AllToAllvTimeDEC" << myrank << " check of recvbuf" << endl ;
+ //
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " check of recvbuf" << endl ;
bool badrecvbuf = false ;
for ( i = 0 ; i < size ; i++ ) {
bool badrecvbuf = false ;
for ( i = 0 ; i < size ; i++ ) {
- int j ;
- for ( j = 0 ; j < datamsglength ; j++ ) {
- int index = i*datamsglength+j ;
- if ( j < recvcounts[i] ) {
+ for ( int jj = 0 ; jj < datamsglength ; jj++ ) {
+ int index = i*datamsglength+jj ;
+ if ( jj < recvcounts[i] ) {
if ( recvbuf[index] != (index/datamsglength)*1000000 + myrank*1000 +
myrank*datamsglength+(index%datamsglength) ) {
badrecvbuf = true ;
if ( recvbuf[index] != (index/datamsglength)*1000000 + myrank*1000 +
myrank*datamsglength+(index%datamsglength) ) {
badrecvbuf = true ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] "
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] "
<< recvbuf[index] << " # " << (index/datamsglength)*1000000 +
myrank*1000 +
myrank*datamsglength+(index%datamsglength) << endl ;
}
else if ( badrecvbuf ) {
<< recvbuf[index] << " # " << (index/datamsglength)*1000000 +
myrank*1000 +
myrank*datamsglength+(index%datamsglength) << endl ;
}
else if ( badrecvbuf ) {
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] "
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] "
<< recvbuf[index] << " == " << (index/datamsglength)*1000000 +
myrank*1000 +
myrank*datamsglength+(index%datamsglength) << endl ;
<< recvbuf[index] << " == " << (index/datamsglength)*1000000 +
myrank*1000 +
myrank*datamsglength+(index%datamsglength) << endl ;
@@
-263,7
+262,7
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
}
else if ( recvbuf[index] != -1 ) {
badrecvbuf = true ;
}
else if ( recvbuf[index] != -1 ) {
badrecvbuf = true ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] "
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " recvbuf[" << index << "] "
<< recvbuf[index] << " # -1" << endl ;
}
}
<< recvbuf[index] << " # -1" << endl ;
}
}
@@
-274,17
+273,17
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
<< "test_AllToAllvTimeDEC" << myrank << " badrecvbuf"
<< endl << "============================================================="
<< endl ;
<< "test_AllToAllvTimeDEC" << myrank << " badrecvbuf"
<< endl << "============================================================="
<< endl ;
-
cout
<< strstream.str() << endl ;
+
debugStream
<< strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
delete [] recvbuf ;
}
CPPUNIT_FAIL( strstream.str() ) ;
}
delete [] recvbuf ;
}
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ;
mpi_access->barrier() ;
mpi_access->barrier() ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " CheckFinalSent" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " CheckFinalSent" << endl ;
sts = MyMPIAccessDEC->checkFinalSent() ;
if ( sts != MPI_SUCCESS ) {
ostringstream strstream ;
sts = MyMPIAccessDEC->checkFinalSent() ;
if ( sts != MPI_SUCCESS ) {
ostringstream strstream ;
@@
-292,11
+291,11
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
<< "test_AllToAllvTimeDEC" << myrank << " final CheckSent ERROR"
<< endl << "================================================================"
<< endl ;
<< "test_AllToAllvTimeDEC" << myrank << " final CheckSent ERROR"
<< endl << "================================================================"
<< endl ;
-
cout
<< strstream.str() << endl ;
+
debugStream
<< strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
CPPUNIT_FAIL( strstream.str() ) ;
}
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " CheckFinalRecv" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " CheckFinalRecv" << endl ;
sts = MyMPIAccessDEC->checkFinalRecv() ;
if ( sts != MPI_SUCCESS ) {
ostringstream strstream ;
sts = MyMPIAccessDEC->checkFinalRecv() ;
if ( sts != MPI_SUCCESS ) {
ostringstream strstream ;
@@
-304,7
+303,7
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
<< "test_AllToAllvTimeDEC" << myrank << " CheckFinalRecv ERROR"
<< endl << "================================================================"
<< endl ;
<< "test_AllToAllvTimeDEC" << myrank << " CheckFinalRecv ERROR"
<< endl << "================================================================"
<< endl ;
-
cout
<< strstream.str() << endl ;
+
debugStream
<< strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
CPPUNIT_FAIL( strstream.str() ) ;
}
@@
-316,22
+315,22
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
<< " RecvRequests # 0 Error"
<< endl << "==============================================================="
<< endl ;
<< " RecvRequests # 0 Error"
<< endl << "==============================================================="
<< endl ;
-
cout
<< strstream.str() << endl ;
+
debugStream
<< strstream.str() << endl ;
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
CPPUNIT_FAIL( strstream.str() ) ;
}
else {
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " RecvRequestIds " << nRecvReq
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " RecvRequestIds " << nRecvReq
<< " RecvRequests = 0 OK" << endl ;
}
time_t endtime = time(NULL) ;
<< " RecvRequests = 0 OK" << endl ;
}
time_t endtime = time(NULL) ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " begintime " << begintime << " endtime " << endtime
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " begintime " << begintime << " endtime " << endtime
<< " elapse " << endtime-begintime << " " << maxtime/deltatime[myrank]
<< " calls to AllToAll" << endl ;
<< " elapse " << endtime-begintime << " " << maxtime/deltatime[myrank]
<< " calls to AllToAll" << endl ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " Barrier :" << endl ;
mpi_access->barrier() ;
mpi_access->barrier() ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ;
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " Barrier done" << endl ;
delete sourcegroup ;
delete targetgroup ;
delete sourcegroup ;
delete targetgroup ;
@@
-351,7
+350,7
@@
void MPIAccessDECTest::test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINat
endtime = time(NULL) ;
endtime = time(NULL) ;
-
cout
<< "test_AllToAllvTimeDEC" << myrank << " OK begintime " << begintime << " endtime " << endtime
+
debugStream
<< "test_AllToAllvTimeDEC" << myrank << " OK begintime " << begintime << " endtime " << endtime
<< " elapse " << endtime-begintime << " " << maxtime/deltatime[myrank]
<< " calls to AllToAll" << endl ;
<< " elapse " << endtime-begintime << " " << maxtime/deltatime[myrank]
<< " calls to AllToAll" << endl ;