1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 15:55:37 +00:00

Diagnostics on memory alloc fail

This commit is contained in:
paboyle 2018-06-27 21:26:20 +01:00
parent dd891f5e3b
commit 7f45222924

View File

@ -170,8 +170,10 @@ public:
// Unified (managed) memory
////////////////////////////////////
if ( ptr == (_Tp *) NULL ) {
if( cudaMallocManaged((void **)&ptr,bytes) != cudaSuccess ) {
auto err = cudaMallocManaged((void **)&ptr,bytes);
if( err != cudaSuccess ) {
ptr = (_Tp *) NULL;
std::cerr << " cudaMallocManaged failed for " << bytes<<" bytes " <<cudaGetErrorString(err)<< std::endl;
assert(0);
}
}