Skip to content

Commit

Permalink
report cuDNN error string
Browse files Browse the repository at this point in the history
  • Loading branch information
shelhamer committed Sep 7, 2014
1 parent e9d641d commit 490d9b8
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions include/caffe/util/cudnn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,40 @@
#define CUDNN_CHECK(condition) \
do { \
cudnnStatus_t status = condition; \
CHECK_EQ(status, CUDNN_STATUS_SUCCESS) << " cuDNN error."; \
CHECK_EQ(status, CUDNN_STATUS_SUCCESS) << " "\
<< cudnnGetErrorString(status); \
} while (0)

inline const char* cudnnGetErrorString(cudnnStatus_t status) {
switch (status) {
case CUDNN_STATUS_SUCCESS:
return "CUDNN_STATUS_SUCCESS";
case CUDNN_STATUS_NOT_INITIALIZED:
return "CUDNN_STATUS_NOT_INITIALIZED";
case CUDNN_STATUS_ALLOC_FAILED:
return "CUDNN_STATUS_ALLOC_FAILED";
case CUDNN_STATUS_BAD_PARAM:
return "CUDNN_STATUS_BAD_PARAM";
case CUDNN_STATUS_INTERNAL_ERROR:
return "CUDNN_STATUS_INTERNAL_ERROR";
case CUDNN_STATUS_INVALID_VALUE:
return "CUDNN_STATUS_INVALID_VALUE";
case CUDNN_STATUS_ARCH_MISMATCH:
return "CUDNN_STATUS_ARCH_MISMATCH";
case CUDNN_STATUS_MAPPING_ERROR:
return "CUDNN_STATUS_MAPPING_ERROR";
case CUDNN_STATUS_EXECUTION_FAILED:
return "CUDNN_STATUS_EXECUTION_FAILED";
case CUDNN_STATUS_NOT_SUPPORTED:
return "CUDNN_STATUS_NOT_SUPPORTED";
case CUDNN_STATUS_LICENSE_ERROR:
return "CUDNN_STATUS_LICENSE_ERROR";
}
return "Unknown cudnn status";
}

namespace caffe {

// TODO(cudnn): check existence, add to CUDN_CHECK
// const char* cudnnGetErrorString(curandStatus_t error);
//
namespace cudnn {

template <typename Dtype> class dataType;
Expand Down Expand Up @@ -86,6 +112,7 @@ inline void createPoolingDesc(cudnnPoolingDescriptor_t* conv,
}

} // namespace cudnn

} // namespace caffe

#endif // USE_CUDNN
Expand Down

0 comments on commit 490d9b8

Please sign in to comment.