diff --git a/src/TNL/Devices/Cuda.h b/src/TNL/Devices/Cuda.h index e1dd264b4c25e92180c8baa3a49a2c8c116444c7..2b3bf8c6660b1f4e4c2d7310c24f25ea047beea6 100644 --- a/src/TNL/Devices/Cuda.h +++ b/src/TNL/Devices/Cuda.h @@ -20,13 +20,29 @@ namespace Devices { class Cuda { public: - static inline void configSetup( Config::ConfigDescription& config, const String& prefix = "" ); + static inline void configSetup( Config::ConfigDescription& config, const String& prefix = "" ) + { +#ifdef HAVE_CUDA + config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device to run the computation.", 0 ); +#else + config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device to run the computation (not supported on this system).", 0 ); +#endif + } static inline bool setup( const Config::ParameterContainer& parameters, - const String& prefix = "" ); + const String& prefix = "" ) + { +#ifdef HAVE_CUDA + int cudaDevice = parameters.getParameter< int >( prefix + "cuda-device" ); + if( cudaSetDevice( cudaDevice ) != cudaSuccess ) + { + std::cerr << "I cannot activate CUDA device number " << cudaDevice << "." << std::endl; + return false; + } +#endif + return true; + } }; } // namespace Devices } // namespace TNL - -#include <TNL/Devices/Cuda_impl.h> diff --git a/src/TNL/Devices/Cuda_impl.h b/src/TNL/Devices/Cuda_impl.h deleted file mode 100644 index ae6bbcd178c20f48e9ac5a55066b81b7beb2d824..0000000000000000000000000000000000000000 --- a/src/TNL/Devices/Cuda_impl.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - Cuda_impl.h - description - ------------------- - begin : Jan 21, 2014 - copyright : (C) 2014 by Tomas Oberhuber - email : tomas.oberhuber@fjfi.cvut.cz - ***************************************************************************/ - -/* See Copyright Notice in tnl/Copyright */ - -#pragma once - -#include <iostream> - -#include <TNL/Math.h> -#include <TNL/Devices/Cuda.h> -#include <TNL/Cuda/DeviceInfo.h> -#include <TNL/Exceptions/CudaBadAlloc.h> -#include <TNL/Exceptions/CudaSupportMissing.h> -#include <TNL/Exceptions/CudaRuntimeError.h> -#include <TNL/Pointers/SmartPointersRegister.h> - -namespace TNL { -namespace Devices { - -inline void -Cuda::configSetup( Config::ConfigDescription& config, - const String& prefix ) -{ -#ifdef HAVE_CUDA - config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device to run the computation.", 0 ); -#else - config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device to run the computation (not supported on this system).", 0 ); -#endif -} - -inline bool -Cuda::setup( const Config::ParameterContainer& parameters, - const String& prefix ) -{ -#ifdef HAVE_CUDA - int cudaDevice = parameters.getParameter< int >( prefix + "cuda-device" ); - if( cudaSetDevice( cudaDevice ) != cudaSuccess ) - { - std::cerr << "I cannot activate CUDA device number " << cudaDevice << "." << std::endl; - return false; - } - Pointers::getSmartPointersSynchronizationTimer< Devices::Cuda >().reset(); - Pointers::getSmartPointersSynchronizationTimer< Devices::Cuda >().stop(); -#endif - return true; -} - -} // namespace Devices -} // namespace TNL