Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUresult vs cudaError - how to get readable error descriptions?

Tags:

cuda

I want to get a human readable description of result returned by cuInit. Every single page I've found recommnend using cudaGetErrorString for this purpose, but this results in error:

error: cannot convert CUresult {aka cudaError_enum} to cudaError_t 
{aka cudaError} for argument 1 to const char* cudaGetErrorString(cudaError_t)

What's the difference between CUresult and cudaError and what function can I use to interpret the former?

like image 589
Kim Strauss Avatar asked Feb 08 '13 15:02

Kim Strauss


Video Answer


2 Answers

The current driver API as time of writing does support translating an CUresult to its string representation and description.

From the Driver API doc:

CUresult cuGetErrorName ( CUresult error, const char** pStr )
    Gets the string representation of an error code enum name. 
CUresult cuGetErrorString ( CUresult error, const char** pStr )
    Gets the string description of an error code. 

http://docs.nvidia.com/cuda/cuda-driver-api/index.html

like image 145
Kratz Avatar answered Sep 17 '22 16:09

Kratz


LIBRARY         RETURN TYPE     VALUES
CUDA Driver     CUresult        enum cudaError_enum    in cuda.h
CUDA Runtime    cudaError_t     enum cudaError         in driver_types.h

The CUDA Runtime provides the function cudaGetErrorString to convert a cudaError enum value to a string.

The CUDA Driver API does not provide a function to return string.

The error names and values for CUresult and cudaError_t do not match.

NVIDIA does not currently supply a library for returning an error string for CUresult. It should only take a few minutes to convert the data in cuda.h into a function.

like image 23
Greg Smith Avatar answered Sep 19 '22 16:09

Greg Smith