context gpu: better error catching

This commit is contained in:
Yangqing Jia
2015-12-14 13:59:28 -08:00
parent 73f3daf736
commit 3b0cc79465

View File

@ -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;