Print some information to stderr when a CUDA kernel fails

This commit is contained in:
Benoit Steiner 2016-02-27 20:42:57 +00:00
parent 1031b31571
commit 609b3337a7

View File

@ -211,8 +211,12 @@ struct GpuDevice {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void synchronize() const {
#if defined(__CUDACC__) && !defined(__CUDA_ARCH__)
cudaError_t err = cudaStreamSynchronize(stream_->stream());
EIGEN_UNUSED_VARIABLE(err)
assert(err == cudaSuccess);
if (err != cudaSuccess) {
std::cerr << "Error detected in CUDA stream: "
<< cudaGetErrorString(err)
<< std::endl;
assert(err == cudaSuccess);
}
#else
assert(false && "The default device should be used instead to generate kernel code");
#endif