Added hipDeviceComputeCapability, hipDeviceGetPCIBusId and hipDeviceGetName
Change-Id: Ibe2d975df796712633900ddc7b0734ec2b8ab4ec
This commit is contained in:
@@ -1244,6 +1244,35 @@ hipError_t hipDeviceGetFromId(hipDevice_t *device, int deviceId);
|
||||
*/
|
||||
hipError_t hipDeviceGet(hipDevice_t *device, int ordinal);
|
||||
|
||||
/**
|
||||
* @brief Returns the compute capability of the device
|
||||
* @param [out] major
|
||||
* @param [out] minor
|
||||
* @param [in] device
|
||||
*
|
||||
* @returns #hipSuccess, #hipErrorInavlidDevice
|
||||
*/
|
||||
hipError_t hipDeviceComputeCapability(int *major,int *minor,hipDevice_t device);
|
||||
|
||||
/**
|
||||
* @brief Returns an identifer string for the device.
|
||||
* @param [out] name
|
||||
* @param [in] len
|
||||
* @param [in] device
|
||||
*
|
||||
* @returns #hipSuccess, #hipErrorInavlidDevice
|
||||
*/
|
||||
hipError_t hipDeviceGetName(char *name,int len,hipDevice_t device);
|
||||
|
||||
/**
|
||||
* @brief Returns a PCI Bus Id string for the device.
|
||||
* @param [out] pciBusId
|
||||
* @param [in] len
|
||||
* @param [in] device
|
||||
*
|
||||
* @returns #hipSuccess, #hipErrorInavlidDevice
|
||||
*/
|
||||
hipError_t hipDeviceGetPCIBusId (int *pciBusId,int len,hipDevice_t device);
|
||||
|
||||
/**
|
||||
* @brief Returns the approximate HIP driver version.
|
||||
|
||||
@@ -630,6 +630,21 @@ inline static hipError_t hipDeviceGet(hipDevice_t *device, int ordinal)
|
||||
return hipCUResultTohipError(cuDeviceGet(device, ordinal));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDeviceComputeCapability(int *major, int *minor, hipDevice_t device)
|
||||
{
|
||||
return hipCUResultTohipError(cuDeviceComputeCapability(major,minor,device));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDeviceGetName(char *name,int len,hipDevice_t device)
|
||||
{
|
||||
return hipCUResultTohipError(cuDeviceGetName(name,len,device));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDeviceGetPCIBusId (int *pciBusId,int len,hipDevice_t device)
|
||||
{
|
||||
return hipCUResultTohipError(cuDeviceGetPCIBusId((char*)pciBusId,len,device));
|
||||
}
|
||||
|
||||
inline static hipError_t hipModuleLoad(hipModule_t *module, const char* fname)
|
||||
{
|
||||
return hipCUResultTohipError(cuModuleLoad(module, fname));
|
||||
|
||||
@@ -324,3 +324,33 @@ hipError_t hipDeviceGetFromId(hipDevice_t *device, int deviceId)
|
||||
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDeviceComputeCapability(int *major, int *minor, hipDevice_t device)
|
||||
{
|
||||
HIP_INIT_API(major,minor, device);
|
||||
hipError_t e = hipSuccess;
|
||||
int deviceId= device->_deviceId;
|
||||
e = hipDeviceGetAttribute(major, hipDeviceAttributeComputeCapabilityMajor, deviceId);
|
||||
e = hipDeviceGetAttribute(minor, hipDeviceAttributeComputeCapabilityMinor, deviceId);
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDeviceGetName(char *name,int len,hipDevice_t device)
|
||||
{
|
||||
HIP_INIT_API(name,len, device);
|
||||
hipError_t e = hipSuccess;
|
||||
int nameLen = strlen(device->_props.name);
|
||||
if(nameLen <= len)
|
||||
memcpy(name,device->_props.name,nameLen);
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipDeviceGetPCIBusId (int *pciBusId,int len,hipDevice_t device)
|
||||
{
|
||||
HIP_INIT_API(pciBusId,len, device);
|
||||
hipError_t e = hipSuccess;
|
||||
int deviceId= device->_deviceId;
|
||||
e = hipDeviceGetAttribute(pciBusId, hipDeviceAttributePciBusId, deviceId);
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user