Skip to content
Snippets Groups Projects
Commit f77a6d82 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added constexpr to some Cuda methods

parent 3fd133eb
No related branches found
No related tags found
No related merge requests found
......@@ -26,11 +26,6 @@ String Cuda::getDeviceType()
return String( "Cuda" );
}
int Cuda::getGPUTransferBufferSize()
{
return 1 << 20;
}
int Cuda::getNumberOfBlocks( const int threads,
const int blockSize )
{
......
......@@ -38,11 +38,15 @@ class Cuda
static String getDeviceType();
__cuda_callable__ static inline int getMaxGridSize();
__cuda_callable__ static inline constexpr int getMaxGridSize();
__cuda_callable__ static inline int getMaxBlockSize();
__cuda_callable__ static inline constexpr int getMaxBlockSize();
__cuda_callable__ static inline int getWarpSize();
__cuda_callable__ static inline constexpr int getWarpSize();
__cuda_callable__ static inline constexpr int getNumberOfSharedMemoryBanks();
static inline constexpr int getGPUTransferBufferSize();
#ifdef HAVE_CUDA
static int getDeviceId();
......@@ -51,10 +55,6 @@ class Cuda
__device__ static Index getGlobalThreadIdx( const Index gridIdx = 0 );
#endif
__cuda_callable__ static inline int getNumberOfSharedMemoryBanks();
static int getGPUTransferBufferSize();
static int getNumberOfBlocks( const int threads,
const int blockSize );
......
......@@ -16,26 +16,38 @@ namespace TNL {
namespace Devices {
__cuda_callable__
inline int Cuda::getMaxGridSize()
inline constexpr int Cuda::getMaxGridSize()
{
// TODO: make it preprocessor macro constant defined in tnlConfig
return 65535;
};
__cuda_callable__
inline int Cuda::getMaxBlockSize()
inline constexpr int Cuda::getMaxBlockSize()
{
// TODO: make it preprocessor macro constant defined in tnlConfig
return 1024;
};
__cuda_callable__
inline int Cuda::getWarpSize()
inline constexpr int Cuda::getWarpSize()
{
// TODO: make it preprocessor macro constant defined in tnlConfig
return 32;
}
__cuda_callable__
inline constexpr int Cuda::getNumberOfSharedMemoryBanks()
{
// TODO: make it preprocessor macro constant defined in tnlConfig
return 32;
}
inline constexpr int Cuda::getGPUTransferBufferSize()
{
return 1 << 20;
}
#ifdef HAVE_CUDA
template< typename Index >
__device__ Index Cuda::getGlobalThreadIdx( const Index gridIdx )
......@@ -45,13 +57,6 @@ __device__ Index Cuda::getGlobalThreadIdx( const Index gridIdx )
#endif
__cuda_callable__
inline int Cuda::getNumberOfSharedMemoryBanks()
{
// TODO: make it preprocessor macro constant defined in tnlConfig
return 32;
}
template< typename ObjectType >
ObjectType* Cuda::passToDevice( const ObjectType& object )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment