Initialization and version#

hipError_t hipInit(unsigned int flags)#

Explicitly initializes the HIP runtime.

Most HIP APIs implicitly initialize the HIP runtime. This API provides control over the timing of the initialization.

Parameters:

flags[in] Initialization flag, should be zero.

Returns:

hipSuccess, hipErrorInvalidValue

hipError_t hipDriverGetVersion(int *driverVersion)#

Returns the approximate HIP driver version.

Warning

The HIP feature set does not correspond to an exact CUDA SDK driver revision. This function always set *driverVersion to 4 as an approximation though HIP supports some features which were introduced in later CUDA SDK revisions. HIP apps code should not rely on the driver revision number here and should use arch feature flags to test device capabilities or conditional compilation.

Parameters:

driverVersion[out] driver version

Returns:

hipSuccess, hipErrorInvalidValue

hipError_t hipRuntimeGetVersion(int *runtimeVersion)#

Returns the approximate HIP Runtime version.

Warning

The version definition of HIP runtime is different from CUDA. On AMD platform, the function returns HIP runtime version, while on NVIDIA platform, it returns CUDA runtime version. And there is no mapping/correlation between HIP version and CUDA version.

Parameters:

runtimeVersion[out] HIP runtime version

Returns:

hipSuccess, hipErrorInvalidValue

hipError_t hipDeviceGet(hipDevice_t *device, int ordinal)#

Returns a handle to a compute device.

Parameters:
  • device[out] Handle of device

  • ordinal[in] Device ordinal

Returns:

hipSuccess, hipErrorInvalidDevice

hipError_t hipDeviceComputeCapability(int *major, int *minor, hipDevice_t device)#

Returns the compute capability of the device.

Parameters:
  • major[out] Major compute capability version number

  • minor[out] Minor compute capability version number

  • device[in] Device ordinal

Returns:

hipSuccess, hipErrorInvalidDevice

hipError_t hipDeviceGetName(char *name, int len, hipDevice_t device)#

Returns an identifer string for the device.

Parameters:
  • name[out] String of the device name

  • len[in] Maximum length of string to store in device name

  • device[in] Device ordinal

Returns:

hipSuccess, hipErrorInvalidDevice

hipError_t hipDeviceGetUuid(hipUUID *uuid, hipDevice_t device)#

Returns an UUID for the device.[BETA].

Warning

This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.

Parameters:
  • uuid[out] UUID for the device

  • device[in] device ordinal

Returns:

hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue, hipErrorNotInitialized, hipErrorDeinitialized

hipError_t hipDeviceGetP2PAttribute(int *value, hipDeviceP2PAttr attr, int srcDevice, int dstDevice)#

Returns a value for attribute of link between two devices.

Parameters:
  • value[out] Pointer of the value for the attrubute

  • attr[in] enum of hipDeviceP2PAttr to query

  • srcDevice[in] The source device of the link

  • dstDevice[in] The destination device of the link

Returns:

hipSuccess, hipErrorInvalidDevice

hipError_t hipDeviceGetPCIBusId(char *pciBusId, int len, int device)#

Returns a PCI Bus Id string for the device, overloaded to take int device ID.

Parameters:
  • pciBusId[out] The string of PCI Bus Id format for the device

  • len[in] Maximum length of string

  • device[in] The device ordinal

Returns:

hipSuccess, hipErrorInvalidDevice

hipError_t hipDeviceGetByPCIBusId(int *device, const char *pciBusId)#

Returns a handle to a compute device.

Parameters:
  • device[out] The handle of the device

  • pciBusId[in] The string of PCI Bus Id for the device

Returns:

hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue

hipError_t hipDeviceTotalMem(size_t *bytes, hipDevice_t device)#

Returns the total amount of memory on the device.

Parameters:
  • bytes[out] The size of memory in bytes, on the device

  • device[in] The ordinal of the device

Returns:

hipSuccess, hipErrorInvalidDevice