Give a better message when out of memory in allocating SliceUnion

This commit is contained in:
Gallo Alejandro 2022-09-12 19:39:38 +02:00
parent 5678ac0d9c
commit a5bb8f3d9c

View File

@ -412,10 +412,17 @@ template <typename F=double>
for (auto& ptr: sliceBuffers) {
#if defined(HAVE_CUDA)
const CUresult error =
cuMemAlloc(&ptr, sizeof(F) * sources[0].size());
if (ptr == 0UL) {
throw "UNSUFICCIENT MEMORY ON THE GRAPHIC CARD FOR FREE POINTERS";
}
if (error != CUDA_SUCCESS) {
std::stringstream s;
s << "Error allocating memory for slice buffers "
<< "code " << error << "\n";
throw s.str();
}
#else
ptr = (DataPtr<F>)malloc(sizeof(F) * sources[0].size());
#endif