Power Queries

Power Queries#

ROCmSMI: Power Queries
Power Queries

Functions

rsmi_status_t rsmi_dev_power_ave_get (uint32_t dv_ind, uint32_t sensor_ind, uint64_t *power)
 Get the average power consumption of the device with provided device index. More...
 
rsmi_status_t rsmi_dev_current_socket_power_get (uint32_t dv_ind, uint64_t *socket_power)
 Get the current socket power (also known as instant power) of the device index provided. More...
 
rsmi_status_t rsmi_dev_power_get (uint32_t dv_ind, uint64_t *power, RSMI_POWER_TYPE *type)
 A generic get which attempts to retieve current socket power (also known as instant power) of the device index provided, if not supported tries to get average power consumed by device. Current socket power is typically supported by newer devices, whereas average power is generally reported on older devices. This function aims to provide backwards compatability depending on device support. More...
 
rsmi_status_t rsmi_dev_energy_count_get (uint32_t dv_ind, uint64_t *power, float *counter_resolution, uint64_t *timestamp)
 Get the energy accumulator counter of the device with provided device index. More...
 
rsmi_status_t rsmi_dev_power_cap_get (uint32_t dv_ind, uint32_t sensor_ind, uint64_t *cap)
 Get the cap on power which, when reached, causes the system to take action to reduce power. More...
 
rsmi_status_t rsmi_dev_power_cap_default_get (uint32_t dv_ind, uint64_t *default_cap)
 Get the default power cap for the device specified by dv_ind. More...
 
rsmi_status_t rsmi_dev_power_cap_range_get (uint32_t dv_ind, uint32_t sensor_ind, uint64_t *max, uint64_t *min)
 Get the range of valid values for the power cap. More...
 

Detailed Description

These functions provide information about power usage.

Function Documentation

◆ rsmi_dev_power_ave_get()

rsmi_status_t rsmi_dev_power_ave_get ( uint32_t  dv_ind,
uint32_t  sensor_ind,
uint64_t *  power 
)

Get the average power consumption of the device with provided device index.

Given a device index dv_ind and a pointer to a uint64_t power, this function will write the current average power consumption (in microwatts) to the uint64_t pointed to by power.

Parameters
[in]dv_inda device index
[in]sensor_inda 0-based sensor index. Normally, this will be 0. If a device has more than one sensor, it could be greater than 0.
[in,out]powera pointer to uint64_t to which the average power consumption will be written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_current_socket_power_get()

rsmi_status_t rsmi_dev_current_socket_power_get ( uint32_t  dv_ind,
uint64_t *  socket_power 
)

Get the current socket power (also known as instant power) of the device index provided.

Given a device index dv_ind and a pointer to a uint64_t socket_power, this function will write the current socket power (in microwatts) to the uint64_t pointed to by socket_power.

Parameters
[in]dv_inda device index
[in,out]socket_powera pointer to uint64_t to which the current socket power will be written to. If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_power_get()

rsmi_status_t rsmi_dev_power_get ( uint32_t  dv_ind,
uint64_t *  power,
RSMI_POWER_TYPE type 
)

A generic get which attempts to retieve current socket power (also known as instant power) of the device index provided, if not supported tries to get average power consumed by device. Current socket power is typically supported by newer devices, whereas average power is generally reported on older devices. This function aims to provide backwards compatability depending on device support.

Given a device index dv_ind, a pointer to a uint64_t power, and type this function will write the current socket or average power (in microwatts) to the uint64_t pointed to by power and a pointer to its type RSMI_POWER_TYPE read.

Parameters
[in]dv_inda device index
[in,out]powera pointer to uint64_t to which the current or average power will be written to. If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
[in,out]typea pointer to RSMI_POWER_TYPE object. Returns the type of power retrieved from the device. Current power is RSMI_CURRENT_POWER and average power is RSMI_AVERAGE_POWER. If an error occurs, returns an invalid power type RSMI_INVALID_POWER.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_energy_count_get()

rsmi_status_t rsmi_dev_energy_count_get ( uint32_t  dv_ind,
uint64_t *  power,
float *  counter_resolution,
uint64_t *  timestamp 
)

Get the energy accumulator counter of the device with provided device index.

Given a device index dv_ind, a pointer to a uint64_t power, and a pointer to a uint64_t timestamp, this function will write amount of energy consumed to the uint64_t pointed to by power, and the timestamp to the uint64_t pointed to by timestamp. The rsmi_dev_power_ave_get() is an average of a short time. This function accumulates all energy consumed.

Parameters
[in]dv_inda device index
[in,out]counter_resolutionresolution of the counter power in micro Joules
[in,out]powera pointer to uint64_t to which the energy counter will be written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
[in,out]timestampa pointer to uint64_t to which the timestamp will be written. Resolution: 1 ns.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_power_cap_get()

rsmi_status_t rsmi_dev_power_cap_get ( uint32_t  dv_ind,
uint32_t  sensor_ind,
uint64_t *  cap 
)

Get the cap on power which, when reached, causes the system to take action to reduce power.

When power use rises above the value power, the system will take action to reduce power use. The power level returned through power will be in microWatts.

Parameters
[in]dv_inda device index
[in]sensor_inda 0-based sensor index. Normally, this will be 0. If a device has more than one sensor, it could be greater than 0.
[in,out]capa pointer to a uint64_t that indicates the power cap, in microwatts If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_power_cap_default_get()

rsmi_status_t rsmi_dev_power_cap_default_get ( uint32_t  dv_ind,
uint64_t *  default_cap 
)

Get the default power cap for the device specified by dv_ind.

The maximum power cap be temporarily changed by the user. However, this function always returns the default reset power cap. The power level returned through power will be in microWatts.

Parameters
[in]dv_inda device index
[in,out]default_capa pointer to a uint64_t that indicates the default power cap, in microwatts If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_power_cap_range_get()

rsmi_status_t rsmi_dev_power_cap_range_get ( uint32_t  dv_ind,
uint32_t  sensor_ind,
uint64_t *  max,
uint64_t *  min 
)

Get the range of valid values for the power cap.

This function will return the maximum possible valid power cap max and the minimum possible valid power cap min

Parameters
[in]dv_inda device index
[in]sensor_inda 0-based sensor index. Normally, this will be 0. If a device has more than one sensor, it could be greater than 0.
[in,out]maxa pointer to a uint64_t that indicates the maximum possible power cap, in microwatts If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
[in,out]mina pointer to a uint64_t that indicates the minimum possible power cap, in microwatts If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid