refine err msg of allocator, test=develop (#20804)

yaoxuefeng
Zeng Jinle 6 years ago committed by GitHub
parent 370f0345b6
commit cd1c404353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -120,7 +120,16 @@ void* GPUAllocator::Alloc(size_t* index, size_t size) {
gpu_alloc_size_ += size;
return p;
} else {
PADDLE_ENFORCE_NE(cudaGetLastError(), cudaSuccess);
if (result == cudaErrorMemoryAllocation) {
result = cudaSuccess;
}
PADDLE_ENFORCE_CUDA_SUCCESS(result);
result = cudaGetLastError();
if (result == cudaErrorMemoryAllocation) {
result = cudaSuccess;
}
PADDLE_ENFORCE_CUDA_SUCCESS(result);
size_t avail, total;
platform::GpuMemoryUsage(&avail, &total);

Loading…
Cancel
Save