问题描述
CUDA运行时有一个方便的函数 cudaGetErrorString(cudaError_t error)
将错误枚举转换为可读的字符串。 cudaGetErrorString
用于许多人用于CUDA错误处理的 CUDA_SAFE_CALL(someCudaFunction())
宏。
CUDA runtime has a convenience function cudaGetErrorString(cudaError_t error)
that translates an error enum into a readable string. cudaGetErrorString
is used in the CUDA_SAFE_CALL(someCudaFunction())
macro that many people use for CUDA error handling.
现在我很熟悉cuBLAS,我想为cuBLAS创建一个类似于 CUDA_SAFE_CALL
的宏。为了使我的宏的打印输出变得有用,我想在cuBLAS中有类似 cudaGetErrorString
的东西。
I'm familiarizing myself with cuBLAS now, and I'd like to create a macro similar to CUDA_SAFE_CALL
for cuBLAS. To make my macro's printouts useful, I'd like to have something analogous to cudaGetErrorString
in cuBLAS.
在cuBLAS中是否有等效的 cudaGetErrorString()
?或者,有任何cuBLAS用户写了这样的功能?
Is there an equivalent of cudaGetErrorString()
in cuBLAS? Or, have any cuBLAS users written a function like this?
推荐答案
,有一个文件.... / samples / common / inc / helper_cuda.h它有以下:
In CUDA 5.0, assuming you installed the samples, there is a file ..../samples/common/inc/helper_cuda.h which has the following:
#ifdef CUBLAS_API_H_
// cuBLAS API errors
static const char *_cudaGetErrorEnum(cublasStatus_t error)
{
switch (error)
{
case CUBLAS_STATUS_SUCCESS:
return "CUBLAS_STATUS_SUCCESS";
case CUBLAS_STATUS_NOT_INITIALIZED:
return "CUBLAS_STATUS_NOT_INITIALIZED";
case CUBLAS_STATUS_ALLOC_FAILED:
return "CUBLAS_STATUS_ALLOC_FAILED";
case CUBLAS_STATUS_INVALID_VALUE:
return "CUBLAS_STATUS_INVALID_VALUE";
case CUBLAS_STATUS_ARCH_MISMATCH:
return "CUBLAS_STATUS_ARCH_MISMATCH";
case CUBLAS_STATUS_MAPPING_ERROR:
return "CUBLAS_STATUS_MAPPING_ERROR";
case CUBLAS_STATUS_EXECUTION_FAILED:
return "CUBLAS_STATUS_EXECUTION_FAILED";
case CUBLAS_STATUS_INTERNAL_ERROR:
return "CUBLAS_STATUS_INTERNAL_ERROR";
}
return "<unknown>";
}
#endif
CUDA SDK(示例)。这不是回答一个问题内置的东西,如果你问,但回答你的问题有任何cuBLAS用户写这样的功能吗?
There is probably something similar in previous versions of the CUDA SDK (Samples). This is not in answer to a question "is something built in" if you asked that, but in answer to your question "have any cuBLAS users written a function like this?"
这篇关于相当于cuBLAS的cudaGetErrorString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!