Salome HOME
Compilation under Windows
[tools/medcoupling.git] / src / ParaMEDMEMTest / test_MPI_Access_IProbe.cxx
index 92fdcf2f2a6e2db2897f3b5ef9a1e7a17f9e1cc8..46c391ee14a507c4c8cde39d51e754614627feb9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  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
 #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 ;
 }