Commit db5c4615 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

MPI refactoring: removed MpiCommunicator from the distributed grid and related classes

parent 037c8255
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ setInitialCondition( const Config::ParameterContainer& parameters,
    if(distributedIOType==Meshes::DistributedMeshes::LocalCopy)
      Meshes::DistributedMeshes::DistributedGridIO<MeshFunctionType,Meshes::DistributedMeshes::LocalCopy> ::load(inputFile, *initialData );
    synchronizer.setDistributedGrid( initialData->getMesh().getDistributedMesh() );
    synchronizer.template synchronize<CommunicatorType>( *initialData );
    synchronizer.synchronize( *initialData );
  }
  else
  {
+94 −94
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ solve( const MeshPointer& mesh,
  InterfaceMapType interfaceMap = *interfaceMapPtr;
  MeshFunctionType aux = *auxPtr;
  synchronizer.setDistributedGrid( aux.getMesh().getDistributedMesh() );
  synchronizer.template synchronize< Communicator >( aux ); //synchronize initialized overlaps
  synchronizer.synchronize( aux ); //synchronize initialized overlaps

  std::cout << "Calculating the values ..." << std::endl;
  while( iteration < this->maxIterations )
@@ -370,7 +370,7 @@ solve( const MeshPointer& mesh,
      if( CommunicatorType::isDistributed() ){
        getInfoFromNeighbours( calculatedBefore, calculateMPIAgain, mesh );

        synchronizer.template synchronize< Communicator >( aux );
        synchronizer.synchronize( aux );
      }
#endif
      if( !CommunicatorType::isDistributed() ) // If we start the solver without MPI, we need calculated 0!
+115 −115
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ solve( const MeshPointer& mesh,
  MeshFunctionType aux = *auxPtr;
  InterfaceMapType interfaceMap = * interfaceMapPtr;
  synchronizer.setDistributedGrid( aux.getMesh().getDistributedMesh() );
  synchronizer.template synchronize< Communicator >( aux ); //synchronization of intial conditions
  synchronizer.synchronize( aux ); //synchronization of intial conditions

  while( iteration < this->maxIterations )
  {
@@ -360,7 +360,7 @@ solve( const MeshPointer& mesh,
        getInfoFromNeighbours( calculatedBefore, calculateMPIAgain, mesh );

        // synchronizate the overlaps
        synchronizer.template synchronize< Communicator >( aux );
        synchronizer.synchronize( aux );

      }
#endif
+11 −12
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@

namespace TNL {
namespace Functions {
template <  typename CommunicatorType,
            typename MeshFunctionType,
template <  typename MeshFunctionType,
            typename OutMesh,
            typename OutDof,
            int outDimension=OutMesh::getMeshDimension(),
@@ -44,7 +43,7 @@ class CutMeshFunction
            auto toDistributedGrid=outMesh.getDistributedMesh();
            TNL_ASSERT_TRUE(toDistributedGrid!=nullptr,"You are trying cut distributed meshfunction, but output grid is not set up for distribution");

            inCut=toDistributedGrid-> template SetupByCut<CommunicatorType>(*fromDistributedGrid,savedDimensions,reducedDimensions,fixedIndexs);
            inCut=toDistributedGrid->SetupByCut(*fromDistributedGrid,savedDimensions,reducedDimensions,fixedIndexs);
            if(inCut)
            {
               toDistributedGrid->setupGrid(outMesh);
+39 −42
Original line number Diff line number Diff line
@@ -11,8 +11,6 @@

#pragma once

#include <iostream>

#include <TNL/Meshes/Grid.h>
#include <TNL/Logger.h>
#include <TNL/Meshes/DistributedMeshes/Directions.h>
@@ -58,7 +56,6 @@ class DistributedMesh< Grid< Dimension, Real, Device, Index > >

      const CoordinatesType& getDomainDecomposition() const;

      template< typename CommunicatorType >
      void setGlobalGrid( const GridType& globalGrid );

      const GridType& getGlobalGrid() const;
@@ -105,8 +102,8 @@ class DistributedMesh< Grid< Dimension, Real, Device, Index > >
      const PointType& getSpaceSteps() const;

      //aka MPI-communcicator
      void setCommunicationGroup(void * group);
      void * getCommunicationGroup() const;
      void setCommunicationGroup(MPI_Comm group);
      MPI_Comm getCommunicationGroup() const;

      template< int EntityDimension >
      IndexType getEntitiesCount() const;
@@ -118,7 +115,7 @@ class DistributedMesh< Grid< Dimension, Real, Device, Index > >

      const int* getPeriodicNeighbors() const;

      template<typename CommunicatorType, typename DistributedGridType>
      template<typename DistributedGridType>
      bool SetupByCut(DistributedGridType &inputDistributedGrid,
                 Containers::StaticVector<Dimension, int> savedDimensions,
                 Containers::StaticVector<DistributedGridType::getMeshDimension()-Dimension,int> reducedDimensions,
@@ -168,7 +165,7 @@ class DistributedMesh< Grid< Dimension, Real, Device, Index > >
      bool isSet;

      //aka MPI-communicator
      void * communicationGroup;
      MPI_Comm group;

};

Loading