Back to index

salome-med  6.5.0
MPIAccessDECTest.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef _MPIACCESSDECTEST_HXX_
00021 #define _MPIACCESSDECTEST_HXX_
00022 
00023 #include <cppunit/extensions/HelperMacros.h>
00024 
00025 #include <set>
00026 #include <string>
00027 #include <iostream>
00028 #include "mpi.h"
00029 
00030 
00031 class MPIAccessDECTest : public CppUnit::TestFixture
00032 {
00033   CPPUNIT_TEST_SUITE( MPIAccessDECTest );
00034   //  CPPUNIT_TEST( test_AllToAllDECSynchronousPointToPoint ) ;
00035   CPPUNIT_TEST( test_AllToAllDECAsynchronousPointToPoint ) ;
00036   //CPPUNIT_TEST( test_AllToAllvDECSynchronousPointToPoint ) ;
00037   CPPUNIT_TEST( test_AllToAllvDECAsynchronousPointToPoint ) ;
00038   //CPPUNIT_TEST( test_AllToAllTimeDECSynchronousPointToPoint ) ;
00039   CPPUNIT_TEST( test_AllToAllTimeDECAsynchronousPointToPoint ) ;
00040   CPPUNIT_TEST( test_AllToAllvTimeDECSynchronousNative ) ;
00041   //CPPUNIT_TEST( test_AllToAllvTimeDECSynchronousPointToPoint ) ;
00042   CPPUNIT_TEST( test_AllToAllvTimeDECAsynchronousPointToPoint ) ;
00043   //CPPUNIT_TEST( test_AllToAllvTimeDoubleDECSynchronousPointToPoint ) ;
00044   CPPUNIT_TEST( test_AllToAllvTimeDoubleDECAsynchronousPointToPoint ) ;
00045   CPPUNIT_TEST_SUITE_END();
00046   
00047 
00048 public:
00049  
00050   MPIAccessDECTest():CppUnit::TestFixture(){}
00051   ~MPIAccessDECTest(){}  
00052   void setUp(){}
00053   void tearDown(){}
00054   void test_AllToAllDECSynchronousPointToPoint() ;
00055   void test_AllToAllDECAsynchronousPointToPoint() ;
00056   void test_AllToAllvDECSynchronousPointToPoint() ;
00057   void test_AllToAllvDECAsynchronousPointToPoint() ;
00058   void test_AllToAllTimeDECSynchronousPointToPoint() ;
00059   void test_AllToAllTimeDECAsynchronousPointToPoint() ;
00060   void test_AllToAllvTimeDECSynchronousNative() ;
00061   void test_AllToAllvTimeDECSynchronousPointToPoint() ;
00062   void test_AllToAllvTimeDECAsynchronousPointToPoint() ;
00063   void test_AllToAllvTimeDoubleDECSynchronousPointToPoint() ;
00064   void test_AllToAllvTimeDoubleDECAsynchronousPointToPoint() ;
00065 
00066 private:
00067   void test_AllToAllDEC( bool Asynchronous ) ;
00068   void test_AllToAllvDEC( bool Asynchronous ) ;
00069   void test_AllToAllTimeDEC( bool Asynchronous ) ;
00070   void test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINative ) ;
00071   void test_AllToAllvTimeDoubleDEC( bool Asynchronous ) ;
00072   };
00073 
00074 // to automatically remove temporary files from disk
00075 class MPIAccessDECTest_TmpFilesRemover
00076 {
00077 public:
00078   MPIAccessDECTest_TmpFilesRemover() {}
00079   ~MPIAccessDECTest_TmpFilesRemover();
00080   bool Register(const std::string theTmpFile);
00081 
00082 private:
00083   std::set<std::string> myTmpFiles;
00084 };
00085 
00089 template<class T>
00090 void MPIAccessDECTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
00091 {
00092   stream << text << ": {";
00093   if (length > 0) {
00094     stream << array[0];
00095     for (int i = 1; i < length; i++) {
00096       stream << ", " << array[i];
00097     }
00098   }
00099   stream << "}" << std::endl;
00100 };
00101 
00102 #endif