X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEMTest%2Ftest_AllToAllvTimeDoubleDEC.cxx;h=5261cb9bf24f7a40e24c585c30f76a186a2a4abf;hb=d426837c21eca9b56b9b8a7a7434aaf3969c8977;hp=8a47938a4b872ea3e8f42d67601e6fd9b50e797a;hpb=fb512e2b77325290aaa2b4c9fd8f22d5949b6369;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx b/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx index 8a47938a4..5261cb9bf 100644 --- a/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx +++ b/src/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx @@ -1,4 +1,4 @@ -// 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 @@ -41,7 +41,7 @@ #define ENABLE_FORCED_FAILURES using namespace std; -using namespace ParaMEDMEM; +using namespace MEDCoupling; void MPIAccessDECTest::test_AllToAllvTimeDoubleDECSynchronousPointToPoint() { test_AllToAllvTimeDoubleDEC( false ) ; @@ -50,19 +50,19 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDECAsynchronousPointToPoint() { 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 ; @@ -70,7 +70,7 @@ static void chksts( int sts , int myrank , ParaMEDMEM::MPIAccess * mpi_access ) void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { - cout << "test_AllToAllvTimeDoubleDEC" << endl ; + debugStream << "test_AllToAllvTimeDoubleDEC" << endl ; // MPI_Init(&argc, &argv) ; @@ -86,15 +86,15 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << " (nbprocs >=2)" << endl << "test must be runned 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 sourceprocs; std::set targetprocs; int i ; @@ -105,8 +105,8 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { 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 , @@ -115,7 +115,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { 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 @@ -170,34 +170,34 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { } } 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 , 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 ) { @@ -211,11 +211,11 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { 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 ; @@ -225,21 +225,21 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { if ( fabs(recvbuf[index] - (target*1000000 + myrank*10000 + (timeLoc[target]/deltatime[target])*100 + j)) > 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) << 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 ; } } else if ( recvbuf[index] != -1 ) { badrecvbuf = true ; - cout << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] " + debugStream << "test_AllToAllvTimeDoubleDEC" << myrank << " recvbuf[" << index << "] " << recvbuf[index] << " # -1" << endl ; } } @@ -250,16 +250,16 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << "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 ; @@ -267,11 +267,11 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << "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 ; @@ -279,7 +279,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << "test_AllToAllvTimeDoubleDEC" << myrank << " CheckFinalRecv ERROR" << endl << "================================================================" << endl ; - cout << strstream.str() << endl ; + debugStream << strstream.str() << endl ; CPPUNIT_FAIL( strstream.str() ) ; } @@ -291,20 +291,20 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { << " 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 ; @@ -325,7 +325,7 @@ void MPIAccessDECTest::test_AllToAllvTimeDoubleDEC( bool Asynchronous ) { 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 ;