Error Handling

Error Handling types and functions.

hipGetLastError

hipError_t hipGetLastError(void)

Return last error returned by any HIP runtime API call and resets the stored error code to #hipSuccess.

Returns the last error that has been returned by any of the runtime calls in the same host thread, and then resets the saved error to #hipSuccess.

Return

return code from last HIP called from the active host thread

See

hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t

hipPeekAtLastError

hipError_t hipPeekAtLastError(void)

Return last error returned by any HIP runtime API call.

Returns the last error that has been returned by any of the runtime calls in the same host thread. Unlike hipGetLastError, this function does not reset the saved error code.

Return

#hipSuccess

See

hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t

hipGetErrorName

const char *hipGetErrorName(hipError_t hip_error)

Return name of the specified error code in text form.

Return

const char pointer to the NULL-terminated error name

See

hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t

Parameters
  • hip_error: Error code to convert to name.

hipGetErrorString

const char *hipGetErrorString(hipError_t hipError)

Return handy text string message to explain the error which occurred.

Return

const char pointer to the NULL-terminated error string

Warning

: on HCC, this function returns the name of the error (same as hipGetErrorName)

See

hipGetErrorName, hipGetLastError, hipPeakAtLastError, hipError_t

Parameters
  • hipError: Error code to convert to string.