mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
context gpu: better error catching
This commit is contained in:
@ -56,9 +56,11 @@ class CUDAContext {
|
||||
}
|
||||
|
||||
inline bool FinishDeviceComputation() {
|
||||
cudaError_t error = cudaStreamSynchronize(cuda_stream_);
|
||||
cudaStreamSynchronize(cuda_stream_);
|
||||
cudaError_t error = cudaGetLastError();
|
||||
if (error != cudaSuccess) {
|
||||
CAFFE_LOG_ERROR << cudaGetErrorString(error);
|
||||
CAFFE_LOG_ERROR << "Encountered CUDA error: "
|
||||
<< cudaGetErrorString(error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user