CUDA Runtime API (PDF) - v6.0 (older) - Last updated February 13, 2014 - Send Feedback -

## 3.3. Error Handling

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

### Functions

const __cudart_builtin__ char* cudaGetErrorString ( cudaError_t error )
  Returns the message string from 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* cudaGetErrorString ( cudaError_t error )
  Returns the message string from an error code.

  ###### Parameters

  `error`
    - Error code to convert to string

  ###### Returns

  `char*` pointer to a NULL-terminated string

  ###### Description

  Returns the message string from an error code.

  See also:

  cudaGetLastError, cudaPeekAtLastError, cudaError

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

  ###### Returns

  cudaSuccess, cudaErrorMissingConfiguration, cudaErrorMemoryAllocation, cudaErrorInitializationError, cudaErrorLaunchFailure, cudaErrorLaunchTimeout, cudaErrorLaunchOutOfResources, cudaErrorInvalidDeviceFunction, cudaErrorInvalidConfiguration, cudaErrorInvalidDevice, cudaErrorInvalidValue, cudaErrorInvalidPitchValue, cudaErrorInvalidSymbol, cudaErrorUnmapBufferObjectFailed, cudaErrorInvalidHostPointer, cudaErrorInvalidDevicePointer, cudaErrorInvalidTexture, cudaErrorInvalidTextureBinding, cudaErrorInvalidChannelDescriptor, cudaErrorInvalidMemcpyDirection, cudaErrorInvalidFilterSetting, cudaErrorInvalidNormSetting, cudaErrorUnknown, cudaErrorInvalidResourceHandle, cudaErrorInsufficientDriver, cudaErrorSetOnActiveProcess, cudaErrorStartupFailure,

  ###### 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, cudaGetErrorString, cudaError

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

  ###### Returns

  cudaSuccess, cudaErrorMissingConfiguration, cudaErrorMemoryAllocation, cudaErrorInitializationError, cudaErrorLaunchFailure, cudaErrorLaunchTimeout, cudaErrorLaunchOutOfResources, cudaErrorInvalidDeviceFunction, cudaErrorInvalidConfiguration, cudaErrorInvalidDevice, cudaErrorInvalidValue, cudaErrorInvalidPitchValue, cudaErrorInvalidSymbol, cudaErrorUnmapBufferObjectFailed, cudaErrorInvalidHostPointer, cudaErrorInvalidDevicePointer, cudaErrorInvalidTexture, cudaErrorInvalidTextureBinding, cudaErrorInvalidChannelDescriptor, cudaErrorInvalidMemcpyDirection, cudaErrorInvalidFilterSetting, cudaErrorInvalidNormSetting, cudaErrorUnknown, cudaErrorInvalidResourceHandle, cudaErrorInsufficientDriver, cudaErrorSetOnActiveProcess, cudaErrorStartupFailure,

  ###### 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, cudaGetErrorString, cudaError