Loading src/TNL/Communicators/MpiCommunicator.h +63 −0 Original line number Diff line number Diff line Loading @@ -431,6 +431,69 @@ std::ofstream MpiCommunicator::filestr; bool MpiCommunicator::redirect; bool MpiCommunicator::inited; #ifdef HAVE_MPI template<typename Type> class MPITypeResolver { public: static inline MPI_Datatype getType() { TNL_ASSERT_TRUE(false, "Fatal Error - Unknown MPI Type"); return MPI_INT; }; }; template<> class MPITypeResolver<char> { public:static inline MPI_Datatype getType(){return MPI_CHAR;}; }; template<> class MPITypeResolver<short int> { public:static inline MPI_Datatype getType(){return MPI_SHORT;}; }; template<> class MPITypeResolver<long int> { public:static inline MPI_Datatype getType(){return MPI_LONG;}; }; template<> class MPITypeResolver<unsigned char> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED_CHAR;}; }; template<> class MPITypeResolver<unsigned short int> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED_SHORT;}; }; template<> class MPITypeResolver<unsigned int> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED;}; }; template<> class MPITypeResolver<unsigned long int> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED_LONG;}; }; template<> class MPITypeResolver<float> { public:static inline MPI_Datatype getType(){return MPI_FLOAT;}; }; template<> class MPITypeResolver<double> { public:static inline MPI_Datatype getType(){return MPI_DOUBLE;}; }; template<> class MPITypeResolver<long double> { public:static inline MPI_Datatype getType(){return MPI_LONG_DOUBLE;}; }; #endif }//namespace Communicators } // namespace TNL Loading src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h +13 −7 Original line number Diff line number Diff line Loading @@ -185,10 +185,9 @@ class DistributedGridIO_MPIIOBase offset +=headerSize; if( std::is_same< RealType, double >::value) MPI_File_set_view(file,offset,MPI_DOUBLE,ftype,"native",MPI_INFO_NULL); /* if( std::is_same< RealType, float >::value) MPI_File_set_view(file,offset,MPI_FLOAT,ftype,"native",MPI_INFO_NULL);*/ MPI_File_set_view(file,offset, Communicators::MPITypeResolver<RealType>::getType(), ftype,"native",MPI_INFO_NULL); MPI_Status wstatus; Loading Loading @@ -216,7 +215,10 @@ class DistributedGridIO_MPIIOBase MPI_Type_create_subarray(dim, fgsize,flsize,fstarts, MPI_ORDER_C,MPI_DOUBLE,ftype); //TYP MPI_ORDER_C, Communicators::MPITypeResolver<RealType>::getType(), ftype); MPI_Type_commit(ftype); int agsize[dim]; Loading @@ -229,7 +231,9 @@ class DistributedGridIO_MPIIOBase MPI_Type_create_subarray(dim, agsize,alsize,astarts, MPI_ORDER_C,MPI_DOUBLE,atype); //TYP MPI_ORDER_C, Communicators::MPITypeResolver<RealType>::getType(), atype); MPI_Type_commit(atype); int dataCount=1; Loading Loading @@ -356,7 +360,9 @@ class DistributedGridIO_MPIIOBase offset+=headerSize; MPI_File_set_view(file,offset,MPI_DOUBLE,ftype,"native",MPI_INFO_NULL);//TYP MPI_File_set_view(file,offset, Communicators::MPITypeResolver<RealType>::getType(), ftype,"native",MPI_INFO_NULL); MPI_Status wstatus; MPI_File_read(file,(void*)data,1,atype,&wstatus); Loading Loading
src/TNL/Communicators/MpiCommunicator.h +63 −0 Original line number Diff line number Diff line Loading @@ -431,6 +431,69 @@ std::ofstream MpiCommunicator::filestr; bool MpiCommunicator::redirect; bool MpiCommunicator::inited; #ifdef HAVE_MPI template<typename Type> class MPITypeResolver { public: static inline MPI_Datatype getType() { TNL_ASSERT_TRUE(false, "Fatal Error - Unknown MPI Type"); return MPI_INT; }; }; template<> class MPITypeResolver<char> { public:static inline MPI_Datatype getType(){return MPI_CHAR;}; }; template<> class MPITypeResolver<short int> { public:static inline MPI_Datatype getType(){return MPI_SHORT;}; }; template<> class MPITypeResolver<long int> { public:static inline MPI_Datatype getType(){return MPI_LONG;}; }; template<> class MPITypeResolver<unsigned char> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED_CHAR;}; }; template<> class MPITypeResolver<unsigned short int> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED_SHORT;}; }; template<> class MPITypeResolver<unsigned int> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED;}; }; template<> class MPITypeResolver<unsigned long int> { public:static inline MPI_Datatype getType(){return MPI_UNSIGNED_LONG;}; }; template<> class MPITypeResolver<float> { public:static inline MPI_Datatype getType(){return MPI_FLOAT;}; }; template<> class MPITypeResolver<double> { public:static inline MPI_Datatype getType(){return MPI_DOUBLE;}; }; template<> class MPITypeResolver<long double> { public:static inline MPI_Datatype getType(){return MPI_LONG_DOUBLE;}; }; #endif }//namespace Communicators } // namespace TNL Loading
src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h +13 −7 Original line number Diff line number Diff line Loading @@ -185,10 +185,9 @@ class DistributedGridIO_MPIIOBase offset +=headerSize; if( std::is_same< RealType, double >::value) MPI_File_set_view(file,offset,MPI_DOUBLE,ftype,"native",MPI_INFO_NULL); /* if( std::is_same< RealType, float >::value) MPI_File_set_view(file,offset,MPI_FLOAT,ftype,"native",MPI_INFO_NULL);*/ MPI_File_set_view(file,offset, Communicators::MPITypeResolver<RealType>::getType(), ftype,"native",MPI_INFO_NULL); MPI_Status wstatus; Loading Loading @@ -216,7 +215,10 @@ class DistributedGridIO_MPIIOBase MPI_Type_create_subarray(dim, fgsize,flsize,fstarts, MPI_ORDER_C,MPI_DOUBLE,ftype); //TYP MPI_ORDER_C, Communicators::MPITypeResolver<RealType>::getType(), ftype); MPI_Type_commit(ftype); int agsize[dim]; Loading @@ -229,7 +231,9 @@ class DistributedGridIO_MPIIOBase MPI_Type_create_subarray(dim, agsize,alsize,astarts, MPI_ORDER_C,MPI_DOUBLE,atype); //TYP MPI_ORDER_C, Communicators::MPITypeResolver<RealType>::getType(), atype); MPI_Type_commit(atype); int dataCount=1; Loading Loading @@ -356,7 +360,9 @@ class DistributedGridIO_MPIIOBase offset+=headerSize; MPI_File_set_view(file,offset,MPI_DOUBLE,ftype,"native",MPI_INFO_NULL);//TYP MPI_File_set_view(file,offset, Communicators::MPITypeResolver<RealType>::getType(), ftype,"native",MPI_INFO_NULL); MPI_Status wstatus; MPI_File_read(file,(void*)data,1,atype,&wstatus); Loading