3.3. Error Handling

This section describes the error handling functions of the CUDA runtime application programming interface.

Functions

const __cudart_builtin__ char* cudaGetErrorName ( cudaError_t error )
Returns the string representation of an error code enum name.
const __cudart_builtin__ char* cudaGetErrorString ( cudaError_t error )
Returns the description string for an error code.
cudaError_t cudaGetLastError ( void )
Returns the last error from a runtime call.
cudaError_t cudaPeekAtLastError ( void )
Returns the last error from a runtime call.

Functions

const __cudart_builtin__ char* cudaGetErrorName ( cudaError_t error )
Returns the string representation of an error code enum name.
Parameters
error
- Error code to convert to string
Returns

char* pointer to a NULL-terminated string, or NULL if the error code is not valid.

Description

Returns a string containing the name of an error code in the enum, or NULL if the error code is not valid.

See also:

cudaGetErrorString, cudaGetLastError, cudaPeekAtLastError, cudaError

const __cudart_builtin__ char* cudaGetErrorString ( cudaError_t error )
Returns the description string for an error code.
Parameters
error
- Error code to convert to string
Returns

char* pointer to a NULL-terminated string, or NULL if the error code is not valid.

Description

Returns the description string for an error code, or NULL if the error code is not valid.

See also:

cudaGetErrorName, cudaGetLastError, cudaPeekAtLastError, cudaError

cudaError_t cudaGetLastError ( void )
Returns the last error from a runtime call.
Description

Returns the last error that has been produced by any of the runtime calls in the same host thread and resets it to cudaSuccess.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaPeekAtLastError, cudaGetErrorName, cudaGetErrorString, cudaError

cudaError_t cudaPeekAtLastError ( void )
Returns the last error from a runtime call.
Description

Returns the last error that has been produced by any of the runtime calls in the same host thread. Note that this call does not reset the error to cudaSuccess like cudaGetLastError().

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cudaGetLastError, cudaGetErrorName, cudaGetErrorString, cudaError