Error Handling

Error Handling#

HIP Runtime API Reference: Error Handling
Error Handling
Collaboration diagram for Error Handling:

Functions

hipError_t hipGetLastError (void)
 Return last error returned by any HIP runtime API call and resets the stored error code to hipSuccess.
 
hipError_t hipPeekAtLastError (void)
 Return last error returned by any HIP runtime API call.
 
const char * hipGetErrorName (hipError_t hip_error)
 Return name of the specified error code in text form.
 
const char * hipGetErrorString (hipError_t hipError)
 Return handy text string message to explain the error which occurred.
 

Detailed Description



This section describes the error handling functions of HIP runtime API.

Function Documentation

◆ hipGetErrorName()

const char * hipGetErrorName ( hipError_t  hip_error)

Return name of the specified error code in text form.

Parameters
hip_errorError code to convert to name.
Returns
const char pointer to the NULL-terminated error name
See also
hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t

◆ hipGetErrorString()

const char * hipGetErrorString ( hipError_t  hipError)

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

Parameters
hipErrorError code to convert to string.
Returns
const char pointer to the NULL-terminated error string
Warning
: on HCC, this function returns the name of the error (same as hipGetErrorName)
See also
hipGetErrorName, hipGetLastError, hipPeakAtLastError, hipError_t

◆ hipGetLastError()

hipError_t hipGetLastError ( void  )

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

Returns
return code from last HIP called from the active host thread

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.

See also
hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t

◆ hipPeekAtLastError()

hipError_t hipPeekAtLastError ( void  )

Return last error returned by any HIP runtime API call.

Returns
hipSuccess

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.

See also
hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t