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 attr 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]major
[out]minor
[in]device
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGet()

hipError_t hipDeviceGet ( hipDevice_t device,
int  ordinal 
)

Returns a handle to a compute device.

Parameters
[out]device
[in]ordinal
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGetByPCIBusId()

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

Returns a handle to a compute device.

Parameters
[out]devicehandle
[in]PCIBus ID
Returns
hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue

◆ hipDeviceGetName()

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

Returns an identifer string for the device.

Parameters
[out]name
[in]len
[in]device
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGetP2PAttribute()

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

Returns a value for attr of link between two devices.

Parameters
[out]value
[in]attr
[in]srcDevice
[in]dstDevice
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]pciBusId
[in]len
[in]device
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDeviceGetUuid()

hipError_t hipDeviceGetUuid ( hipUUID uuid,
hipDevice_t  device 
)

Returns an UUID for the device.[BETA].

Parameters
[out]uuid
[in]device@beta 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]bytes
[in]device
Returns
hipSuccess, hipErrorInvalidDevice

◆ hipDriverGetVersion()

hipError_t hipDriverGetVersion ( int *  driverVersion)

Returns the approximate HIP driver version.

Parameters
[out]driverVersion
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.

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

◆ hipRuntimeGetVersion()

hipError_t hipRuntimeGetVersion ( int *  runtimeVersion)

Returns the approximate HIP Runtime version.

Parameters
[out]runtimeVersion
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