Loading install +3 −2 Original line number Diff line number Diff line Loading @@ -108,8 +108,9 @@ then fi if test x`python src/Tools/python-path-test.py 2> /dev/null` != xOK; PYTHON_TEST="`python src/Tools/python-path-test.py 2> /dev/null`" echo "xxxxx ${PYTHON_TEST} xxxxx\n" if test PYTHON_TEST != "xOK"; then source ${BUILD_PREFIX}/python-version echo "" Loading src/TNL/Devices/Host.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -74,11 +74,11 @@ int Host::getThreadIdx() void Host::configSetup( Config::ConfigDescription& config, const String& prefix ) { #ifdef HAVE_OPENMP config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP.", true ); config.addEntry< int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() ); config.addEntry< bool >( prefix + "openmp-enabled", "Enable support of OpenMP.", true ); config.addEntry< int >( prefix + "openmp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() ); #else config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP (not supported on this system).", false ); config.addEntry< int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 ); config.addEntry< bool >( prefix + "openmp-enabled", "Enable support of OpenMP (not supported on this system).", false ); config.addEntry< int >( prefix + "openmp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 ); #endif } Loading @@ -86,11 +86,11 @@ void Host::configSetup( Config::ConfigDescription& config, const String& prefix bool Host::setup( const Config::ParameterContainer& parameters, const String& prefix ) { if( parameters.getParameter< bool >( prefix + "omp-enabled" ) ) if( parameters.getParameter< bool >( prefix + "openmp-enabled" ) ) enableOMP(); else disableOMP(); setMaxThreadsCount( parameters.getParameter< int >( prefix + "omp-max-threads" ) ); setMaxThreadsCount( parameters.getParameter< int >( prefix + "openmp-max-threads" ) ); return true; } Loading src/TNL/Solvers/ODE/Merson.h +2 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ class Merson : public ExplicitSolver< Problem > * This controls the accuracy of the solver */ RealType adaptivity; Containers::Vector< RealType, DeviceType, IndexType > openMPErrorEstimateBuffer; }; } // namespace ODE Loading src/TNL/Solvers/ODE/Merson_impl.h +21 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ #include <TNL/Devices/Cuda.h> #include <TNL/Config/ParameterContainer.h> #include "Merson.h" namespace TNL { namespace Solvers { namespace ODE { Loading Loading @@ -85,6 +87,10 @@ template< typename Problem > Merson< Problem > :: Merson() : adaptivity( 0.00001 ) { if( std::is_same< DeviceType, Devices::Host >::value ) { this->openMPErrorEstimateBuffer.setSize( std::max( 1, Devices::Host::getMaxThreadsCount() ) ); } }; template< typename Problem > Loading Loading @@ -378,7 +384,11 @@ typename Problem :: RealType Merson< Problem > :: computeError( const RealType t RealType eps( 0.0 ), maxEps( 0.0 ); if( std::is_same< DeviceType, Devices::Host >::value ) { // TODO: implement OpenMP support this->openMPErrorEstimateBuffer.setValue( 0.0 ); #pragma omp parallel if( Devices::Host::isOMPEnabled() ) { RealType localEps( 0.0 ); #pragma omp for for( IndexType i = 0; i < size; i ++ ) { RealType err = ( RealType ) ( tau / 3.0 * Loading @@ -386,8 +396,11 @@ typename Problem :: RealType Merson< Problem > :: computeError( const RealType t -0.9 * _k3[ i ] + 0.8 * _k4[ i ] + -0.1 * _k5[ i ] ) ); eps = max( eps, err ); localEps = max( localEps, err ); } this->openMPErrorEstimateBuffer[ Devices::Host::getThreadIdx() ] = localEps; } eps = this->openMPErrorEstimateBuffer.max(); } if( std::is_same< DeviceType, Devices::Cuda >::value ) { Loading Loading
install +3 −2 Original line number Diff line number Diff line Loading @@ -108,8 +108,9 @@ then fi if test x`python src/Tools/python-path-test.py 2> /dev/null` != xOK; PYTHON_TEST="`python src/Tools/python-path-test.py 2> /dev/null`" echo "xxxxx ${PYTHON_TEST} xxxxx\n" if test PYTHON_TEST != "xOK"; then source ${BUILD_PREFIX}/python-version echo "" Loading
src/TNL/Devices/Host.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -74,11 +74,11 @@ int Host::getThreadIdx() void Host::configSetup( Config::ConfigDescription& config, const String& prefix ) { #ifdef HAVE_OPENMP config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP.", true ); config.addEntry< int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() ); config.addEntry< bool >( prefix + "openmp-enabled", "Enable support of OpenMP.", true ); config.addEntry< int >( prefix + "openmp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() ); #else config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP (not supported on this system).", false ); config.addEntry< int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 ); config.addEntry< bool >( prefix + "openmp-enabled", "Enable support of OpenMP (not supported on this system).", false ); config.addEntry< int >( prefix + "openmp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 ); #endif } Loading @@ -86,11 +86,11 @@ void Host::configSetup( Config::ConfigDescription& config, const String& prefix bool Host::setup( const Config::ParameterContainer& parameters, const String& prefix ) { if( parameters.getParameter< bool >( prefix + "omp-enabled" ) ) if( parameters.getParameter< bool >( prefix + "openmp-enabled" ) ) enableOMP(); else disableOMP(); setMaxThreadsCount( parameters.getParameter< int >( prefix + "omp-max-threads" ) ); setMaxThreadsCount( parameters.getParameter< int >( prefix + "openmp-max-threads" ) ); return true; } Loading
src/TNL/Solvers/ODE/Merson.h +2 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ class Merson : public ExplicitSolver< Problem > * This controls the accuracy of the solver */ RealType adaptivity; Containers::Vector< RealType, DeviceType, IndexType > openMPErrorEstimateBuffer; }; } // namespace ODE Loading
src/TNL/Solvers/ODE/Merson_impl.h +21 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ #include <TNL/Devices/Cuda.h> #include <TNL/Config/ParameterContainer.h> #include "Merson.h" namespace TNL { namespace Solvers { namespace ODE { Loading Loading @@ -85,6 +87,10 @@ template< typename Problem > Merson< Problem > :: Merson() : adaptivity( 0.00001 ) { if( std::is_same< DeviceType, Devices::Host >::value ) { this->openMPErrorEstimateBuffer.setSize( std::max( 1, Devices::Host::getMaxThreadsCount() ) ); } }; template< typename Problem > Loading Loading @@ -378,7 +384,11 @@ typename Problem :: RealType Merson< Problem > :: computeError( const RealType t RealType eps( 0.0 ), maxEps( 0.0 ); if( std::is_same< DeviceType, Devices::Host >::value ) { // TODO: implement OpenMP support this->openMPErrorEstimateBuffer.setValue( 0.0 ); #pragma omp parallel if( Devices::Host::isOMPEnabled() ) { RealType localEps( 0.0 ); #pragma omp for for( IndexType i = 0; i < size; i ++ ) { RealType err = ( RealType ) ( tau / 3.0 * Loading @@ -386,8 +396,11 @@ typename Problem :: RealType Merson< Problem > :: computeError( const RealType t -0.9 * _k3[ i ] + 0.8 * _k4[ i ] + -0.1 * _k5[ i ] ) ); eps = max( eps, err ); localEps = max( localEps, err ); } this->openMPErrorEstimateBuffer[ Devices::Host::getThreadIdx() ] = localEps; } eps = this->openMPErrorEstimateBuffer.max(); } if( std::is_same< DeviceType, Devices::Cuda >::value ) { Loading