This page contains proposed changes for a future release of ROCm. Read the latest Linux release of ROCm documentation for your production environments.

Initialization and Version

Initialization and Version#

HIP Runtime API Reference: Initialization and Version
Initialization and Version
Collaboration diagram for Initialization and Version:

Functions

hipError_t hipInit (unsigned int flags)
 Explicitly initializes the HIP runtime. More...
 
hipError_t hipDriverGetVersion (int *driverVersion)
 Returns the approximate HIP driver version. More...
 
hipError_t hipRuntimeGetVersion (int *runtimeVersion)
 Returns the approximate HIP Runtime version. More...
 
hipError_t hipDeviceGet (hipDevice_t *device, int ordinal)
 Returns a handle to a compute device. More...
 
hipError_t hipDeviceComputeCapability (int *major, int *minor, hipDevice_t device)
 Returns the compute capability of the device. More...
 
hipError_t hipDeviceGetName (char *name, int len, hipDevice_t device)
 Returns an identifer string for the device. More...
 
hipError_t hipDeviceGetUuid (hipUUID *uuid, hipDevice_t device)
 Returns an UUID for the device.[BETA]. More...
 
hipError_t hipDeviceGetP2PAttribute (int *value, hipDeviceP2PAttr attr, int srcDevice, int dstDevice)
 Returns a value for attribute of link between two devices. More...
 
hipError_t hipDeviceGetPCIBusId (char *pciBusId, int len, int device)
 Returns a PCI Bus Id string for the device, overloaded to take int device ID. More...
 
hipError_t hipDeviceGetByPCIBusId (int *device, const char *pciBusId)
 Returns a handle to a compute device. More...
 
hipError_t hipDeviceTotalMem (size_t *bytes, hipDevice_t device)
 Returns the total amount of memory on the device. More...
 

Detailed Description

This section describes the initializtion and version functions of HIP runtime API.

Function Documentation

◆ hipDeviceComputeCapability()

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

Returns the compute capability of the device.

Parameters
[out]majorMajor compute capability version number
[out]minorMinor compute capability version number
[in]deviceDevice ordinal
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGet()

hipError_t hipDeviceGet ( hipDevice_t device,
int  ordinal 
)

Returns a handle to a compute device.

Parameters
[out]deviceHandle of device
[in]ordinalDevice ordinal
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGetByPCIBusId()

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

Returns a handle to a compute device.

Parameters
[out]deviceThe handle of the device
[in]pciBusIdThe string of PCI Bus Id for the device
Returns
hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue

◆ hipDeviceGetName()

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

Returns an identifer string for the device.

Parameters
[out]nameString of the device name
[in]lenMaximum length of string to store in device name
[in]deviceDevice ordinal
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGetP2PAttribute()

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

Returns a value for attribute of link between two devices.

Parameters
[out]valuePointer of the value for the attrubute
[in]attrenum of hipDeviceP2PAttr to query
[in]srcDeviceThe source device of the link
[in]dstDeviceThe destination device of the link
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGetPCIBusId()

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
[out]pciBusIdThe string of PCI Bus Id format for the device
[in]lenMaximum length of string
[in]deviceThe device ordinal
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGetUuid()

hipError_t hipDeviceGetUuid ( hipUUID uuid,
hipDevice_t  device 
)

Returns an UUID for the device.[BETA].

Parameters
[out]uuidUUID for the device
[in]devicedevice ordinal
Warning
This API is marked as beta, meaning, while this is feature complete, it is still open to changes and may have outstanding issues.
Returns
hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue, hipErrorNotInitialized, hipErrorDeinitialized

◆ hipDeviceTotalMem()

hipError_t hipDeviceTotalMem ( size_t *  bytes,
hipDevice_t  device 
)

Returns the total amount of memory on the device.

Parameters
[out]bytesThe size of memory in bytes, on the device
[in]deviceThe ordinal of the device
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDriverGetVersion()

hipError_t hipDriverGetVersion ( int *  driverVersion)

Returns the approximate HIP driver version.

Parameters
[out]driverVersiondriver version
Returns
hipSuccess, hipErrorInvalidValue
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.
See also
hipRuntimeGetVersion

◆ hipInit()

hipError_t hipInit ( unsigned int  flags)

Explicitly initializes the HIP runtime.

Parameters
[in]flagsInitialization flag, should be zero.

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

Returns
hipSuccess, hipErrorInvalidValue

◆ hipRuntimeGetVersion()

hipError_t hipRuntimeGetVersion ( int *  runtimeVersion)

Returns the approximate HIP Runtime version.

Parameters
[out]runtimeVersionHIP runtime version
Returns
hipSuccess, hipErrorInvalidValue
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.
See also
hipDriverGetVersion