Fix CUDA memory check for large array sizes

Closes #123
This commit is contained in:
Tom Deakin 2022-02-16 14:33:17 +00:00
parent e21134d538
commit a35c7b4bea

View File

@ -51,7 +51,7 @@ CUDAStream<T>::CUDAStream(const int ARRAY_SIZE, const int device_index)
// Check buffers fit on the device // Check buffers fit on the device
cudaDeviceProp props; cudaDeviceProp props;
cudaGetDeviceProperties(&props, 0); 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"); throw std::runtime_error("Device does not have enough memory for all 3 buffers");
// Create device buffers // Create device buffers