diff --git a/src/TNL/Devices/Cuda.cpp b/src/TNL/Devices/Cuda.cpp index 30ce841c4c6b428590325d9b5a31cf7500c1c595..64a7ee1e9fe9bf0d45b2fe57110accaa212848d8 100644 --- a/src/TNL/Devices/Cuda.cpp +++ b/src/TNL/Devices/Cuda.cpp @@ -38,11 +38,6 @@ int Cuda::getNumberOfGrids( const int blocks, return roundUpDivision( blocks, gridSize ); } -/*size_t Cuda::getFreeMemory() -{ - -}*/ - void Cuda::configSetup( Config::ConfigDescription& config, const String& prefix ) { diff --git a/src/TNL/Devices/Cuda.h b/src/TNL/Devices/Cuda.h index 71a372c9f80dd47276e7d88407470d449b00cb43..23f2f342eac8993b6e0099ce4678cab6bf64b5cb 100644 --- a/src/TNL/Devices/Cuda.h +++ b/src/TNL/Devices/Cuda.h @@ -60,8 +60,6 @@ class Cuda static int getNumberOfGrids( const int blocks, const int gridSize = getMaxGridSize() ); - static size_t getFreeMemory(); - template< typename ObjectType > static ObjectType* passToDevice( const ObjectType& object ); diff --git a/src/TNL/Devices/CudaDeviceInfo.cpp b/src/TNL/Devices/CudaDeviceInfo.cpp index 93061f8bd5ff1817c02f35b654de78f671f8c009..3a4fc166741651c9a0837a60c8142d3d9f449e57 100644 --- a/src/TNL/Devices/CudaDeviceInfo.cpp +++ b/src/TNL/Devices/CudaDeviceInfo.cpp @@ -64,6 +64,13 @@ getGlobalMemory( int deviceNum ) return 0; } +size_t +CudaDeviceInfo:: +getFreeGlobalMemory() +{ + return 0; +} + int CudaDeviceInfo:: getMemoryClockRate( int deviceNum ) diff --git a/src/TNL/Devices/CudaDeviceInfo.cu b/src/TNL/Devices/CudaDeviceInfo.cu index 390984f836ed0b894a0e9bfecdb0a29b93804b59..452080f05742105bfba688dc8646b9ff9efeb0a4 100644 --- a/src/TNL/Devices/CudaDeviceInfo.cu +++ b/src/TNL/Devices/CudaDeviceInfo.cu @@ -81,6 +81,16 @@ getGlobalMemory( int deviceNum ) return properties.totalGlobalMem; } +size_t +CudaDeviceInfo:: +getFreeGlobalMemory() +{ + size_t free = 0; + size_t total = 0; + cudaMemGetInfo( &free, &total ); + return free; +} + int CudaDeviceInfo:: getMemoryClockRate( int deviceNum ) diff --git a/src/TNL/Devices/CudaDeviceInfo.h b/src/TNL/Devices/CudaDeviceInfo.h index 3bc7475727faee79b016a4d881aee36cc36b8973..c98f539572f387c104d9f7478eb86a86a808e735 100644 --- a/src/TNL/Devices/CudaDeviceInfo.h +++ b/src/TNL/Devices/CudaDeviceInfo.h @@ -34,6 +34,8 @@ class CudaDeviceInfo static size_t getGlobalMemory( int deviceNum ); + static size_t getFreeGlobalMemory(); + static int getMemoryClockRate( int deviceNum ); static bool getECCEnabled( int deviceNum );