Commit 60ee5cd0 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

MPI refactoring: removed unit tests for MpiCommunicator and marked it as deprecated

parent cc3b9348
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ namespace Communicators {
namespace {

//! \brief MPI communicator.
class MpiCommunicator
class [[deprecated("use the functions in the TNL::MPI namespace instead")]]
MpiCommunicator
{
   public:
#ifdef HAVE_MPI
+0 −1
Original line number Diff line number Diff line
ADD_SUBDIRECTORY( Communicators )
ADD_SUBDIRECTORY( Containers )
ADD_SUBDIRECTORY( Functions )
# Matrices are included from src/CMakeLists.txt
+0 −9
Original line number Diff line number Diff line
if( ${BUILD_MPI} )
   ADD_EXECUTABLE( MpiCommunicatorTest MpiCommunicatorTest.cpp )
   TARGET_COMPILE_OPTIONS( MpiCommunicatorTest PRIVATE ${CXX_TESTS_FLAGS} )
   TARGET_LINK_LIBRARIES( MpiCommunicatorTest ${GTEST_BOTH_LIBRARIES} )

   SET( mpi_test_parameters -np 4 -H localhost:4 "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MpiCommunicatorTest${CMAKE_EXECUTABLE_SUFFIX}" )
   ADD_TEST( NAME MpiCommunicatorTest COMMAND "mpirun" ${mpi_test_parameters})

endif()
+0 −51
Original line number Diff line number Diff line
/***************************************************************************
                          MpiCommunicatorTest.h  -  description
                             -------------------
    begin                : Jul 10, 2019
    copyright            : (C) 2019 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

#ifdef HAVE_GTEST

#include "gtest/gtest.h"
#include <TNL/Communicators/MpiCommunicator.h>

using namespace TNL;
using namespace TNL::Communicators;

// test fixture for typed tests
template< typename Real >
class MpiCommunicatorTest : public ::testing::Test
{
   protected:
      using RealType = Real;
      using CommunicatorType = MpiCommunicator;
};

// types for which MpiCommunicatorTest is instantiated
using MpiCommunicatorTypes = ::testing::Types<
   short,
   int,
   long,
   float,
   double
>;

TYPED_TEST_SUITE( MpiCommunicatorTest, MpiCommunicatorTypes );

TYPED_TEST( MpiCommunicatorTest, allReduce )
{
   using RealType = typename TestFixture::RealType;
   using CommunicatorType = typename TestFixture::CommunicatorType;
   RealType a = CommunicatorType::GetRank();
   RealType b = 0;
   CommunicatorType::Allreduce( &a, &b, 1, MPI_MAX, MPI_COMM_WORLD );
   EXPECT_EQ( b, CommunicatorType::GetSize() - 1  );
}

#endif // HAVE_GTEST

#include "../main_mpi.h"
 No newline at end of file
+0 −5
Original line number Diff line number Diff line
@@ -2,13 +2,8 @@
      #include <gtest/gtest.h>
#ifdef HAVE_MPI

#include <TNL/Communicators/MpiCommunicator.h>
#include "DistributedVectorFieldIO_MPIIOTestBase.h"

using namespace TNL::Communicators;

typedef MpiCommunicator CommunicatorType;

TEST( DistributedVectorFieldIO_MPIIO, Save_1D )
{
    TestDistributedVectorFieldMPIIO<1,2,Host>::TestSave();
Loading