Loading src/TNL/MPI.h +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "MPI/DummyDefs.h" #include "MPI/getDataType.h" #include "MPI/Profiling.h" #include "MPI/selectGPU.h" #include "MPI/Wrappers.h" #include "MPI/Utils.h" Loading src/TNL/MPI/Profiling.h 0 → 100644 +25 −0 Original line number Diff line number Diff line /*************************************************************************** MPI/Profiling.h - description ------------------- begin : Jan 1, 2021 copyright : (C) 2021 by Tomas Oberhuber et al. email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #pragma once #include <TNL/Timer.h> namespace TNL { namespace MPI { inline Timer& getTimerAllreduce() { static Timer t; return t; } } // namespace MPI } // namespace TNL src/TNL/MPI/Wrappers.h +5 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <TNL/Assert.h> #include "getDataType.h" #include "Profiling.h" namespace TNL { namespace MPI { Loading Loading @@ -278,7 +279,9 @@ void Allreduce( const T* data, { #ifdef HAVE_MPI TNL_ASSERT_NE( group, NullGroup(), "Allreduce cannot be called with NullGroup" ); getTimerAllreduce().start(); MPI_Allreduce( (const void*) data, (void*) reduced_data, count, getDataType<T>(), op, group ); getTimerAllreduce().stop(); #else std::memcpy( (void*) reduced_data, (const void*) data, count * sizeof(T) ); #endif Loading @@ -293,7 +296,9 @@ void Allreduce( T* data, { #ifdef HAVE_MPI TNL_ASSERT_NE( group, NullGroup(), "Allreduce cannot be called with NullGroup" ); getTimerAllreduce().start(); MPI_Allreduce( MPI_IN_PLACE, (void*) data, count, getDataType<T>(), op, group ); getTimerAllreduce().stop(); #endif } Loading Loading
src/TNL/MPI.h +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "MPI/DummyDefs.h" #include "MPI/getDataType.h" #include "MPI/Profiling.h" #include "MPI/selectGPU.h" #include "MPI/Wrappers.h" #include "MPI/Utils.h" Loading
src/TNL/MPI/Profiling.h 0 → 100644 +25 −0 Original line number Diff line number Diff line /*************************************************************************** MPI/Profiling.h - description ------------------- begin : Jan 1, 2021 copyright : (C) 2021 by Tomas Oberhuber et al. email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #pragma once #include <TNL/Timer.h> namespace TNL { namespace MPI { inline Timer& getTimerAllreduce() { static Timer t; return t; } } // namespace MPI } // namespace TNL
src/TNL/MPI/Wrappers.h +5 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <TNL/Assert.h> #include "getDataType.h" #include "Profiling.h" namespace TNL { namespace MPI { Loading Loading @@ -278,7 +279,9 @@ void Allreduce( const T* data, { #ifdef HAVE_MPI TNL_ASSERT_NE( group, NullGroup(), "Allreduce cannot be called with NullGroup" ); getTimerAllreduce().start(); MPI_Allreduce( (const void*) data, (void*) reduced_data, count, getDataType<T>(), op, group ); getTimerAllreduce().stop(); #else std::memcpy( (void*) reduced_data, (const void*) data, count * sizeof(T) ); #endif Loading @@ -293,7 +296,9 @@ void Allreduce( T* data, { #ifdef HAVE_MPI TNL_ASSERT_NE( group, NullGroup(), "Allreduce cannot be called with NullGroup" ); getTimerAllreduce().start(); MPI_Allreduce( MPI_IN_PLACE, (void*) data, count, getDataType<T>(), op, group ); getTimerAllreduce().stop(); #endif } Loading