Loading src/TNL/Communicators/MpiCommunicator.h +32 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ class MpiCommunicator inline static MPI_Datatype MPIDataType( const double* ) { return MPI_DOUBLE; }; inline static MPI_Datatype MPIDataType( const long double* ) { return MPI_LONG_DOUBLE; }; // TODO: How to deal with bool using Request = MPI_Request; using CommunicationGroup = MPI_Comm; #else Loading Loading @@ -335,6 +337,36 @@ class MpiCommunicator #endif } template< typename T > static void SendReceive( T* sendData, int sendCount, int destination, int sendTag, T* receiveData, int receiveCount, int source, int receiveTag, CommunicationGroup group ) { #ifdef HAVE_MPI MPI_Status status; MPI_Sendrecv( ( void* ) sendData, sendCount, MPIDataType( sendData ), destination, sendTag, ( void* ) receiveData, receiveCount, MPIDataType( receiveData ), source, receiveTag, group, &status ); #else throw Exceptions::MPISupportMissing(); #endif } static void writeProlog( Logger& logger ) { Loading src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.h +3 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ class DistributedGrid_Base const int* getNeighbors() const; const int* getPeriodicNeighbors() const; template<typename CommunicatorType, typename DistributedGridType> bool SetupByCut(DistributedGridType &inputDistributedGrid, Containers::StaticVector<dim, int> savedDimensions, Loading src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.hpp +9 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,15 @@ getNeighbors() const return this->neighbors; } template< int dim, typename RealType, typename Device, typename Index > const int* DistributedGrid_Base< dim, RealType, Device, Index >:: getPeriodicNeighbors() const { TNL_ASSERT_TRUE(this->isSet,"DistributedGrid is not set, but used by getNeighbors"); return this->periodicNeighbors; } template< int dim, typename RealType, typename Device, typename Index > template<typename CommunicatorType, typename DistributedGridType > bool Loading src/TNL/Meshes/GridDetails/Grid2D.h +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ class Grid< 2, Real, Device, Index > : public Object void setDistMesh(DistributedMeshType * distGrid); DistributedMeshType * getDistributedMesh(void) const; DistributedMeshType * getDistributedMesh() const; //! Method for saving the object to a file as a binary data bool save( File& file ) const; Loading src/TNL/param-types.h +7 −2 Original line number Diff line number Diff line Loading @@ -20,14 +20,19 @@ String getType() { return T::getType(); }; template<> inline String getType< void >() { return String( "void" ); }; template<> inline String getType< bool >() { return String( "bool" ); }; template<> inline String getType< char >() { return String( "char" ); }; template<> inline String getType< short int >() { return String( "short int" ); }; template<> inline String getType< int >() { return String( "int" ); }; template<> inline String getType< long int >() { return String( "long int" ); }; template<> inline String getType< unsigned char >() { return String( "unsigned char" ); }; template<> inline String getType< unsigned short >() { return String( "unsigned short" ); }; template<> inline String getType< unsigned int >() { return String( "unsigned int" ); }; template<> inline String getType< unsigned long >() { return String( "unsigned long" ); }; template<> inline String getType< char >() { return String( "char" ); }; template<> inline String getType< unsigned char >() { return String( "unsigned char" ); }; template<> inline String getType< signed char >() { return String( "signed char" ); }; template<> inline String getType< float >() { return String( "float" ); }; template<> inline String getType< double >() { return String( "double" ); }; template<> inline String getType< long double >() { return String( "long double" ); }; Loading Loading
src/TNL/Communicators/MpiCommunicator.h +32 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ class MpiCommunicator inline static MPI_Datatype MPIDataType( const double* ) { return MPI_DOUBLE; }; inline static MPI_Datatype MPIDataType( const long double* ) { return MPI_LONG_DOUBLE; }; // TODO: How to deal with bool using Request = MPI_Request; using CommunicationGroup = MPI_Comm; #else Loading Loading @@ -335,6 +337,36 @@ class MpiCommunicator #endif } template< typename T > static void SendReceive( T* sendData, int sendCount, int destination, int sendTag, T* receiveData, int receiveCount, int source, int receiveTag, CommunicationGroup group ) { #ifdef HAVE_MPI MPI_Status status; MPI_Sendrecv( ( void* ) sendData, sendCount, MPIDataType( sendData ), destination, sendTag, ( void* ) receiveData, receiveCount, MPIDataType( receiveData ), source, receiveTag, group, &status ); #else throw Exceptions::MPISupportMissing(); #endif } static void writeProlog( Logger& logger ) { Loading
src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.h +3 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ class DistributedGrid_Base const int* getNeighbors() const; const int* getPeriodicNeighbors() const; template<typename CommunicatorType, typename DistributedGridType> bool SetupByCut(DistributedGridType &inputDistributedGrid, Containers::StaticVector<dim, int> savedDimensions, Loading
src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.hpp +9 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,15 @@ getNeighbors() const return this->neighbors; } template< int dim, typename RealType, typename Device, typename Index > const int* DistributedGrid_Base< dim, RealType, Device, Index >:: getPeriodicNeighbors() const { TNL_ASSERT_TRUE(this->isSet,"DistributedGrid is not set, but used by getNeighbors"); return this->periodicNeighbors; } template< int dim, typename RealType, typename Device, typename Index > template<typename CommunicatorType, typename DistributedGridType > bool Loading
src/TNL/Meshes/GridDetails/Grid2D.h +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ class Grid< 2, Real, Device, Index > : public Object void setDistMesh(DistributedMeshType * distGrid); DistributedMeshType * getDistributedMesh(void) const; DistributedMeshType * getDistributedMesh() const; //! Method for saving the object to a file as a binary data bool save( File& file ) const; Loading
src/TNL/param-types.h +7 −2 Original line number Diff line number Diff line Loading @@ -20,14 +20,19 @@ String getType() { return T::getType(); }; template<> inline String getType< void >() { return String( "void" ); }; template<> inline String getType< bool >() { return String( "bool" ); }; template<> inline String getType< char >() { return String( "char" ); }; template<> inline String getType< short int >() { return String( "short int" ); }; template<> inline String getType< int >() { return String( "int" ); }; template<> inline String getType< long int >() { return String( "long int" ); }; template<> inline String getType< unsigned char >() { return String( "unsigned char" ); }; template<> inline String getType< unsigned short >() { return String( "unsigned short" ); }; template<> inline String getType< unsigned int >() { return String( "unsigned int" ); }; template<> inline String getType< unsigned long >() { return String( "unsigned long" ); }; template<> inline String getType< char >() { return String( "char" ); }; template<> inline String getType< unsigned char >() { return String( "unsigned char" ); }; template<> inline String getType< signed char >() { return String( "signed char" ); }; template<> inline String getType< float >() { return String( "float" ); }; template<> inline String getType< double >() { return String( "double" ); }; template<> inline String getType< long double >() { return String( "long double" ); }; Loading