未验证 提交 cd1c4043 编写于 作者: Z Zeng Jinle 提交者: GitHub

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

上级 370f0345
...@@ -120,7 +120,16 @@ void* GPUAllocator::Alloc(size_t* index, size_t size) { ...@@ -120,7 +120,16 @@ void* GPUAllocator::Alloc(size_t* index, size_t size) {
gpu_alloc_size_ += size; gpu_alloc_size_ += size;
return p; return p;
} else { } 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; size_t avail, total;
platform::GpuMemoryUsage(&avail, &total); platform::GpuMemoryUsage(&avail, &total);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册