6.13. Error Handling
This section describes the error handling functions of the CUDA runtime application programming interface.
Functions
- __host__ const char * cudaGetErrorName(cudaError_t error)
Returns the string representation of an error code enum name.
- __host__ const char * cudaGetErrorString(cudaError_t error)
Returns the description string for an error code.
- __host__ cudaError_t cudaGetLastError(void)
Returns the last error from a runtime call.
- __host__ cudaError_t cudaPeekAtLastError(void)
Returns the last error from a runtime call.
6.13.1. Functions
-
__host__ const char *cudaGetErrorName(cudaError_t error)
Returns the string representation of an error code enum name.
Returns a string containing the name of an error code in the enum. If the error code is not recognized, “unrecognized error code” is returned.
See also
cudaGetErrorString, cudaGetLastError, cudaPeekAtLastError, cudaError, ::cuGetErrorName
- Parameters
error – - Error code to convert to string
- Returns
char*pointer to a NULL-terminated string
-
__host__ const char *cudaGetErrorString(cudaError_t error)
Returns the description string for an error code.
Returns the description string for an error code. If the error code is not recognized, “unrecognized error code” is returned.
See also
cudaGetErrorName, cudaGetLastError, cudaPeekAtLastError, cudaError, ::cuGetErrorString
- Parameters
error – - Error code to convert to string
- Returns
char*pointer to a NULL-terminated string
-
__host__ cudaError_t cudaGetLastError(void)
Returns the last error from a runtime call.
Returns the last error that has been produced by any of the runtime calls in the same instance of the CUDA Runtime library in the host thread and resets it to cudaSuccess.
Note: Multiple instances of the CUDA Runtime library can be present in an application when using a library that statically links the CUDA Runtime.
Note
Note that this function may also return error codes from previous, asynchronous launches.
Note
Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note
Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback. cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
- Returns
cudaSuccess, cudaErrorMissingConfiguration, cudaErrorMemoryAllocation, cudaErrorInitializationError, cudaErrorLaunchFailure, cudaErrorLaunchTimeout, cudaErrorLaunchOutOfResources, cudaErrorInvalidDeviceFunction, cudaErrorInvalidConfiguration, cudaErrorInvalidDevice, cudaErrorInvalidValue, cudaErrorInvalidPitchValue, cudaErrorInvalidSymbol, cudaErrorUnmapBufferObjectFailed, cudaErrorInvalidTexture, cudaErrorInvalidTextureBinding, cudaErrorInvalidChannelDescriptor, cudaErrorInvalidMemcpyDirection, cudaErrorInvalidFilterSetting, cudaErrorInvalidNormSetting, cudaErrorUnknown, cudaErrorInvalidResourceHandle, cudaErrorInsufficientDriver, cudaErrorNoDevice, cudaErrorSetOnActiveProcess, cudaErrorStartupFailure, cudaErrorInvalidPtx, cudaErrorUnsupportedPtxVersion, cudaErrorNoKernelImageForDevice, cudaErrorJitCompilerNotFound, cudaErrorJitCompilationDisabled
-
__host__ cudaError_t cudaPeekAtLastError(void)
Returns the last error from a runtime call.
Returns the last error that has been produced by any of the runtime calls in the same instance of the CUDA Runtime library in the host thread. This call does not reset the error to cudaSuccess like cudaGetLastError().
Note: Multiple instances of the CUDA Runtime library can be present in an application when using a library that statically links the CUDA Runtime.
See also
cudaGetLastError, cudaGetErrorName, cudaGetErrorString, cudaError
Note
Note that this function may also return error codes from previous, asynchronous launches.
Note
Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
Note
Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback. cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
- Returns
cudaSuccess, cudaErrorMissingConfiguration, cudaErrorMemoryAllocation, cudaErrorInitializationError, cudaErrorLaunchFailure, cudaErrorLaunchTimeout, cudaErrorLaunchOutOfResources, cudaErrorInvalidDeviceFunction, cudaErrorInvalidConfiguration, cudaErrorInvalidDevice, cudaErrorInvalidValue, cudaErrorInvalidPitchValue, cudaErrorInvalidSymbol, cudaErrorUnmapBufferObjectFailed, cudaErrorInvalidTexture, cudaErrorInvalidTextureBinding, cudaErrorInvalidChannelDescriptor, cudaErrorInvalidMemcpyDirection, cudaErrorInvalidFilterSetting, cudaErrorInvalidNormSetting, cudaErrorUnknown, cudaErrorInvalidResourceHandle, cudaErrorInsufficientDriver, cudaErrorNoDevice, cudaErrorSetOnActiveProcess, cudaErrorStartupFailure, cudaErrorInvalidPtx, cudaErrorUnsupportedPtxVersion, cudaErrorNoKernelImageForDevice, cudaErrorJitCompilerNotFound, cudaErrorJitCompilationDisabled