00001 // Copyright (C) 2007-2011 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 _MPIACCESSTEST_HXX_ 00021 #define _MPIACCESSTEST_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 MPIAccessTest : public CppUnit::TestFixture 00032 { 00033 CPPUNIT_TEST_SUITE( MPIAccessTest ); 00034 CPPUNIT_TEST( test_MPI_Access_Send_Recv ) ; 00035 CPPUNIT_TEST( test_MPI_Access_Cyclic_Send_Recv ) ; 00036 CPPUNIT_TEST( test_MPI_Access_SendRecv ) ; 00037 CPPUNIT_TEST( test_MPI_Access_ISend_IRecv ) ; 00038 CPPUNIT_TEST( test_MPI_Access_Cyclic_ISend_IRecv ) ; 00039 CPPUNIT_TEST( test_MPI_Access_ISendRecv ) ; 00040 CPPUNIT_TEST( test_MPI_Access_Probe ) ; 00041 CPPUNIT_TEST( test_MPI_Access_IProbe ) ; 00042 CPPUNIT_TEST( test_MPI_Access_Cancel ) ; 00043 CPPUNIT_TEST( test_MPI_Access_Send_Recv_Length ) ; 00044 CPPUNIT_TEST( test_MPI_Access_ISend_IRecv_Length ) ; 00045 CPPUNIT_TEST( test_MPI_Access_ISend_IRecv_Length_1 ) ; 00046 CPPUNIT_TEST( test_MPI_Access_Time ) ; 00047 CPPUNIT_TEST( test_MPI_Access_Time_0 ) ; 00048 CPPUNIT_TEST( test_MPI_Access_ISend_IRecv_BottleNeck ) ; 00049 CPPUNIT_TEST_SUITE_END(); 00050 00051 00052 public: 00053 00054 MPIAccessTest():CppUnit::TestFixture(){} 00055 ~MPIAccessTest(){} 00056 void setUp(){} 00057 void tearDown(){} 00058 void test_MPI_Access_Send_Recv() ; 00059 void test_MPI_Access_Cyclic_Send_Recv() ; 00060 void test_MPI_Access_SendRecv() ; 00061 void test_MPI_Access_ISend_IRecv() ; 00062 void test_MPI_Access_Cyclic_ISend_IRecv() ; 00063 void test_MPI_Access_ISendRecv() ; 00064 void test_MPI_Access_Probe() ; 00065 void test_MPI_Access_IProbe() ; 00066 void test_MPI_Access_Cancel() ; 00067 void test_MPI_Access_Send_Recv_Length() ; 00068 void test_MPI_Access_ISend_IRecv_Length() ; 00069 void test_MPI_Access_ISend_IRecv_Length_1() ; 00070 void test_MPI_Access_Time() ; 00071 void test_MPI_Access_Time_0() ; 00072 void test_MPI_Access_ISend_IRecv_BottleNeck() ; 00073 00074 private: 00075 }; 00076 00077 // to automatically remove temporary files from disk 00078 class MPIAccessTest_TmpFilesRemover 00079 { 00080 public: 00081 MPIAccessTest_TmpFilesRemover() {} 00082 ~MPIAccessTest_TmpFilesRemover(); 00083 bool Register(const std::string theTmpFile); 00084 00085 private: 00086 std::set<std::string> myTmpFiles; 00087 }; 00088 00092 template<class T> 00093 void MPIAccessTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text) 00094 { 00095 stream << text << ": {"; 00096 if (length > 0) { 00097 stream << array[0]; 00098 for (int i = 1; i < length; i++) { 00099 stream << ", " << array[i]; 00100 } 00101 } 00102 stream << "}" << std::endl; 00103 }; 00104 00105 #endif