X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEMTest%2Ftest_MPI_Access_IProbe.cxx;h=46c391ee14a507c4c8cde39d51e754614627feb9;hb=dcc261ea8b9015285a05b5f7bc2960d883815c9a;hp=77d6dc77c7df400ce4ef02725056c74fc1bf4f4f;hpb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEMTest/test_MPI_Access_IProbe.cxx b/src/ParaMEDMEMTest/test_MPI_Access_IProbe.cxx index 77d6dc77c..46c391ee1 100644 --- a/src/ParaMEDMEMTest/test_MPI_Access_IProbe.cxx +++ b/src/ParaMEDMEMTest/test_MPI_Access_IProbe.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 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 @@ -43,11 +43,11 @@ #define ENABLE_FORCED_FAILURES using namespace std; -using namespace ParaMEDMEM; +using namespace MEDCoupling; void MPIAccessTest::test_MPI_Access_IProbe() { - cout << "test_MPI_Access_IProbe" << endl ; + debugStream << "test_MPI_Access_IProbe" << endl ; // MPI_Init(&argc, &argv) ; @@ -58,18 +58,19 @@ void MPIAccessTest::test_MPI_Access_IProbe() { if ( size < 2 ) { ostringstream strstream ; - strstream << "test_MPI_Access_IProbe must be runned with 2 procs" << endl ; - cout << strstream.str() << endl ; - CPPUNIT_FAIL( strstream.str() ) ; + strstream << "test_MPI_Access_IProbe must be run with 2 procs" << endl ; + cerr << strstream.str() << endl ; + //CPPUNIT_FAIL( strstream.str() ) ; + return; } - cout << "test_MPI_Access_IProbe" << myrank << endl ; + debugStream << "test_MPI_Access_IProbe" << 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() ; @@ -80,13 +81,13 @@ void MPIAccessTest::test_MPI_Access_IProbe() { int target = 1 - myrank ; int sendbuf[10] ; int RequestId[10] ; - int sts ; + int sts = 0; int i ; for ( i = 0 ; i < 10 ; i++ ) { if ( myrank == 0 ) { sendbuf[i] = i ; sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,target, RequestId[i]) ; - cout << "test" << myrank << " Send RequestId " << RequestId[i] + debugStream << "test" << myrank << " Send RequestId " << RequestId[i] << endl ; } else { @@ -96,12 +97,12 @@ void MPIAccessTest::test_MPI_Access_IProbe() { MPI_Datatype datatype ; 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 << " IProbe flag " << flag << endl ; + debugStream << "test" << myrank << " IProbe flag " << flag << endl ; sleep( 1 ) ; } if ( flag ) { @@ -115,10 +116,10 @@ void MPIAccessTest::test_MPI_Access_IProbe() { << " 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 << "===========================================================" @@ -129,7 +130,7 @@ void MPIAccessTest::test_MPI_Access_IProbe() { 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 ) { @@ -138,10 +139,10 @@ void MPIAccessTest::test_MPI_Access_IProbe() { << "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.testAll(10,RequestId,flag) ; @@ -151,10 +152,10 @@ void MPIAccessTest::test_MPI_Access_IProbe() { 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() ; @@ -162,7 +163,7 @@ void MPIAccessTest::test_MPI_Access_IProbe() { // MPI_Finalize(); - cout << "test" << myrank << " OK" << endl ; + debugStream << "test" << myrank << " OK" << endl ; return ; }