From a35c7b4bea7d5cb81e172abb2c4c988f4aac392e Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Wed, 16 Feb 2022 14:33:17 +0000 Subject: [PATCH] Fix CUDA memory check for large array sizes Closes #123 --- src/cuda/CUDAStream.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cuda/CUDAStream.cu b/src/cuda/CUDAStream.cu index b467d00..778a044 100644 --- a/src/cuda/CUDAStream.cu +++ b/src/cuda/CUDAStream.cu @@ -51,7 +51,7 @@ CUDAStream::CUDAStream(const int ARRAY_SIZE, const int device_index) // Check buffers fit on the device cudaDeviceProp props; cudaGetDeviceProperties(&props, 0); - if (props.totalGlobalMem < 3*ARRAY_SIZE*sizeof(T)) + if (props.totalGlobalMem < std::size_t{3}*ARRAY_SIZE*sizeof(T)) throw std::runtime_error("Device does not have enough memory for all 3 buffers"); // Create device buffers