Salome HOME
MPIAccessDEC tests cleanup.
[modules/med.git] / src / ParaMEDMEMTest / MPIAccessDECTest.hxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _MPIACCESSDECTEST_HXX_
21 #define _MPIACCESSDECTEST_HXX_
22
23 #include <cppunit/extensions/HelperMacros.h>
24
25 #include <set>
26 #include <string>
27 #include <iostream>
28 #include "mpi.h"
29
30 // (ABN]: too many text output in the MPIAccesTest - this renders
31 // the analysis complicated:
32 #define MPI_ACCESS_VERBOSE 0
33 #define debugStream \
34     if (!MPI_ACCESS_VERBOSE) {} \
35     else std::cout
36
37 class MPIAccessDECTest : public CppUnit::TestFixture
38 {
39   CPPUNIT_TEST_SUITE( MPIAccessDECTest );
40   //  CPPUNIT_TEST( test_AllToAllDECSynchronousPointToPoint ) ;
41   CPPUNIT_TEST( test_AllToAllDECAsynchronousPointToPoint ) ;
42   //CPPUNIT_TEST( test_AllToAllvDECSynchronousPointToPoint ) ;
43   CPPUNIT_TEST( test_AllToAllvDECAsynchronousPointToPoint ) ;
44   //CPPUNIT_TEST( test_AllToAllTimeDECSynchronousPointToPoint ) ;
45   CPPUNIT_TEST( test_AllToAllTimeDECAsynchronousPointToPoint ) ;
46   CPPUNIT_TEST( test_AllToAllvTimeDECSynchronousNative ) ;
47   //CPPUNIT_TEST( test_AllToAllvTimeDECSynchronousPointToPoint ) ;
48   CPPUNIT_TEST( test_AllToAllvTimeDECAsynchronousPointToPoint ) ;
49   //CPPUNIT_TEST( test_AllToAllvTimeDoubleDECSynchronousPointToPoint ) ;
50   CPPUNIT_TEST( test_AllToAllvTimeDoubleDECAsynchronousPointToPoint ) ;
51   CPPUNIT_TEST_SUITE_END();
52   
53
54 public:
55  
56   MPIAccessDECTest():CppUnit::TestFixture(){}
57   ~MPIAccessDECTest(){}  
58   void setUp(){}
59   void tearDown(){}
60   void test_AllToAllDECSynchronousPointToPoint() ;
61   void test_AllToAllDECAsynchronousPointToPoint() ;
62   void test_AllToAllvDECSynchronousPointToPoint() ;
63   void test_AllToAllvDECAsynchronousPointToPoint() ;
64   void test_AllToAllTimeDECSynchronousPointToPoint() ;
65   void test_AllToAllTimeDECAsynchronousPointToPoint() ;
66   void test_AllToAllvTimeDECSynchronousNative() ;
67   void test_AllToAllvTimeDECSynchronousPointToPoint() ;
68   void test_AllToAllvTimeDECAsynchronousPointToPoint() ;
69   void test_AllToAllvTimeDoubleDECSynchronousPointToPoint() ;
70   void test_AllToAllvTimeDoubleDECAsynchronousPointToPoint() ;
71
72 private:
73   void test_AllToAllDEC( bool Asynchronous ) ;
74   void test_AllToAllvDEC( bool Asynchronous ) ;
75   void test_AllToAllTimeDEC( bool Asynchronous ) ;
76   void test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINative ) ;
77   void test_AllToAllvTimeDoubleDEC( bool Asynchronous ) ;
78   };
79
80 // to automatically remove temporary files from disk
81 class MPIAccessDECTest_TmpFilesRemover
82 {
83 public:
84   MPIAccessDECTest_TmpFilesRemover() {}
85   ~MPIAccessDECTest_TmpFilesRemover();
86   bool Register(const std::string theTmpFile);
87
88 private:
89   std::set<std::string> myTmpFiles;
90 };
91
92 /*!
93  *  Tool to print array to stream.
94  */
95 template<class T>
96 void MPIAccessDECTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
97 {
98   stream << text << ": {";
99   if (length > 0) {
100     stream << array[0];
101     for (int i = 1; i < length; i++) {
102       stream << ", " << array[i];
103     }
104   }
105   stream << "}" << std::endl;
106 };
107
108 #endif