Merge amd-dev into amd-master 20231220
Signed-off-by: guanyu12 <guanyu12@amd.com> Change-Id: I327c51c037a1f39c564aba7ebd893a3167829d56
Этот коммит содержится в:
@@ -24,6 +24,7 @@ import logging
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import json
|
||||
|
||||
from _version import __version__
|
||||
from amdsmi_helpers import AMDSMIHelpers
|
||||
@@ -41,20 +42,45 @@ class AMDSMICommands():
|
||||
def __init__(self, format='human_readable', destination='stdout') -> None:
|
||||
self.helpers = AMDSMIHelpers()
|
||||
self.logger = AMDSMILogger(format=format, destination=destination)
|
||||
self.device_handles = []
|
||||
self.cpu_handles = []
|
||||
self.core_handles = []
|
||||
try:
|
||||
self.device_handles = amdsmi_interface.amdsmi_get_processor_handles()
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_DRIVER_NOT_LOADED):
|
||||
logging.error('Unable to get devices, driver not initialized (amdgpu not found in modules)')
|
||||
sys.exit(-1)
|
||||
else:
|
||||
raise e
|
||||
|
||||
if len(self.device_handles) == 0:
|
||||
logging.error('Unable to detect any devices, check if driver is initialized (amdgpu not found in modules)')
|
||||
sys.exit(-1)
|
||||
logging.info('Unable to detect any devices, check if driver is initialized (amdgpu not found in modules)')
|
||||
|
||||
# Fetch CPU handles
|
||||
try:
|
||||
self.cpu_handles = amdsmi_interface.amdsmi_get_cpusocket_handles()
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_NO_DRV):
|
||||
|
||||
logging.info('Unable to get CPU devices, hsmp driver not loaded')
|
||||
else:
|
||||
raise e
|
||||
|
||||
# core handles
|
||||
try:
|
||||
self.core_handles = amdsmi_interface.amdsmi_get_cpucore_handles()
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_NO_DRV):
|
||||
logging.info('Unable to get CORE devices, hsmp driver not loaded')
|
||||
else:
|
||||
raise e
|
||||
|
||||
if (len(self.device_handles) == 0 and len(self.cpu_handles) == 0 and len(self.core_handles) == 0):
|
||||
logging.error('Unable to detect any devices, check if amdgpu and hsmp drivers are initialized')
|
||||
sys.exit(-1)
|
||||
self.stop = ''
|
||||
|
||||
|
||||
@@ -134,14 +160,77 @@ class AMDSMICommands():
|
||||
self.logger.print_output()
|
||||
|
||||
|
||||
def static(self, args, multiple_devices=False, gpu=None, asic=None,
|
||||
bus=None, vbios=None, limit=None, driver=None, ras=None,
|
||||
board=None, numa=None, vram=None, cache=None, partition=None,
|
||||
dfc_ucode=None, fb_info=None, num_vf=None):
|
||||
def get_static_cpu(self, args, multiple_devices=False, cpu=None):
|
||||
"""Get Static information for target cpu
|
||||
|
||||
Args:
|
||||
args (Namespace): Namespace containing the parsed CLI args
|
||||
multiple_devices (bool, optional): True if checking for multiple devices. Defaults to False.
|
||||
cpu (device_handle, optional): device_handle for target device. Defaults to None.
|
||||
|
||||
Returns:
|
||||
None: Print output via AMDSMILogger to destination
|
||||
"""
|
||||
|
||||
if (cpu):
|
||||
args.cpu = cpu
|
||||
|
||||
#store cpu args that are applicable to the current platform
|
||||
curr_platform_cpu_args = ["smu", "interface_ver"]
|
||||
curr_platform_cpu_values = [args.smu, args.interface_ver]
|
||||
|
||||
if (not any(curr_platform_cpu_values)):
|
||||
for arg in curr_platform_cpu_args:
|
||||
setattr(args, arg, True)
|
||||
|
||||
if (len(self.cpu_handles)):
|
||||
handled_multiple_cpus, device_handle = self.helpers.handle_cpus(args,
|
||||
self.logger,
|
||||
self.get_static_cpu)
|
||||
if handled_multiple_cpus:
|
||||
return # This function is recursive
|
||||
args.cpu = device_handle
|
||||
# get cpu id for logging
|
||||
cpu_id = self.helpers.get_cpu_id_from_device_handle(args.cpu)
|
||||
logging.debug(f"Static Arg information for CPU {cpu_id} on {self.helpers.os_info()}")
|
||||
|
||||
static_dict = {}
|
||||
|
||||
if (args.smu):
|
||||
try:
|
||||
smu = amdsmi_interface.amdsmi_get_cpu_smu_fw_version(args.cpu)
|
||||
static_dict["smu"] = {"FW_VERSION" : f"{ smu['smu_fw_major_ver_num']}"
|
||||
f":{smu['smu_fw_minor_ver_num']}:{smu['smu_fw_debug_ver_num']}"}
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["smu"] = "N/A"
|
||||
logging.debug("Failed to get SMU FW for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.interface_ver):
|
||||
static_dict["interface_version"] = {}
|
||||
try:
|
||||
intf_ver = amdsmi_interface.amdsmi_get_cpu_hsmp_proto_ver(args.cpu)
|
||||
static_dict["interface_version"]["proto version"] = intf_ver
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["interface_version"]["proto version"] = "N/A"
|
||||
logging.debug("Failed to get proto version for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
multiple_devices_csv_override = False
|
||||
self.logger.store_cpu_output(args.cpu, 'values', static_dict)
|
||||
if multiple_devices:
|
||||
self.logger.store_multiple_device_output()
|
||||
return # Skip printing when there are multiple devices
|
||||
self.logger.print_output(multiple_device_enabled=multiple_devices_csv_override)
|
||||
|
||||
|
||||
def get_static_gpu(self, args, multiple_devices=False, gpu=None, asic=None, bus=None, vbios=None,
|
||||
limit=None, driver=None, ras=None, board=None, numa=None, vram=None,
|
||||
cache=None, partition=None, dfc_ucode=None, fb_info=None, num_vf=None):
|
||||
"""Get Static information for target gpu
|
||||
|
||||
Args:
|
||||
args (Namespace): Namespace containing the parsed CLI args
|
||||
current_platform_args (list): gpu supported platform arguments
|
||||
current_platform_values (list): gpu supported platform values for each argument
|
||||
multiple_devices (bool, optional): True if checking for multiple devices. Defaults to False.
|
||||
gpu (device_handle, optional): device_handle for target device. Defaults to None.
|
||||
asic (bool, optional): Value override for args.asic. Defaults to None.
|
||||
@@ -159,13 +248,10 @@ class AMDSMICommands():
|
||||
fb_info (bool, optional): Value override for args.fb_info. Defaults to None.
|
||||
num_vf (bool, optional): Value override for args.num_vf. Defaults to None.
|
||||
|
||||
Raises:
|
||||
IndexError: Index error if gpu list is empty
|
||||
|
||||
Returns:
|
||||
None: Print output via AMDSMILogger to destination
|
||||
"""
|
||||
# Set args.* to passed in arguments
|
||||
|
||||
if gpu:
|
||||
args.gpu = gpu
|
||||
if asic:
|
||||
@@ -213,26 +299,20 @@ class AMDSMICommands():
|
||||
current_platform_args += ["dfc_ucode", "fb_info", "num_vf"]
|
||||
current_platform_values += [args.dfc_ucode, args.fb_info, args.num_vf]
|
||||
|
||||
# Handle No GPU passed
|
||||
if args.gpu == None:
|
||||
args.gpu = self.device_handles
|
||||
if (not any(current_platform_values)):
|
||||
for arg in current_platform_args:
|
||||
setattr(args, arg, True)
|
||||
|
||||
# Handle multiple GPUs
|
||||
handled_multiple_gpus, device_handle = self.helpers.handle_gpus(args, self.logger, self.static)
|
||||
handled_multiple_gpus, device_handle = self.helpers.handle_gpus(args, self.logger, self.get_static_gpu)
|
||||
if handled_multiple_gpus:
|
||||
return # This function is recursive
|
||||
args.gpu = device_handle
|
||||
|
||||
# Get gpu_id for logging
|
||||
gpu_id = self.helpers.get_gpu_id_from_device_handle(args.gpu)
|
||||
|
||||
logging.debug(f"Static Arg information for GPU {gpu_id} on {self.helpers.os_info()}")
|
||||
logging.debug(f"Applicable Args: {current_platform_args}")
|
||||
logging.debug(f"Arg Values: {current_platform_values}")
|
||||
# Set the platform applicable args to True if no args are set
|
||||
if not any(current_platform_values):
|
||||
for arg in current_platform_args:
|
||||
setattr(args, arg, True)
|
||||
|
||||
static_dict = {}
|
||||
|
||||
@@ -587,10 +667,84 @@ class AMDSMICommands():
|
||||
if multiple_devices:
|
||||
self.logger.store_multiple_device_output()
|
||||
return # Skip printing when there are multiple devices
|
||||
|
||||
self.logger.print_output(multiple_device_enabled=multiple_devices_csv_override)
|
||||
|
||||
|
||||
def static(self, args, multiple_devices=False, gpu=None, asic=None,
|
||||
bus=None, vbios=None, limit=None, driver=None, ras=None,
|
||||
board=None, numa=None, vram=None, cache=None, partition=None,
|
||||
dfc_ucode=None, fb_info=None, num_vf=None, cpu=None,
|
||||
interface_ver=None):
|
||||
"""Get Static information for target gpu and cpu
|
||||
|
||||
Args:
|
||||
args (Namespace): Namespace containing the parsed CLI args
|
||||
multiple_devices (bool, optional): True if checking for multiple devices. Defaults to False.
|
||||
gpu (device_handle, optional): device_handle for target device. Defaults to None.
|
||||
asic (bool, optional): Value override for args.asic. Defaults to None.
|
||||
bus (bool, optional): Value override for args.bus. Defaults to None.
|
||||
vbios (bool, optional): Value override for args.vbios. Defaults to None.
|
||||
limit (bool, optional): Value override for args.limit. Defaults to None.
|
||||
driver (bool, optional): Value override for args.driver. Defaults to None.
|
||||
ras (bool, optional): Value override for args.ras. Defaults to None.
|
||||
board (bool, optional): Value override for args.board. Defaults to None.
|
||||
numa (bool, optional): Value override for args.numa. Defaults to None.
|
||||
vram (bool, optional): Value override for args.vram. Defaults to None.
|
||||
cache (bool, optional): Value override for args.cache. Defaults to None.
|
||||
partition (bool, optional): Value override for args.partition. Defaults to None.
|
||||
dfc_ucode (bool, optional): Value override for args.dfc_ucode. Defaults to None.
|
||||
fb_info (bool, optional): Value override for args.fb_info. Defaults to None.
|
||||
num_vf (bool, optional): Value override for args.num_vf. Defaults to None.
|
||||
cpu (cpu_handle, optional): cpu_handle for target device. Defaults to None.
|
||||
interface_ver (bool, optional): Value override for args.interface_ver. Defaults to None
|
||||
|
||||
Raises:
|
||||
IndexError: Index error if gpu list is empty
|
||||
|
||||
Returns:
|
||||
None: Print output via AMDSMILogger to destination
|
||||
"""
|
||||
# Set args.* to passed in arguments
|
||||
if gpu:
|
||||
args.gpu = gpu
|
||||
if cpu:
|
||||
args.cpu = cpu
|
||||
if interface_ver:
|
||||
args.interface_ver = interface_ver
|
||||
|
||||
gpus = args.gpu
|
||||
cpus = args.cpu
|
||||
|
||||
gpu_options = any([args.gpu, args.asic, args.bus, args.vbios, args.driver, args.vram, args.cache, args.board])
|
||||
cpu_options = any([args.smu, args.interface_ver])
|
||||
|
||||
# Handle No GPU passed
|
||||
if args.gpu == None:
|
||||
args.gpu = self.device_handles
|
||||
|
||||
# Handle No CPU passed
|
||||
if args.cpu == None:
|
||||
args.cpu = self.cpu_handles
|
||||
|
||||
if (len(self.cpu_handles) and (((not gpus) and (not cpus)) or cpus)):
|
||||
self.get_static_cpu(args, cpu)
|
||||
else:
|
||||
logging.info("No CPU devices present")
|
||||
|
||||
if (len(self.device_handles) and (((not gpus) and (not cpus)) or gpus)):
|
||||
self.logger.clear_multiple_devices_ouput()
|
||||
self.get_static_gpu(args, multiple_devices, gpu, asic,
|
||||
bus, vbios, limit, driver, ras,
|
||||
board, numa, vram, cache, partition,
|
||||
dfc_ucode, fb_info, num_vf)
|
||||
else:
|
||||
logging.info("No GPU devices present")
|
||||
|
||||
if (len(self.cpu_handles) == 0 and len(self.device_handles) == 0):
|
||||
logging.error("No CPU and GPU devices present")
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
def firmware(self, args, multiple_devices=False, gpu=None, fw_list=True):
|
||||
""" Get Firmware information for target gpu
|
||||
|
||||
@@ -786,7 +940,7 @@ class AMDSMICommands():
|
||||
self.logger.print_output()
|
||||
|
||||
|
||||
def metric(self, args, multiple_devices=False, watching_output=False, gpu=None,
|
||||
def metric_gpu(self, args, multiple_devices=False, watching_output=False, gpu=None,
|
||||
usage=None, watch=None, watch_time=None, iterations=None, power=None,
|
||||
clock=None, temperature=None, ecc=None, ecc_block=None, pcie=None,
|
||||
fan=None, voltage_curve=None, overdrive=None, perf_level=None,
|
||||
@@ -915,7 +1069,7 @@ class AMDSMICommands():
|
||||
|
||||
# Store output from multiple devices
|
||||
for device_handle in args.gpu:
|
||||
self.metric(args, multiple_devices=True, watching_output=watching_output, gpu=device_handle)
|
||||
self.metric_gpu(args, multiple_devices=True, watching_output=watching_output, gpu=device_handle)
|
||||
|
||||
# Reload original gpus
|
||||
args.gpu = stored_gpus
|
||||
@@ -941,7 +1095,9 @@ class AMDSMICommands():
|
||||
|
||||
# Put the metrics table in the debug logs
|
||||
try:
|
||||
logging.debug("GPU Metrics table for %s | %s", gpu_id, amdsmi_interface.amdsmi_get_gpu_metrics_info(args.gpu))
|
||||
gpu_metric_output = amdsmi_interface.amdsmi_get_gpu_metrics_info(args.gpu)
|
||||
gpu_metric_str = json.dumps(gpu_metric_output, indent=4)
|
||||
logging.debug("GPU Metrics table for %s | %s", gpu_id, gpu_metric_str)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
logging.debug("Unabled to load GPU Metrics table for %s | %s", gpu_id, e.err_info)
|
||||
|
||||
@@ -963,14 +1119,30 @@ class AMDSMICommands():
|
||||
engine_usage['gfx_usage'] = engine_usage.pop('gfx_activity')
|
||||
engine_usage['mem_usage'] = engine_usage.pop('umc_activity')
|
||||
engine_usage['mm_ip_usage'] = engine_usage.pop('mm_activity')
|
||||
|
||||
engine_usage['vcn_activities'] = gpu_metric_output.pop('vcn_activity')
|
||||
engine_usage['jpeg_activities[AID0]'] = gpu_metric_output.pop('jpeg_activities[AID0]')
|
||||
engine_usage['jpeg_activities[AID1]'] = gpu_metric_output.pop('jpeg_activities[AID1]')
|
||||
engine_usage['jpeg_activities[AID2]'] = gpu_metric_output.pop('jpeg_activities[AID2]')
|
||||
engine_usage['jpeg_activities[AID3]'] = gpu_metric_output.pop('jpeg_activities[AID3]')
|
||||
for key, value in engine_usage.items():
|
||||
if value == 65535:
|
||||
if not isinstance(value, list) and value > 100:
|
||||
engine_usage[key] = "N/A"
|
||||
elif isinstance(value, list):
|
||||
engine_usage[key] = ["N/A" if v > 100 else v for v in value]
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
if engine_usage[key] != "N/A":
|
||||
unit = '%'
|
||||
unit = '%'
|
||||
if isinstance(value, list):
|
||||
engine_usage[key] = [f"{v} {unit}" if str(v) != "N/A" else str(v) for v in engine_usage[key]]
|
||||
save_value = engine_usage[key]
|
||||
pretty_array = "["
|
||||
for i in range(len(save_value)):
|
||||
if (i+1 != len(save_value)):
|
||||
pretty_array += save_value[i] + ", "
|
||||
else:
|
||||
pretty_array += save_value[i] + "]"
|
||||
engine_usage[key] = pretty_array
|
||||
elif not isinstance(value, list) and engine_usage[key] != "N/A":
|
||||
engine_usage[key] = f"{value} {unit}"
|
||||
|
||||
values_dict['usage'] = engine_usage
|
||||
@@ -1001,7 +1173,7 @@ class AMDSMICommands():
|
||||
power_dict['current_power'] = power_info['current_socket_power']
|
||||
|
||||
if power_dict['current_power'] == "N/A":
|
||||
power_dict['current_power'] = power_info['average_socket_power']
|
||||
power_dict['average_power'] = power_info['average_socket_power']
|
||||
|
||||
power_dict['current_gfx_voltage'] = power_info['gfx_voltage']
|
||||
power_dict['current_soc_voltage'] = power_info['soc_voltage']
|
||||
@@ -1193,7 +1365,9 @@ class AMDSMICommands():
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
unit = 'GT/s'
|
||||
pcie_link_status['current_speed'] = f"{pcie_link_status['pcie_speed']} {unit}"
|
||||
pcie_dict['current_lanes'] = f"{pcie_link_status['pcie_lanes']} lanes"
|
||||
pcie_dict['current_speed'] = f"{pcie_dict['current_speed']} GT/s"
|
||||
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
logging.debug("Failed to get pcie link status for gpu %s | %s", gpu_id, e.get_error_info())
|
||||
|
||||
@@ -1225,9 +1399,6 @@ class AMDSMICommands():
|
||||
logging.debug("Failed to get pcie replay rollover counter for gpu %s | %s", gpu_id, e.get_error_info())
|
||||
|
||||
try:
|
||||
# nak_info = amdsmi_interface.amdsmi_get_gpu_pci_nak_info(args.gpu)
|
||||
# pcie_dict['nak_sent_count'] = nak_info['nak_sent_count']
|
||||
# pcie_dict['nak_received_count'] = nak_info['nak_received_count']
|
||||
pcie_dict['nak_sent_count'] = "N/A"
|
||||
pcie_dict['nak_received_count'] = "N/A"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
@@ -1464,6 +1635,642 @@ class AMDSMICommands():
|
||||
self.logger.store_watch_output(multiple_device_enabled=False)
|
||||
|
||||
|
||||
def metric_cpu(self, args, multiple_devices=False, cpu=None, power_metrics=None, prochot=None,
|
||||
freq_metrics=None, c0_res=None, lclk_dpm_level=None,pwr_svi_telemtry_rails=None,
|
||||
io_bandwidth=None, xgmi_bandwidth=None, enable_apb=None, disable_apb=None,
|
||||
set_pow_limit=None, set_xgmi_link_width=None, set_lclk_dpm_level=None,
|
||||
set_soc_boost_limit=None, metrics_ver=None, metrics_table=None, socket_energy=None,
|
||||
set_pwr_eff_mode=None, ddr_bandwidth=None, cpu_temp=None, dimm_temp_range_rate=None,
|
||||
dimm_pow_conumption=None, dimm_thermal_sensor=None, set_gmi3_link_width=None,
|
||||
set_pcie_lnk_rate=None, set_df_pstate_range=None):
|
||||
"""Get Metric information for target cpu
|
||||
|
||||
Args:
|
||||
args (Namespace): Namespace containing the parsed CLI args
|
||||
multiple_devices (bool, optional): True if checking for multiple devices. Defaults to False.
|
||||
cpu (cpu_handle, optional): device_handle for target device. Defaults to None.
|
||||
|
||||
Returns:
|
||||
None: Print output via AMDSMILogger to destination
|
||||
"""
|
||||
|
||||
if (cpu):
|
||||
args.cpu = cpu
|
||||
if (power_metrics):
|
||||
args.cpu_power_metrics = power_metrics
|
||||
if (prochot):
|
||||
args.cpu_prochot = prochot
|
||||
if (freq_metrics):
|
||||
args.cpu_freq_metrics = freq_metrics
|
||||
if (c0_res):
|
||||
args.cpu_c0_res = c0_res
|
||||
if (lclk_dpm_level):
|
||||
args.cpu_lclk_dpm_level = lclk_dpm_level
|
||||
if (pwr_svi_telemtry_rails):
|
||||
args.cpu_pwr_svi_telemtry_rails = pwr_svi_telemtry_rails
|
||||
if (io_bandwidth):
|
||||
args.cpu_io_bandwidth = io_bandwidth
|
||||
if (xgmi_bandwidth):
|
||||
args.cpu_xgmi_bandwidth = xgmi_bandwidth
|
||||
if (enable_apb):
|
||||
args.cpu_enable_apb = enable_apb
|
||||
if (disable_apb):
|
||||
args.cpu_disable_apb = disable_apb
|
||||
if (set_pow_limit):
|
||||
args.set_cpu_pow_limit = set_pow_limit
|
||||
if (set_xgmi_link_width):
|
||||
args.set_xgmi_link_width = set_xgmi_link_width
|
||||
if (set_lclk_dpm_level):
|
||||
args.set_lclk_dpm_level = set_lclk_dpm_level
|
||||
if (set_soc_boost_limit):
|
||||
args.set_soc_boost_limit = set_soc_boost_limit
|
||||
if (metrics_ver):
|
||||
args.cpu_metrics_ver = metrics_ver
|
||||
if (metrics_table):
|
||||
args.cpu_metrics_table = metrics_table
|
||||
if (socket_energy):
|
||||
args.socket_energy = socket_energy
|
||||
if (set_pwr_eff_mode):
|
||||
args.set_cpu_pwr_eff_mode = set_pwr_eff_mode
|
||||
if (ddr_bandwidth):
|
||||
args.set_cpu_pwr_eff_mode = ddr_bandwidth
|
||||
if (cpu_temp):
|
||||
args.cpu_temp = cpu_temp
|
||||
if (dimm_temp_range_rate):
|
||||
args.cpu_dimm_temp_range_rate = dimm_temp_range_rate
|
||||
if (dimm_pow_conumption):
|
||||
args.cpu_dimm_pow_conumption = dimm_pow_conumption
|
||||
if (dimm_thermal_sensor):
|
||||
args.cpu_dimm_thermal_sensor = dimm_thermal_sensor
|
||||
if (set_gmi3_link_width):
|
||||
args.set_cpu_gmi3_link_width = set_gmi3_link_width
|
||||
if (set_pcie_lnk_rate):
|
||||
args.set_cpu_pcie_lnk_rate = set_pcie_lnk_rate
|
||||
if (set_df_pstate_range):
|
||||
args.set_cpu_df_pstate_range = set_df_pstate_range
|
||||
|
||||
|
||||
#store cpu args that are applicable to the current platform
|
||||
curr_platform_cpu_args = ["cpu_power_metrics", "cpu_prochot", "cpu_freq_metrics",
|
||||
"cpu_c0_res", "cpu_lclk_dpm_level", "cpu_pwr_svi_telemtry_rails",
|
||||
"cpu_io_bandwidth", "cpu_xgmi_bandwidth", "cpu_disable_apb",
|
||||
"set_cpu_pow_limit","set_cpu_xgmi_link_width", "set_cpu_lclk_dpm_level",
|
||||
"set_soc_boost_limit", "cpu_metrics_ver", "cpu_metrics_table",
|
||||
"socket_energy", "set_cpu_pwr_eff_mode", "cpu_ddr_bandwidth",
|
||||
"cpu_temp", "cpu_dimm_temp_range_rate", "cpu_dimm_pow_conumption",
|
||||
"cpu_dimm_thermal_sensor", "set_cpu_gmi3_link_width", "set_cpu_pcie_lnk_rate",
|
||||
"set_cpu_df_pstate_range"]
|
||||
curr_platform_cpu_values = [args.cpu_power_metrics, args.cpu_prochot, args.cpu_freq_metrics,
|
||||
args.cpu_c0_res, args.cpu_lclk_dpm_level, args.cpu_pwr_svi_telemtry_rails,
|
||||
args.cpu_io_bandwidth, args.cpu_xgmi_bandwidth, args.cpu_disable_apb,
|
||||
args.set_cpu_pow_limit, args.set_cpu_xgmi_link_width, args.set_cpu_lclk_dpm_level,
|
||||
args.set_soc_boost_limit, args.cpu_metrics_ver, args.cpu_metrics_table,
|
||||
args.socket_energy, args.set_cpu_pwr_eff_mode, args.cpu_ddr_bandwidth,
|
||||
args.cpu_temp, args.cpu_dimm_temp_range_rate, args.cpu_dimm_pow_conumption,
|
||||
args.cpu_dimm_thermal_sensor, args.set_cpu_gmi3_link_width, args.set_cpu_pcie_lnk_rate,
|
||||
args.set_cpu_df_pstate_range]
|
||||
|
||||
|
||||
# Handle No CPU passed
|
||||
if args.cpu == None:
|
||||
args.cpu = self.cpu_handles
|
||||
|
||||
if (not any(curr_platform_cpu_values)):
|
||||
for arg in curr_platform_cpu_args:
|
||||
if arg not in("cpu_lclk_dpm_level", "cpu_io_bandwidth", "cpu_xgmi_bandwidth", "cpu_disable_apb",
|
||||
"set_cpu_pow_limit", "set_cpu_xgmi_link_width", "set_cpu_lclk_dpm_level",
|
||||
"set_soc_boost_limit", "set_cpu_pwr_eff_mode", "cpu_dimm_temp_range_rate",
|
||||
"cpu_dimm_temp_range_rate", "cpu_dimm_pow_conumption", "cpu_dimm_thermal_sensor",
|
||||
"set_cpu_gmi3_link_width", "set_cpu_pcie_lnk_rate", "set_cpu_df_pstate_range"):
|
||||
setattr(args, arg, True)
|
||||
|
||||
if (len(self.cpu_handles)):
|
||||
handled_multiple_cpus, device_handle = self.helpers.handle_cpus(args,
|
||||
self.logger,
|
||||
self.metric_cpu)
|
||||
if handled_multiple_cpus:
|
||||
return # This function is recursive
|
||||
args.cpu = device_handle
|
||||
# get cpu id for logging
|
||||
cpu_id = self.helpers.get_cpu_id_from_device_handle(args.cpu)
|
||||
logging.debug(f"Metric Arg information for CPU {cpu_id} on {self.helpers.os_info()}")
|
||||
|
||||
static_dict = {}
|
||||
if (args.cpu_power_metrics):
|
||||
static_dict["power_metrics"] = {}
|
||||
try:
|
||||
soc_pow = amdsmi_interface.amdsmi_get_cpu_socket_power(args.cpu)
|
||||
static_dict["power_metrics"]["socket power"] = soc_pow
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["power_metrics"]["socket power"] = "N/A"
|
||||
logging.debug("Failed to get socket power for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
try:
|
||||
soc_pow_limit = amdsmi_interface.amdsmi_get_cpu_socket_power_cap(args.cpu)
|
||||
static_dict["power_metrics"]["socket power limit"] = soc_pow_limit
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["power_metrics"]["socket power limit"] = "N/A"
|
||||
logging.debug("Failed to get socket power limit for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
try:
|
||||
soc_max_pow_limit = amdsmi_interface.amdsmi_get_cpu_socket_power_cap_max(args.cpu)
|
||||
static_dict["power_metrics"]["socket max power limit"] = soc_max_pow_limit
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["power_metrics"]["socket max power limit"] = "N/A"
|
||||
logging.debug("Failed to get max socket power limit for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_prochot):
|
||||
static_dict["prochot"] = {}
|
||||
try:
|
||||
proc_status = amdsmi_interface.amdsmi_get_cpu_prochot_status(args.cpu)
|
||||
static_dict["prochot"]["prochot_status"] = proc_status
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["prochot"]["prochot_status"] = "N/A"
|
||||
logging.debug("Failed to get prochot status for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_freq_metrics):
|
||||
static_dict["freq_metrics"] = {}
|
||||
try:
|
||||
fclk_mclk = amdsmi_interface.amdsmi_get_cpu_fclk_mclk(args.cpu)
|
||||
static_dict["freq_metrics"]["fclkmemclk"] = fclk_mclk
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["freq_metrics"]["fclkmemclk"] = "N/A"
|
||||
logging.debug("Failed to get current fclkmemclk freq for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
try:
|
||||
cclk_freq = amdsmi_interface.amdsmi_get_cpu_cclk_limit(args.cpu)
|
||||
static_dict["freq_metrics"]["cclkfreqlimit"] = cclk_freq
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["freq_metrics"]["cclkfreqlimit"] = "N/A"
|
||||
logging.debug("Failed to get current cclk freq for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
try:
|
||||
soc_cur_freq_limit = amdsmi_interface.amdsmi_get_cpu_socket_current_active_freq_limit(args.cpu)
|
||||
static_dict["freq_metrics"]["soc_current_active_freq_limit"] = soc_cur_freq_limit
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["freq_metrics"]["soc_current_active_freq_limit"] = "N/A"
|
||||
logging.debug("Failed to get socket current freq limit for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
try:
|
||||
soc_freq_range = amdsmi_interface.amdsmi_get_cpu_socket_freq_range(args.cpu)
|
||||
static_dict["freq_metrics"]["soc_freq_range"] = soc_freq_range
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["freq_metrics"]["soc_freq_range"] = "N/A"
|
||||
logging.debug("Failed to get socket freq range for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_c0_res):
|
||||
static_dict["c0_residency"] = {}
|
||||
try:
|
||||
residency = amdsmi_interface.amdsmi_get_cpu_socket_c0_residency(args.cpu)
|
||||
static_dict["c0_residency"]["residency"] = residency
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["c0_residency"]["residency"] = "N/A"
|
||||
logging.debug("Failed to get C0 residency for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_lclk_dpm_level):
|
||||
static_dict["socket_dpm"] = {}
|
||||
try:
|
||||
dpm_val = amdsmi_interface.amdsmi_get_cpu_socket_lclk_dpm_level(args.cpu,
|
||||
args.cpu_lclk_dpm_level[0][0])
|
||||
static_dict["socket_dpm"]["dpml_level_range"] = dpm_val
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["socket_dpm"]["dpml_level_range"] = dpm_val
|
||||
logging.debug("Failed to get socket dpm level range for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_pwr_svi_telemtry_rails):
|
||||
static_dict["svi_telemetry_all_rails"] = {}
|
||||
try:
|
||||
power = amdsmi_interface.amdsmi_get_cpu_pwr_svi_telemetry_all_rails(args.cpu)
|
||||
static_dict["svi_telemetry_all_rails"]["power"] = power
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["c0_residency"]["residency"] = "N/A"
|
||||
logging.debug("Failed to get svi telemetry all rails for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
if (args.cpu_io_bandwidth):
|
||||
static_dict["io_bandwidth"] = {}
|
||||
try:
|
||||
bandwidth = amdsmi_interface.amdsmi_get_cpu_current_io_bandwidth(args.cpu,
|
||||
int(args.cpu_io_bandwidth[0][0]),
|
||||
args.cpu_io_bandwidth[0][1])
|
||||
static_dict["io_bandwidth"]["band_width"] = bandwidth
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["io_bandwidth"]["band_width"] = "N/A"
|
||||
logging.debug("Failed to get io bandwidth for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
if (args.cpu_xgmi_bandwidth):
|
||||
static_dict["xgmi_bandwidth"] = {}
|
||||
try:
|
||||
bandwidth = amdsmi_interface.amdsmi_get_cpu_current_xgmi_bw(args.cpu,
|
||||
int(args.cpu_xgmi_bandwidth[0][0]),
|
||||
args.cpu_xgmi_bandwidth[0][1])
|
||||
static_dict["xgmi_bandwidth"]["band_width"] = bandwidth
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["xgmi_bandwidth"]["band_width"] = "N/A"
|
||||
logging.debug("Failed to get xgmi bandwidth for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
if (args.cpu_enable_apb):
|
||||
static_dict["apbenable"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_cpu_apb_enable(args.cpu)
|
||||
static_dict["apbenable"]["state"] = "Enabled DF - Pstate performance boost algorithm"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["apbenable"]["state"] = "N/A"
|
||||
logging.debug("Failed to enable APB for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_disable_apb):
|
||||
static_dict["apbdisable"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_cpu_apb_disable(args.cpu, args.cpu_disable_apb[0][0])
|
||||
static_dict["apbdisable"]["state"] = "Disabled DF - Pstate performance boost algorithm"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["apbdisable"]["state"] = "N/A"
|
||||
logging.debug("Failed to enable APB for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.set_cpu_pow_limit):
|
||||
static_dict["set_pow_limit"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_socket_power_cap(args.cpu, args.set_cpu_pow_limit[0][0])
|
||||
static_dict["set_pow_limit"]["Response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_pow_limit"]["Response"] = "Set Operation successful"
|
||||
logging.debug("Failed to set power limit for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.set_cpu_xgmi_link_width):
|
||||
static_dict["set_xgmi_link_width"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_xgmi_width(args.cpu, args.set_cpu_xgmi_link_width[0][0],
|
||||
args.set_cpu_xgmi_link_width[0][1])
|
||||
static_dict["set_xgmi_link_width"]["Response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_xgmi_link_width"]["Response"] = "N/A"
|
||||
logging.debug("Failed to set xgmi link width for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.set_cpu_lclk_dpm_level):
|
||||
static_dict["set_lclk_dpm_level"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_socket_lclk_dpm_level(args.cpu, args.set_cpu_lclk_dpm_level[0][0],
|
||||
args.set_cpu_lclk_dpm_level[0][1],
|
||||
args.set_cpu_lclk_dpm_level[0][2])
|
||||
static_dict["set_lclk_dpm_level"]["Response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_lclk_dpm_level"]["Response"] = "N/A"
|
||||
logging.debug("Failed to set lclk dpm level for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
if (args.set_soc_boost_limit):
|
||||
static_dict["set_soc_boost_limit"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_socket_boostlimit(args.cpu, args.set_soc_boost_limit[0][0])
|
||||
static_dict["set_soc_boost_limit"]["Response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_soc_boost_limit"]["Response"] = "N/A"
|
||||
logging.debug("Failed to set socket boost limit for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_metrics_ver):
|
||||
static_dict["metric_version"] = {}
|
||||
try:
|
||||
version = amdsmi_interface.amdsmi_get_metrics_table_version(args.cpu)
|
||||
static_dict["metric_version"]["version"] = version
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["metric_version"]["version"] = "N/A"
|
||||
logging.debug("Failed to get metrics table version for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_metrics_table):
|
||||
static_dict["metrics_table"] = {}
|
||||
static_dict["metrics_table"]["response"] = "N/A"
|
||||
# Note:- amdsmi_get_metrics_table has been disabled as there is fix needed in the library API and will be
|
||||
# in next version
|
||||
"""try:
|
||||
metrics_table = amdsmi_interface.amdsmi_get_metrics_table(args.cpu)
|
||||
static_dict["metrics_table"]["response"] = metrics_table
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["metrics_table"]["response"] = "N/A"
|
||||
logging.debug("Failed to get metrics table for cpu %s | %s", cpu_id, e.get_error_info())"""
|
||||
|
||||
if (args.socket_energy):
|
||||
static_dict["socket_energy"] = {}
|
||||
try:
|
||||
energy = amdsmi_interface.amdsmi_get_cpu_socket_energy(args.cpu)
|
||||
static_dict["socket_energy"]["response"] = energy
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["socket_energy"]["response"] = "N/A"
|
||||
logging.debug("Failed to get socket energy for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if(args.set_cpu_pwr_eff_mode):
|
||||
static_dict["set_pwr_eff_mode"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_pwr_efficiency_mode(args.cpu, args.set_cpu_pwr_eff_mode[0][0])
|
||||
static_dict["set_pwr_eff_mode"]["Response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_pwr_eff_mode"]["Response"] = "N/A"
|
||||
logging.debug("Failed to set power efficiency mode for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_ddr_bandwidth):
|
||||
static_dict["ddr_bandwidth"] = {}
|
||||
try:
|
||||
resp = amdsmi_interface.amdsmi_get_cpu_ddr_bw(args.cpu)
|
||||
static_dict["ddr_bandwidth"]["response"] = resp
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["ddr_bandwidth"]["response"] = "N/A"
|
||||
logging.debug("Failed to get ddr bandwdith for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_temp):
|
||||
static_dict["cpu_temp"] = {}
|
||||
try:
|
||||
resp = amdsmi_interface.amdsmi_get_cpu_socket_temperature(args.cpu)
|
||||
static_dict["cpu_temp"]["response"] = resp
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["cpu_temp"]["response"] = "N/A"
|
||||
logging.debug("Failed to get cpu temperature for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_dimm_temp_range_rate):
|
||||
static_dict["dimm_temp_range_rate"] = {}
|
||||
try:
|
||||
resp = amdsmi_interface.amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(args.cpu, args.cpu_dimm_temp_range_rate[0][0])
|
||||
static_dict["dimm_temp_range_rate"]["response"] = resp
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["dimm_temp_range_rate"]["response"] = "N/A"
|
||||
logging.debug("Failed to get dimm temperature range and refresh rate for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_dimm_pow_conumption):
|
||||
static_dict["dimm_pow_conumption"] = {}
|
||||
try:
|
||||
resp = amdsmi_interface.amdsmi_get_cpu_dimm_power_consumption(args.cpu, args.cpu_dimm_pow_conumption[0][0])
|
||||
static_dict["dimm_pow_conumption"]["response"] = resp
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["dimm_pow_conumption"]["response"] = "N/A"
|
||||
logging.debug("Failed to get dimm temperature range and refresh rate for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.cpu_dimm_thermal_sensor):
|
||||
static_dict["dimm_thermal_sensor"] = {}
|
||||
try:
|
||||
resp = amdsmi_interface.amdsmi_get_cpu_dimm_thermal_sensor(args.cpu, args.cpu_dimm_thermal_sensor[0][0])
|
||||
static_dict["dimm_thermal_sensor"]["response"] = resp
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["dimm_thermal_sensor"]["response"] = "N/A"
|
||||
logging.debug("Failed to get dimm temperature range and refresh rate for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.set_cpu_gmi3_link_width):
|
||||
static_dict["set_gmi3_link_width"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_gmi3_link_width_range(args.cpu, args.set_cpu_gmi3_link_width[0][0],
|
||||
args.set_cpu_gmi3_link_width[0][1])
|
||||
static_dict["set_gmi3_link_width"]["response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_gmi3_link_width"]["response"] = "N/A"
|
||||
logging.debug("Failed to set gmi3 link width for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.set_cpu_pcie_lnk_rate):
|
||||
static_dict["set_pcie_lnk_rate"] = {}
|
||||
try:
|
||||
resp = amdsmi_interface.amdsmi_set_cpu_pcie_link_rate(args.cpu, args.set_cpu_pcie_lnk_rate[0][0])
|
||||
static_dict["set_pcie_lnk_rate"]["prev_mode"] = resp
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_pcie_lnk_rate"]["prev_mode"] = "N/A"
|
||||
logging.debug("Failed to set pcie link rate for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
if (args.set_cpu_df_pstate_range):
|
||||
static_dict["set_df_pstate_range"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_df_pstate_range(args.cpu, args.set_cpu_df_pstate_range[0][0],
|
||||
args.set_cpu_df_pstate_range[0][1])
|
||||
static_dict["set_df_pstate_range"]["response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_df_pstate_range"]["response"] = "N/A"
|
||||
logging.debug("Failed to set df pstate range for cpu %s | %s", cpu_id, e.get_error_info())
|
||||
|
||||
multiple_devices_csv_override = False
|
||||
self.logger.store_cpu_output(args.cpu, 'values', static_dict)
|
||||
if multiple_devices:
|
||||
self.logger.store_multiple_device_output()
|
||||
return # Skip printing when there are multiple devices
|
||||
self.logger.print_output(multiple_device_enabled=multiple_devices_csv_override)
|
||||
|
||||
|
||||
def metric_core(self, args, multiple_devices=False, core=None, boost_limit=None,
|
||||
curr_active_freq_core_limit=None, set_core_boost_limit=None, core_energy=None):
|
||||
"""Get Static information for target core
|
||||
|
||||
Args:
|
||||
args (Namespace): Namespace containing the parsed CLI args
|
||||
multiple_devices (bool, optional): True if checking for multiple devices. Defaults to False.
|
||||
core (device_handle, optional): device_handle for target device. Defaults to None.
|
||||
|
||||
Returns:
|
||||
None: Print output via AMDSMILogger to destination
|
||||
"""
|
||||
if core:
|
||||
args.core = core
|
||||
if boost_limit:
|
||||
args.core_boost_limit = boost_limit
|
||||
if curr_active_freq_core_limit:
|
||||
args.core_curr_active_freq_core_limit = curr_active_freq_core_limit
|
||||
if set_core_boost_limit:
|
||||
args.set_core_boost_limit = boost_limit
|
||||
if core_energy:
|
||||
args.core_energy = core_energy
|
||||
|
||||
#store core args that are applicable to the current platform
|
||||
curr_platform_core_args = ["core_boost_limit", "core_curr_active_freq_core_limit",
|
||||
"set_core_boost_limit","core_energy"]
|
||||
curr_platform_core_values = [args.core_boost_limit, args.core_curr_active_freq_core_limit,
|
||||
args.set_core_boost_limit, args.core_energy]
|
||||
|
||||
# Handle No core passed
|
||||
if args.core == None:
|
||||
args.core = self.core_handles
|
||||
|
||||
if (not any(curr_platform_core_values)):
|
||||
for arg in curr_platform_core_args:
|
||||
if arg not in (["set_core_boost_limit"]):
|
||||
setattr(args, arg, True)
|
||||
|
||||
if (len(self.core_handles)):
|
||||
handled_multiple_cores, device_handle = self.helpers.handle_cores(args,
|
||||
self.logger,
|
||||
self.metric_core)
|
||||
if handled_multiple_cores:
|
||||
return # This function is recursive
|
||||
args.core = device_handle
|
||||
# get core id for logging
|
||||
core_id = self.helpers.get_core_id_from_device_handle(args.core)
|
||||
logging.debug(f"Static Arg information for Core {core_id} on {self.helpers.os_info()}")
|
||||
|
||||
static_dict = {}
|
||||
if (args.core_boost_limit):
|
||||
static_dict["boost_limit"] ={}
|
||||
|
||||
try:
|
||||
boost_limit = amdsmi_interface.amdsmi_get_cpu_core_boostlimit(args.core)
|
||||
static_dict["boost_limit"]["value"] = boost_limit
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["boost_limit"]["value"] = "N/A"
|
||||
logging.debug("Failed to get core boost limit for core %s | %s", core_id, e.get_error_info())
|
||||
if (args.core_curr_active_freq_core_limit):
|
||||
static_dict["curr_active_freq_core_limit"] = {}
|
||||
|
||||
try:
|
||||
freq = amdsmi_interface.amdsmi_get_cpu_core_current_freq_limit(args.core)
|
||||
static_dict["curr_active_freq_core_limit"]["value"] = freq
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["curr_active_freq_core_limit"]["value"] = "N/A"
|
||||
logging.debug("Failed to get current active frequency core for core %s | %s", core_id, e.get_error_info())
|
||||
|
||||
if (args.set_core_boost_limit):
|
||||
static_dict["set_core_boost_limit"] = {}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_cpu_core_boostlimit(args.core, args.set_core_boost_limit[0][0])
|
||||
static_dict["set_core_boost_limit"]["Response"] = "Set Operation successful"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["set_core_boost_limit"]["Response"] = "N/A"
|
||||
logging.debug("Failed to set core boost limit for cpu %s | %s", core_id, e.get_error_info())
|
||||
|
||||
|
||||
if (args.core_energy):
|
||||
static_dict["core_energy"] ={}
|
||||
try:
|
||||
energy = amdsmi_interface.amdsmi_get_cpu_core_energy(args.core)
|
||||
static_dict["core_energy"]["value"] = energy
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["core_energy"]["value"] = "N/A"
|
||||
logging.debug("Failed to get core energy for core %s | %s", core_id, e.get_error_info())
|
||||
|
||||
|
||||
multiple_devices_csv_override = False
|
||||
self.logger.store_core_output(args.core, 'values', static_dict)
|
||||
if multiple_devices:
|
||||
self.logger.store_multiple_device_output()
|
||||
return # Skip printing when there are multiple devices
|
||||
self.logger.print_output(multiple_device_enabled=multiple_devices_csv_override)
|
||||
|
||||
|
||||
def metric(self, args, multiple_devices=False, watching_output=False, gpu=None,
|
||||
usage=None, watch=None, watch_time=None, iterations=None, power=None,
|
||||
clock=None, temperature=None, ecc=None, ecc_block=None, pcie=None,
|
||||
fan=None, voltage_curve=None, overdrive=None, perf_level=None,
|
||||
xgmi_err=None, energy=None, mem_usage=None, schedule=None,
|
||||
guard=None, guest_data=None, fb_usage=None, xgmi=None,cpu=None,
|
||||
cpu_power_metrics=None, prochot=None, freq_metrics=None, c0_res=None,
|
||||
lclk_dpm_level=None,pwr_svi_telemtry_rails=None, io_bandwidth=None,
|
||||
xgmi_bandwidth=None, enable_apb=None, disable_apb=None,set_pow_limit=None,
|
||||
set_xgmi_link_width=None, set_lclk_dpm_level=None, set_soc_boost_limit=None,
|
||||
metrics_ver=None, metrics_table=None, socket_energy=None,set_pwr_eff_mode=None,
|
||||
ddr_bandwidth=None, cpu_temp=None, dimm_temp_range_rate=None,dimm_pow_conumption=None,
|
||||
dimm_thermal_sensor=None, set_gmi3_link_width=None, set_pcie_lnk_rate=None,
|
||||
set_df_pstate_range=None, core=None, boost_limit=None,
|
||||
curr_active_freq_core_limit=None, set_core_boost_limit=None, core_energy=None):
|
||||
"""Get Metric information for target gpu
|
||||
|
||||
Args:
|
||||
args (Namespace): Namespace containing the parsed CLI args
|
||||
multiple_devices (bool, optional): True if checking for multiple devices. Defaults to False.
|
||||
watching_output (bool, optional): True if watch option has been set. Defaults to False.
|
||||
gpu (device_handle, optional): device_handle for target device. Defaults to None.
|
||||
usage (bool, optional): Value override for args.usage. Defaults to None.
|
||||
watch (Positive int, optional): Value override for args.watch. Defaults to None.
|
||||
watch_time (Positive int, optional): Value override for args.watch_time. Defaults to None.
|
||||
iterations (Positive int, optional): Value override for args.iterations. Defaults to None.
|
||||
power (bool, optional): Value override for args.power. Defaults to None.
|
||||
clock (bool, optional): Value override for args.clock. Defaults to None.
|
||||
temperature (bool, optional): Value override for args.temperature. Defaults to None.
|
||||
ecc (bool, optional): Value override for args.ecc. Defaults to None.
|
||||
ecc_block (bool, optional): Value override for args.ecc. Defaults to None.
|
||||
pcie (bool, optional): Value override for args.pcie. Defaults to None.
|
||||
fan (bool, optional): Value override for args.fan. Defaults to None.
|
||||
voltage_curve (bool, optional): Value override for args.voltage_curve. Defaults to None.
|
||||
overdrive (bool, optional): Value override for args.overdrive. Defaults to None.
|
||||
perf_level (bool, optional): Value override for args.perf_level. Defaults to None.
|
||||
xgmi_err (bool, optional): Value override for args.xgmi_err. Defaults to None.
|
||||
energy (bool, optional): Value override for args.energy. Defaults to None.
|
||||
mem_usage (bool, optional): Value override for args.mem_usage. Defaults to None.
|
||||
schedule (bool, optional): Value override for args.schedule. Defaults to None.
|
||||
guard (bool, optional): Value override for args.guard. Defaults to None.
|
||||
guest_data (bool, optional): Value override for args.guest_data. Defaults to None.
|
||||
fb_usage (bool, optional): Value override for args.fb_usage. Defaults to None.
|
||||
xgmi (bool, optional): Value override for args.xgmi. Defaults to None.
|
||||
cpu_power_metrics (bool, optional): Value override for args.cpu_power_metrics. Defaults to None
|
||||
prochot (bool, optional): Value override for args.prochot. Defaults to None.
|
||||
freq_metrics (bool, optional): Value override for args.freq_metrics. Defaults to None.
|
||||
c0_res (bool, optional): Value override for args.c0_res. Defaults to None
|
||||
lclk_dpm_level (list, optional): Value override for args.lclk_dpm_level. Defaults to None
|
||||
pwr_svi_telemtry_rails (list, optional): value override for args.pwr_svi_telemtry_rails. Defaults to None
|
||||
io_bandwidth (list, optional): value override for args.io_bandwidth. Defaults to None
|
||||
xgmi_bandwidth (list, optional): value override for args.xgmi_bandwidth. Defaults to None
|
||||
enable_apb (bool, optional): Value override for args.enable_apb. Defaults to None
|
||||
disable_apb (bool, optional): Value override for args.disable_apb. Defaults to None
|
||||
set_pow_limit (bool, optional): Value override for args.cpu_set_pow_limit. Defaults to None
|
||||
set_xgmi_link_width (list, optional): Value override for args.set_cpu_xgmi_link_width. Defaults to None
|
||||
set_lclk_dpm_level (bool, optional): Value override for args.set_cpu_lclk_dpm_level. Defaults to None
|
||||
boost_limit (bool, optional): Value override for args.boost_limit. Defaults to None
|
||||
set_soc_boost_limit (list, optional): Value override for args.set_soc_boost_limit. Defaults to None
|
||||
metrics_ver (bool, optional): Value override for args.cpu_metrics_ver. Defaults to None
|
||||
metrics_table (bool, optional): Value override for args.cpu_metrics_table. Defaults to None
|
||||
socket_energy (bool, optional): Value override for args.socket_energy. Defaults to None
|
||||
set_pwr_eff_mode (list, optional): Value override for args.set_cpu_pwr_eff_mode. Defaults to None
|
||||
ddr_bandwidth (bool, optional): Value override for args.ddr_bandwidth. Defaults to None
|
||||
cpu_temp (bool, optional): Value override for args.cpu_temp. Defaults to None
|
||||
dimm_temp_range_rate (bool, optional): Value override for args.cpu_dimm_temp_range_rate. Defaults to None
|
||||
dimm_pow_conumption (bool, optional): Value override for args.cpu_dimm_pow_conumption. Defaults to None
|
||||
dimm_thermal_sensor (bool, optional): Value override for args.cpu_dimm_thermal_sensor. Defaults to None
|
||||
set_gmi3_link_width (list, optional): Value override for args.set_cpu_gmi3_link_width. Defaults to None
|
||||
set_pcie_lnk_rate (list, optional): Value override for args.set_cpu_pcie_lnk_rate. Defaults to None
|
||||
set_df_pstate_range (list, optional): Value override for args.set_cpu_df_pstate_range. Defaults to None
|
||||
|
||||
Raises:
|
||||
IndexError: Index error if gpu list is empty
|
||||
|
||||
Returns:
|
||||
None: Print output via AMDSMILogger to destination
|
||||
"""
|
||||
gpus = args.gpu
|
||||
cpus= args.cpu
|
||||
cores = args.core
|
||||
gpu_options = any([args.gpu, args.usage,args.watch, args.watch_time, args.iterations,
|
||||
args.power, args.clock, args.temperature, args.ecc, args.ecc_block,
|
||||
args.pcie, args.fan, args.voltage_curve, args.overdrive, args.perf_level,
|
||||
args.xgmi_err, args.energy, args.mem_usage])
|
||||
cpu_options = any([args.cpu, args.cpu_power_metrics, args.cpu_prochot,
|
||||
args.cpu_freq_metrics, args.cpu_c0_res, args.cpu_lclk_dpm_level,
|
||||
args.cpu_pwr_svi_telemtry_rails, args.cpu_io_bandwidth, args.cpu_xgmi_bandwidth,
|
||||
args.cpu_enable_apb, args.cpu_disable_apb, args.set_cpu_pow_limit,
|
||||
args.set_cpu_xgmi_link_width, args.set_cpu_lclk_dpm_level,
|
||||
args.set_soc_boost_limit,args.cpu_metrics_ver, args.cpu_metrics_table,
|
||||
args.socket_energy, args.set_cpu_pwr_eff_mode,args.cpu_ddr_bandwidth,
|
||||
args.cpu_temp, args.cpu_dimm_temp_range_rate, args.cpu_dimm_pow_conumption,
|
||||
args.cpu_dimm_thermal_sensor, args.set_cpu_gmi3_link_width,
|
||||
args.set_cpu_pcie_lnk_rate, args.set_cpu_df_pstate_range])
|
||||
|
||||
core_options = any([args.core_boost_limit, args.core_curr_active_freq_core_limit,
|
||||
args.set_core_boost_limit, args.core_energy])
|
||||
if ((len(self.device_handles) and ((((not gpus) and (not cpus) and (not cores)) or gpus)
|
||||
and not cpu_options and not core_options))):
|
||||
self.metric_gpu( args, multiple_devices, watching_output, gpu,
|
||||
usage, watch, watch_time, iterations, power,
|
||||
clock, temperature, ecc, ecc_block, pcie,
|
||||
fan, voltage_curve, overdrive, perf_level,
|
||||
xgmi_err, energy, mem_usage, schedule,
|
||||
guard, guest_data, fb_usage, xgmi)
|
||||
|
||||
if ((len(self.cpu_handles) and ((((not gpus) and (not cpus) and (not cores)) or cpus)
|
||||
and not gpu_options and not core_options))):
|
||||
self.logger.clear_multiple_devices_ouput()
|
||||
self.metric_cpu(args, multiple_devices, cpu, cpu_power_metrics, prochot,
|
||||
freq_metrics, c0_res, lclk_dpm_level, pwr_svi_telemtry_rails,
|
||||
io_bandwidth, xgmi_bandwidth, enable_apb, disable_apb,
|
||||
set_pow_limit,set_xgmi_link_width, set_lclk_dpm_level,
|
||||
set_soc_boost_limit, metrics_ver, metrics_table, socket_energy,
|
||||
set_pwr_eff_mode,ddr_bandwidth, cpu_temp, dimm_temp_range_rate,
|
||||
dimm_pow_conumption,dimm_thermal_sensor, set_gmi3_link_width,
|
||||
set_pcie_lnk_rate, set_df_pstate_range)
|
||||
|
||||
|
||||
if ((len(self.core_handles) and ((((not gpus) and (not cpus) and (not cores)) or cores)
|
||||
and not gpu_options and not cpu_options))):
|
||||
self.logger.clear_multiple_devices_ouput()
|
||||
self.metric_core(args, multiple_devices, core, boost_limit,
|
||||
curr_active_freq_core_limit, set_core_boost_limit,
|
||||
core_energy)
|
||||
|
||||
if (len(self.cpu_handles) == 0 and len(self.device_handles) == 0 and
|
||||
len(self.core_handles) == 0):
|
||||
logging.error("No CPU and GPU devices present")
|
||||
sys.exit(-1)
|
||||
|
||||
def process(self, args, multiple_devices=False, watching_output=False,
|
||||
gpu=None, general=None, engine=None, pid=None, name=None,
|
||||
watch=None, watch_time=None, iterations=None):
|
||||
|
||||
@@ -116,6 +116,97 @@ class AMDSMIHelpers():
|
||||
return self._is_windows
|
||||
|
||||
|
||||
def get_cpu_choices(self):
|
||||
"""Return dictionary of possible CPU choices and string of the output:
|
||||
Dictionary will be in format: cpus[ID]: Device Handle)
|
||||
String output will be in format:
|
||||
"ID: 0 "
|
||||
params:
|
||||
None
|
||||
return:
|
||||
(dict, str) : (cpu_choices, cpu_choices_str)
|
||||
"""
|
||||
cpu_choices = {}
|
||||
cpu_choices_str = ""
|
||||
#import pdb;pdb.set_trace()
|
||||
try:
|
||||
cpu_handles = []
|
||||
# amdsmi_get_cpusocket_handles() returns the cpu socket handles stored for cpu_id
|
||||
cpu_handles = amdsmi_interface.amdsmi_get_cpusocket_handles()
|
||||
except amdsmi_interface.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_DRIVER_NOT_LOADED):
|
||||
logging.info('Unable to get device choices, driver not initialized (amdhsmp not found in modules)')
|
||||
else:
|
||||
raise e
|
||||
if len(cpu_handles) == 0:
|
||||
logging.info('Unable to find any devices, check if driver is initialized (amdhsmp not found in modules)')
|
||||
else:
|
||||
# Handle spacing for the gpu_choices_str
|
||||
max_padding = int(math.log10(len(cpu_handles))) + 1
|
||||
|
||||
for cpu_id, device_handle in enumerate(cpu_handles):
|
||||
cpu_choices[str(cpu_id)] = {
|
||||
"Device Handle": device_handle
|
||||
}
|
||||
if cpu_id == 0:
|
||||
id_padding = max_padding
|
||||
else:
|
||||
id_padding = max_padding - int(math.log10(cpu_id))
|
||||
cpu_choices_str += f"ID: {cpu_id}\n"
|
||||
|
||||
# Add the all option to the gpu_choices
|
||||
cpu_choices["all"] = "all"
|
||||
cpu_choices_str += f" all{' ' * max_padding}| Selects all devices\n"
|
||||
|
||||
return (cpu_choices, cpu_choices_str)
|
||||
|
||||
def get_core_choices(self):
|
||||
"""Return dictionary of possible Core choices and string of the output:
|
||||
Dictionary will be in format: coress[ID]: Device Handle)
|
||||
String output will be in format:
|
||||
"ID: 0 "
|
||||
params:
|
||||
None
|
||||
return:
|
||||
(dict, str) : (core_choices, core_choices_str)
|
||||
"""
|
||||
core_choices = {}
|
||||
core_choices_str = ""
|
||||
|
||||
try:
|
||||
core_handles = []
|
||||
# amdsmi_get_cpucore_handles() returns the core handles stored for core_id
|
||||
core_handles = amdsmi_interface.amdsmi_get_cpucore_handles()
|
||||
except amdsmi_interface.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_DRIVER_NOT_LOADED):
|
||||
logging.info('Unable to get device choices, driver not initialized (amdhsmp not found in modules)')
|
||||
else:
|
||||
raise e
|
||||
if len(core_handles) == 0:
|
||||
logging.info('Unable to find any devices, check if driver is initialized (amdhsmp not found in modules)')
|
||||
else:
|
||||
# Handle spacing for the gpu_choices_str
|
||||
max_padding = int(math.log10(len(core_handles))) + 1
|
||||
|
||||
for core_id, device_handle in enumerate(core_handles):
|
||||
core_choices[str(core_id)] = {
|
||||
"Device Handle": device_handle
|
||||
}
|
||||
if core_id == 0:
|
||||
id_padding = max_padding
|
||||
else:
|
||||
id_padding = max_padding - int(math.log10(core_id))
|
||||
core_choices_str += f"ID: 0 - {len(core_handles) - 1}\n"
|
||||
|
||||
# Add the all option to the core_choices
|
||||
core_choices["all"] = "all"
|
||||
core_choices_str += f" all{' ' * max_padding}| Selects all devices\n"
|
||||
|
||||
return (core_choices, core_choices_str)
|
||||
|
||||
|
||||
def get_output_format(self):
|
||||
"""Returns the output format read from sys.argv
|
||||
Returns:
|
||||
@@ -142,6 +233,7 @@ class AMDSMIHelpers():
|
||||
"""
|
||||
gpu_choices = {}
|
||||
gpu_choices_str = ""
|
||||
device_handles = []
|
||||
|
||||
try:
|
||||
# amdsmi_get_processor_handles returns the device_handles storted for gpu_id
|
||||
@@ -149,36 +241,34 @@ class AMDSMIHelpers():
|
||||
except amdsmi_interface.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_DRIVER_NOT_LOADED):
|
||||
logging.error('Unable to get device choices, driver not initialized (amdgpu not found in modules)')
|
||||
sys.exit(-1)
|
||||
logging.info('Unable to get device choices, driver not initialized (amdgpu not found in modules)')
|
||||
else:
|
||||
raise e
|
||||
|
||||
if len(device_handles) == 0:
|
||||
logging.error('Unable to find any devices, check if driver is initialized (amdgpu not found in modules)')
|
||||
sys.exit(-1)
|
||||
logging.info('Unable to find any devices, check if driver is initialized (amdgpu not found in modules)')
|
||||
else:
|
||||
# Handle spacing for the gpu_choices_str
|
||||
max_padding = int(math.log10(len(device_handles))) + 1
|
||||
|
||||
# Handle spacing for the gpu_choices_str
|
||||
max_padding = int(math.log10(len(device_handles))) + 1
|
||||
for gpu_id, device_handle in enumerate(device_handles):
|
||||
bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(device_handle)
|
||||
uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(device_handle)
|
||||
gpu_choices[str(gpu_id)] = {
|
||||
"BDF": bdf,
|
||||
"UUID": uuid,
|
||||
"Device Handle": device_handle,
|
||||
}
|
||||
|
||||
for gpu_id, device_handle in enumerate(device_handles):
|
||||
bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(device_handle)
|
||||
uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(device_handle)
|
||||
gpu_choices[str(gpu_id)] = {
|
||||
"BDF": bdf,
|
||||
"UUID": uuid,
|
||||
"Device Handle": device_handle,
|
||||
}
|
||||
if gpu_id == 0:
|
||||
id_padding = max_padding
|
||||
else:
|
||||
id_padding = max_padding - int(math.log10(gpu_id))
|
||||
gpu_choices_str += f"ID: {gpu_id}{' ' * id_padding}| BDF: {bdf} | UUID: {uuid}\n"
|
||||
|
||||
if gpu_id == 0:
|
||||
id_padding = max_padding
|
||||
else:
|
||||
id_padding = max_padding - int(math.log10(gpu_id))
|
||||
gpu_choices_str += f"ID: {gpu_id}{' ' * id_padding}| BDF: {bdf} | UUID: {uuid}\n"
|
||||
|
||||
# Add the all option to the gpu_choices
|
||||
gpu_choices["all"] = "all"
|
||||
gpu_choices_str += f" all{' ' * max_padding}| Selects all devices\n"
|
||||
# Add the all option to the gpu_choices
|
||||
gpu_choices["all"] = "all"
|
||||
gpu_choices_str += f" all{' ' * max_padding}| Selects all devices\n"
|
||||
|
||||
return (gpu_choices, gpu_choices_str)
|
||||
|
||||
@@ -234,11 +324,89 @@ class AMDSMIHelpers():
|
||||
return True, selected_device_handles
|
||||
|
||||
|
||||
def handle_gpus(self, args, logger, subcommand):
|
||||
def get_device_handles_from_cpu_selections(self, cpu_selections: List[str], cpu_choices=None):
|
||||
"""Convert provided cpu_selections to device_handles
|
||||
|
||||
Args:
|
||||
cpu_selections (list[str]): Selected CPU ID(s):
|
||||
ex: ID:0
|
||||
cpu_choices (dict{cpu_choices}): This is a dictionary of the possible cpu_choices
|
||||
Returns:
|
||||
(True, list[device_handles]): Returns a list of all the cpu_selections converted to
|
||||
amdsmi device_handles
|
||||
(False, str): Return False, and the first input that failed to be converted
|
||||
"""
|
||||
if 'all' in cpu_selections:
|
||||
return (True, amdsmi_interface.amdsmi_get_cpusocket_handles())
|
||||
|
||||
if isinstance(cpu_selections, str):
|
||||
cpu_selections = [cpu_selections]
|
||||
|
||||
if cpu_choices is None:
|
||||
cpu_choices = self.get_cpu_choices()[0]
|
||||
|
||||
selected_device_handles = []
|
||||
for cpu_selection in cpu_selections:
|
||||
valid_cpu_choice = False
|
||||
for cpu_id, cpu_info in cpu_choices.items():
|
||||
device_handle = cpu_info['Device Handle']
|
||||
|
||||
# Check if passed gpu is a gpu ID
|
||||
if cpu_selection == cpu_id:
|
||||
selected_device_handles.append(device_handle)
|
||||
valid_cpu_choice = True
|
||||
break
|
||||
if not valid_cpu_choice:
|
||||
logging.debug(f"AMDSMIHelpers.get_device_handles_from_cpu_selections - Unable to convert {cpu_selection}")
|
||||
return False, cpu_selection
|
||||
return True, selected_device_handles
|
||||
|
||||
|
||||
def get_device_handles_from_core_selections(self, core_selections: List[str], core_choices=None):
|
||||
"""Convert provided core_selections to device_handles
|
||||
|
||||
Args:
|
||||
core_selections (list[str]): Selected CORE ID(s):
|
||||
ex: ID:0
|
||||
core_choices (dict{core_choices}): This is a dictionary of the possible core_choices
|
||||
Returns:
|
||||
(True, list[device_handles]): Returns a list of all the core_selections converted to
|
||||
amdsmi device_handles
|
||||
(False, str): Return False, and the first input that failed to be converted
|
||||
"""
|
||||
if 'all' in core_selections:
|
||||
return (True, amdsmi_interface.amdsmi_get_cpucore_handles())
|
||||
|
||||
if isinstance(core_selections, str):
|
||||
core_selections = [core_selections]
|
||||
|
||||
if core_choices is None:
|
||||
core_choices = self.get_core_choices()[0]
|
||||
|
||||
selected_device_handles = []
|
||||
for core_selection in core_selections:
|
||||
valid_cpu_choice = False
|
||||
for core_id, core_info in core_choices.items():
|
||||
device_handle = core_info['Device Handle']
|
||||
|
||||
# Check if passed core is a core ID
|
||||
if core_selection == core_id:
|
||||
selected_device_handles.append(device_handle)
|
||||
valid_core_choice = True
|
||||
break
|
||||
if not valid_core_choice:
|
||||
logging.debug(f"AMDSMIHelpers.get_device_handles_from_core_selections - Unable to convert {core_selection}")
|
||||
return False, core_selection
|
||||
return True, selected_device_handles
|
||||
|
||||
|
||||
def handle_gpus(self, args,logger, subcommand):
|
||||
"""This function will run execute the subcommands based on the number
|
||||
of gpus passed in via args.
|
||||
params:
|
||||
args - argparser args to pass to subcommand
|
||||
current_platform_args (list) - GPU supported platform arguments
|
||||
current_platform_values (list) - GPU supported values for the arguments
|
||||
logger (AMDSMILogger) - Logger to print out output
|
||||
subcommand (AMDSMICommands) - Function that can handle multiple gpus
|
||||
|
||||
@@ -260,11 +428,72 @@ class AMDSMIHelpers():
|
||||
args.gpu = args.gpu[0]
|
||||
return False, args.gpu
|
||||
else:
|
||||
raise IndexError("args.gpu should not be an empty list")
|
||||
logging.debug("args.gpu has an empty list")
|
||||
else:
|
||||
return False, args.gpu
|
||||
|
||||
|
||||
def handle_cpus(self, args, logger, subcommand):
|
||||
"""This function will run execute the subcommands based on the number
|
||||
of cpus passed in via args.
|
||||
params:
|
||||
args - argparser args to pass to subcommand
|
||||
logger (AMDSMILogger) - Logger to print out output
|
||||
subcommand (AMDSMICommands) - Function that can handle multiple gpus
|
||||
|
||||
return:
|
||||
tuple(bool, device_handle) :
|
||||
bool - True if executed subcommand for multiple devices
|
||||
device_handle - Return the device_handle if the list of devices is a length of 1
|
||||
(handled_multiple_gpus, device_handle)
|
||||
|
||||
"""
|
||||
if isinstance(args.cpu, list):
|
||||
if len(args.cpu) > 1:
|
||||
for device_handle in args.cpu:
|
||||
# Handle multiple_devices to print all output at once
|
||||
subcommand(args, multiple_devices=True, cpu=device_handle)
|
||||
logger.print_output(multiple_device_enabled=True)
|
||||
return True, args.cpu
|
||||
elif len(args.cpu) == 1:
|
||||
args.cpu = args.cpu[0]
|
||||
return False, args.cpu
|
||||
else:
|
||||
logging.debug("args.cpu has empty list")
|
||||
else:
|
||||
return False, args.cpu
|
||||
|
||||
def handle_cores(self, args, logger, subcommand):
|
||||
"""This function will run execute the subcommands based on the number
|
||||
of cores passed in via args.
|
||||
params:
|
||||
args - argparser args to pass to subcommand
|
||||
logger (AMDSMILogger) - Logger to print out output
|
||||
subcommand (AMDSMICommands) - Function that can handle multiple gpus
|
||||
|
||||
return:
|
||||
tuple(bool, device_handle) :
|
||||
bool - True if executed subcommand for multiple devices
|
||||
device_handle - Return the device_handle if the list of devices is a length of 1
|
||||
(handled_multiple_gpus, device_handle)
|
||||
|
||||
"""
|
||||
if isinstance(args.core, list):
|
||||
if len(args.core) > 1:
|
||||
for device_handle in args.core:
|
||||
# Handle multiple_devices to print all output at once
|
||||
subcommand(args, multiple_devices=True, core=device_handle)
|
||||
logger.print_output(multiple_device_enabled=True)
|
||||
return True, args.core
|
||||
elif len(args.core) == 1:
|
||||
args.core = args.core[0]
|
||||
return False, args.core
|
||||
else:
|
||||
logging.debug("args.core has empty list")
|
||||
else:
|
||||
return False, args.core
|
||||
|
||||
|
||||
def handle_watch(self, args, subcommand, logger):
|
||||
"""This function will run the subcommand multiple times based
|
||||
on the passed watch, watch_time, and iterations passed in.
|
||||
@@ -326,6 +555,31 @@ class AMDSMIHelpers():
|
||||
"Unable to find gpu ID from device_handle")
|
||||
|
||||
|
||||
def get_cpu_id_from_device_handle(self, input_device_handle):
|
||||
"""Get the cpu index from the device_handle.
|
||||
amdsmi_interface.amdsmi_get_cpusocket_handles() returns the list of device_handles in order of cpu_index
|
||||
"""
|
||||
device_handles = amdsmi_interface.amdsmi_get_cpusocket_handles()
|
||||
for cpu_index, device_handle in enumerate(device_handles):
|
||||
if input_device_handle.value == device_handle.value:
|
||||
return cpu_index
|
||||
raise amdsmi_exception.AmdSmiParameterException(input_device_handle,
|
||||
amdsmi_interface.amdsmi_wrapper.amdsmi_processor_handle,
|
||||
"Unable to find cpu ID from device_handle")
|
||||
|
||||
def get_core_id_from_device_handle(self, input_device_handle):
|
||||
"""Get the core index from the device_handle.
|
||||
amdsmi_interface.amdsmi_get_cpusocket_handles() returns the list of device_handles in order of cpu_index
|
||||
"""
|
||||
device_handles = amdsmi_interface.amdsmi_get_cpucore_handles()
|
||||
for core_index, device_handle in enumerate(device_handles):
|
||||
if input_device_handle.value == device_handle.value:
|
||||
return core_index
|
||||
raise amdsmi_exception.AmdSmiParameterException(input_device_handle,
|
||||
amdsmi_interface.amdsmi_wrapper.amdsmi_processor_handle,
|
||||
"Unable to find core ID from device_handle")
|
||||
|
||||
|
||||
def get_amd_gpu_bdfs(self):
|
||||
"""Return a list of GPU BDFs visibile to amdsmi
|
||||
|
||||
|
||||
@@ -53,17 +53,41 @@ def check_amdgpu_driver():
|
||||
return False
|
||||
|
||||
|
||||
def check_amdhsmp_driver():
|
||||
""" Returns true if amd hsmp is found in the list of initialized modules """
|
||||
amd_cpu_status_file = Path("/sys/module/amd_hsmp/initstate")
|
||||
if amd_cpu_status_file.exists():
|
||||
if amd_cpu_status_file.read_text(encoding="ascii").strip() == "live":
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def init_amdsmi(flag=amdsmi_interface.AmdSmiInitFlags.INIT_AMD_GPUS):
|
||||
""" Initializes AMDSMI
|
||||
|
||||
Raises:
|
||||
err: AmdSmiLibraryException if not successful
|
||||
"""
|
||||
gpu_flag = False;
|
||||
cpu_flag = False;
|
||||
|
||||
# Check if both the amdgpu and amdhsmp driver is up and handle error gracefully
|
||||
if check_amdgpu_driver() and check_amdhsmp_driver():
|
||||
# init AMD APUS
|
||||
try:
|
||||
amdsmi_interface.amdsmi_init(amdsmi_interface.AmdSmiInitFlags.INIT_AMD_APUS)
|
||||
except (amdsmi_interface.AmdSmiLibraryException, amdsmi_interface.AmdSmiParameterException) as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_DRIVER_NOT_LOADED):
|
||||
logging.error("Drivers not loaded (amdgpu and hsmp drivers not found in modules)")
|
||||
sys.exit(-1)
|
||||
else:
|
||||
raise e
|
||||
# # Check if amdgpu driver is up & Handle error gracefully
|
||||
if check_amdgpu_driver():
|
||||
elif check_amdgpu_driver():
|
||||
# Only init AMD GPUs for now, waiting for future support for AMD CPUs
|
||||
try:
|
||||
amdsmi_interface.amdsmi_init(flag)
|
||||
amdsmi_interface.amdsmi_init(amdsmi_interface.AmdSmiInitFlags.INIT_AMD_GPUS)
|
||||
except (amdsmi_interface.AmdSmiLibraryException, amdsmi_interface.AmdSmiParameterException) as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_DRIVER_NOT_LOADED):
|
||||
@@ -72,9 +96,23 @@ def init_amdsmi(flag=amdsmi_interface.AmdSmiInitFlags.INIT_AMD_GPUS):
|
||||
else:
|
||||
raise e
|
||||
logging.debug("AMDSMI initialized successfully, but initstate was not live")
|
||||
|
||||
elif check_amdhsmp_driver():
|
||||
# Only init AMD CPUs
|
||||
try:
|
||||
amdsmi_interface.amdsmi_init(amdsmi_interface.AmdSmiInitFlags.INIT_AMD_CPUS)
|
||||
cpu_flag = True
|
||||
except (amdsmi_interface.AmdSmiLibraryException, amdsmi_interface.AmdSmiParameterException) as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_DRIVER_NOT_LOADED):
|
||||
logging.error("Driver not loaded (hsmp not found in modules)")
|
||||
sys.exit(-1)
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
logging.error("Driver not found (amdgpu not found in modules)")
|
||||
sys.exit(-1)
|
||||
pass
|
||||
|
||||
logging.debug("AMDSMI initialized successfully")
|
||||
|
||||
|
||||
def shut_down_amdsmi():
|
||||
|
||||
@@ -72,6 +72,8 @@ class AMDSMILogger():
|
||||
def is_human_readable_format(self):
|
||||
return self.format == self.LoggerFormat.human_readable.value
|
||||
|
||||
def clear_multiple_devices_ouput(self):
|
||||
self.multiple_device_output.clear()
|
||||
|
||||
def _capitalize_keys(self, input_dict):
|
||||
output_dict = {}
|
||||
@@ -216,6 +218,75 @@ class AMDSMILogger():
|
||||
self._store_output_amdsmi(gpu_id=gpu_id, argument=argument, data=data)
|
||||
|
||||
|
||||
def store_cpu_output(self, device_handle, argument, data):
|
||||
""" Convert device handle to cpu id and store output
|
||||
params:
|
||||
device_handle - device handle object to the target device output
|
||||
argument (str) - key to store data
|
||||
data (dict | list) - Data store against argument
|
||||
return:
|
||||
Nothing
|
||||
"""
|
||||
cpu_id = self.helpers.get_cpu_id_from_device_handle(device_handle)
|
||||
self._store_cpu_output_amdsmi(cpu_id=cpu_id, argument=argument, data=data)
|
||||
|
||||
|
||||
def store_core_output(self, device_handle, argument, data):
|
||||
""" Convert device handle to core id and store output
|
||||
params:
|
||||
device_handle - device handle object to the target device output
|
||||
argument (str) - key to store data
|
||||
data (dict | list) - Data store against argument
|
||||
return:
|
||||
Nothing
|
||||
"""
|
||||
core_id = self.helpers.get_core_id_from_device_handle(device_handle)
|
||||
self._store_core_output_amdsmi(core_id=core_id, argument=argument, data=data)
|
||||
|
||||
def _store_core_output_amdsmi(self, core_id, argument, data):
|
||||
if argument == 'timestamp': # Make sure timestamp is the first element in the output
|
||||
self.output['timestamp'] = int(time.time())
|
||||
|
||||
if self.is_json_format() or self.is_human_readable_format():
|
||||
self.output['core'] = int(core_id)
|
||||
if argument == 'values' and isinstance(data, dict):
|
||||
self.output.update(data)
|
||||
else:
|
||||
self.output[argument] = data
|
||||
elif self.is_csv_format():
|
||||
self.output['core'] = int(core_id)
|
||||
|
||||
if argument == 'values' or isinstance(data, dict):
|
||||
flat_dict = self.flatten_dict(data)
|
||||
self.output.update(flat_dict)
|
||||
else:
|
||||
self.output[argument] = data
|
||||
else:
|
||||
raise amdsmi_cli_exceptions(self, "Invalid output format given, only json, csv, and human_readable supported")
|
||||
|
||||
|
||||
def _store_cpu_output_amdsmi(self, cpu_id, argument, data):
|
||||
if argument == 'timestamp': # Make sure timestamp is the first element in the output
|
||||
self.output['timestamp'] = int(time.time())
|
||||
|
||||
if self.is_json_format() or self.is_human_readable_format():
|
||||
self.output['cpu'] = int(cpu_id)
|
||||
if argument == 'values' and isinstance(data, dict):
|
||||
self.output.update(data)
|
||||
else:
|
||||
self.output[argument] = data
|
||||
elif self.is_csv_format():
|
||||
self.output['cpu'] = int(cpu_id)
|
||||
|
||||
if argument == 'values' or isinstance(data, dict):
|
||||
flat_dict = self.flatten_dict(data)
|
||||
self.output.update(flat_dict)
|
||||
else:
|
||||
self.output[argument] = data
|
||||
else:
|
||||
raise amdsmi_cli_exceptions(self, "Invalid output format given, only json, csv, and human_readable supported")
|
||||
|
||||
|
||||
def _store_output_amdsmi(self, gpu_id, argument, data):
|
||||
if argument == 'timestamp': # Make sure timestamp is the first element in the output
|
||||
self.output['timestamp'] = int(time.time())
|
||||
|
||||
@@ -72,6 +72,8 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
# Helper variables
|
||||
self.helpers = AMDSMIHelpers()
|
||||
self.gpu_choices, self.gpu_choices_str = self.helpers.get_gpu_choices()
|
||||
self.cpu_choices, self.cpu_choices_str = self.helpers.get_cpu_choices()
|
||||
self.core_choices, self.core_choices_str = self.helpers.get_core_choices()
|
||||
self.vf_choices = ['3', '2', '1']
|
||||
|
||||
version_string = f"Version: {__version__}"
|
||||
@@ -233,6 +235,56 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
return _GPUSelectAction
|
||||
|
||||
|
||||
def _cpu_select(self, cpu_choices):
|
||||
""" Custom argparse action to return the device handle(s) for the cpu(s) selected
|
||||
This will set the destination (args.cpu) to a list of 1 or more device handles
|
||||
If 1 or more device handles are not found then raise an ArgumentError for the first invalid cpu seen
|
||||
"""
|
||||
amdsmi_helpers = self.helpers
|
||||
class _CPUSelectAction(argparse.Action):
|
||||
ouputformat=self.helpers.get_output_format()
|
||||
# Checks the values
|
||||
def __call__(self, parser, args, values, option_string=None):
|
||||
if "all" in cpu_choices:
|
||||
del cpu_choices["all"]
|
||||
status, selected_device_handles = amdsmi_helpers.get_device_handles_from_cpu_selections(cpu_selections=values,
|
||||
cpu_choices=cpu_choices)
|
||||
if status:
|
||||
setattr(args, self.dest, selected_device_handles)
|
||||
else:
|
||||
if selected_device_handles == '':
|
||||
raise amdsmi_cli_exceptions.AmdSmiMissingParameterValueException("--cpu", _CPUSelectAction.ouputformat)
|
||||
else:
|
||||
raise amdsmi_cli_exceptions.AmdSmiDeviceNotFoundException(selected_device_handles,
|
||||
_CPUSelectAction.ouputformat)
|
||||
return _CPUSelectAction
|
||||
|
||||
|
||||
def _core_select(self, core_choices):
|
||||
""" Custom argparse action to return the device handle(s) for the core(s) selected
|
||||
This will set the destination (args.core) to a list of 1 or more device handles
|
||||
If 1 or more device handles are not found then raise an ArgumentError for the first invalid core seen
|
||||
"""
|
||||
amdsmi_helpers = self.helpers
|
||||
class _CoreSelectAction(argparse.Action):
|
||||
ouputformat=self.helpers.get_output_format()
|
||||
# Checks the values
|
||||
def __call__(self, parser, args, values, option_string=None):
|
||||
if "all" in core_choices:
|
||||
del core_choices["all"]
|
||||
status, selected_device_handles = amdsmi_helpers.get_device_handles_from_core_selections(core_selections=values,
|
||||
core_choices=core_choices)
|
||||
if status:
|
||||
setattr(args, self.dest, selected_device_handles)
|
||||
else:
|
||||
if selected_device_handles == '':
|
||||
raise amdsmi_cli_exceptions.AmdSmiMissingParameterValueException("--core", _CoreSelectAction.ouputformat)
|
||||
else:
|
||||
raise amdsmi_cli_exceptions.AmdSmiDeviceNotFoundException(selected_device_handles,
|
||||
_CoreSelectAction.ouputformat)
|
||||
return _CoreSelectAction
|
||||
|
||||
|
||||
def _add_command_modifiers(self, subcommand_parser):
|
||||
json_help = "Displays output in JSON format (human readable by default)."
|
||||
csv_help = "Displays output in CSV format (human readable by default)."
|
||||
@@ -274,11 +326,18 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
gpu_help = f"Select a GPU ID, BDF, or UUID from the possible choices:\n{self.gpu_choices_str}"
|
||||
vf_help = "Gets general information about the specified VF (timeslice, fb info, …).\
|
||||
\nAvailable only on virtualization OSs"
|
||||
cpu_help = f"Select a CPU ID from the possible choices:\n{self.cpu_choices_str}"
|
||||
core_help = f"Select a Core ID from the possible choices:\n{self.core_choices_str}"
|
||||
|
||||
|
||||
# Mutually Exclusive Args within the subparser
|
||||
device_args = subcommand_parser.add_mutually_exclusive_group(required=required)
|
||||
device_args.add_argument('-g', '--gpu', action=self._gpu_select(self.gpu_choices),
|
||||
nargs='+', help=gpu_help)
|
||||
device_args.add_argument('-U', '--cpu', action=self._cpu_select(self.cpu_choices),
|
||||
nargs='+', help=cpu_help)
|
||||
device_args.add_argument('-O', '--core', action=self._core_select(self.core_choices),
|
||||
nargs='+', help=core_help)
|
||||
|
||||
if self.helpers.is_hypervisor():
|
||||
device_args.add_argument('-v', '--vf', action='store', nargs='+',
|
||||
@@ -345,11 +404,16 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
fb_help = "Displays Frame Buffer information"
|
||||
num_vf_help = "Displays number of supported and enabled VFs"
|
||||
|
||||
# Options arguments help text for cpu
|
||||
smu_help = "All SMU FW information"
|
||||
interface_help = "Displays hsmp interface version"
|
||||
|
||||
# Create static subparser
|
||||
static_parser = subparsers.add_parser('static', help=static_help, description=static_subcommand_help)
|
||||
static_parser._optionals.title = static_optionals_title
|
||||
static_parser.formatter_class=lambda prog: AMDSMISubparserHelpFormatter(prog)
|
||||
static_parser.set_defaults(func=func)
|
||||
cpu_group = static_parser.add_argument_group("CPU Option<s>")
|
||||
|
||||
# Add Universal Arguments
|
||||
self._add_command_modifiers(static_parser)
|
||||
@@ -363,7 +427,8 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
static_parser.add_argument('-v', '--vram', action='store_true', required=False, help=vram_help)
|
||||
static_parser.add_argument('-c', '--cache', action='store_true', required=False, help=cache_help)
|
||||
static_parser.add_argument('-B', '--board', action='store_true', required=False, help=board_help)
|
||||
|
||||
cpu_group.add_argument('-s', '--smu', action='store_true', required=False, help=smu_help)
|
||||
cpu_group.add_argument('-i', '--interface_ver', action='store_true', required=False, help=interface_help)
|
||||
# Options to display on Hypervisors and Baremetal
|
||||
if self.helpers.is_hypervisor() or self.helpers.is_baremetal():
|
||||
static_parser.add_argument('-r', '--ras', action='store_true', required=False, help=ras_help)
|
||||
@@ -475,11 +540,55 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
fb_usage_help = "Displays total and used Frame Buffer usage information"
|
||||
xgmi_help = "Table of current XGMI metrics information"
|
||||
|
||||
# Help text for cpu options
|
||||
cpu_power_metrics_help = "Cpu power metrics"
|
||||
cpu_proc_help = "Displays prochot status"
|
||||
cpu_freq_help = "Displays currentFclkMemclk frequencies and cclk frequency limit"
|
||||
cpu_c0_res_help = "Displays C0 residency"
|
||||
cpu_lclk_dpm_help = "Displays lclk dpm level range. Requires socket ID and nbio id as inputs"
|
||||
cpu_pwr_svi_telemtry_rails_help = "Displays svi based telemetry for all rails"
|
||||
cpu_io_bandwidth_help = "Displays current IO bandwidth for the selected CPU.\
|
||||
\n input parameters are bandwidth type(1) and link ID encodings\
|
||||
\n i.e. P2, P3, G0 - G7"
|
||||
cpu_xgmi_bandwidth_help = "Displays current XGMI bandwidth for the selected CPU\
|
||||
\n input parameters are bandwidth type(1,2,4) and link ID encodings\
|
||||
\n i.e. P2, P3, G0 - G7"
|
||||
cpu_enable_apb_help = "Enables the DF p-state performance boost algorithm"
|
||||
cpu_disable_apb_help = "Disables the DF p-state performance boost alogorithm."
|
||||
"Input parameter is DFPstate (0 -3 )"
|
||||
set_cpu_pow_limit_help = "Set power limit for the given socket. Input parameter is \
|
||||
power limit value."
|
||||
set_cpu_xgmi_link_width_help = "Set max and Min linkwidth. Input parameters are \
|
||||
min and max link width values"
|
||||
set_cpu_lclk_dpm_level_help = "Sets the max and min dpm level on a given NBIO. Inpur parameters are \
|
||||
die_index, min dpm, max dpm."
|
||||
core_boost_limit_help = "Get booslimit for the selected cores"
|
||||
core_curr_active_freq_core_limit_help = "Get Current CCLK limit set per Core"
|
||||
set_soc_boost_limit_help = "Sets the boost limit for the given socket. Input parameter is \
|
||||
socket limit value"
|
||||
set_core_boost_limit_help = "Sets the boost limit for the given core. Input parameter is \
|
||||
core limit value"
|
||||
cpu_metrics_ver_help = "Displays metrics table version"
|
||||
cpu_metrics_table_help = "Displays metric table"
|
||||
core_energy_help = "Displays core energy for the selected core"
|
||||
socket_energy_help = "Displays socket energy for the selected socket"
|
||||
set_cpu_pwr_eff_mode_help = "Sets the power efficency mode policy. Input parameter is mode."
|
||||
cpu_ddr_bandwidth_help = "Displays per socket max ddr bw, current utilized bw and current utilized ddr bw in percentage"
|
||||
cpu_temp_help = "Displays cpu socket temperature"
|
||||
cpu_dimm_temp_range_rate_help = "Displays dimm temperature range and refresh rate"
|
||||
cpu_dimm_pow_conumption_help = "Displays dimm power conumption"
|
||||
cpu_dimm_thermal_sensor_help = "Displays dimm thermal sensor"
|
||||
set_cpu_gmi3_link_width_help = "Sets max and min gmi3 link width range"
|
||||
set_cpu_pcie_lnk_rate_help = "Sets pcie link rate"
|
||||
set_cpu_df_pstate_range_help = "Sets max and min df-pstates"
|
||||
|
||||
# Create metric subparser
|
||||
metric_parser = subparsers.add_parser('metric', help=metric_help, description=metric_subcommand_help)
|
||||
metric_parser._optionals.title = metric_optionals_title
|
||||
metric_parser.formatter_class=lambda prog: AMDSMISubparserHelpFormatter(prog)
|
||||
metric_parser.set_defaults(func=func)
|
||||
cpu_group = metric_parser.add_argument_group("CPU Option<s>")
|
||||
set_group = metric_parser.add_argument_group("Set Options<s>")
|
||||
|
||||
# Add Universal Arguments
|
||||
self._add_command_modifiers(metric_parser)
|
||||
@@ -519,6 +628,36 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
metric_parser.add_argument('-f', '--fb_usage', action='store_true', required=False, help=fb_usage_help)
|
||||
metric_parser.add_argument('-m', '--xgmi', action='store_true', required=False, help=xgmi_help)
|
||||
|
||||
cpu_group.add_argument('--cpu_power_metrics', action='store_true', required=False, help=cpu_power_metrics_help)
|
||||
cpu_group.add_argument('--cpu_prochot', action='store_true', required=False, help=cpu_proc_help)
|
||||
cpu_group.add_argument('--cpu_freq_metrics', action='store_true', required=False, help=cpu_freq_help)
|
||||
cpu_group.add_argument('--cpu_c0_res', action='store_true', required=False, help=cpu_c0_res_help)
|
||||
cpu_group.add_argument('--cpu_lclk_dpm_level', action='append', required=False, type=int, nargs=1, metavar=("NBIOID"), help=cpu_lclk_dpm_help)
|
||||
cpu_group.add_argument('--cpu_pwr_svi_telemtry_rails', action='store_true', required=False, help=cpu_pwr_svi_telemtry_rails_help)
|
||||
cpu_group.add_argument('--cpu_io_bandwidth', action='append', required=False, nargs=2, metavar=("IO_BW","LINKID_NAME"), help=cpu_io_bandwidth_help)
|
||||
cpu_group.add_argument('--cpu_xgmi_bandwidth', action='append', required=False, nargs=2, metavar=("XGMI_BW","LINKID_NAME"), help=cpu_xgmi_bandwidth_help)
|
||||
cpu_group.add_argument('--cpu_enable_apb', action='store_true', required=False, help=cpu_enable_apb_help)
|
||||
cpu_group.add_argument('--cpu_disable_apb', action='append', required=False, type=int, nargs=1, metavar=("DF_PSTATE"), help=cpu_disable_apb_help)
|
||||
set_group.add_argument('--set_cpu_pow_limit', action='append', required=False, type=int, nargs=1, metavar=("POW_LIMIT"),help=set_cpu_pow_limit_help)
|
||||
set_group.add_argument('--set_cpu_xgmi_link_width', action='append', required=False, type=int, nargs=2, metavar=("MIN_WIDTH", "MAX_WIDTH"), help=set_cpu_xgmi_link_width_help)
|
||||
set_group.add_argument('--set_cpu_lclk_dpm_level', action='append', required=False, type=int, nargs=3, metavar=("NBIOID", "MIN_DPM", "MAX_DPM"),help=set_cpu_lclk_dpm_level_help)
|
||||
cpu_group.add_argument('--core_boost_limit', action='store_true', required=False, help=core_boost_limit_help)
|
||||
cpu_group.add_argument('--core_curr_active_freq_core_limit', action='store_true', required=False, help=core_curr_active_freq_core_limit_help)
|
||||
set_group.add_argument('--set_soc_boost_limit', action='append', required=False, type=int, nargs=1, metavar=("BOOST_LIMIT"), help=set_soc_boost_limit_help)
|
||||
set_group.add_argument('--set_core_boost_limit', action='append', required=False, type=int, nargs=1, metavar=("BOOST_LIMIT"), help=set_core_boost_limit_help)
|
||||
cpu_group.add_argument('--cpu_metrics_ver', action='store_true', required=False, help=cpu_metrics_ver_help)
|
||||
cpu_group.add_argument('--cpu_metrics_table', action='store_true', required=False, help=cpu_metrics_table_help)
|
||||
cpu_group.add_argument('--core_energy', action='store_true', required=False, help=core_energy_help)
|
||||
cpu_group.add_argument('--socket_energy', action='store_true', required=False, help=socket_energy_help)
|
||||
set_group.add_argument('--set_cpu_pwr_eff_mode', action='append', required=False, type=int, nargs=1, metavar=("MODE"), help=set_cpu_pwr_eff_mode_help)
|
||||
cpu_group.add_argument('--cpu_ddr_bandwidth', action='store_true', required=False, help=cpu_ddr_bandwidth_help)
|
||||
cpu_group.add_argument('--cpu_temp', action='store_true', required=False, help=cpu_temp_help)
|
||||
cpu_group.add_argument('--cpu_dimm_temp_range_rate', action='append', required=False, type=int, nargs=1, metavar=("DIMM_ADDR"), help=cpu_dimm_temp_range_rate_help)
|
||||
cpu_group.add_argument('--cpu_dimm_pow_conumption', action='append', required=False, type=int, nargs=1, metavar=("DIMM_ADDR"), help=cpu_dimm_pow_conumption_help)
|
||||
cpu_group.add_argument('--cpu_dimm_thermal_sensor', action='append', required=False, type=int, nargs=1, metavar=("DIMM_ADDR"), help=cpu_dimm_thermal_sensor_help)
|
||||
set_group.add_argument('--set_cpu_gmi3_link_width', action='append', required=False, type=int, nargs=2, metavar=("MIN_LW", "MAX_LW"), help=set_cpu_gmi3_link_width_help)
|
||||
set_group.add_argument('--set_cpu_pcie_lnk_rate', action='append', required=False, type=int, nargs=1, metavar=("LINK_RATE"), help=set_cpu_pcie_lnk_rate_help)
|
||||
set_group.add_argument('--set_cpu_df_pstate_range', action='append', required=False, type=int, nargs=2, metavar=("MAX_PSTATE", "MIN_PSTATE"), help=set_cpu_df_pstate_range_help)
|
||||
|
||||
def _add_process_parser(self, subparsers, func):
|
||||
if self.helpers.is_hypervisor():
|
||||
|
||||
@@ -86,7 +86,7 @@ int main(int argc, char **argv) {
|
||||
// Get all sockets
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
ret = amdsmi_get_cpusocket_handles(&socket_count, nullptr);
|
||||
/*ret = amdsmi_get_cpusocket_handles(&socket_count, nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
@@ -94,528 +94,170 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Get the sockets of the system
|
||||
ret = amdsmi_get_cpusocket_handles(&socket_count, &sockets[0]);
|
||||
CHK_AMDSMI_RET(ret)*/
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
// Allocate the memory for the sockets
|
||||
vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
// Get the sockets of the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
cout << "Total Socket: " << socket_count << endl;
|
||||
|
||||
// For each socket, get identifier and cores
|
||||
for (uint8_t i = 0; i < socket_count; i++) {
|
||||
// Get Socket info
|
||||
uint32_t socket_info = 0;
|
||||
ret = amdsmi_get_cpusocket_info(sockets[i], socket_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
cout << "Socket " << socket_info << endl;
|
||||
|
||||
// Get the core count available for the socket.
|
||||
uint32_t cpu_count = 0;
|
||||
uint32_t core_count = 0;
|
||||
ret = amdsmi_get_cpucore_handles(sockets[i], &core_count, nullptr);
|
||||
processor_type_t processor_type = AMD_CPU;
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &cpu_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Allocate the memory for the cpu core handles on the socket
|
||||
vector<amdsmi_processor_handle> processor_handles(core_count);
|
||||
// Get all cores of the socket
|
||||
ret = amdsmi_get_cpucore_handles(sockets[i],
|
||||
&core_count, &processor_handles[0]);
|
||||
vector<amdsmi_processor_handle> plist(cpu_count);
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &plist[0], &cpu_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
cout << "core_count=" << core_count << endl;
|
||||
|
||||
ret = amdsmi_get_cpu_hsmp_proto_ver(sockets[i], &proto_ver);
|
||||
cout << endl;
|
||||
// Read core count for each sockets
|
||||
processor_type = AMD_CPU_CORE;
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &core_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| HSMP Proto Version | "<< proto_ver <<"\t\t |"<< endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
|
||||
ret = amdsmi_get_cpu_smu_fw_version(sockets[i], &smu_fw);
|
||||
vector<amdsmi_processor_handle> core_list(core_count);
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &core_list[0], &core_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
for (int index = 0; index < plist.size(); index++) {
|
||||
socket_count = plist.size();
|
||||
ret = amdsmi_get_cpu_hsmp_proto_ver(plist[i], &proto_ver);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| SMU FW Version | "
|
||||
<<(unsigned)smu_fw.major<<"."
|
||||
<<(unsigned)smu_fw.minor<<"."
|
||||
<<(unsigned)smu_fw.debug
|
||||
<<"\t\t |"<<endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| HSMP Proto Version | "<< proto_ver <<"\t\t |"<< endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
|
||||
uint32_t err_bits = 0;
|
||||
ret = amdsmi_get_cpu_smu_fw_version(plist[i], &smu_fw);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
uint32_t prochot;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| ProchotStatus:\t\t |";
|
||||
ret = amdsmi_get_cpu_prochot_status(sockets[i], i, &prochot);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<< (prochot ? "active" : "inactive")<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| SMU FW Version | "
|
||||
<<(unsigned)smu_fw.major<<"."
|
||||
<<(unsigned)smu_fw.minor<<"."
|
||||
<<(unsigned)smu_fw.debug
|
||||
<<"\t\t |"<<endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
|
||||
size_t len;
|
||||
char str[SHOWLINESZ] = {};
|
||||
int retVal = 0;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| fclk (Mhz)\t\t\t |";
|
||||
retVal = snprintf(str, SHOWLINESZ, "\n| mclk (Mhz)\t\t\t |");
|
||||
uint32_t err_bits = 0;
|
||||
|
||||
len = strlen(str);
|
||||
uint32_t fclk, mclk, cclk;
|
||||
err_bits = 0;
|
||||
ret = amdsmi_get_cpu_fclk_mclk(sockets[i], i, &fclk, &mclk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<<" "<<fclk<<"\t\t|";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " %d\t\t|", mclk);
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err: "<<setprecision(2)<<ret<<" |";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " NA (Err: %-2d) |", ret);
|
||||
}
|
||||
if (retVal > 0 && retVal < SHOWLINESZ)
|
||||
cout << str;
|
||||
else
|
||||
cout <<"error writing to buffer" << endl;
|
||||
uint32_t prochot;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| ProchotStatus:\t\t |";
|
||||
ret = amdsmi_get_cpu_prochot_status(plist[i], &prochot);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<< (prochot ? "active" : "inactive")<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
cout<<"-----------------------------------------------------------------";
|
||||
ret = amdsmi_get_cpu_cclk_limit(sockets[i], i, &cclk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
cout<<"\n| SOCKET["<<i<<"] core clock current frequency limit (MHz) : "<<cclk<<"\t|\n";
|
||||
cout<<"-----------------------------------------------------------------\n";
|
||||
size_t len;
|
||||
char str[SHOWLINESZ] = {};
|
||||
int retVal = 0;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| fclk (Mhz)\t\t\t |";
|
||||
retVal = snprintf(str, SHOWLINESZ, "\n| mclk (Mhz)\t\t\t |");
|
||||
|
||||
uint32_t c_clk = 0;
|
||||
ret = amdsmi_get_cpu_core_current_freq_limit(processor_handles[i], i, &c_clk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
len = strlen(str);
|
||||
uint32_t fclk, mclk, cclk;
|
||||
err_bits = 0;
|
||||
ret = amdsmi_get_cpu_fclk_mclk(plist[i], &fclk, &mclk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<<" "<<fclk<<"\t\t|";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " %d\t\t|", mclk);
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err: "<<setprecision(2)<<ret<<" |";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " NA (Err: %-2d) |", ret);
|
||||
}
|
||||
if (retVal > 0 && retVal < SHOWLINESZ)
|
||||
cout << str;
|
||||
else
|
||||
cout <<"error writing to buffer" << endl;
|
||||
|
||||
cout<<"--------------------------------------------------------------";
|
||||
cout<<"\n| CPU["<<i<<"] core clock current frequency limit (MHz) : "<<c_clk<<"\t|\n";
|
||||
cout<<"--------------------------------------------------------------\n";
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t socket_power;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Power (Watts)\t\t\t | ";
|
||||
uint32_t socket_power;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Power (Watts)\t\t\t | ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power(sockets[i], i, &socket_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
ret = amdsmi_get_cpu_socket_power(plist[i], &socket_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(socket_power)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
uint32_t power_limit;
|
||||
cout<<"\n| PowerLimit (Watts)\t\t | ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power_cap(sockets[i], i, &power_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_limit)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
uint32_t power_max;
|
||||
cout<<"\n| PowerLimitMax (Watts)\t\t | ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(sockets[i], i, &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_max)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t input_power;
|
||||
power_max = 0;
|
||||
cout<<"\nEnter the max power to be set:\n";
|
||||
cin>>input_power;
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(sockets[i], i, &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if ((ret == AMDSMI_STATUS_SUCCESS) && (input_power > power_max)) {
|
||||
cout<<"Input power is more than max power limit,"
|
||||
" limiting to "<<static_cast<double>(power_max)/1000<<"Watts\n";
|
||||
input_power = power_max;
|
||||
}
|
||||
ret = amdsmi_set_cpu_socket_power_cap(sockets[i], i, input_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<"Socket["<<i<<"] power_limit set to "
|
||||
<<fixed<<setprecision(3)<<static_cast<double>(input_power)/1000<<" Watts successfully\n";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t mode;
|
||||
const char *err_str;
|
||||
cout <<"Enter the power efficiency mode to be set[0, 1 or 2]:\n";
|
||||
cin>>mode;
|
||||
ret = amdsmi_set_cpu_pwr_efficiency_mode(sockets[i], i, mode);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
cout<<"Failed to set power efficiency mode for socket["<<i<<"], Err["
|
||||
<<ret<<"]: "<<*amdsmi_get_esmi_err_msg(ret, &err_str)<<"\n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
cout<<"Power efficiency profile policy is set to "<<mode<<"successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t svi_power;
|
||||
cout<<"\n| SVI Power Telemetry (mWatts) \t |";
|
||||
|
||||
ret = amdsmi_get_cpu_pwr_svi_telemetry_all_rails(sockets[i], i, &svi_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(svi_power)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t boost_limit = 0;
|
||||
const char *err_str1;
|
||||
ret = amdsmi_get_cpu_core_boostlimit(processor_handles[i], i, &boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to get core"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| core["<<i<<"] boostlimit (MHz)\t | "<<boost_limit<<" \t |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
boost_limit = 0;
|
||||
cout<<"\nEnter the boost limit to be set:\n";
|
||||
cin>>boost_limit;
|
||||
ret = amdsmi_set_cpu_core_boostlimit(processor_handles[i], i, boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to set core"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
ret = amdsmi_get_cpu_core_boostlimit(processor_handles[i], i, &boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to get core"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| core["<<i<<"] boostlimit (MHz)\t | "<<boost_limit<<" \t |\n";
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
ret = amdsmi_set_cpu_socket_boostlimit(sockets[i], i, boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to set socket"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t residency = 0;
|
||||
ret = amdsmi_get_cpu_socket_c0_residency(sockets[i], i, &residency);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] c0_residency, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| socket["<<i<<"] c0_residency(%) | "<<residency<<" |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
cout<<"\n| DDR Bandwidth\t\t\t\t |\n";
|
||||
amdsmi_ddr_bw_metrics_t ddr;
|
||||
ret = amdsmi_get_cpu_ddr_bw(sockets[i], &ddr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(!ret) {
|
||||
cout<<"\n| \tDDR Max BW (GB/s)\t |"<<ddr.max_bw<<"\t|"<<endl;
|
||||
cout<<"\n| \tDDR Utilized BW (GB/s)\t |"<<ddr.utilized_bw<<"\t|"<<endl;
|
||||
cout<<"\n| \tDDR Utilized Percent(%)\t |"<<ddr.utilized_pct<<"\t|"<<endl;
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(socket_power)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
uint32_t power_limit;
|
||||
cout<<"\n| PowerLimit (Watts)\t\t | ";
|
||||
|
||||
uint32_t tmon;
|
||||
cout<<"\n| Socket temperature (°C)\t\t |";
|
||||
ret = amdsmi_get_cpu_socket_temperature(sockets[i], i, &tmon);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
ret = amdsmi_get_cpu_socket_power_cap(plist[i], &power_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<""<<(double)tmon/1000<<"|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err: "<<ret<<") |";
|
||||
}
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_limit)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
uint32_t power_max;
|
||||
cout<<"\n| PowerLimitMax (Watts)\t\t | ";
|
||||
|
||||
amdsmi_temp_range_refresh_rate_t rate;
|
||||
uint8_t dimm_addr = 0x80;
|
||||
cout<<"\n| Socket DIMM temp range and refresh rate\t\t |\n";
|
||||
ret = amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(sockets[i], i, dimm_addr, &rate);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(plist[i], &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret) {
|
||||
cout<<"\n| \tDIMM temp range\t |"<<rate.range<<"\t|"<<endl;
|
||||
cout<<"\n| \tRefresh rate\t |"<<rate.ref_rate<<"\t|"<<endl;
|
||||
} else
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] DIMM temperature range and refresh rate, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_max)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_dimm_power_t dimm_power;
|
||||
cout<<"\n| Socket DIMM power consumption\t\t |\n";
|
||||
ret = amdsmi_get_cpu_dimm_power_consumption(sockets[i], i, dimm_addr, &dimm_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret) {
|
||||
cout<<"\n| Power(mWatts)\t\t |"<<dimm_power.power<<"\t|"<<endl;
|
||||
cout<<"\n| Power update rate(ms)\t |"<<dimm_power.update_rate<<"\t|"<<endl;
|
||||
cout<<"\n| Dimm address \t\t |"<<dimm_power.dimm_addr<<"\t|"<<endl;
|
||||
} else
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] DIMM power and update rate, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_dimm_thermal_t d_sensor;
|
||||
cout<<"\n| Socket DIMM thermal sensor\t\t |\n";
|
||||
ret = amdsmi_get_cpu_dimm_thermal_sensor(sockets[i], i, dimm_addr, &d_sensor);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret) {
|
||||
cout<<"\n| Temperature(°C)\t |"<<d_sensor.temp<<"\t|"<<endl;
|
||||
cout<<"\n| Update rate(ms)\t |"<<d_sensor.update_rate<<"\t|"<<endl;
|
||||
cout<<"\n| Dimm address returned\t |"<<d_sensor.dimm_addr<<"\t|"<<endl;
|
||||
} else
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] DIMM temperature and update rate, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t min, max;
|
||||
cout<<"\nEnter the XGMI min value to be set:\n";
|
||||
cin>>min;
|
||||
cout<<"\nEnter the XGMI max value to be set:\n";
|
||||
cin>>max;
|
||||
|
||||
ret = amdsmi_set_cpu_xgmi_width(sockets[i], min, max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to set xGMI link width, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"xGMI link width (min:"<<min<< "max:"<<max<<") is set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t min_link_width, max_link_width;
|
||||
cout<<"\nEnter the GMI3 link width min value to be set:\n";
|
||||
cin>>min_link_width;
|
||||
cout<<"\nEnter the GMI3 link width max value to be set:\n";
|
||||
cin>>max_link_width;
|
||||
|
||||
ret = amdsmi_set_cpu_gmi3_link_width_range(sockets[i], i, min_link_width, max_link_width);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed to set gmi3 link width for socket["<<i<<"] Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"Gmi3 link width range is set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
ret = amdsmi_cpu_apb_enable(sockets[i], i);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to enable DF performance boost algo on socket["<<i<<"] Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"APB is enabled successfully on socket["<<i<<"]\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
int8_t pstate;
|
||||
cout<<"\nEnter the pstate to be set:\n";
|
||||
cin>>pstate;
|
||||
ret = amdsmi_cpu_apb_disable(sockets[i], i, pstate);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to set socket["<<i<<"] DF pstate, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"APB is disabled, P-state is set to ["<<pstate<<"] on socket["<<i<<"] successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t min_val=0, max_val=2;
|
||||
uint8_t nbio_id=1;
|
||||
|
||||
ret = amdsmi_set_cpu_socket_lclk_dpm_level(sockets[i], i, nbio_id, min_val, max_val);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to set lclk dpm level for socket["<<i<<"], nbioid["<<unsigned(nbio_id)<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"Socket["<<i<<"] nbio["<<unsigned(nbio_id)<<"] LCLK frequency set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_dpm_level_t nbio;
|
||||
ret = amdsmi_get_cpu_socket_lclk_dpm_level(sockets[i], i, nbio_id, &nbio);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to get lclk dpm level for socket["<<i<<"], nbioid["<<unsigned(nbio_id)<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else {
|
||||
cout<<"| \tMIN\t | "<<unsigned(nbio.min_dpm_level)<<"\t |\n";
|
||||
cout<<"| \tMAX\t | "<<unsigned(nbio.max_dpm_level)<<"\t |\n";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t rate_ctrl;
|
||||
uint8_t prev_mode;
|
||||
std::string pcie_strings[] = {
|
||||
"automatically detect based on bandwidth utilisation",
|
||||
"limited to Gen4 rate",
|
||||
"limited to Gen5 rate"
|
||||
};
|
||||
cout<<"\nEnter the rate ctrl to be set:\n";
|
||||
cin>>rate_ctrl;
|
||||
|
||||
ret = amdsmi_set_cpu_pcie_link_rate(sockets[i], i, rate_ctrl, &prev_mode);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to set pcie link rate control for socket["<<i<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else {
|
||||
cout<<"Pcie link rate is set to "<<rate_ctrl<<" (i.e. "<<pcie_strings[rate_ctrl]<<") successfully.\n";
|
||||
cout<<"\nPrevious pcie link rate control was : "<<prev_mode<<"\n";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
uint8_t max_pstate, min_pstate;
|
||||
cout<<"\nEnter the max_pstate to be set:\n";
|
||||
cin>>max_pstate;
|
||||
cout<<"\nEnter the min_pstate to be set:\n";
|
||||
cin>>min_pstate;
|
||||
|
||||
ret = amdsmi_set_cpu_df_pstate_range(sockets[i], i, max_pstate, min_pstate);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to set df pstate range, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"Data Fabric PState range(max:"<<unsigned(max_pstate)
|
||||
<<" min:"<<unsigned(min_pstate)<<") set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_link_id_bw_type_t io_link;
|
||||
uint32_t bw;
|
||||
char* link = "P0";
|
||||
io_link.link_name = link;
|
||||
io_link.bw_type = static_cast<amdsmi_io_bw_encoding_t>(1) ;
|
||||
ret = amdsmi_get_cpu_current_io_bandwidth(sockets[i], i, io_link, &bw);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to get io bandwidth width for socket ["<<i<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| Current IO Aggregate bandwidth of link"<<io_link.link_name<<" | "<<bw<<" Mbps |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_link_id_bw_type_t xgmi_link;
|
||||
uint32_t bw1;
|
||||
int bw_ind = 1;
|
||||
char* link1 = "P1";
|
||||
xgmi_link.link_name = link1;
|
||||
xgmi_link.bw_type = static_cast<amdsmi_io_bw_encoding_t>(1<<bw_ind) ;
|
||||
ret = amdsmi_get_cpu_current_xgmi_bw(sockets[i], xgmi_link, &bw1);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to get xgmi bandwidth width, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| Current "<<bw_string[bw_ind]<<"bandwidth of xGMI link "<<xgmi_link.link_name<<" | "<<bw<<" Mbps |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t met_ver;
|
||||
ret = amdsmi_get_metrics_table_version(sockets[i], &met_ver);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
cout<<"Failed to get Metrics Table Version, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
} else
|
||||
cout<<"\n| METRICS TABLE Version | "<<met_ver<<" \t\t |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
double fraction_q10 = 1/pow(2,10);
|
||||
double fraction_uq10 = fraction_q10;
|
||||
|
||||
struct hsmp_metric_table mtbl;
|
||||
ret = amdsmi_get_metrics_table(sockets[i], i, &mtbl);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
cout<<"Failed to get Metrics Table for socket["<<i<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
} else {
|
||||
cout<<"\n| METRICS TABLE \t\t |\n";
|
||||
cout<<"\n| ACCUMULATOR COUNTER | "<<mtbl.accumulation_counter<<"\t\t|\n";
|
||||
cout<<"\n| SOCKET POWER LIMIT | "<<(mtbl.socket_power_limit * fraction_uq10)<<" W\t\t|\n";
|
||||
cout<<"\n| MAX SOCKET POWER LIMIT | "<<(mtbl.max_socket_power_limit * fraction_uq10)<<" W\t\t|\n";
|
||||
cout<<"\n| SOCKET POWER | "<<(mtbl.socket_power * fraction_uq10)<<" W\t\t|\n";
|
||||
uint32_t input_power;
|
||||
power_max = 0;
|
||||
cout<<"\nEnter the max power to be set:\n";
|
||||
cin>>input_power;
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(plist[i], &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if ((ret == AMDSMI_STATUS_SUCCESS) && (input_power > power_max)) {
|
||||
cout<<"Input power is more than max power limit,"
|
||||
" limiting to "<<static_cast<double>(power_max)/1000<<"Watts\n";
|
||||
input_power = power_max;
|
||||
}
|
||||
ret = amdsmi_set_cpu_socket_power_cap(plist[i], input_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<"Socket["<<i<<"] power_limit set to "
|
||||
<<fixed<<setprecision(3)<<static_cast<double>(input_power)/1000<<" Watts successfully\n";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
}
|
||||
// Clean up resources allocated at amdsmi_init
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
+244
-199
@@ -71,7 +71,8 @@ typedef enum {
|
||||
AMDSMI_INIT_AMD_CPUS = (1 << 0),
|
||||
AMDSMI_INIT_AMD_GPUS = (1 << 1),
|
||||
AMDSMI_INIT_NON_AMD_CPUS = (1 << 2),
|
||||
AMDSMI_INIT_NON_AMD_GPUS = (1 << 3)
|
||||
AMDSMI_INIT_NON_AMD_GPUS = (1 << 3),
|
||||
AMDSMI_INIT_AMD_APUS = (AMDSMI_INIT_AMD_CPUS | AMDSMI_INIT_AMD_GPUS)
|
||||
} amdsmi_init_flags_t;
|
||||
|
||||
/* Maximum size definitions AMDSMI */
|
||||
@@ -88,6 +89,55 @@ typedef enum {
|
||||
|
||||
#define AMDSMI_GPU_UUID_SIZE 38
|
||||
|
||||
/**
|
||||
* @brief The following structure holds the gpu metrics values for a device.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Unit conversion factor for HBM temperatures
|
||||
*/
|
||||
#define CENTRIGRADE_TO_MILLI_CENTIGRADE 1000
|
||||
|
||||
/**
|
||||
* @brief This should match NUM_HBM_INSTANCES
|
||||
*/
|
||||
#define AMDSMI_NUM_HBM_INSTANCES 4
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_VCN
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_VCN 4
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_CLKS
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_CLKS 4
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_XGMI_LINKS
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_XGMI_LINKS 8
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_GFX_CLKS
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_GFX_CLKS 8
|
||||
|
||||
/**
|
||||
* @brief This should match AMDSMI_MAX_AID
|
||||
*/
|
||||
#define AMDSMI_MAX_AID 4
|
||||
|
||||
/**
|
||||
* @brief This should match AMDSMI_MAX_ENGINES
|
||||
*/
|
||||
#define AMDSMI_MAX_ENGINES 8
|
||||
|
||||
/**
|
||||
* @brief This should match AMDSMI_MAX_NUM_JPEG (8*4=32)
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_JPEG 32
|
||||
|
||||
/* string format */
|
||||
#define AMDSMI_TIME_FORMAT "%02d:%02d:%02d.%03d"
|
||||
#define AMDSMI_DATE_FORMAT "%04d-%02d-%02d:%02d:%02d:%02d.%03d"
|
||||
@@ -544,6 +594,12 @@ typedef struct {
|
||||
uint32_t reserved[4];
|
||||
} amdsmi_clk_info_t;
|
||||
|
||||
/**
|
||||
* amdsmi_engine_usage_t:
|
||||
* This structure holds common
|
||||
* GPU activity values seen in both BM or
|
||||
* SRIOV
|
||||
**/
|
||||
typedef struct {
|
||||
uint32_t gfx_activity;
|
||||
uint32_t umc_activity;
|
||||
@@ -1137,41 +1193,6 @@ typedef struct {
|
||||
/// \endcond
|
||||
} amd_metrics_table_header_t;
|
||||
|
||||
/**
|
||||
* @brief The following structure holds the gpu metrics values for a device.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Unit conversion factor for HBM temperatures
|
||||
*/
|
||||
#define CENTRIGRADE_TO_MILLI_CENTIGRADE 1000
|
||||
|
||||
/**
|
||||
* @brief This should match NUM_HBM_INSTANCES
|
||||
*/
|
||||
#define AMDSMI_NUM_HBM_INSTANCES 4
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_VCN
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_VCN 4
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_CLKS
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_CLKS 4
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_XGMI_LINKS
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_XGMI_LINKS 8
|
||||
|
||||
/**
|
||||
* @brief This should match MAX_NUM_GFX_CLKS
|
||||
*/
|
||||
#define AMDSMI_MAX_NUM_GFX_CLKS 8
|
||||
|
||||
|
||||
typedef struct {
|
||||
// TODO(amd) Doxygen documents
|
||||
// Note: This structure is extended to fit the needs of different GPU metric
|
||||
@@ -1191,7 +1212,7 @@ typedef struct {
|
||||
/*
|
||||
* v1.0 Base
|
||||
*/
|
||||
// Temperature
|
||||
// Temperature (C)
|
||||
uint16_t temperature_edge;
|
||||
uint16_t temperature_hotspot;
|
||||
uint16_t temperature_mem;
|
||||
@@ -1199,19 +1220,19 @@ typedef struct {
|
||||
uint16_t temperature_vrsoc;
|
||||
uint16_t temperature_vrmem;
|
||||
|
||||
// Utilization
|
||||
// Utilization (%)
|
||||
uint16_t average_gfx_activity;
|
||||
uint16_t average_umc_activity; // memory controller
|
||||
uint16_t average_mm_activity; // UVD or VCN
|
||||
|
||||
// Power/Energy
|
||||
// Power (W) /Energy (15.259uJ per 1ns)
|
||||
uint16_t average_socket_power;
|
||||
uint64_t energy_accumulator; // v1 mod. (32->64)
|
||||
|
||||
// Driver attached timestamp (in ns)
|
||||
uint64_t system_clock_counter; // v1 mod. (moved from top of struct)
|
||||
|
||||
// Average clocks
|
||||
// Average clocks (MHz)
|
||||
uint16_t average_gfxclk_frequency;
|
||||
uint16_t average_socclk_frequency;
|
||||
uint16_t average_uclk_frequency;
|
||||
@@ -1220,7 +1241,7 @@ typedef struct {
|
||||
uint16_t average_vclk1_frequency;
|
||||
uint16_t average_dclk1_frequency;
|
||||
|
||||
// Current clocks
|
||||
// Current clocks (MHz)
|
||||
uint16_t current_gfxclk;
|
||||
uint16_t current_socclk;
|
||||
uint16_t current_uclk;
|
||||
@@ -1232,10 +1253,10 @@ typedef struct {
|
||||
// Throttle status
|
||||
uint32_t throttle_status;
|
||||
|
||||
// Fans
|
||||
// Fans (RPM)
|
||||
uint16_t current_fan_speed;
|
||||
|
||||
// Link width/speed
|
||||
// Link width (number of lanes) /speed (0.1 GT/s)
|
||||
uint16_t pcie_link_width; // v1 mod.(8->16)
|
||||
uint16_t pcie_link_speed; // in 0.1 GT/s; v1 mod. (8->16)
|
||||
|
||||
@@ -1274,19 +1295,19 @@ typedef struct {
|
||||
uint16_t current_socket_power;
|
||||
|
||||
// Utilization (%)
|
||||
uint16_t vcn_activity[AMDSMI_MAX_NUM_VCN]; // VCN instances activity percent (encode/decode)
|
||||
uint16_t vcn_activity[AMDSMI_MAX_NUM_VCN];
|
||||
|
||||
// Clock Lock Status. Each bit corresponds to clock instance
|
||||
uint32_t gfxclk_lock_status;
|
||||
|
||||
// XGMI bus width and bitrate (in Gbps)
|
||||
// XGMI bus width and bitrate (in GB/s)
|
||||
uint16_t xgmi_link_width;
|
||||
uint16_t xgmi_link_speed;
|
||||
|
||||
// PCIE accumulated bandwidth (GB/sec)
|
||||
// PCIe accumulated bandwidth (GB/sec)
|
||||
uint64_t pcie_bandwidth_acc;
|
||||
|
||||
// PCIE instantaneous bandwidth (GB/sec)
|
||||
// PCIe instantaneous bandwidth (GB/sec)
|
||||
uint64_t pcie_bandwidth_inst;
|
||||
|
||||
// PCIE L0 to recovery state transition accumulated count
|
||||
@@ -1298,15 +1319,33 @@ typedef struct {
|
||||
// PCIE replay rollover accumulated count
|
||||
uint64_t pcie_replay_rover_count_acc;
|
||||
|
||||
// XGMI accumulated data transfer size(KiloBytes)
|
||||
// XGMI accumulated data transfer size (KB)
|
||||
uint64_t xgmi_read_data_acc[AMDSMI_MAX_NUM_XGMI_LINKS];
|
||||
uint64_t xgmi_write_data_acc[AMDSMI_MAX_NUM_XGMI_LINKS];
|
||||
|
||||
// Current clock frequencies
|
||||
// Current clock frequencies (MHz)
|
||||
uint16_t current_gfxclks[AMDSMI_MAX_NUM_GFX_CLKS];
|
||||
uint16_t current_socclks[AMDSMI_MAX_NUM_CLKS];
|
||||
uint16_t current_vclk0s[AMDSMI_MAX_NUM_CLKS];
|
||||
uint16_t current_dclk0s[AMDSMI_MAX_NUM_CLKS];
|
||||
|
||||
/*
|
||||
* v1.5 additions
|
||||
*/
|
||||
// JPEG activity % per AID
|
||||
uint16_t jpeg_activity[AMDSMI_MAX_NUM_JPEG];
|
||||
|
||||
// Memory Bandwidth Usage Accumulated (GB/sec)
|
||||
uint64_t mem_bandwidth_acc;
|
||||
|
||||
// Memory Bandwidth Maximum (GB/sec)
|
||||
uint32_t mem_max_bandwidth;
|
||||
|
||||
// PCIE NAK sent accumulated count
|
||||
uint32_t pcie_nak_sent_count_acc;
|
||||
|
||||
// PCIE NAK received accumulated count
|
||||
uint32_t pcie_nak_rcvd_count_acc;
|
||||
/// \endcond
|
||||
} amdsmi_gpu_metrics_t;
|
||||
|
||||
@@ -1588,32 +1627,67 @@ amdsmi_status_t amdsmi_get_socket_info(
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
/**
|
||||
* @brief Get information about the given cpu socket
|
||||
* @brief Get information about the given processor
|
||||
*
|
||||
* @details This function retrieves cpu socket information. The @p socket_handle must
|
||||
* be provided to retrieve the Socket ID.
|
||||
* @details This function retrieves processor information. The @p processor_handle must
|
||||
* be provided to retrieve the processor ID.
|
||||
*
|
||||
* @param[in] socket_handle a socket handle
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[out] sockid The id of the socket.
|
||||
* @param[out] name The id of the processor.
|
||||
*
|
||||
* @param[in] len the length of the caller provided buffer @p name.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpusocket_info(amdsmi_cpusocket_handle socket_handle, uint32_t sockid);
|
||||
amdsmi_status_t amdsmi_get_processor_info(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
size_t len, char *name);
|
||||
|
||||
/**
|
||||
* @brief Get information about the given cpu core
|
||||
* @brief Get respective processor counts from the processor handles
|
||||
*
|
||||
* @details This function retrieves cpu core information. The @p core_handle must
|
||||
* be provided to retrieve the core ID.
|
||||
* @details This function retrieves respective processor counts information.
|
||||
* The @p processor_handle must be provided to retrieve the processor ID.
|
||||
*
|
||||
* @param[in] core_handle a processor handle
|
||||
* @param[in] processor_handles A pointer to a block of memory to which the
|
||||
* ::amdsmi_processor_handle values will be written. This value may be NULL.
|
||||
*
|
||||
* @param[out] coreid The id of the core.
|
||||
* @param[in] processor_count total processor count per socket
|
||||
*
|
||||
* @param[out] nr_cpusockets Total number of cpu sockets
|
||||
*
|
||||
* @param[out] nr_cpucores Total number of cpu cores
|
||||
*
|
||||
* @param[out] nr_gpus Total number of gpu devices
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpucore_info(amdsmi_processor_handle core_handle, uint32_t coreid);
|
||||
amdsmi_status_t amdsmi_get_processor_count_from_handles(amdsmi_processor_handle* processor_handles,
|
||||
uint32_t* processor_count, uint32_t* nr_cpusockets,
|
||||
uint32_t* nr_cpucores, uint32_t* nr_gpus);
|
||||
|
||||
/**
|
||||
* @brief Get processor list as per processor type
|
||||
*
|
||||
* @details This function retrieves processor list as per the processor type
|
||||
* from the total processor handles list.
|
||||
* The @p list of processor_handles and processor type must be provided.
|
||||
*
|
||||
* @param[in] socket_handle socket handle
|
||||
*
|
||||
* @param[in] processor_type processor type
|
||||
*
|
||||
* @param[out] processor_handles list of processor handles as per processor type
|
||||
*
|
||||
* @param[out] processor_count processor count as per processor type selected
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_processor_handles_by_type(amdsmi_socket_handle socket_handle,
|
||||
processor_type_t processor_type,
|
||||
amdsmi_processor_handle* processor_handles,
|
||||
uint32_t* processor_count);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -5302,27 +5376,25 @@ amdsmi_get_gpu_metrics_log(amdsmi_processor_handle processor_handle);
|
||||
* @brief Get the core energy for a given core.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - cpu core index
|
||||
*
|
||||
* @param[in,out] penergy - Input buffer to return the core energy
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_energy(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint64_t *penergy);
|
||||
uint64_t *penergy);
|
||||
|
||||
/**
|
||||
* @brief Get the socket energy for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] penergy - Input buffer to return the socket energy
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint64_t *penergy);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_processor_handle processor_handle,
|
||||
uint64_t *penergy);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5334,43 +5406,41 @@ amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_cpusocket_handle socket_hand
|
||||
/**
|
||||
* @brief Get SMU Firmware Version.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] amdsmi_smu_fw - Input buffer to return the firmware version
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_smu_fw_version(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_smu_fw_version_t *amdsmi_smu_fw);
|
||||
amdsmi_status_t amdsmi_get_cpu_smu_fw_version(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_smu_fw_version_t *amdsmi_smu_fw);
|
||||
|
||||
/**
|
||||
* @brief Get HSMP protocol Version.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] proto_ver - Input buffer to return the protocol version
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t *proto_ver);
|
||||
amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *proto_ver);
|
||||
|
||||
/**
|
||||
* @brief Get normalized status of the processor's PROCHOT status.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] prochot - Input buffer to return the procohot status.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *prochot);
|
||||
amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *prochot);
|
||||
|
||||
/**
|
||||
* @brief Get Data fabric clock and Memory clock in MHz.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] fclk - Input buffer to return fclk
|
||||
*
|
||||
@@ -5378,27 +5448,25 @@ amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_cpusocket_handle socket_han
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_fclk_mclk(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *fclk, uint32_t *mclk);
|
||||
amdsmi_status_t amdsmi_get_cpu_fclk_mclk(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *fclk, uint32_t *mclk);
|
||||
|
||||
/**
|
||||
* @brief Get core clock in MHz.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] cclk - Input buffer to return core clock
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *cclk);
|
||||
amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *cclk);
|
||||
|
||||
/**
|
||||
* @brief Get current active frequency limit of the socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] freq - Input buffer to return frequency value in MHz
|
||||
*
|
||||
@@ -5406,14 +5474,13 @@ amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint16_t *freq, char **src_type);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_processor_handle processor_handle,
|
||||
uint16_t *freq, char **src_type);
|
||||
|
||||
/**
|
||||
* @brief Get socket frequency range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] fmax - Input buffer to return maximum frequency
|
||||
*
|
||||
@@ -5421,21 +5488,20 @@ amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_cpusocket
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint16_t *fmax, uint16_t *fmin);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_processor_handle processor_handle,
|
||||
uint16_t *fmax, uint16_t *fmin);
|
||||
|
||||
/**
|
||||
* @brief Get socket frequency limit of the core.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in,out] freq - Input buffer to return frequency.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t *freq);
|
||||
uint32_t *freq);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5447,80 +5513,74 @@ amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle p
|
||||
/**
|
||||
* @brief Get the socket power.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] ppower - Input buffer to return socket power
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *ppower);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *ppower);
|
||||
|
||||
/**
|
||||
* @brief Get the socket power cap.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pcap - Input buffer to return power cap.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pcap);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pcap);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum power cap value for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pmax - Input buffer to return maximum power limit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pmax);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pmax);
|
||||
|
||||
/**
|
||||
* @brief Get the SVI based power telemetry for all rails.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] power - Input buffer to return svi based power value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *power);
|
||||
amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *power);
|
||||
|
||||
/**
|
||||
* @brief Set the power cap value for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] power - Input power limit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t pcap);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_processor_handle processor_handle,
|
||||
uint32_t pcap);
|
||||
|
||||
/**
|
||||
* @brief Set the power efficiency profile policy.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] mode - mode to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t mode);
|
||||
amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_processor_handle processor_handle,
|
||||
uint8_t mode);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5533,53 +5593,49 @@ amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_cpusocket_handle socke
|
||||
* @brief Get the core boost limit.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in,out] pboostlimit - Input buffer to fill the boostlimit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t *pboostlimit);
|
||||
uint32_t *pboostlimit);
|
||||
|
||||
/**
|
||||
* @brief Get the socket c0 residency.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pc0_residency - Input buffer to fill the c0 residency value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pc0_residency);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pc0_residency);
|
||||
|
||||
/**
|
||||
* @brief Set the core boostlimit value.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in] boostlimit - boostlimit value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_core_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t boostlimit);
|
||||
uint32_t boostlimit);
|
||||
|
||||
/**
|
||||
* @brief Set the socket boostlimit value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] boostlimit - boostlimit value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t boostlimit);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t boostlimit);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5591,13 +5647,13 @@ amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_cpusocket_handle socket_
|
||||
/**
|
||||
* @brief Get the DDR bandwidth data.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] ddr_bw - Input buffer to fill ddr bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_ddr_bw_metrics_t *ddr_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_ddr_bw_metrics_t *ddr_bw);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5609,15 +5665,14 @@ amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Get socket temperature.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] ptmon - Input buffer to fill temperature value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *ptmon);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *ptmon);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5629,41 +5684,41 @@ amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_cpusocket_handle socket
|
||||
/**
|
||||
* @brief Get DIMM temperature range and refresh rate.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] rate - Input buffer to fill temperature range and refresh rate value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_temp_range_refresh_rate_t *rate);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_temp_range_refresh_rate_t *rate);
|
||||
|
||||
/**
|
||||
* @brief Get DIMM power consumption.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] rate - Input buffer to fill power consumption value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_dimm_power_t *dimm_pow);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_dimm_power_t *dimm_pow);
|
||||
|
||||
/**
|
||||
* @brief Get DIMM thermal sensor value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] dimm_temp - Input buffer to fill temperature value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_dimm_thermal_t *dimm_temp);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_dimm_thermal_t *dimm_temp);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5675,13 +5730,13 @@ amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_cpusocket_handle socke
|
||||
/**
|
||||
* @brief Set xgmi width.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] min - Minimum xgmi width to be set
|
||||
* @param[in] max - maximum xgmi width to be set
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t min, uint8_t max);
|
||||
amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min, uint8_t max);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5693,15 +5748,14 @@ amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Set gmi3 link width range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] min_link_width - minimum link width to be set.
|
||||
* @param[in] max_link_width - maximum link width to be set.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t min_link_width, uint8_t max_link_width);
|
||||
amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min_link_width, uint8_t max_link_width);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5713,78 +5767,72 @@ amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_cpusocket_handle soc
|
||||
/**
|
||||
* @brief Enable APB.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_cpu_apb_enable(amdsmi_cpusocket_handle socket_handle, uint32_t sock_ind);
|
||||
amdsmi_status_t amdsmi_cpu_apb_enable(amdsmi_processor_handle processor_handle);
|
||||
|
||||
/**
|
||||
* @brief Disable APB.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] pstate - pstate value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_cpu_apb_disable(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint8_t pstate);
|
||||
amdsmi_status_t amdsmi_cpu_apb_disable(amdsmi_processor_handle processor_handle,
|
||||
uint8_t pstate);
|
||||
|
||||
/**
|
||||
* @brief Set NBIO lclk dpm level value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] nbio_id - nbio index
|
||||
* @param[in] min - minimum value to be set
|
||||
* @param[in] max - maximum value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint8_t nbio_id, uint8_t min, uint8_t max);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(amdsmi_processor_handle processor_handle,
|
||||
uint8_t nbio_id, uint8_t min, uint8_t max);
|
||||
|
||||
/**
|
||||
* @brief Get NBIO LCLK dpm level.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] nbio_id - nbio index
|
||||
* @param[in,out] nbio - Input buffer to fill lclk dpm level
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t nbio_id, amdsmi_dpm_level_t *nbio);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(amdsmi_processor_handle processor_handle,
|
||||
uint8_t nbio_id, amdsmi_dpm_level_t *nbio);
|
||||
|
||||
/**
|
||||
* @brief Set pcie link rate.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] rate_ctrl - rate control value to be set.
|
||||
* @param[in,out] prev_mode - Input buffer to fill previous rate control value.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t rate_ctrl, uint8_t *prev_mode);
|
||||
amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_processor_handle processor_handle,
|
||||
uint8_t rate_ctrl, uint8_t *prev_mode);
|
||||
|
||||
/**
|
||||
* @brief Set df pstate range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] max_pstate - maximum pstate value to be set
|
||||
* @param[in] min_pstate - minimum pstate value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t max_pstate, uint8_t min_pstate);
|
||||
amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t max_pstate, uint8_t min_pstate);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5796,27 +5844,26 @@ amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_cpusocket_handle socket_ha
|
||||
/**
|
||||
* @brief Get current input output bandwidth.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] link - link id and bw type to which io bandwidth to be obtained
|
||||
* @param[in,out] io_bw - Input buffer to fill bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, amdsmi_link_id_bw_type_t link, uint32_t *io_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *io_bw);
|
||||
|
||||
/**
|
||||
* @brief Get current input output bandwidth.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] link - link id and bw type to which xgmi bandwidth to be obtained
|
||||
* @param[in,out] xgmi_bw - Input buffer to fill bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *xgmi_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *xgmi_bw);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5828,25 +5875,24 @@ amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_cpusocket_handle socket_ha
|
||||
/**
|
||||
* @brief Get metrics table version
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_version input buffer to return the metrics table version.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t *metrics_version);
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *metrics_version);
|
||||
|
||||
/**
|
||||
* @brief Get metrics table
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_table input buffer to return the metrics table.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle, uint8_t sock_ind,
|
||||
struct hsmp_metric_table *metrics_table);
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handle,
|
||||
struct hsmp_metric_table *metrics_table);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5858,15 +5904,14 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Get first online core on socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index.
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] sockets - Input buffer to fill first online core on socket data
|
||||
* @param[in,out] pcore_ind - Input buffer to fill first online core on socket data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pcore_ind);
|
||||
amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pcore_ind);
|
||||
|
||||
/**
|
||||
* @brief Get a description of provided AMDSMI error status for esmi errors.
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
/*Subclass CPU Core*/
|
||||
class AMDSmiCpuCore : public AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiCpuCore(const uint32_t& core_idx):AMDSmiProcessor(AMD_CPU_CORE),core_idx_(core_idx) {}
|
||||
|
||||
virtual ~AMDSmiCpuCore() {}
|
||||
|
||||
const uint32_t& get_core_id() const { return core_idx_; }
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
|
||||
private:
|
||||
uint32_t core_idx_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_cpu_core.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
/*Subclass CPU Socket*/
|
||||
class AMDSmiCpuSocket : public AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiCpuSocket(const uint32_t& id):AMDSmiProcessor(AMD_CPU),socket_identifier_(id) {}
|
||||
|
||||
virtual ~AMDSmiCpuSocket() {}
|
||||
|
||||
amdsmi_status_t get_cpu_vendor() { return AMDSMI_STATUS_SUCCESS; }
|
||||
uint32_t get_cpu_id() const { return cpu_id_; }
|
||||
const uint32_t& get_socket_id() const { return socket_identifier_; }
|
||||
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
|
||||
private:
|
||||
uint32_t cpu_id_;
|
||||
uint32_t socket_identifier_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
#include "shared_mutex.h" // NOLINT
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
|
||||
#include <string>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
namespace amd {
|
||||
@@ -51,14 +52,18 @@ namespace smi {
|
||||
|
||||
class AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiProcessor(processor_type_t processor) : processor_type_(processor) {}
|
||||
explicit AMDSmiProcessor(processor_type_t type) : processor_type_(type) {}
|
||||
explicit AMDSmiProcessor(processor_type_t type, uint32_t index) : processor_type_(type), pindex_(index) {}
|
||||
explicit AMDSmiProcessor(const std::string& id) : processor_identifier_(id) {}
|
||||
virtual ~AMDSmiProcessor() {}
|
||||
processor_type_t get_processor_type() const { return processor_type_;}
|
||||
const std::string& get_processor_id() const { return processor_identifier_;}
|
||||
uint32_t get_processor_index() const { return pindex_;}
|
||||
private:
|
||||
processor_type_t processor_type_;
|
||||
uint32_t pindex_;
|
||||
std::string processor_identifier_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -56,14 +56,46 @@ namespace smi {
|
||||
class AMDSmiSocket {
|
||||
public:
|
||||
explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {}
|
||||
explicit AMDSmiSocket(uint32_t index) : sindex_(index) {}
|
||||
~AMDSmiSocket();
|
||||
const std::string& get_socket_id() const { return socket_identifier_;}
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
uint32_t get_socket_index() { return sindex_;}
|
||||
void add_processor(AMDSmiProcessor* processor) {
|
||||
switch (processor->get_processor_type()) {
|
||||
case AMD_GPU:
|
||||
processors_.push_back(processor);
|
||||
break;
|
||||
case AMD_CPU:
|
||||
cpu_processors_.push_back(processor);
|
||||
break;
|
||||
case AMD_CPU_CORE:
|
||||
cpu_core_processors_.push_back(processor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
std::vector<AMDSmiProcessor*>& get_processors(processor_type_t type) {
|
||||
switch (type) {
|
||||
case AMD_GPU:
|
||||
return processors_;
|
||||
case AMD_CPU:
|
||||
return cpu_processors_;
|
||||
case AMD_CPU_CORE:
|
||||
return cpu_core_processors_;
|
||||
default:
|
||||
return processors_;
|
||||
}
|
||||
}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
amdsmi_status_t get_processor_count(processor_type_t type, uint32_t* processor_count) const;
|
||||
private:
|
||||
uint32_t sindex_;
|
||||
std::string socket_identifier_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
std::vector<AMDSmiProcessor*> cpu_processors_;
|
||||
std::vector<AMDSmiProcessor*> cpu_core_processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
|
||||
@@ -50,9 +50,6 @@
|
||||
#include "amd_smi/impl/amd_smi_socket.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
#include "amd_smi/impl/amd_smi_cpu_socket.h"
|
||||
#endif
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
@@ -78,25 +75,6 @@ class AMDSmiSystem {
|
||||
amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index,
|
||||
amdsmi_processor_handle* processor_handle);
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
std::vector<AMDSmiCpuSocket*>& get_cpu_sockets() {return cpu_sockets_;}
|
||||
|
||||
amdsmi_status_t handle_to_cpusocket(amdsmi_cpusocket_handle cpusock_handle,
|
||||
AMDSmiCpuSocket** cpu_socket);
|
||||
|
||||
amdsmi_status_t cpu_index_to_handle(uint32_t cpu_index,
|
||||
amdsmi_cpusocket_handle* cpusock_handle);
|
||||
|
||||
amdsmi_status_t get_cpu_sockets(uint32_t *socks);
|
||||
|
||||
amdsmi_status_t get_cpu_cores(uint32_t *cpus);
|
||||
|
||||
amdsmi_status_t get_threads_per_core(uint32_t *threads);
|
||||
|
||||
amdsmi_status_t get_cpu_family(uint32_t *family);
|
||||
|
||||
amdsmi_status_t get_cpu_model(uint32_t *model);
|
||||
#endif
|
||||
private:
|
||||
AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {}
|
||||
|
||||
@@ -106,23 +84,12 @@ class AMDSmiSystem {
|
||||
*/
|
||||
amdsmi_status_t get_gpu_socket_id(uint32_t index, std::string& socketid);
|
||||
amdsmi_status_t populate_amd_gpu_devices();
|
||||
amdsmi_status_t populate_amd_cpus();
|
||||
uint64_t init_flag_;
|
||||
AMDSmiDrm drm_;
|
||||
std::vector<AMDSmiSocket*> sockets_;
|
||||
std::set<AMDSmiProcessor*> processors_; // Track valid processors
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t populate_amd_cpus();
|
||||
std::vector<AMDSmiCpuSocket*> cpu_sockets_;
|
||||
static uint32_t sockets;
|
||||
static uint32_t cpus;
|
||||
static uint32_t threads;
|
||||
static uint32_t family;
|
||||
static uint32_t model;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
+470
-213
@@ -2117,63 +2117,68 @@ Input parameters:
|
||||
|
||||
Output: Dictionary with fields
|
||||
|
||||
Field | Description
|
||||
`---|---
|
||||
`temperature_edge` | edge temperature value
|
||||
`temperature_hotspot` | hotspot temperature value
|
||||
`temperature_mem` | memory temperature value
|
||||
`temperature_vrgfx` | vrgfx temperature value
|
||||
`temperature_vrsoc` | vrsoc temperature value
|
||||
`temperature_vrmem` | vrmem temperature value
|
||||
`average_gfx_activity` | average gfx activity
|
||||
`average_umc_activity` | average umc activity
|
||||
`average_mm_activity` | average mm activity
|
||||
`average_socket_power` | average socket power
|
||||
`energy_accumulator` | energy accumulator value
|
||||
`system_clock_counter` | system clock counter
|
||||
`average_gfxclk_frequency` | average gfx clock frequency
|
||||
`average_socclk_frequency` | average soc clock frequency
|
||||
`average_uclk_frequency` | average uclk frequency
|
||||
`average_vclk0_frequency` | average vclk0 frequency
|
||||
`average_dclk0_frequency` | average dclk0 frequency
|
||||
`average_vclk1_frequency` | average vclk1 frequency
|
||||
`average_dclk1_frequency` | average dclk1 frequency
|
||||
`current_gfxclk` | current gfx clock
|
||||
`current_socclk` | current soc clock
|
||||
`current_uclk` | current uclk
|
||||
`current_vclk0` | current vclk0
|
||||
`current_dclk0` | current dclk0
|
||||
`current_vclk1` | current vclk1
|
||||
`current_dclk1` | current dclk1
|
||||
`throttle_status` | current throttle status
|
||||
`current_fan_speed` | current fan speed
|
||||
`pcie_link_width` | pcie link width
|
||||
`pcie_link_speed` | pcie link speed
|
||||
| Field | Description |Unit|
|
||||
|-------|-------------|----|
|
||||
`temperature_edge` | Edge temperature value | Celsius (C)
|
||||
`temperature_hotspot` | Hotspot (aka junction) temperature value | Celsius (C)
|
||||
`temperature_mem` | Memory temperature value | Celsius (C)
|
||||
`temperature_vrgfx` | vrgfx temperature value | Celsius (C)
|
||||
`temperature_vrsoc` | vrsoc temperature value | Celsius (C)
|
||||
`temperature_vrmem` | vrmem temperature value | Celsius (C)
|
||||
`average_gfx_activity` | Average gfx activity | %
|
||||
`average_umc_activity` | Average umc activity | %
|
||||
`average_mm_activity` | Average mm activity | %
|
||||
`average_socket_power` | Average socket power | W
|
||||
`energy_accumulator` | Energy accumulated with a 15.3 uJ resolution over 1ns | uJ
|
||||
`system_clock_counter` | System clock counter | ns
|
||||
`average_gfxclk_frequency` | Average gfx clock frequency | MHz
|
||||
`average_socclk_frequency` | Average soc clock frequency | MHz
|
||||
`average_uclk_frequency` | Average uclk frequency | MHz
|
||||
`average_vclk0_frequency` | Average vclk0 frequency | MHz
|
||||
`average_dclk0_frequency` | Average dclk0 frequency | MHz
|
||||
`average_vclk1_frequency` | Average vclk1 frequency | MHz
|
||||
`average_dclk1_frequency` | Average dclk1 frequency | MHz
|
||||
`current_gfxclk` | Current gfx clock | MHz
|
||||
`current_socclk` | Current soc clock | MHz
|
||||
`current_uclk` | Current uclk | MHz
|
||||
`current_vclk0` | Current vclk0 | MHz
|
||||
`current_dclk0` | Current dclk0 | MHz
|
||||
`current_vclk1` | Current vclk1 | MHz
|
||||
`current_dclk1` | Current dclk1 | MHz
|
||||
`throttle_status` | Current throttle status | MHz
|
||||
`current_fan_speed` | Current fan speed | RPM
|
||||
`pcie_link_width` | PCIe link width (number of lanes) | lanes
|
||||
`pcie_link_speed` | PCIe link speed in 0.1 GT/s (Giga Transfers per second) | GT/s
|
||||
`padding` | padding
|
||||
`gfx_activity_acc` | gfx activity acc
|
||||
`mem_activity_acc` | mem activity acc
|
||||
`temperature_hbm` | list of hbm temperatures
|
||||
`firmware_timestamp` | timestamp from PMFW
|
||||
`voltage_soc` | soc voltage
|
||||
`voltage_gfx` | gfx voltage
|
||||
`voltage_mem` | mem voltage
|
||||
`indep_throttle_status` | asic independent throttle status
|
||||
`current_socket_power` | current socket power
|
||||
`vcn_activity` | list of encoding and decoding engine utilizations
|
||||
`gfxclk_lock_status` | gfx clock lock status
|
||||
`xgmi_link_width` | XGMI bus width
|
||||
`xgmi_link_speed` | XGMI bitrate (in Gbps)
|
||||
`pcie_bandwidth_acc` | PCIE accumulated bandwidth (GB/sec)
|
||||
`pcie_bandwidth_inst` | PCIE instantaneous bandwidth (GB/sec)
|
||||
`pcie_l0_to_recov_count_acc` | PCIE L0 to recovery state transition accumulated count
|
||||
`pcie_replay_count_acc` | PCIE replay accumulated count
|
||||
`pcie_replay_rover_count_acc` | PCIE replay rollover accumulated count
|
||||
`xgmi_read_data_acc` | XGMI accumulated read data transfer size(KiloBytes)
|
||||
`xgmi_write_data_acc` | XGMI accumulated write data transfer size(KiloBytes)
|
||||
`current_gfxclks` | list of current gfx clock frequencies
|
||||
`current_socclks` | list of current soc clock frequencies
|
||||
`current_vclk0s` | list of current v0 clock frequencies
|
||||
`current_dclk0s` | list of current d0 clock frequencies
|
||||
`gfx_activity_acc` | gfx activity accumulated | %
|
||||
`mem_activity_acc` | Memory activity accumulated | %
|
||||
`temperature_hbm` | list of hbm temperatures | Celsius (C)
|
||||
`firmware_timestamp` | timestamp from PMFW (10ns resolution) | ns
|
||||
`voltage_soc` | soc voltage | mV
|
||||
`voltage_gfx` | gfx voltage | mV
|
||||
`voltage_mem` | mem voltage | mV
|
||||
`indep_throttle_status` | ASIC independent throttle status (see drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h for bit flags) |
|
||||
`current_socket_power` | Current socket power (also known as instant socket power) | W
|
||||
`vcn_activity` | List of VCN encode/decode engine utilization per AID | %
|
||||
`gfxclk_lock_status` | Clock lock status. Each bit corresponds to clock instance. |
|
||||
`xgmi_link_width` | XGMI bus width | lanes
|
||||
`xgmi_link_speed` | XGMI bitrate | GB/s
|
||||
`pcie_bandwidth_acc` | PCIe accumulated bandwidth | GB/s
|
||||
`pcie_bandwidth_inst` | PCIe instantaneous bandwidth | GB/s
|
||||
`pcie_l0_to_recov_count_acc` | PCIe L0 to recovery state transition accumulated count |
|
||||
`pcie_replay_count_acc` | PCIe replay accumulated count |
|
||||
`pcie_replay_rover_count_acc` | PCIe replay rollover accumulated count |
|
||||
`xgmi_read_data_acc` | XGMI accumulated read data transfer size (KiloBytes) | KB
|
||||
`xgmi_write_data_acc` | XGMI accumulated write data transfer size (KiloBytes) | KB
|
||||
`current_gfxclks` | List of current gfx clock frequencies | MHz
|
||||
`current_socclks` | List of current soc clock frequencies | MHz
|
||||
`current_vclk0s` | List of current v0 clock frequencies | MHz
|
||||
`current_dclk0s` | List of current d0 clock frequencies | MHz
|
||||
`mem_bandwidth_acc` | Memory bandwidth usage accumulated | GB/s
|
||||
`mem_max_bandwidth` | Maximum memory bandwidth usage accumulated | GB/s
|
||||
`pcie_nak_sent_count_acc` | PCIe NAC sent count accumulated |
|
||||
`pcie_nak_rcvd_count_acc` | PCIe NAC received count accumulated |
|
||||
`jpeg_activitys[AID<X>]` | List of JPEG engine activity for each AID (X=0-3) | %
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_info` function:
|
||||
|
||||
@@ -5119,40 +5124,17 @@ except AmdSmiException as e:
|
||||
|
||||
## CPU APIs
|
||||
|
||||
### amdsmi_get_cpusocket_handles
|
||||
|
||||
**Note: CURRENTLY HARDCODED TO RETURN DUMMY DATA**
|
||||
Description: Returns list of cpusocket handle objects on current machine
|
||||
|
||||
Input parameters: `None`
|
||||
|
||||
Output: List of cpusocket handle objects
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpusocket_handles` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
sockets = amdsmi_get_cpusocket_handles()
|
||||
print('Socket numbers: {}'.format(len(sockets)))
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpusocket_info
|
||||
### amdsmi_get_processor_info
|
||||
|
||||
**Note: CURRENTLY HARDCODED TO RETURN EMPTY VALUES**
|
||||
Description: Return cpu socket index
|
||||
Description: Return processor name
|
||||
|
||||
Input parameters:
|
||||
`socket_handle` cpu socket handle
|
||||
`processor_handle` processor handle
|
||||
|
||||
Output: Socket index
|
||||
Output: Processor name
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpusocket_info` function:
|
||||
Exceptions that can be thrown by `amdsmi_get_processor_info` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
@@ -5160,38 +5142,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No processors on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
print(amdsmi_get_cpusocket_info(socket))
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpucore_handles
|
||||
|
||||
Description: Returns list of CPU core handle objects on current machine
|
||||
|
||||
Input parameters: `None`
|
||||
|
||||
Output: List of CPU core handle objects
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpucore_handles` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
core_handles = amdsmi_get_cpucore_handles()
|
||||
if len(core_handles) == 0:
|
||||
print("No CPU cores on machine")
|
||||
else:
|
||||
for core in core_handles:
|
||||
print(amdsmi_get_cpucore_info(core))
|
||||
for processor in processor_handles:
|
||||
print(amdsmi_get_processor_info(processor))
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
@@ -5210,12 +5166,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
version = amdsmi_get_cpu_hsmp_proto_ver(socket)
|
||||
for processor in processor_handles:
|
||||
version = amdsmi_get_cpu_hsmp_proto_ver(processor)
|
||||
print(version)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5235,12 +5191,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
version = amdsmi_get_cpu_smu_fw_version(socket)
|
||||
for processor in processor_handles:
|
||||
version = amdsmi_get_cpu_smu_fw_version(processor)
|
||||
print(version['debug'])
|
||||
print(version['minor'])
|
||||
print(version['major'])
|
||||
@@ -5262,12 +5218,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
prochot = amdsmi_get_cpu_prochot_status(socket)
|
||||
for processor in processor_handles:
|
||||
prochot = amdsmi_get_cpu_prochot_status(processor)
|
||||
print(prochot)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5287,12 +5243,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
clk = amdsmi_get_cpu_fclk_mclk(socket)
|
||||
for processor in processor_handles:
|
||||
clk = amdsmi_get_cpu_fclk_mclk(processor)
|
||||
for fclk, mclk in clk.items():
|
||||
print(fclk)
|
||||
print(mclk)
|
||||
@@ -5314,12 +5270,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
cclk_limit = amdsmi_get_cpu_cclk_limit(socket)
|
||||
for processor in processor_handles:
|
||||
cclk_limit = amdsmi_get_cpu_cclk_limit(processor)
|
||||
print(cclk_limit)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5339,12 +5295,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
freq_limit = amdsmi_get_cpu_socket_current_active_freq_limit(socket)
|
||||
for processor in processor_handles:
|
||||
freq_limit = amdsmi_get_cpu_socket_current_active_freq_limit(processor)
|
||||
for freq, src in freq_limit.items():
|
||||
print(freq)
|
||||
print(src)
|
||||
@@ -5366,12 +5322,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
freq_range = amdsmi_get_cpu_socket_freq_range(socket)
|
||||
for processor in processor_handles:
|
||||
freq_range = amdsmi_get_cpu_socket_freq_range(processor)
|
||||
for fmax, fmin in freq_range.items():
|
||||
print(fmax)
|
||||
print(fmin)
|
||||
@@ -5393,12 +5349,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
core_handles = amdsmi_get_cpucore_handles()
|
||||
if len(core_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU cores on machine")
|
||||
else:
|
||||
for core in core_handles:
|
||||
freq_limit = amdsmi_get_cpu_core_current_freq_limit(core)
|
||||
for processor in processor_handles:
|
||||
freq_limit = amdsmi_get_cpu_core_current_freq_limit(processor)
|
||||
print(freq_limit)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5418,12 +5374,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
sock_power = amdsmi_get_cpu_socket_power(socket)
|
||||
for processor in processor_handles:
|
||||
sock_power = amdsmi_get_cpu_socket_power(processor)
|
||||
print(sock_power)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5443,12 +5399,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
sock_power = amdsmi_get_cpu_socket_power_cap(socket)
|
||||
for processor in processor_handles:
|
||||
sock_power = amdsmi_get_cpu_socket_power_cap(processor)
|
||||
print(sock_power)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5468,12 +5424,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
sock_power = amdsmi_get_cpu_socket_power_cap_max(socket)
|
||||
for processor in processor_handles:
|
||||
sock_power = amdsmi_get_cpu_socket_power_cap_max(processor)
|
||||
print(sock_power)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5493,12 +5449,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
power = amdsmi_get_cpu_pwr_svi_telemetry_all_rails(socket)
|
||||
for processor in processor_handles:
|
||||
power = amdsmi_get_cpu_pwr_svi_telemetry_all_rails(processor)
|
||||
print(power)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5508,7 +5464,7 @@ except AmdSmiException as e:
|
||||
|
||||
Description: Set the power cap value for a given socket.
|
||||
|
||||
Input: socket index, amdsmi socket power cap value
|
||||
Input: amdsmi socket power cap value
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_cpu_socket_power_cap` function:
|
||||
|
||||
@@ -5518,12 +5474,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
power = amdsmi_set_cpu_socket_power_cap(socket, 0, 1000)
|
||||
for processor in processor_handles:
|
||||
power = amdsmi_set_cpu_socket_power_cap(processor, 1000)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
@@ -5532,7 +5488,7 @@ except AmdSmiException as e:
|
||||
|
||||
Description: Set the power efficiency profile policy.
|
||||
|
||||
Input: socket index, mode(0, 1, or 2)
|
||||
Input: mode(0, 1, or 2)
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_cpu_pwr_efficiency_mode` function:
|
||||
|
||||
@@ -5542,12 +5498,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
policy = amdsmi_set_cpu_pwr_efficiency_mode(socket, 0, 0)
|
||||
for processor in processor_handles:
|
||||
policy = amdsmi_set_cpu_pwr_efficiency_mode(processor, 0)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
@@ -5566,12 +5522,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
core_handles = amdsmi_get_cpucore_handles()
|
||||
if len(core_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU cores on machine")
|
||||
else:
|
||||
for core in core_handles:
|
||||
boost_limit = amdsmi_get_cpu_core_boostlimit(core)
|
||||
for processor in processor_handles:
|
||||
boost_limit = amdsmi_get_cpu_core_boostlimit(processor)
|
||||
print(boost_limit)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5591,12 +5547,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
c0_residency = amdsmi_get_cpu_socket_c0_residency(socket)
|
||||
for processor in processor_handles:
|
||||
c0_residency = amdsmi_get_cpu_socket_c0_residency(processor)
|
||||
print(c0_residency)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5616,12 +5572,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
core_handles = amdsmi_get_cpucore_handles()
|
||||
if len(core_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU cores on machine")
|
||||
else:
|
||||
for core in core_handles:
|
||||
boost_limit = amdsmi_set_cpu_core_boostlimit(core, 1000)
|
||||
for processor in processor_handles:
|
||||
boost_limit = amdsmi_set_cpu_core_boostlimit(processor, 1000)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
@@ -5640,12 +5596,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
boost_limit = amdsmi_set_cpu_socket_boostlimit(socket, 1000)
|
||||
for processor in processor_handles:
|
||||
boost_limit = amdsmi_set_cpu_socket_boostlimit(processor, 1000)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
@@ -5664,12 +5620,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
ddr_bw = amdsmi_get_cpu_ddr_bw(socket)
|
||||
for processor in processor_handles:
|
||||
ddr_bw = amdsmi_get_cpu_ddr_bw(processor)
|
||||
print(ddr_bw['max_bw'])
|
||||
print(ddr_bw['utilized_bw'])
|
||||
print(ddr_bw['utilized_pct'])
|
||||
@@ -5691,12 +5647,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
ptmon = amdsmi_get_cpu_socket_temperature(socket)
|
||||
for processor in processor_handles:
|
||||
ptmon = amdsmi_get_cpu_socket_temperature(processor)
|
||||
print(ptmon)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -5716,12 +5672,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
dimm = amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(socket)
|
||||
for processor in processor_handles:
|
||||
dimm = amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(processor)
|
||||
print(dimm['range'])
|
||||
print(dimm['ref_rate'])
|
||||
except AmdSmiException as e:
|
||||
@@ -5742,12 +5698,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
dimm = amdsmi_get_cpu_dimm_power_consumption(socket)
|
||||
for processor in processor_handles:
|
||||
dimm = amdsmi_get_cpu_dimm_power_consumption(processor)
|
||||
print(dimm['power'])
|
||||
print(dimm['update_rate'])
|
||||
print(dimm['dimm_addr'])
|
||||
@@ -5769,12 +5725,12 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
dimm = amdsmi_get_cpu_dimm_thermal_sensor(socket)
|
||||
for processor in processor_handles:
|
||||
dimm = amdsmi_get_cpu_dimm_thermal_sensor(processor)
|
||||
print(dimm['sensor'])
|
||||
print(dimm['update_rate'])
|
||||
print(dimm['dimm_addr'])
|
||||
@@ -5797,12 +5753,313 @@ Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
socket_handles = amdsmi_get_cpusocket_handles()
|
||||
if len(socket_handles) == 0:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
xgmi_width = amdsmi_set_cpu_xgmi_width(socket, 0, 100)
|
||||
for processor in processor_handles:
|
||||
xgmi_width = amdsmi_set_cpu_xgmi_width(processor, 0, 100)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_set_cpu_gmi3_link_width_range
|
||||
|
||||
Description: Set gmi3 link width range.
|
||||
|
||||
Input: minimum & maximum link width to be set.
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_cpu_gmi3_link_width_range` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
gmi_link_width = amdsmi_set_cpu_gmi3_link_width_range(processor, 0, 100)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_cpu_apb_enable
|
||||
|
||||
Description: Enable APB.
|
||||
|
||||
Input: amdsmi processor handle
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_cpu_apb_enable` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
apb_enable = amdsmi_cpu_apb_enable(processor)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_cpu_apb_disable
|
||||
|
||||
Description: Disable APB.
|
||||
|
||||
Input: pstate value
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_cpu_apb_disable` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
apb_disable = amdsmi_cpu_apb_disable(processor, 0)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_set_cpu_socket_lclk_dpm_level
|
||||
|
||||
Description: Set NBIO lclk dpm level value.
|
||||
|
||||
Input: nbio id, min value, max value
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_cpu_socket_lclk_dpm_level` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for socket in socket_handles:
|
||||
nbio = amdsmi_set_cpu_socket_lclk_dpm_level(socket, 0, 0, 2)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpu_socket_lclk_dpm_level
|
||||
|
||||
Description: Get NBIO LCLK dpm level.
|
||||
|
||||
Output: nbio id
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpu_socket_lclk_dpm_level` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
nbio = amdsmi_get_cpu_socket_lclk_dpm_level(processor)
|
||||
print(nbio['max_dpm_level'])
|
||||
print(nbio['max_dpm_level'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_set_cpu_pcie_link_rate
|
||||
|
||||
Description: Set pcie link rate.
|
||||
|
||||
Input: rate control value
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_cpu_pcie_link_rate` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
link_rate = amdsmi_set_cpu_pcie_link_rate(processor, 0, 0)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_set_cpu_df_pstate_range
|
||||
|
||||
Description: Set df pstate range.
|
||||
|
||||
Input: max pstate, min pstate
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_set_cpu_df_pstate_range` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
pstate_range = amdsmi_set_cpu_df_pstate_range(processor, 0, 2)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpu_current_io_bandwidth
|
||||
|
||||
Description: Get current input output bandwidth.
|
||||
|
||||
Output: link id and bw type to which io bandwidth to be obtained
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpu_current_io_bandwidth` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
io_bw = amdsmi_get_cpu_current_io_bandwidth(processor)
|
||||
print(io_bw)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpu_current_xgmi_bw
|
||||
|
||||
Description: Get current xgmi bandwidth.
|
||||
|
||||
Output: amdsmi link id and bw type to which xgmi bandwidth to be obtained
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpu_current_xgmi_bw` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
xgmi_bw = amdsmi_get_cpu_current_xgmi_bw(processor)
|
||||
print(xgmi_bw)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_metrics_table_version
|
||||
|
||||
Description: Get metrics table version.
|
||||
|
||||
Output: amdsmi metrics table version
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_metrics_table_version` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
met_ver = amdsmi_get_metrics_table_version(processor)
|
||||
print(met_ver)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_metrics_table
|
||||
|
||||
Description: Get metrics table
|
||||
|
||||
Output: metric table data
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_metrics_table` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
mtbl = amdsmi_get_metrics_table(processor)
|
||||
print(mtbl['accumulation_counter'])
|
||||
print(mtbl['max_socket_temperature'])
|
||||
print(mtbl['max_vr_temperature'])
|
||||
print(mtbl['max_hbm_temperature'])
|
||||
print(mtbl['socket_power_limit'])
|
||||
print(mtbl['max_socket_power_limit'])
|
||||
print(mtbl['socket_power'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_first_online_core_on_cpu_socket
|
||||
|
||||
Description: Get first online core on cpu socket.
|
||||
|
||||
Output: first online core on cpu socket
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_first_online_core_on_cpu_socket` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
processor_handles = amdsmi_get_processor_handles()
|
||||
if len(processor_handles) == 0:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
pcore_ind = amdsmi_first_online_core_on_cpu_socket(processor)
|
||||
print(pcore_ind)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
@@ -32,8 +32,8 @@ from .amdsmi_interface import amdsmi_get_socket_info
|
||||
# ESMI Dependent Functions
|
||||
try:
|
||||
from .amdsmi_interface import amdsmi_get_cpusocket_handles
|
||||
from .amdsmi_interface import amdsmi_get_cpusocket_info
|
||||
from .amdsmi_interface import amdsmi_get_cpucore_handles
|
||||
from .amdsmi_interface import amdsmi_get_processor_info
|
||||
from .amdsmi_interface import amdsmi_get_cpu_hsmp_proto_ver
|
||||
from .amdsmi_interface import amdsmi_get_cpu_smu_fw_version
|
||||
from .amdsmi_interface import amdsmi_get_cpu_core_energy
|
||||
@@ -60,6 +60,18 @@ try:
|
||||
from .amdsmi_interface import amdsmi_get_cpu_dimm_power_consumption
|
||||
from .amdsmi_interface import amdsmi_get_cpu_dimm_thermal_sensor
|
||||
from .amdsmi_interface import amdsmi_set_cpu_xgmi_width
|
||||
from .amdsmi_interface import amdsmi_set_cpu_gmi3_link_width_range
|
||||
from .amdsmi_interface import amdsmi_cpu_apb_enable
|
||||
from .amdsmi_interface import amdsmi_cpu_apb_disable
|
||||
from .amdsmi_interface import amdsmi_set_cpu_socket_lclk_dpm_level
|
||||
from .amdsmi_interface import amdsmi_get_cpu_socket_lclk_dpm_level
|
||||
from .amdsmi_interface import amdsmi_set_cpu_pcie_link_rate
|
||||
from .amdsmi_interface import amdsmi_set_cpu_df_pstate_range
|
||||
from .amdsmi_interface import amdsmi_get_cpu_current_io_bandwidth
|
||||
from .amdsmi_interface import amdsmi_get_cpu_current_xgmi_bw
|
||||
from .amdsmi_interface import amdsmi_get_metrics_table_version
|
||||
from .amdsmi_interface import amdsmi_get_metrics_table
|
||||
from .amdsmi_interface import amdsmi_first_online_core_on_cpu_socket
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -181,6 +181,16 @@ try:
|
||||
except OSError as error:
|
||||
print(error)
|
||||
print("Unable to find amdsmi library try installing amd-smi-lib from your package manager")
|
||||
class FunctionFactoryStub:
|
||||
def __getattr__(self, _):
|
||||
return ctypes.CFUNCTYPE(lambda y:y)
|
||||
|
||||
# libraries['FIXME_STUB'] explanation
|
||||
# As you did not list (-l libraryname.so) a library that exports this function
|
||||
# This is a non-working stub instead.
|
||||
# You can either re-run clan2py with -l /path/to/library.so
|
||||
# Or manually fix this by comment the ctypes.CDLL loading
|
||||
_libraries['FIXME_STUB'] = FunctionFactoryStub() # ctypes.CDLL('FIXME_STUB')
|
||||
|
||||
|
||||
|
||||
@@ -191,12 +201,14 @@ amdsmi_init_flags_t__enumvalues = {
|
||||
2: 'AMDSMI_INIT_AMD_GPUS',
|
||||
4: 'AMDSMI_INIT_NON_AMD_CPUS',
|
||||
8: 'AMDSMI_INIT_NON_AMD_GPUS',
|
||||
3: 'AMDSMI_INIT_AMD_APUS',
|
||||
}
|
||||
AMDSMI_INIT_ALL_PROCESSORS = 0
|
||||
AMDSMI_INIT_AMD_CPUS = 1
|
||||
AMDSMI_INIT_AMD_GPUS = 2
|
||||
AMDSMI_INIT_NON_AMD_CPUS = 4
|
||||
AMDSMI_INIT_NON_AMD_GPUS = 8
|
||||
AMDSMI_INIT_AMD_APUS = 3
|
||||
amdsmi_init_flags_t = ctypes.c_uint32 # enum
|
||||
|
||||
# values for enumeration 'amdsmi_mm_ip_t'
|
||||
@@ -894,6 +906,7 @@ amdsmi_clk_info_t = struct_amdsmi_clk_info_t
|
||||
class struct_amdsmi_engine_usage_t(Structure):
|
||||
pass
|
||||
|
||||
|
||||
struct_amdsmi_engine_usage_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_engine_usage_t._fields_ = [
|
||||
('gfx_activity', ctypes.c_uint32),
|
||||
@@ -1514,6 +1527,11 @@ struct_amdsmi_gpu_metrics_t._fields_ = [
|
||||
('current_socclks', ctypes.c_uint16 * 4),
|
||||
('current_vclk0s', ctypes.c_uint16 * 4),
|
||||
('current_dclk0s', ctypes.c_uint16 * 4),
|
||||
('mem_bandwidth_acc', ctypes.c_uint64),
|
||||
('mem_max_bandwidth', ctypes.c_uint32),
|
||||
('pcie_nak_sent_count_acc', ctypes.c_uint32),
|
||||
('pcie_nak_rcvd_count_acc', ctypes.c_uint32),
|
||||
('jpeg_activities', ctypes.c_uint16 * 32),
|
||||
]
|
||||
|
||||
amdsmi_gpu_metrics_t = struct_amdsmi_gpu_metrics_t
|
||||
@@ -1709,24 +1727,26 @@ amdsmi_shut_down.argtypes = []
|
||||
amdsmi_get_socket_handles = _libraries['libamd_smi.so'].amdsmi_get_socket_handles
|
||||
amdsmi_get_socket_handles.restype = amdsmi_status_t
|
||||
amdsmi_get_socket_handles.argtypes = [ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))]
|
||||
amdsmi_get_cpusocket_handles = _libraries['libamd_smi.so'].amdsmi_get_cpusocket_handles
|
||||
amdsmi_get_cpusocket_handles = _libraries['FIXME_STUB'].amdsmi_get_cpusocket_handles
|
||||
amdsmi_get_cpusocket_handles.restype = amdsmi_status_t
|
||||
amdsmi_get_cpusocket_handles.argtypes = [ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))]
|
||||
size_t = ctypes.c_uint64
|
||||
amdsmi_get_socket_info = _libraries['libamd_smi.so'].amdsmi_get_socket_info
|
||||
amdsmi_get_socket_info.restype = amdsmi_status_t
|
||||
amdsmi_get_socket_info.argtypes = [amdsmi_socket_handle, size_t, ctypes.POINTER(ctypes.c_char)]
|
||||
uint32_t = ctypes.c_uint32
|
||||
amdsmi_get_cpusocket_info = _libraries['libamd_smi.so'].amdsmi_get_cpusocket_info
|
||||
amdsmi_get_cpusocket_info.restype = amdsmi_status_t
|
||||
amdsmi_get_cpusocket_info.argtypes = [amdsmi_cpusocket_handle, uint32_t]
|
||||
amdsmi_get_cpucore_info = _libraries['libamd_smi.so'].amdsmi_get_cpucore_info
|
||||
amdsmi_get_cpucore_info.restype = amdsmi_status_t
|
||||
amdsmi_get_cpucore_info.argtypes = [amdsmi_processor_handle, uint32_t]
|
||||
amdsmi_get_processor_info = _libraries['libamd_smi.so'].amdsmi_get_processor_info
|
||||
amdsmi_get_processor_info.restype = amdsmi_status_t
|
||||
amdsmi_get_processor_info.argtypes = [amdsmi_processor_handle, size_t, ctypes.POINTER(ctypes.c_char)]
|
||||
amdsmi_get_processor_count_from_handles = _libraries['libamd_smi.so'].amdsmi_get_processor_count_from_handles
|
||||
amdsmi_get_processor_count_from_handles.restype = amdsmi_status_t
|
||||
amdsmi_get_processor_count_from_handles.argtypes = [ctypes.POINTER(ctypes.POINTER(None)), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_processor_handles_by_type = _libraries['libamd_smi.so'].amdsmi_get_processor_handles_by_type
|
||||
amdsmi_get_processor_handles_by_type.restype = amdsmi_status_t
|
||||
amdsmi_get_processor_handles_by_type.argtypes = [amdsmi_socket_handle, processor_type_t, ctypes.POINTER(ctypes.POINTER(None)), ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_processor_handles = _libraries['libamd_smi.so'].amdsmi_get_processor_handles
|
||||
amdsmi_get_processor_handles.restype = amdsmi_status_t
|
||||
amdsmi_get_processor_handles.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))]
|
||||
amdsmi_get_cpucore_handles = _libraries['libamd_smi.so'].amdsmi_get_cpucore_handles
|
||||
amdsmi_get_cpucore_handles = _libraries['FIXME_STUB'].amdsmi_get_cpucore_handles
|
||||
amdsmi_get_cpucore_handles.restype = amdsmi_status_t
|
||||
amdsmi_get_cpucore_handles.argtypes = [amdsmi_cpusocket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))]
|
||||
amdsmi_get_processor_type = _libraries['libamd_smi.so'].amdsmi_get_processor_type
|
||||
@@ -1744,6 +1764,7 @@ amdsmi_get_gpu_revision.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctyp
|
||||
amdsmi_get_gpu_vendor_name = _libraries['libamd_smi.so'].amdsmi_get_gpu_vendor_name
|
||||
amdsmi_get_gpu_vendor_name.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_vendor_name.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), size_t]
|
||||
uint32_t = ctypes.c_uint32
|
||||
amdsmi_get_gpu_vram_vendor = _libraries['libamd_smi.so'].amdsmi_get_gpu_vram_vendor
|
||||
amdsmi_get_gpu_vram_vendor.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_vram_vendor.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), uint32_t]
|
||||
@@ -2198,122 +2219,122 @@ amdsmi_get_gpu_metrics_log.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_metrics_log.argtypes = [amdsmi_processor_handle]
|
||||
amdsmi_get_cpu_core_energy = _libraries['libamd_smi.so'].amdsmi_get_cpu_core_energy
|
||||
amdsmi_get_cpu_core_energy.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_core_energy.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_uint64)]
|
||||
amdsmi_get_cpu_core_energy.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)]
|
||||
amdsmi_get_cpu_socket_energy = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_energy
|
||||
amdsmi_get_cpu_socket_energy.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_energy.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint64)]
|
||||
amdsmi_get_cpu_socket_energy.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)]
|
||||
amdsmi_get_cpu_smu_fw_version = _libraries['libamd_smi.so'].amdsmi_get_cpu_smu_fw_version
|
||||
amdsmi_get_cpu_smu_fw_version.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_smu_fw_version.argtypes = [amdsmi_cpusocket_handle, ctypes.POINTER(struct_amdsmi_smu_fw_version_t)]
|
||||
amdsmi_get_cpu_smu_fw_version.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_smu_fw_version_t)]
|
||||
amdsmi_get_cpu_hsmp_proto_ver = _libraries['libamd_smi.so'].amdsmi_get_cpu_hsmp_proto_ver
|
||||
amdsmi_get_cpu_hsmp_proto_ver.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_hsmp_proto_ver.argtypes = [amdsmi_cpusocket_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_hsmp_proto_ver.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_prochot_status = _libraries['libamd_smi.so'].amdsmi_get_cpu_prochot_status
|
||||
amdsmi_get_cpu_prochot_status.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_prochot_status.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_prochot_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_fclk_mclk = _libraries['libamd_smi.so'].amdsmi_get_cpu_fclk_mclk
|
||||
amdsmi_get_cpu_fclk_mclk.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_fclk_mclk.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_fclk_mclk.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_cclk_limit = _libraries['libamd_smi.so'].amdsmi_get_cpu_cclk_limit
|
||||
amdsmi_get_cpu_cclk_limit.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_cclk_limit.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_cclk_limit.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_current_active_freq_limit = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_current_active_freq_limit
|
||||
amdsmi_get_cpu_socket_current_active_freq_limit.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_current_active_freq_limit.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint16), ctypes.POINTER(ctypes.POINTER(ctypes.c_char))]
|
||||
amdsmi_get_cpu_socket_current_active_freq_limit.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16), ctypes.POINTER(ctypes.POINTER(ctypes.c_char))]
|
||||
amdsmi_get_cpu_socket_freq_range = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_freq_range
|
||||
amdsmi_get_cpu_socket_freq_range.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_freq_range.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint16), ctypes.POINTER(ctypes.c_uint16)]
|
||||
amdsmi_get_cpu_socket_freq_range.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16), ctypes.POINTER(ctypes.c_uint16)]
|
||||
amdsmi_get_cpu_core_current_freq_limit = _libraries['libamd_smi.so'].amdsmi_get_cpu_core_current_freq_limit
|
||||
amdsmi_get_cpu_core_current_freq_limit.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_core_current_freq_limit.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_core_current_freq_limit.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_power = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_power
|
||||
amdsmi_get_cpu_socket_power.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_power.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_power.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_power_cap = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_power_cap
|
||||
amdsmi_get_cpu_socket_power_cap.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_power_cap.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_power_cap.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_power_cap_max = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_power_cap_max
|
||||
amdsmi_get_cpu_socket_power_cap_max.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_power_cap_max.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_power_cap_max.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_pwr_svi_telemetry_all_rails = _libraries['libamd_smi.so'].amdsmi_get_cpu_pwr_svi_telemetry_all_rails
|
||||
amdsmi_get_cpu_pwr_svi_telemetry_all_rails.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_pwr_svi_telemetry_all_rails.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_pwr_svi_telemetry_all_rails.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_set_cpu_socket_power_cap = _libraries['libamd_smi.so'].amdsmi_set_cpu_socket_power_cap
|
||||
amdsmi_set_cpu_socket_power_cap.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_socket_power_cap.argtypes = [amdsmi_cpusocket_handle, uint32_t, uint32_t]
|
||||
amdsmi_set_cpu_socket_power_cap.argtypes = [amdsmi_processor_handle, uint32_t]
|
||||
uint8_t = ctypes.c_uint8
|
||||
amdsmi_set_cpu_pwr_efficiency_mode = _libraries['libamd_smi.so'].amdsmi_set_cpu_pwr_efficiency_mode
|
||||
amdsmi_set_cpu_pwr_efficiency_mode.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_pwr_efficiency_mode.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t]
|
||||
amdsmi_set_cpu_pwr_efficiency_mode.argtypes = [amdsmi_processor_handle, uint8_t]
|
||||
amdsmi_get_cpu_core_boostlimit = _libraries['libamd_smi.so'].amdsmi_get_cpu_core_boostlimit
|
||||
amdsmi_get_cpu_core_boostlimit.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_core_boostlimit.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_core_boostlimit.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_c0_residency = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_c0_residency
|
||||
amdsmi_get_cpu_socket_c0_residency.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_c0_residency.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_c0_residency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_set_cpu_core_boostlimit = _libraries['libamd_smi.so'].amdsmi_set_cpu_core_boostlimit
|
||||
amdsmi_set_cpu_core_boostlimit.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_core_boostlimit.argtypes = [amdsmi_processor_handle, uint32_t, uint32_t]
|
||||
amdsmi_set_cpu_core_boostlimit.argtypes = [amdsmi_processor_handle, uint32_t]
|
||||
amdsmi_set_cpu_socket_boostlimit = _libraries['libamd_smi.so'].amdsmi_set_cpu_socket_boostlimit
|
||||
amdsmi_set_cpu_socket_boostlimit.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_socket_boostlimit.argtypes = [amdsmi_cpusocket_handle, uint32_t, uint32_t]
|
||||
amdsmi_set_cpu_socket_boostlimit.argtypes = [amdsmi_processor_handle, uint32_t]
|
||||
amdsmi_get_cpu_ddr_bw = _libraries['libamd_smi.so'].amdsmi_get_cpu_ddr_bw
|
||||
amdsmi_get_cpu_ddr_bw.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_ddr_bw.argtypes = [amdsmi_cpusocket_handle, ctypes.POINTER(struct_amdsmi_ddr_bw_metrics_t)]
|
||||
amdsmi_get_cpu_ddr_bw.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_ddr_bw_metrics_t)]
|
||||
amdsmi_get_cpu_socket_temperature = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_temperature
|
||||
amdsmi_get_cpu_socket_temperature.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_temperature.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_socket_temperature.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_dimm_temp_range_and_refresh_rate = _libraries['libamd_smi.so'].amdsmi_get_cpu_dimm_temp_range_and_refresh_rate
|
||||
amdsmi_get_cpu_dimm_temp_range_and_refresh_rate.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_dimm_temp_range_and_refresh_rate.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t, ctypes.POINTER(struct_amdsmi_temp_range_refresh_rate_t)]
|
||||
amdsmi_get_cpu_dimm_temp_range_and_refresh_rate.argtypes = [amdsmi_processor_handle, uint8_t, ctypes.POINTER(struct_amdsmi_temp_range_refresh_rate_t)]
|
||||
amdsmi_get_cpu_dimm_power_consumption = _libraries['libamd_smi.so'].amdsmi_get_cpu_dimm_power_consumption
|
||||
amdsmi_get_cpu_dimm_power_consumption.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_dimm_power_consumption.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t, ctypes.POINTER(struct_amdsmi_dimm_power_t)]
|
||||
amdsmi_get_cpu_dimm_power_consumption.argtypes = [amdsmi_processor_handle, uint8_t, ctypes.POINTER(struct_amdsmi_dimm_power_t)]
|
||||
amdsmi_get_cpu_dimm_thermal_sensor = _libraries['libamd_smi.so'].amdsmi_get_cpu_dimm_thermal_sensor
|
||||
amdsmi_get_cpu_dimm_thermal_sensor.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_dimm_thermal_sensor.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t, ctypes.POINTER(struct_amdsmi_dimm_thermal_t)]
|
||||
amdsmi_get_cpu_dimm_thermal_sensor.argtypes = [amdsmi_processor_handle, uint8_t, ctypes.POINTER(struct_amdsmi_dimm_thermal_t)]
|
||||
amdsmi_set_cpu_xgmi_width = _libraries['libamd_smi.so'].amdsmi_set_cpu_xgmi_width
|
||||
amdsmi_set_cpu_xgmi_width.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_xgmi_width.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t]
|
||||
amdsmi_set_cpu_xgmi_width.argtypes = [amdsmi_processor_handle, uint8_t, uint8_t]
|
||||
amdsmi_set_cpu_gmi3_link_width_range = _libraries['libamd_smi.so'].amdsmi_set_cpu_gmi3_link_width_range
|
||||
amdsmi_set_cpu_gmi3_link_width_range.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_gmi3_link_width_range.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t, uint8_t]
|
||||
amdsmi_set_cpu_gmi3_link_width_range.argtypes = [amdsmi_processor_handle, uint8_t, uint8_t]
|
||||
amdsmi_cpu_apb_enable = _libraries['libamd_smi.so'].amdsmi_cpu_apb_enable
|
||||
amdsmi_cpu_apb_enable.restype = amdsmi_status_t
|
||||
amdsmi_cpu_apb_enable.argtypes = [amdsmi_cpusocket_handle, uint32_t]
|
||||
amdsmi_cpu_apb_enable.argtypes = [amdsmi_processor_handle]
|
||||
amdsmi_cpu_apb_disable = _libraries['libamd_smi.so'].amdsmi_cpu_apb_disable
|
||||
amdsmi_cpu_apb_disable.restype = amdsmi_status_t
|
||||
amdsmi_cpu_apb_disable.argtypes = [amdsmi_cpusocket_handle, uint32_t, uint8_t]
|
||||
amdsmi_cpu_apb_disable.argtypes = [amdsmi_processor_handle, uint8_t]
|
||||
amdsmi_set_cpu_socket_lclk_dpm_level = _libraries['libamd_smi.so'].amdsmi_set_cpu_socket_lclk_dpm_level
|
||||
amdsmi_set_cpu_socket_lclk_dpm_level.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_socket_lclk_dpm_level.argtypes = [amdsmi_cpusocket_handle, uint32_t, uint8_t, uint8_t, uint8_t]
|
||||
amdsmi_set_cpu_socket_lclk_dpm_level.argtypes = [amdsmi_processor_handle, uint8_t, uint8_t, uint8_t]
|
||||
amdsmi_get_cpu_socket_lclk_dpm_level = _libraries['libamd_smi.so'].amdsmi_get_cpu_socket_lclk_dpm_level
|
||||
amdsmi_get_cpu_socket_lclk_dpm_level.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_socket_lclk_dpm_level.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t, ctypes.POINTER(struct_amdsmi_dpm_level_t)]
|
||||
amdsmi_get_cpu_socket_lclk_dpm_level.argtypes = [amdsmi_processor_handle, uint8_t, ctypes.POINTER(struct_amdsmi_dpm_level_t)]
|
||||
amdsmi_set_cpu_pcie_link_rate = _libraries['libamd_smi.so'].amdsmi_set_cpu_pcie_link_rate
|
||||
amdsmi_set_cpu_pcie_link_rate.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_pcie_link_rate.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t, ctypes.POINTER(ctypes.c_ubyte)]
|
||||
amdsmi_set_cpu_pcie_link_rate.argtypes = [amdsmi_processor_handle, uint8_t, ctypes.POINTER(ctypes.c_ubyte)]
|
||||
amdsmi_set_cpu_df_pstate_range = _libraries['libamd_smi.so'].amdsmi_set_cpu_df_pstate_range
|
||||
amdsmi_set_cpu_df_pstate_range.restype = amdsmi_status_t
|
||||
amdsmi_set_cpu_df_pstate_range.argtypes = [amdsmi_cpusocket_handle, uint8_t, uint8_t, uint8_t]
|
||||
amdsmi_set_cpu_df_pstate_range.argtypes = [amdsmi_processor_handle, uint8_t, uint8_t]
|
||||
amdsmi_get_cpu_current_io_bandwidth = _libraries['libamd_smi.so'].amdsmi_get_cpu_current_io_bandwidth
|
||||
amdsmi_get_cpu_current_io_bandwidth.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_current_io_bandwidth.argtypes = [amdsmi_cpusocket_handle, uint8_t, amdsmi_link_id_bw_type_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_current_io_bandwidth.argtypes = [amdsmi_processor_handle, amdsmi_link_id_bw_type_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_current_xgmi_bw = _libraries['libamd_smi.so'].amdsmi_get_cpu_current_xgmi_bw
|
||||
amdsmi_get_cpu_current_xgmi_bw.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_current_xgmi_bw.argtypes = [amdsmi_cpusocket_handle, amdsmi_link_id_bw_type_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_current_xgmi_bw.argtypes = [amdsmi_processor_handle, amdsmi_link_id_bw_type_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_metrics_table_version = _libraries['libamd_smi.so'].amdsmi_get_metrics_table_version
|
||||
amdsmi_get_metrics_table_version.restype = amdsmi_status_t
|
||||
amdsmi_get_metrics_table_version.argtypes = [amdsmi_cpusocket_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_metrics_table_version.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
class struct_hsmp_metric_table(Structure):
|
||||
pass
|
||||
|
||||
amdsmi_get_metrics_table = _libraries['libamd_smi.so'].amdsmi_get_metrics_table
|
||||
amdsmi_get_metrics_table.restype = amdsmi_status_t
|
||||
amdsmi_get_metrics_table.argtypes = [amdsmi_cpusocket_handle, uint8_t, ctypes.POINTER(struct_hsmp_metric_table)]
|
||||
amdsmi_get_metrics_table.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_hsmp_metric_table)]
|
||||
amdsmi_first_online_core_on_cpu_socket = _libraries['libamd_smi.so'].amdsmi_first_online_core_on_cpu_socket
|
||||
amdsmi_first_online_core_on_cpu_socket.restype = amdsmi_status_t
|
||||
amdsmi_first_online_core_on_cpu_socket.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_first_online_core_on_cpu_socket.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_esmi_err_msg = _libraries['libamd_smi.so'].amdsmi_get_esmi_err_msg
|
||||
amdsmi_get_esmi_err_msg.restype = ctypes.POINTER(ctypes.POINTER(ctypes.c_char))
|
||||
amdsmi_get_esmi_err_msg.argtypes = [amdsmi_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))]
|
||||
@@ -2358,9 +2379,10 @@ __all__ = \
|
||||
'AMDSMI_GPU_BLOCK_SEM', 'AMDSMI_GPU_BLOCK_SMN',
|
||||
'AMDSMI_GPU_BLOCK_UMC', 'AMDSMI_GPU_BLOCK_XGMI_WAFL',
|
||||
'AMDSMI_HSMP_TIMEOUT', 'AMDSMI_INIT_ALL_PROCESSORS',
|
||||
'AMDSMI_INIT_AMD_CPUS', 'AMDSMI_INIT_AMD_GPUS',
|
||||
'AMDSMI_INIT_NON_AMD_CPUS', 'AMDSMI_INIT_NON_AMD_GPUS',
|
||||
'AMDSMI_INVALID_POWER', 'AMDSMI_IOLINK_TYPE_NUMIOLINKTYPES',
|
||||
'AMDSMI_INIT_AMD_APUS', 'AMDSMI_INIT_AMD_CPUS',
|
||||
'AMDSMI_INIT_AMD_GPUS', 'AMDSMI_INIT_NON_AMD_CPUS',
|
||||
'AMDSMI_INIT_NON_AMD_GPUS', 'AMDSMI_INVALID_POWER',
|
||||
'AMDSMI_IOLINK_TYPE_NUMIOLINKTYPES',
|
||||
'AMDSMI_IOLINK_TYPE_PCIEXPRESS', 'AMDSMI_IOLINK_TYPE_SIZE',
|
||||
'AMDSMI_IOLINK_TYPE_UNDEFINED', 'AMDSMI_IOLINK_TYPE_XGMI',
|
||||
'AMDSMI_MEM_PAGE_STATUS_PENDING',
|
||||
@@ -2520,8 +2542,7 @@ __all__ = \
|
||||
'amdsmi_get_cpu_socket_power', 'amdsmi_get_cpu_socket_power_cap',
|
||||
'amdsmi_get_cpu_socket_power_cap_max',
|
||||
'amdsmi_get_cpu_socket_temperature', 'amdsmi_get_cpucore_handles',
|
||||
'amdsmi_get_cpucore_info', 'amdsmi_get_cpusocket_handles',
|
||||
'amdsmi_get_cpusocket_info', 'amdsmi_get_energy_count',
|
||||
'amdsmi_get_cpusocket_handles', 'amdsmi_get_energy_count',
|
||||
'amdsmi_get_esmi_err_msg', 'amdsmi_get_fw_info',
|
||||
'amdsmi_get_gpu_activity', 'amdsmi_get_gpu_asic_info',
|
||||
'amdsmi_get_gpu_available_counters',
|
||||
@@ -2613,8 +2634,11 @@ __all__ = \
|
||||
'amdsmi_get_minmax_bandwidth_between_processors',
|
||||
'amdsmi_get_pcie_link_caps', 'amdsmi_get_pcie_link_status',
|
||||
'amdsmi_get_power_cap_info', 'amdsmi_get_power_info',
|
||||
'amdsmi_get_processor_count_from_handles',
|
||||
'amdsmi_get_processor_handle_from_bdf',
|
||||
'amdsmi_get_processor_handles', 'amdsmi_get_processor_type',
|
||||
'amdsmi_get_processor_handles',
|
||||
'amdsmi_get_processor_handles_by_type',
|
||||
'amdsmi_get_processor_info', 'amdsmi_get_processor_type',
|
||||
'amdsmi_get_socket_handles', 'amdsmi_get_socket_info',
|
||||
'amdsmi_get_temp_metric', 'amdsmi_get_utilization_count',
|
||||
'amdsmi_get_xgmi_info', 'amdsmi_gpu_block_t',
|
||||
|
||||
@@ -6800,23 +6800,26 @@ rsmi_dev_metrics_curr_gfxclk_get(uint32_t dv_ind, GPUMetricCurrGfxClk_t* current
|
||||
}
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrGfxClock);
|
||||
amd::smi::GPUMetricCurrGfxClkTbl_t tmp_curr_gfxclk_tbl{};
|
||||
auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_curr_gfxclk_tbl);
|
||||
if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) {
|
||||
const auto max_num_elems =
|
||||
static_cast<uint16_t>(std::end(*current_gfxclk_value) - std::begin(*current_gfxclk_value));
|
||||
std::copy_n(std::begin(tmp_curr_gfxclk_tbl), max_num_elems, *current_gfxclk_value);
|
||||
rsmi_gpu_metrics_t gpu = {};
|
||||
auto status = rsmi_dev_gpu_metrics_info_get(dv_ind, &gpu);
|
||||
if (status == rsmi_status_t::RSMI_STATUS_SUCCESS) {
|
||||
std::copy_n(std::begin(gpu.current_gfxclks),
|
||||
static_cast<uint16_t>(
|
||||
sizeof(gpu.current_gfxclks)/sizeof(gpu.current_gfxclks[0])),
|
||||
*current_gfxclk_value);
|
||||
}
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | End Result "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Metric Type: " << static_cast<AMDGpuMetricTypeId_t>(gpu_metric_unit)
|
||||
<< " | Metric Size: " << tmp_curr_gfxclk_tbl.size()
|
||||
<< " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |";
|
||||
<< " | Metric Size: " << static_cast<uint16_t>(
|
||||
sizeof(gpu.current_gfxclks)/sizeof(gpu.current_gfxclks[0]))
|
||||
<< " | Returning = " << status << " "
|
||||
<< getRSMIStatusString(status) << " |";
|
||||
LOG_INFO(ostrstream);
|
||||
|
||||
return status_code;
|
||||
return status;
|
||||
CATCH
|
||||
}
|
||||
|
||||
|
||||
@@ -836,29 +836,35 @@ rsmi_status_t init_max_public_gpu_matrics(AMGpuMetricsPublicLatest_t& rsmi_gpu_m
|
||||
rsmi_gpu_metrics.pcie_replay_count_acc = init_max_uint_types<decltype(rsmi_gpu_metrics.pcie_replay_count_acc)>();
|
||||
rsmi_gpu_metrics.pcie_replay_rover_count_acc = init_max_uint_types<decltype(rsmi_gpu_metrics.pcie_replay_rover_count_acc)>();
|
||||
|
||||
std::fill(std::begin(rsmi_gpu_metrics.xgmi_read_data_acc),
|
||||
std::end(rsmi_gpu_metrics.xgmi_read_data_acc),
|
||||
init_max_uint_types<std::uint64_t>());
|
||||
std::fill_n(&rsmi_gpu_metrics.xgmi_read_data_acc[0],
|
||||
(sizeof(rsmi_gpu_metrics.xgmi_read_data_acc) /
|
||||
sizeof(rsmi_gpu_metrics.xgmi_read_data_acc[0])),
|
||||
std::numeric_limits<uint64_t>::max());
|
||||
|
||||
std::fill(std::begin(rsmi_gpu_metrics.xgmi_write_data_acc),
|
||||
std::end(rsmi_gpu_metrics.xgmi_write_data_acc),
|
||||
init_max_uint_types<std::uint64_t>());
|
||||
std::fill_n(&rsmi_gpu_metrics.xgmi_write_data_acc[0],
|
||||
(sizeof(rsmi_gpu_metrics.xgmi_write_data_acc) /
|
||||
sizeof(rsmi_gpu_metrics.xgmi_write_data_acc[0])),
|
||||
std::numeric_limits<uint64_t>::max());
|
||||
|
||||
std::fill(std::begin(rsmi_gpu_metrics.current_gfxclks),
|
||||
std::end(rsmi_gpu_metrics.current_gfxclks),
|
||||
init_max_uint_types<std::uint16_t>());
|
||||
std::fill_n(&rsmi_gpu_metrics.current_gfxclks[0],
|
||||
(sizeof(rsmi_gpu_metrics.current_gfxclks) /
|
||||
sizeof(rsmi_gpu_metrics.current_gfxclks[0])),
|
||||
std::numeric_limits<uint16_t>::max());
|
||||
|
||||
std::fill(std::begin(rsmi_gpu_metrics.current_socclks),
|
||||
std::end(rsmi_gpu_metrics.current_socclks),
|
||||
init_max_uint_types<std::uint16_t>());
|
||||
std::fill_n(&rsmi_gpu_metrics.current_socclks[0],
|
||||
(sizeof(rsmi_gpu_metrics.current_socclks) /
|
||||
sizeof(rsmi_gpu_metrics.current_socclks[0])),
|
||||
std::numeric_limits<uint16_t>::max());
|
||||
|
||||
std::fill(std::begin(rsmi_gpu_metrics.current_vclk0s),
|
||||
std::end(rsmi_gpu_metrics.current_vclk0s),
|
||||
init_max_uint_types<std::uint16_t>());
|
||||
std::fill_n(&rsmi_gpu_metrics.current_vclk0s[0],
|
||||
(sizeof(rsmi_gpu_metrics.current_vclk0s) /
|
||||
sizeof(rsmi_gpu_metrics.current_vclk0s[0])),
|
||||
std::numeric_limits<uint16_t>::max());
|
||||
|
||||
std::fill(std::begin(rsmi_gpu_metrics.current_dclk0s),
|
||||
std::end(rsmi_gpu_metrics.current_dclk0s),
|
||||
init_max_uint_types<std::uint16_t>());
|
||||
std::fill_n(&rsmi_gpu_metrics.current_dclk0s[0],
|
||||
(sizeof(rsmi_gpu_metrics.current_dclk0s) /
|
||||
sizeof(rsmi_gpu_metrics.current_dclk0s[0])),
|
||||
std::numeric_limits<uint16_t>::max());
|
||||
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
@@ -1016,22 +1022,22 @@ AMGpuMetricsPublicLatestTupl_t GpuMetricsBase_v14_t::copy_internal_to_external_m
|
||||
// Note: Backwards compatibility -> Handling extra/exception cases
|
||||
// related to earlier versions (1.3)
|
||||
metrics_public_init.current_gfxclk = metrics_public_init.current_gfxclks[0];
|
||||
metrics_public_init.average_gfxclk_frequency = metrics_public_init.current_gfxclks[0];
|
||||
// metrics_public_init.average_gfxclk_frequency = metrics_public_init.current_gfxclks[0];
|
||||
|
||||
metrics_public_init.current_socclk = metrics_public_init.current_socclks[0];
|
||||
metrics_public_init.average_socclk_frequency = metrics_public_init.current_socclks[0];
|
||||
// metrics_public_init.average_socclk_frequency = metrics_public_init.current_socclks[0];
|
||||
|
||||
metrics_public_init.current_vclk0 = metrics_public_init.current_vclk0s[0];
|
||||
metrics_public_init.average_vclk0_frequency = metrics_public_init.current_vclk0s[0];
|
||||
// metrics_public_init.average_vclk0_frequency = metrics_public_init.current_vclk0s[0];
|
||||
|
||||
metrics_public_init.current_vclk1 = metrics_public_init.current_vclk0s[1];
|
||||
metrics_public_init.average_vclk1_frequency = metrics_public_init.current_vclk0s[1];
|
||||
// metrics_public_init.average_vclk1_frequency = metrics_public_init.current_vclk0s[1];
|
||||
|
||||
metrics_public_init.current_dclk0 = metrics_public_init.current_dclk0s[0];
|
||||
metrics_public_init.average_dclk0_frequency = metrics_public_init.current_dclk0s[0];
|
||||
// metrics_public_init.average_dclk0_frequency = metrics_public_init.current_dclk0s[0];
|
||||
|
||||
metrics_public_init.current_dclk1 = metrics_public_init.current_dclk0s[1];
|
||||
metrics_public_init.average_dclk1_frequency = metrics_public_init.current_dclk0s[1];
|
||||
// metrics_public_init.average_dclk1_frequency = metrics_public_init.current_dclk0s[1];
|
||||
|
||||
return metrics_public_init;
|
||||
}();
|
||||
@@ -1407,7 +1413,7 @@ AMGpuMetricsPublicLatestTupl_t GpuMetricsBase_v13_t::copy_internal_to_external_m
|
||||
metrics_public_init.average_mm_activity = m_gpu_metrics_tbl.m_average_mm_activity;
|
||||
|
||||
// Power/Energy
|
||||
metrics_public_init.average_socket_power = m_gpu_metrics_tbl.m_average_socket_power; // 1.3 and 1.4 have the same value
|
||||
// metrics_public_init.average_socket_power = m_gpu_metrics_tbl.m_average_socket_power; // 1.3 and 1.4 have the same value
|
||||
metrics_public_init.energy_accumulator = m_gpu_metrics_tbl.m_energy_accumulator;
|
||||
|
||||
// Driver attached timestamp (in ns)
|
||||
@@ -1424,9 +1430,13 @@ AMGpuMetricsPublicLatestTupl_t GpuMetricsBase_v13_t::copy_internal_to_external_m
|
||||
|
||||
// Current clocks
|
||||
metrics_public_init.current_gfxclk = m_gpu_metrics_tbl.m_current_gfxclk;
|
||||
metrics_public_init.current_gfxclks[0] = m_gpu_metrics_tbl.m_current_gfxclk;
|
||||
metrics_public_init.current_socclk = m_gpu_metrics_tbl.m_current_socclk;
|
||||
metrics_public_init.current_socclks[0] = m_gpu_metrics_tbl.m_current_socclk;
|
||||
metrics_public_init.current_vclk0 = m_gpu_metrics_tbl.m_current_vclk0;
|
||||
metrics_public_init.current_vclk0s[0] = m_gpu_metrics_tbl.m_current_vclk0;
|
||||
metrics_public_init.current_dclk0 = m_gpu_metrics_tbl.m_current_dclk0;
|
||||
metrics_public_init.current_dclk0s[0] = m_gpu_metrics_tbl.m_current_dclk0;
|
||||
metrics_public_init.current_uclk = m_gpu_metrics_tbl.m_current_uclk;
|
||||
metrics_public_init.current_vclk1 = m_gpu_metrics_tbl.m_current_vclk1;
|
||||
metrics_public_init.current_dclk1 = m_gpu_metrics_tbl.m_current_dclk1;
|
||||
@@ -1467,7 +1477,7 @@ AMGpuMetricsPublicLatestTupl_t GpuMetricsBase_v13_t::copy_internal_to_external_m
|
||||
//
|
||||
// Note: Backwards compatibility -> Handling extra/exception cases
|
||||
// related to earlier versions (1.2)
|
||||
metrics_public_init.current_socket_power = metrics_public_init.average_socket_power;
|
||||
// metrics_public_init.current_socket_power = metrics_public_init.average_socket_power;
|
||||
|
||||
return metrics_public_init;
|
||||
}();
|
||||
@@ -2798,6 +2808,14 @@ rsmi_dev_gpu_metrics_info_get(uint32_t dv_ind, rsmi_gpu_metrics_t* smu) {
|
||||
assert(smu != nullptr);
|
||||
if (smu == nullptr) {
|
||||
status_code = rsmi_status_t::RSMI_STATUS_INVALID_ARGS;
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
|
||||
|
||||
+339
-338
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include "amd_smi/impl/amd_smi_cpu_core.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
AMDSmiCpuCore::~AMDSmiCpuCore() {
|
||||
for (uint32_t i = 0; i < processors_.size(); i++) {
|
||||
delete processors_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiCpuCore::get_processor_count(uint32_t* processor_count) const {
|
||||
*processor_count = static_cast<uint32_t>(processors_.size());
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include "amd_smi/impl/amd_smi_cpu_socket.h"
|
||||
#include <cpuid.h>
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
AMDSmiCpuSocket::~AMDSmiCpuSocket() {}
|
||||
|
||||
amdsmi_status_t AMDSmiCpuSocket::set_socket_id(uint32_t idx, uint32_t socket_id) {
|
||||
socket_id = idx;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiCpuSocket::get_cpu_vendor() {
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
|
||||
if (!__get_cpuid(0, &eax, &ebx, &ecx, &edx))
|
||||
return AMDSMI_STATUS_IO;
|
||||
|
||||
/* check if the value in ebx, ecx, edx matches "AuthenticAMD" string */
|
||||
if (ebx != 0x68747541 || ecx != 0x444d4163 || edx != 0x69746e65)
|
||||
return AMDSMI_STATUS_NON_AMD_CPU;
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
@@ -53,6 +53,14 @@ AMDSmiSocket::~AMDSmiSocket() {
|
||||
delete processors_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
for (uint32_t i = 0; i < cpu_processors_.size(); i++) {
|
||||
delete cpu_processors_[i];
|
||||
}
|
||||
cpu_processors_.clear();
|
||||
for (uint32_t i = 0; i < cpu_core_processors_.size(); i++) {
|
||||
delete cpu_core_processors_[i];
|
||||
}
|
||||
cpu_core_processors_.clear();
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSocket::get_processor_count(uint32_t* processor_count) const {
|
||||
@@ -60,6 +68,26 @@ amdsmi_status_t AMDSmiSocket::get_processor_count(uint32_t* processor_count) con
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSocket::get_processor_count(processor_type_t type, uint32_t* processor_count) const {
|
||||
amdsmi_status_t ret = AMDSMI_STATUS_SUCCESS;
|
||||
switch (type) {
|
||||
case AMD_GPU:
|
||||
*processor_count = static_cast<uint32_t>(processors_.size());
|
||||
break;
|
||||
case AMD_CPU:
|
||||
*processor_count = static_cast<uint32_t>(cpu_processors_.size());
|
||||
break;
|
||||
case AMD_CPU_CORE:
|
||||
*processor_count = static_cast<uint32_t>(cpu_core_processors_.size());
|
||||
break;
|
||||
default:
|
||||
*processor_count = 0;
|
||||
ret = AMDSMI_STATUS_INVAL;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -53,16 +53,65 @@
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
uint32_t AMDSmiSystem::sockets = 0;
|
||||
uint32_t AMDSmiSystem::cpus = 0;
|
||||
uint32_t AMDSmiSystem::threads = 0;
|
||||
uint32_t AMDSmiSystem::family = 0;
|
||||
uint32_t AMDSmiSystem::model = 0;
|
||||
#endif
|
||||
|
||||
#define AMD_SMI_INIT_FLAG_RESRV_TEST1 0x800000000000000 //!< Reserved for test
|
||||
|
||||
static amdsmi_status_t get_cpu_family(uint32_t *cpu_family) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_family_get(cpu_family));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu family, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static amdsmi_status_t get_cpu_model(uint32_t *cpu_model) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_model_get(cpu_model));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu model, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static amdsmi_status_t get_nr_cpu_cores(uint32_t *num_cpus) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_cpus_get(num_cpus));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of cpus, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static amdsmi_status_t get_nr_threads_per_core(uint32_t *threads_per_core) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_threads_per_core_get(threads_per_core));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get threads per core, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static amdsmi_status_t get_nr_cpu_sockets(uint32_t *num_socks) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_sockets_get(num_socks));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of sockets, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::init(uint64_t flags) {
|
||||
init_flag_ = flags;
|
||||
amdsmi_status_t amd_smi_status;
|
||||
@@ -73,137 +122,61 @@ amdsmi_status_t AMDSmiSystem::init(uint64_t flags) {
|
||||
return amd_smi_status;
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
}
|
||||
else if(flags & AMDSMI_INIT_AMD_CPUS) {
|
||||
|
||||
if (flags & AMDSMI_INIT_AMD_CPUS) {
|
||||
amd_smi_status = populate_amd_cpus();
|
||||
if (amd_smi_status != AMDSMI_STATUS_SUCCESS)
|
||||
return amd_smi_status;
|
||||
#endif
|
||||
} else {
|
||||
return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t AMDSmiSystem::populate_amd_cpus() {
|
||||
uint32_t sockets, cpus, threads;
|
||||
amdsmi_status_t amd_smi_status;
|
||||
amd::smi::AMDSmiCpuSocket *cpu_instance = nullptr;
|
||||
|
||||
/* detect if its an AMD cpu */
|
||||
amd_smi_status = cpu_instance->get_cpu_vendor();
|
||||
/* esmi is for AMD cpus, if its not AMD CPU, we are not going to initialise esmi */
|
||||
if (!amd_smi_status) {
|
||||
amd_smi_status = static_cast<amdsmi_status_t>(esmi_init());
|
||||
if (amd_smi_status != AMDSMI_STATUS_SUCCESS){
|
||||
std::cout<<"\tESMI Not initialized, drivers not found " << std::endl;
|
||||
return amd_smi_status;
|
||||
}
|
||||
amd_smi_status = static_cast<amdsmi_status_t>(esmi_init());
|
||||
if (amd_smi_status != AMDSMI_STATUS_SUCCESS){
|
||||
std::cout<<"\tESMI Not initialized, drivers not found " << std::endl;
|
||||
return amd_smi_status;
|
||||
}
|
||||
|
||||
amd_smi_status = get_cpu_sockets(&sockets);
|
||||
amd_smi_status = get_cpu_cores(&cpus);
|
||||
amd_smi_status = get_threads_per_core(&threads);
|
||||
amd_smi_status = get_cpu_family(&family);
|
||||
amd_smi_status = get_cpu_model(&model);
|
||||
std::cout << "\n***********************EPYC METRICS***********************" << std::endl;
|
||||
std::cout <<"| NR_SOCKETS | "<<sockets<<"\t\t|" << std::endl;
|
||||
std::cout <<"| NR_CPUS | "<<cpus<<"\t\t|" << std::endl;
|
||||
|
||||
if (threads > 1) {
|
||||
std::cout <<"| THREADS PER CORE | "<<threads<<" (SMT ON)\t|" << std::endl;
|
||||
} else {
|
||||
std::cout <<"| THREADS PER CORE | "<<threads<<" (SMT OFF)\t|" << std::endl;
|
||||
}
|
||||
std::cout <<"| CPU Family | 0x"<<std::hex<<family<<"("<<std::dec<<family<<")\t|" << std::endl;
|
||||
std::cout <<"| CPU Model | 0x"<<std::hex<<model<<"("<<std::dec<<model<<")\t|" << std::endl;
|
||||
std::cout << std::endl;
|
||||
amd_smi_status = get_nr_cpu_sockets(&sockets);
|
||||
amd_smi_status = get_nr_cpu_cores(&cpus);
|
||||
amd_smi_status = get_nr_threads_per_core(&threads);
|
||||
|
||||
for(uint32_t i = 0; i < sockets; i++) {
|
||||
uint32_t cpu_socket_id = i;
|
||||
|
||||
std::string cpu_socket_id = std::to_string(i);
|
||||
// Multiple cores may share the same socket
|
||||
AMDSmiCpuSocket* socket = nullptr;
|
||||
for (uint32_t j = 0; j < cpu_sockets_.size(); j++) {
|
||||
if (cpu_sockets_[j]->get_socket_id() == cpu_socket_id) {
|
||||
socket = cpu_sockets_[j];
|
||||
AMDSmiSocket* socket = nullptr;
|
||||
for (uint32_t j = 0; j < sockets_.size(); j++) {
|
||||
if (sockets_[j]->get_socket_id() == cpu_socket_id) {
|
||||
socket = sockets_[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (socket == nullptr) {
|
||||
socket = new AMDSmiCpuSocket(cpu_socket_id);
|
||||
cpu_sockets_.push_back(socket);
|
||||
socket = new AMDSmiSocket(cpu_socket_id);
|
||||
sockets_.push_back(socket);
|
||||
}
|
||||
AMDSmiProcessor* cpusocket = new AMDSmiProcessor(AMD_CPU, i);
|
||||
socket->add_processor(cpusocket);
|
||||
processors_.insert(cpusocket);
|
||||
|
||||
for (uint32_t k = 0; k < cpus/threads; k++) {
|
||||
AMDSmiCpuCore* core = new AMDSmiCpuCore(k);
|
||||
for (uint32_t k = 0; k < (cpus/threads)/sockets; k++) {
|
||||
AMDSmiProcessor* core = new AMDSmiProcessor(AMD_CPU_CORE, k);
|
||||
socket->add_processor(core);
|
||||
processors_.insert(core);
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_sockets(uint32_t *num_socks) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_sockets_get(num_socks));
|
||||
sockets = *num_socks;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of sockets, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_cores(uint32_t *num_cpus) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_cpus_get(num_cpus));
|
||||
cpus = *num_cpus;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of cpus, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_threads_per_core(uint32_t *threads_per_core) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_threads_per_core_get(threads_per_core));
|
||||
threads = *threads_per_core;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get threads per core, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_family(uint32_t *cpu_family) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_family_get(cpu_family));
|
||||
family = *cpu_family;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu family, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_model(uint32_t *cpu_model) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_model_get(cpu_model));
|
||||
model = *cpu_model;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu model, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::populate_amd_gpu_devices() {
|
||||
@@ -281,29 +254,31 @@ amdsmi_status_t AMDSmiSystem::get_gpu_socket_id(uint32_t index,
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::cleanup() {
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
if(init_flag_ == AMDSMI_INIT_AMD_CPUS){
|
||||
for (uint32_t i = 0; i < cpu_sockets_.size(); i++) {
|
||||
delete cpu_sockets_[i];
|
||||
if (init_flag_ & AMDSMI_INIT_AMD_CPUS) {
|
||||
for (uint32_t i = 0; i < sockets_.size(); i++) {
|
||||
delete sockets_[i];
|
||||
}
|
||||
cpu_sockets_.clear();
|
||||
processors_.clear();
|
||||
sockets_.clear();
|
||||
esmi_exit();
|
||||
init_flag_ = AMDSMI_INIT_ALL_PROCESSORS;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
for (uint32_t i = 0; i < sockets_.size(); i++) {
|
||||
delete sockets_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
sockets_.clear();
|
||||
init_flag_ = AMDSMI_INIT_ALL_PROCESSORS;
|
||||
rsmi_status_t ret = rsmi_shut_down();
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return amd::smi::rsmi_to_amdsmi_status(ret);
|
||||
if (init_flag_ & AMDSMI_INIT_AMD_GPUS) {
|
||||
for (uint32_t i = 0; i < sockets_.size(); i++) {
|
||||
delete sockets_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
sockets_.clear();
|
||||
init_flag_ = AMDSMI_INIT_ALL_PROCESSORS;
|
||||
rsmi_status_t ret = rsmi_shut_down();
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return amd::smi::rsmi_to_amdsmi_status(ret);
|
||||
}
|
||||
|
||||
drm_.cleanup();
|
||||
}
|
||||
|
||||
drm_.cleanup();
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -323,24 +298,6 @@ amdsmi_status_t AMDSmiSystem::handle_to_socket(
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t AMDSmiSystem::handle_to_cpusocket(
|
||||
amdsmi_cpusocket_handle socket_handle,
|
||||
AMDSmiCpuSocket** socket) {
|
||||
if (socket_handle == nullptr || socket == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
*socket = static_cast<AMDSmiCpuSocket*>(socket_handle);
|
||||
|
||||
// double check handlers is here
|
||||
if (std::find(cpu_sockets_.begin(), cpu_sockets_.end(), *socket)
|
||||
!= cpu_sockets_.end()) {
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::handle_to_processor(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
AMDSmiProcessor** processor) {
|
||||
@@ -378,28 +335,6 @@ amdsmi_status_t AMDSmiSystem::gpu_index_to_handle(uint32_t gpu_index,
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t AMDSmiSystem::cpu_index_to_handle(uint32_t cpu_index,
|
||||
amdsmi_cpusocket_handle* cpu_handle) {
|
||||
if (cpu_handle == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
auto iter = cpu_sockets_.begin();
|
||||
for (; iter != cpu_sockets_.end(); iter++) {
|
||||
auto cur_socket = (*iter);
|
||||
if (cur_socket->get_processor_type() != AMD_CPU)
|
||||
continue;
|
||||
amd::smi::AMDSmiCpuSocket* cpu_socket =
|
||||
static_cast<amd::smi::AMDSmiCpuSocket*>(cur_socket);
|
||||
uint32_t cur_cpu_index = cpu_socket->get_cpu_id();
|
||||
if (cpu_index == cur_cpu_index) {
|
||||
*cpu_handle = cur_socket;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include "amd_smi/impl/amd_smi_utils.h"
|
||||
#include "shared_mutex.h" // NOLINT
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
static const uint32_t kAmdGpuId = 0x1002;
|
||||
|
||||
@@ -153,6 +154,20 @@ amdsmi_status_t smi_amdgpu_get_board_info(amd::smi::AMDSmiGPUDevice* device, amd
|
||||
fgets(info->product_name, sizeof(info->product_name), fp);
|
||||
fclose(fp);
|
||||
}
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< "Returning status = AMDSMI_STATUS_SUCCESS"
|
||||
<< " | model_number_path = " << model_number_path
|
||||
<< "; info->model_number: " << info->model_number
|
||||
<< "\n product_serial_path = " << product_serial_path
|
||||
<< "; info->product_serial: " << info->product_serial
|
||||
<< "\n fru_id_path = " << fru_id_path
|
||||
<< "; info->fru_id: " << info->fru_id
|
||||
<< "\n manufacturer_name_path = " << manufacturer_name_path
|
||||
<< "; info->manufacturer_name: " << info->manufacturer_name
|
||||
<< "\n product_name_path = " << product_name_path
|
||||
<< "; info->product_name: " << info->product_name;
|
||||
LOG_INFO(ss);
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -236,8 +251,8 @@ amdsmi_status_t smi_amdgpu_get_ranges(amd::smi::AMDSmiGPUDevice* device, amdsmi_
|
||||
unsigned int dpm_level, freq;
|
||||
|
||||
char firstChar = line[0];
|
||||
if (firstChar == 'S'){
|
||||
if (sscanf(line.c_str(), "%c: %d%s", &single_char, &sleep_freq, str) <= 2){
|
||||
if (firstChar == 'S') {
|
||||
if (sscanf(line.c_str(), "%c: %d%s", &single_char, &sleep_freq, str) <= 2) {
|
||||
ranges.close();
|
||||
return AMDSMI_STATUS_NO_DATA;
|
||||
}
|
||||
|
||||
@@ -98,12 +98,17 @@ void TestGpuMetricsRead::Run(void) {
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
std::cout << "Device #" << std::to_string(i) << "\n";
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU METRICS: Using static struct (Backwards Compatibility):\n";
|
||||
}
|
||||
amdsmi_gpu_metrics_t smu;
|
||||
err = amdsmi_get_gpu_metrics_info(processor_handles_[i], &smu);
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(err, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_info(): " << status_string
|
||||
<< "\n";
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -115,8 +120,21 @@ void TestGpuMetricsRead::Run(void) {
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "METRIC TABLE HEADER:\n";
|
||||
std::cout << "structure_size=" << std::dec
|
||||
<< static_cast<int>(smu.common_header.structure_size) << '\n';
|
||||
std::cout << "format_revision=" << std::dec
|
||||
<< static_cast<int>(smu.common_header.format_revision) << '\n';
|
||||
std::cout << "content_revision=" << std::dec
|
||||
<< static_cast<int>(smu.common_header.content_revision) << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "TIME STAMPS (ns):\n";
|
||||
std::cout << std::dec << "system_clock_counter="
|
||||
<< smu.system_clock_counter << '\n';
|
||||
std::cout << "firmware_timestamp (10ns resolution)=" << std::dec
|
||||
<< smu.firmware_timestamp << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "TEMPERATURES (C):\n";
|
||||
std::cout << std::dec << "temperature_edge="
|
||||
<< smu.temperature_edge << '\n';
|
||||
std::cout << std::dec << "temperature_hotspot="
|
||||
@@ -129,16 +147,39 @@ void TestGpuMetricsRead::Run(void) {
|
||||
<< smu.temperature_vrsoc << '\n';
|
||||
std::cout << std::dec << "temperature_vrmem="
|
||||
<< smu.temperature_vrmem << '\n';
|
||||
for (int i = 0; i < AMDSMI_NUM_HBM_INSTANCES; ++i) {
|
||||
std::cout << "temperature_hbm[" << i << "]=" << std::dec <<
|
||||
smu.temperature_hbm[i] << '\n';
|
||||
}
|
||||
std::cout << "\n";
|
||||
std::cout << "UTILIZATION (%):\n";
|
||||
std::cout << std::dec << "average_gfx_activity="
|
||||
<< smu.average_gfx_activity << '\n';
|
||||
std::cout << std::dec << "average_umc_activity="
|
||||
<< smu.average_umc_activity << '\n';
|
||||
std::cout << std::dec << "average_mm_activity="
|
||||
<< smu.average_mm_activity << '\n';
|
||||
std::cout << std::dec << "jpeg_activity= [";
|
||||
uint16_t size = static_cast<uint16_t>(
|
||||
sizeof(smu.jpeg_activity)/sizeof(smu.jpeg_activity[0]));
|
||||
for (uint16_t i= 0; i < size; i++) {
|
||||
if (i+1 < size) {
|
||||
std::cout << std::dec << smu.jpeg_activity[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << smu.jpeg_activity[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << "\n";
|
||||
std::cout << "POWER (W)/ENERGY (15.259uJ per 1ns):\n";
|
||||
std::cout << std::dec << "average_socket_power="
|
||||
<< smu.average_socket_power << '\n';
|
||||
std::cout << std::dec << "current_socket_power="
|
||||
<< smu.current_socket_power << '\n';
|
||||
std::cout << std::dec << "energy_accumulator="
|
||||
<< smu.energy_accumulator << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "AVG CLOCKS (MHz):\n";
|
||||
std::cout << std::dec << "average_gfxclk_frequency="
|
||||
<< smu.average_gfxclk_frequency << '\n';
|
||||
std::cout << std::dec << "average_gfxclk_frequency="
|
||||
@@ -153,417 +194,820 @@ void TestGpuMetricsRead::Run(void) {
|
||||
<< smu.average_vclk1_frequency << '\n';
|
||||
std::cout << std::dec << "average_dclk1_frequency="
|
||||
<< smu.average_dclk1_frequency << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "CURRENT CLOCKS (MHz):\n";
|
||||
std::cout << std::dec << "current_gfxclk="
|
||||
<< smu.current_gfxclk << '\n';
|
||||
std::cout << std::dec << "current_gfxclks= [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(smu.current_gfxclks)/sizeof(smu.current_gfxclks[0]));
|
||||
for (uint16_t i= 0; i < size; i++) {
|
||||
if (i+1 < size) {
|
||||
std::cout << std::dec << smu.current_gfxclks[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << smu.current_gfxclks[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << std::dec << "current_socclk="
|
||||
<< smu.current_socclk << '\n';
|
||||
std::cout << std::dec << "current_socclks= [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(smu.current_socclks)/sizeof(smu.current_socclks[0]));
|
||||
for (uint16_t i= 0; i < size; i++) {
|
||||
if (i+1 < size) {
|
||||
std::cout << std::dec << smu.current_socclks[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << smu.current_socclks[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << std::dec << "current_uclk="
|
||||
<< smu.current_uclk << '\n';
|
||||
std::cout << std::dec << "current_vclk0="
|
||||
<< smu.current_vclk0 << '\n';
|
||||
std::cout << std::dec << "current_vclk0s= [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(smu.current_vclk0s)/sizeof(smu.current_vclk0s[0]));
|
||||
for (uint16_t i= 0; i < size; i++) {
|
||||
if (i+1 < size) {
|
||||
std::cout << std::dec << smu.current_vclk0s[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << smu.current_vclk0s[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << std::dec << "current_dclk0="
|
||||
<< smu.current_dclk0 << '\n';
|
||||
std::cout << std::dec << "current_dclk0s= [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(smu.current_dclk0s)/sizeof(smu.current_dclk0s[0]));
|
||||
for (uint16_t i= 0; i < size; i++) {
|
||||
if (i+1 < size) {
|
||||
std::cout << std::dec << smu.current_dclk0s[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << smu.current_dclk0s[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << std::dec << "current_vclk1="
|
||||
<< smu.current_vclk1 << '\n';
|
||||
std::cout << std::dec << "current_dclk1="
|
||||
<< smu.current_dclk1 << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "TROTTLE STATUS:\n";
|
||||
std::cout << std::dec << "throttle_status="
|
||||
<< smu.throttle_status << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "FAN SPEED:\n";
|
||||
std::cout << std::dec << "current_fan_speed="
|
||||
<< smu.current_fan_speed << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "LINK WIDTH (number of lanes) /SPEED (0.1 GT/s):\n";
|
||||
std::cout << "pcie_link_width="
|
||||
<< std::to_string(smu.pcie_link_width) << '\n';
|
||||
std::cout << "pcie_link_width="
|
||||
std::cout << "pcie_link_speed="
|
||||
<< std::to_string(smu.pcie_link_speed) << '\n';
|
||||
std::cout << "xgmi_link_width="
|
||||
<< std::to_string(smu.xgmi_link_width) << '\n';
|
||||
std::cout << "xgmi_link_speed="
|
||||
<< std::to_string(smu.xgmi_link_speed) << '\n';
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "Utilization Accumulated(%):\n";
|
||||
std::cout << "gfx_activity_acc="
|
||||
<< std::dec << smu.gfx_activity_acc << '\n';
|
||||
std::cout << "mem_activity_acc="
|
||||
<< std::dec << smu.mem_activity_acc << '\n';
|
||||
|
||||
for (int i = 0; i < AMDSMI_NUM_HBM_INSTANCES; ++i) {
|
||||
std::cout << "temperature_hbm[" << i << "]=" << std::dec <<
|
||||
smu.temperature_hbm[i] << '\n';
|
||||
std::cout << "\n";
|
||||
std::cout << "XGMI ACCUMULATED DATA TRANSFER SIZE (KB):\n";
|
||||
std::cout << std::dec << "xgmi_read_data_acc= [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(smu.xgmi_read_data_acc)/sizeof(smu.xgmi_read_data_acc[0]));
|
||||
for (uint16_t i= 0; i < size; i++) {
|
||||
if (i+1 < size) {
|
||||
std::cout << std::dec << smu.xgmi_read_data_acc[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << smu.xgmi_read_data_acc[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << std::dec << "xgmi_write_data_acc= [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(smu.xgmi_write_data_acc)/sizeof(smu.xgmi_write_data_acc[0]));
|
||||
for (uint16_t i= 0; i < size; i++) {
|
||||
if (i+1 < size) {
|
||||
std::cout << std::dec << smu.xgmi_write_data_acc[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << smu.xgmi_write_data_acc[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << "mem_bandwidth_acc=" << std::dec
|
||||
<< smu.mem_bandwidth_acc << "\n";
|
||||
std::cout << "mem_max_bandwidth=" << std::dec
|
||||
<< smu.mem_max_bandwidth << "\n";
|
||||
std::cout << "pcie_nak_sent_count_acc=" << std::dec
|
||||
<< smu.pcie_nak_sent_count_acc << "\n";
|
||||
std::cout << "pcie_nak_rcvd_count_acc=" << std::dec
|
||||
<< smu.pcie_nak_rcvd_count_acc << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_metrics_info(processor_handles_[i], nullptr);
|
||||
DISPLAY_AMDSMI_ERR(err);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
||||
auto val_ui16 = uint16_t(0);
|
||||
auto val_ui32 = uint32_t(0);
|
||||
auto val_ui64 = uint64_t(0);
|
||||
auto status_code(amdsmi_status_t::AMDSMI_STATUS_SUCCESS);
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
std::cout << "Device #" << std::to_string(i) << "\n";
|
||||
|
||||
auto temp_edge_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_temp_edge(processor_handles_[i], &temp_edge_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_edge(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_hotspot_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_temp_hotspot(processor_handles_[i], &temp_hotspot_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_hotspot(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_mem_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_temp_mem(processor_handles_[i], &temp_mem_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_mem(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_vrgfx_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_temp_vrgfx(processor_handles_[i], &temp_vrgfx_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_vrgfx(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_vrsoc_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_temp_vrsoc(processor_handles_[i], &temp_vrsoc_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_vrsoc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_vrmem_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_temp_vrmem(processor_handles_[i], &temp_vrmem_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_vrmem(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_temp_hbm_t temp_hbm_values;
|
||||
status_code = amdsmi_get_gpu_metrics_temp_hbm(processor_handles_[i], &temp_hbm_values);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_hbm(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_curr_socket_power_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_socket_power(processor_handles_[i], &temp_curr_socket_power_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_socket_power(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_energy_accum_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_energy_acc(processor_handles_[i], &temp_energy_accum_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_energy_acc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_socket_power_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_socket_power(processor_handles_[i], &temp_avg_socket_power_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_temp_edge(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_gfx_activity_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_gfx_activity(processor_handles_[i], &temp_avg_gfx_activity_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_gfx_activity(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_umc_activity_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_umc_activity(processor_handles_[i], &temp_avg_umc_activity_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_umc_activity(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_mm_activity_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_mm_activity(processor_handles_[i], &temp_avg_mm_activity_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_mm_activity(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_vcn_activity_t temp_vcn_values;
|
||||
status_code = amdsmi_get_gpu_metrics_vcn_activity(processor_handles_[i], &temp_vcn_values);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_vcn_activity(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_mem_activity_accum_value = val_ui32;
|
||||
status_code = amdsmi_get_gpu_metrics_mem_activity_acc(processor_handles_[i], &temp_mem_activity_accum_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_mem_activity_acc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_gfx_activity_accum_value = val_ui32;
|
||||
status_code = amdsmi_get_gpu_metrics_gfx_activity_acc(processor_handles_[i], &temp_gfx_activity_accum_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_gfx_activity_acc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_gfx_clock_freq_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_gfx_clock_frequency(processor_handles_[i], &temp_avg_gfx_clock_freq_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_gfx_clock_frequency(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_soc_clock_freq_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_soc_clock_frequency(processor_handles_[i], &temp_avg_soc_clock_freq_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_soc_clock_frequency(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_uclock_freq_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_uclock_frequency(processor_handles_[i], &temp_avg_uclock_freq_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_uclock_frequency(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_vclock0_freq_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_vclock0_frequency(processor_handles_[i], &temp_avg_vclock0_freq_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_vclock0_frequency(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_dclock0_freq_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_dclock0_frequency(processor_handles_[i], &temp_avg_dclock0_freq_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_dclock0_frequency(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_vclock1_freq_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_vclock1_frequency(processor_handles_[i], &temp_avg_vclock1_freq_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_vclock1_frequency(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_avg_dclock1_freq_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_avg_dclock1_frequency(processor_handles_[i], &temp_avg_dclock1_freq_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_avg_dclock1_frequency(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_curr_vclk1_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_vclk1(processor_handles_[i], &temp_curr_vclk1_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_vclk1(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_curr_dclk1_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_dclk1(processor_handles_[i], &temp_curr_dclk1_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_dclk1(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_curr_uclk_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_uclk(processor_handles_[i], &temp_curr_uclk_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_uclk(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_curr_dclk0_t temp_curr_dclk0_values;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_dclk0(processor_handles_[i], &temp_curr_dclk0_values);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_dclk0(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_curr_gfxclk_t temp_curr_gfxclk_values;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_gfxclk(processor_handles_[i], &temp_curr_gfxclk_values);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_gfxclk(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_curr_socclk_t temp_curr_socclk_values;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_socclk(processor_handles_[i], &temp_curr_socclk_values);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_socclk(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_curr_vclk0_t temp_curr_vclk0_values;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_vclk0(processor_handles_[i], &temp_curr_vclk0_values);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_vclk0(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_indep_throttle_status_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_indep_throttle_status(processor_handles_[i], &temp_indep_throttle_status_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_indep_throttle_status(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_throttle_status_value = val_ui32;
|
||||
status_code = amdsmi_get_gpu_metrics_throttle_status(processor_handles_[i], &temp_throttle_status_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_throttle_status(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_gfxclk_lock_status_value = val_ui32;
|
||||
status_code = amdsmi_get_gpu_metrics_gfxclk_lock_status(processor_handles_[i], &temp_gfxclk_lock_status_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_gfxclk_lock_status(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_curr_fan_speed_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_curr_fan_speed(processor_handles_[i], &temp_curr_fan_speed_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_curr_fan_speed(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_pcie_link_width_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_pcie_link_width(processor_handles_[i], &temp_pcie_link_width_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_pcie_link_width(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_pcie_link_speed_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_pcie_link_speed(processor_handles_[i], &temp_pcie_link_speed_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_pcie_link_speed(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_pcie_bandwidth_accum_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_pcie_bandwidth_acc(processor_handles_[i], &temp_pcie_bandwidth_accum_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_pcie_bandwidth_acc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_pcie_bandwidth_inst_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_pcie_bandwidth_inst(processor_handles_[i], &temp_pcie_bandwidth_inst_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_pcie_bandwidth_inst(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_pcie_l0_recov_count_accum_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc(processor_handles_[i], &temp_pcie_l0_recov_count_accum_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_pcie_replay_count_accum_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_pcie_replay_count_acc(processor_handles_[i], &temp_pcie_replay_count_accum_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_pcie_replay_count_acc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_pcie_replay_rover_count_accum_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc(processor_handles_[i], &temp_pcie_replay_rover_count_accum_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_xgmi_link_width_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_xgmi_link_width(processor_handles_[i], &temp_xgmi_link_width_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_xgmi_link_width(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_xgmi_link_speed_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_xgmi_link_speed(processor_handles_[i], &temp_xgmi_link_speed_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_xgmi_link_speed(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_xgmi_read_data_acc_t temp_xgmi_read_values;
|
||||
status_code = amdsmi_get_gpu_metrics_xgmi_read_data(processor_handles_[i], &temp_xgmi_read_values);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_xgmi_read_data(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
gpu_metric_xgmi_write_data_acc_t temp_xgmi_write_values;
|
||||
status_code = amdsmi_get_gpu_metrics_xgmi_write_data(processor_handles_[i], &temp_xgmi_write_values);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_xgmi_write_data(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_voltage_soc_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_volt_soc(processor_handles_[i], &temp_voltage_soc_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_volt_soc(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_voltage_gfx_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_volt_gfx(processor_handles_[i], &temp_voltage_gfx_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_volt_gfx(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_voltage_mem_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_volt_mem(processor_handles_[i], &temp_voltage_mem_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_volt_mem(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_system_clock_counter_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_system_clock_counter(processor_handles_[i], &temp_system_clock_counter_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_system_clock_counter(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_firmware_timestamp_value = val_ui64;
|
||||
status_code = amdsmi_get_gpu_metrics_firmware_timestamp(processor_handles_[i], &temp_firmware_timestamp_value);
|
||||
CHK_ERR_ASRT(status_code);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_firmware_timestamp(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
auto temp_xcd_counter_value = val_ui16;
|
||||
status_code = amdsmi_get_gpu_metrics_xcd_counter(processor_handles_[i], &temp_xcd_counter_value);
|
||||
if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(status_code);
|
||||
} else {
|
||||
const char *status_string;
|
||||
amdsmi_status_code_to_string(status_code, &status_string);
|
||||
std::cout << "\t\t** amdsmi_get_gpu_metrics_xcd_counter(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Temperature]" << "\n";
|
||||
std::cout << "\t -> temp_edge(): " << temp_edge_value << "\n";
|
||||
std::cout << "\t -> temp_hotspot(): " << temp_hotspot_value << "\n";
|
||||
std::cout << "\t -> temp_mem(): " << temp_mem_value << "\n";
|
||||
std::cout << "\t -> temp_vrgfx(): " << temp_vrgfx_value << "\n";
|
||||
std::cout << "\t -> temp_vrsoc(): " << temp_vrsoc_value << "\n";
|
||||
std::cout << "\t -> temp_vrmem(): " << temp_vrmem_value << "\n";
|
||||
std::cout << "\t -> temp_hbm(): " << temp_hbm_values << "\n";
|
||||
std::cout << "\t -> temp_edge(): " << std::dec << temp_edge_value << "\n";
|
||||
std::cout << "\t -> temp_hotspot(): " << std::dec << temp_hotspot_value << "\n";
|
||||
std::cout << "\t -> temp_mem(): " << std::dec << temp_mem_value << "\n";
|
||||
std::cout << "\t -> temp_vrgfx(): " << std::dec << temp_vrgfx_value << "\n";
|
||||
std::cout << "\t -> temp_vrsoc(): " << std::dec << temp_vrsoc_value << "\n";
|
||||
std::cout << "\t -> temp_vrmem(): " << std::dec << temp_vrmem_value << "\n";
|
||||
std::cout << "\t -> temp_hbm(temp_hbm_values): [";
|
||||
uint16_t size = static_cast<uint16_t>(
|
||||
sizeof(temp_hbm_values) / sizeof(temp_hbm_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_hbm_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_hbm_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Power/Energy]" << "\n";
|
||||
std::cout << "\t -> current_socket_power(): " << temp_curr_socket_power_value << "\n";
|
||||
std::cout << "\t -> energy_accum(): " << temp_energy_accum_value << "\n";
|
||||
std::cout << "\t -> average_socket_power(): " << temp_avg_socket_power_value << "\n";
|
||||
std::cout << "\t -> current_socket_power(): " << std::dec << temp_curr_socket_power_value << "\n";
|
||||
std::cout << "\t -> energy_accum(): " << std::dec << temp_energy_accum_value << "\n";
|
||||
std::cout << "\t -> average_socket_power(): " << std::dec << temp_avg_socket_power_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Utilization]" << "\n";
|
||||
std::cout << "\t -> average_gfx_activity(): " << temp_avg_gfx_activity_value << "\n";
|
||||
std::cout << "\t -> average_umc_activity(): " << temp_avg_umc_activity_value << "\n";
|
||||
std::cout << "\t -> average_mm_activity(): " << temp_avg_mm_activity_value << "\n";
|
||||
std::cout << "\t -> vcn_activity(): " << temp_vcn_values << "\n";
|
||||
std::cout << "\t -> mem_activity_accum(): " << temp_mem_activity_accum_value << "\n";
|
||||
std::cout << "\t -> gfx_activity_accum(): " << temp_gfx_activity_accum_value << "\n";
|
||||
std::cout << "\t -> average_gfx_activity(): " << std::dec << temp_avg_gfx_activity_value << "\n";
|
||||
std::cout << "\t -> average_umc_activity(): " << std::dec << temp_avg_umc_activity_value << "\n";
|
||||
std::cout << "\t -> average_mm_activity(): " << std::dec << temp_avg_mm_activity_value << "\n";
|
||||
std::cout << "\t -> vcn_activity(temp_vcn_values): [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(temp_vcn_values) / sizeof(temp_vcn_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_vcn_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_vcn_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << "\t -> mem_activity_accum(): " << std::dec << temp_mem_activity_accum_value << "\n";
|
||||
std::cout << "\t -> gfx_activity_accum(): " << std::dec << temp_gfx_activity_accum_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Average Clock]" << "\n";
|
||||
std::cout << "\t -> average_gfx_clock_frequency(): " << temp_avg_gfx_clock_freq_value << "\n";
|
||||
std::cout << "\t -> average_soc_clock_frequency(): " << temp_avg_soc_clock_freq_value << "\n";
|
||||
std::cout << "\t -> average_uclock_frequency(): " << temp_avg_uclock_freq_value << "\n";
|
||||
std::cout << "\t -> average_vclock0_frequency(): " << temp_avg_vclock0_freq_value << "\n";
|
||||
std::cout << "\t -> average_dclock0_frequency(): " << temp_avg_dclock0_freq_value << "\n";
|
||||
std::cout << "\t -> average_vclock1_frequency(): " << temp_avg_vclock1_freq_value << "\n";
|
||||
std::cout << "\t -> average_dclock1_frequency(): " << temp_avg_dclock1_freq_value << "\n";
|
||||
std::cout << "\t -> average_gfx_clock_frequency(): " << std::dec << temp_avg_gfx_clock_freq_value << "\n";
|
||||
std::cout << "\t -> average_soc_clock_frequency(): " << std::dec << temp_avg_soc_clock_freq_value << "\n";
|
||||
std::cout << "\t -> average_uclock_frequency(): " << std::dec << temp_avg_uclock_freq_value << "\n";
|
||||
std::cout << "\t -> average_vclock0_frequency(): " << std::dec << std::dec << temp_avg_vclock0_freq_value << "\n";
|
||||
std::cout << "\t -> average_dclock0_frequency(): " << std::dec << temp_avg_dclock0_freq_value << "\n";
|
||||
std::cout << "\t -> average_vclock1_frequency(): " << std::dec << temp_avg_vclock1_freq_value << "\n";
|
||||
std::cout << "\t -> average_dclock1_frequency(): " << std::dec << temp_avg_dclock1_freq_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Current Clock]" << "\n";
|
||||
std::cout << "\t -> current_vclock1(): " << temp_curr_vclk1_value << "\n";
|
||||
std::cout << "\t -> current_dclock1(): " << temp_curr_dclk1_value << "\n";
|
||||
std::cout << "\t -> current_uclock(): " << temp_curr_uclk_value << "\n";
|
||||
std::cout << "\t -> current_dclk0(): " << temp_curr_dclk0_values << "\n";
|
||||
std::cout << "\t -> current_gfxclk(): " << temp_curr_gfxclk_values << "\n";
|
||||
std::cout << "\t -> current_soc_clock(): " << temp_curr_socclk_values << "\n";
|
||||
std::cout << "\t -> current_vclk0(): " << temp_curr_vclk0_values << "\n";
|
||||
std::cout << "\t -> current_vclock1(): " << std::dec << temp_curr_vclk1_value << "\n";
|
||||
std::cout << "\t -> current_dclock1(): " << std::dec << temp_curr_dclk1_value << "\n";
|
||||
std::cout << "\t -> current_uclock(): " << std::dec << temp_curr_uclk_value << "\n";
|
||||
std::cout << "\t -> current_dclk0(temp_curr_dclk0_values): [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(temp_curr_dclk0_values) / sizeof(temp_curr_dclk0_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_curr_dclk0_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_curr_dclk0_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << "\t -> current_gfxclk(temp_curr_gfxclk_values): [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(temp_curr_gfxclk_values) / sizeof(temp_curr_gfxclk_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_curr_gfxclk_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_curr_gfxclk_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << "\t -> current_soc_clock(temp_curr_socclk_values): [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(temp_curr_socclk_values) / sizeof(temp_curr_socclk_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_curr_socclk_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_curr_socclk_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << "\t -> current_vclk0(temp_curr_vclk0_values): [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(temp_curr_vclk0_values) / sizeof(temp_curr_vclk0_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_curr_vclk0_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_curr_vclk0_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Throttle]" << "\n";
|
||||
std::cout << "\t -> indep_throttle_status(): " << temp_indep_throttle_status_value << "\n";
|
||||
std::cout << "\t -> throttle_status(): " << temp_throttle_status_value << "\n";
|
||||
std::cout << "\t -> indep_throttle_status(): " << std::dec << temp_indep_throttle_status_value << "\n";
|
||||
std::cout << "\t -> throttle_status(): " << std::dec << temp_throttle_status_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Gfx Clock Lock]" << "\n";
|
||||
std::cout << "\t -> gfxclk_lock_status(): " << temp_gfxclk_lock_status_value << "\n";
|
||||
std::cout << "\t -> gfxclk_lock_status(): " << std::dec << temp_gfxclk_lock_status_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Current Fan Speed]" << "\n";
|
||||
std::cout << "\t -> current_fan_speed(): " << temp_curr_fan_speed_value << "\n";
|
||||
std::cout << "\t -> current_fan_speed(): " << std::dec << temp_curr_fan_speed_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Link/Bandwidth/Speed]" << "\n";
|
||||
std::cout << "\t -> pcie_link_width(): " << temp_pcie_link_width_value << "\n";
|
||||
std::cout << "\t -> pcie_link_speed(): " << temp_pcie_link_speed_value << "\n";
|
||||
std::cout << "\t -> pcie_bandwidth_accum(): " << temp_pcie_bandwidth_accum_value << "\n";
|
||||
std::cout << "\t -> pcie_bandwidth_inst(): " << temp_pcie_bandwidth_inst_value << "\n";
|
||||
std::cout << "\t -> pcie_l0_recov_count_accum(): " << temp_pcie_l0_recov_count_accum_value << "\n";
|
||||
std::cout << "\t -> pcie_replay_count_accum(): " << temp_pcie_replay_count_accum_value << "\n";
|
||||
std::cout << "\t -> pcie_replay_rollover_count_accum(): " << temp_pcie_replay_rover_count_accum_value << "\n";
|
||||
std::cout << "\t -> xgmi_link_width(): " << temp_xgmi_link_width_value << "\n";
|
||||
std::cout << "\t -> xgmi_link_speed(): " << temp_xgmi_link_speed_value << "\n";
|
||||
std::cout << "\t -> xgmi_read_data(): " << temp_xgmi_read_values << "\n";
|
||||
std::cout << "\t -> xgmi_write_data(): " << temp_xgmi_write_values << "\n";
|
||||
std::cout << "\t -> pcie_link_width(): " << std::dec << temp_pcie_link_width_value << "\n";
|
||||
std::cout << "\t -> pcie_link_speed(): " << std::dec << temp_pcie_link_speed_value << "\n";
|
||||
std::cout << "\t -> pcie_bandwidth_accum(): " << std::dec << std::dec << temp_pcie_bandwidth_accum_value << "\n";
|
||||
std::cout << "\t -> pcie_bandwidth_inst(): " << std::dec << temp_pcie_bandwidth_inst_value << "\n";
|
||||
std::cout << "\t -> pcie_l0_recov_count_accum(): " << std::dec << std::dec << temp_pcie_l0_recov_count_accum_value << "\n";
|
||||
std::cout << "\t -> pcie_replay_count_accum(): " << std::dec << temp_pcie_replay_count_accum_value << "\n";
|
||||
std::cout << "\t -> pcie_replay_rollover_count_accum(): " << std::dec << temp_pcie_replay_rover_count_accum_value << "\n";
|
||||
std::cout << "\t -> xgmi_link_width(): " << std::dec << temp_xgmi_link_width_value << "\n";
|
||||
std::cout << "\t -> xgmi_link_speed(): " << std::dec << std::dec << temp_xgmi_link_speed_value << "\n";
|
||||
std::cout << "\t -> xgmi_read_data(temp_xgmi_read_values): ";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(temp_xgmi_read_values) / sizeof(temp_xgmi_read_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_xgmi_read_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_xgmi_read_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
std::cout << "\t -> xgmi_write_data(temp_xgmi_write_values): [";
|
||||
size = static_cast<uint16_t>(
|
||||
sizeof(temp_xgmi_write_values) / sizeof(temp_xgmi_write_values[0]));
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (i + 1 < size) {
|
||||
std::cout << std::dec << temp_xgmi_write_values[i] << ", ";
|
||||
} else {
|
||||
std::cout << std::dec << temp_xgmi_write_values[i];
|
||||
}
|
||||
}
|
||||
std::cout << std::dec << "]\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Voltage]" << "\n";
|
||||
std::cout << "\t -> voltage_soc(): " << temp_voltage_soc_value << "\n";
|
||||
std::cout << "\t -> voltage_gfx(): " << temp_voltage_gfx_value << "\n";
|
||||
std::cout << "\t -> voltage_mem(): " << temp_voltage_mem_value << "\n";
|
||||
std::cout << "\t -> voltage_soc(): " << std::dec << temp_voltage_soc_value << "\n";
|
||||
std::cout << "\t -> voltage_gfx(): " << std::dec << temp_voltage_gfx_value << "\n";
|
||||
std::cout << "\t -> voltage_mem(): " << std::dec << temp_voltage_mem_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[Timestamp]" << "\n";
|
||||
std::cout << "\t -> system_clock_counter(): " << temp_system_clock_counter_value << "\n";
|
||||
std::cout << "\t -> firmware_timestamp(): " << temp_firmware_timestamp_value << "\n";
|
||||
std::cout << "\t -> system_clock_counter(): " << std::dec << temp_system_clock_counter_value << "\n";
|
||||
std::cout << "\t -> firmware_timestamp(): " << std::dec << temp_firmware_timestamp_value << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t[XCD CounterVoltage]" << "\n";
|
||||
std::cout << "\t -> xcd_counter(): " << temp_xcd_counter_value << "\n";
|
||||
std::cout << "\t[XCD Counter]" << "\n";
|
||||
std::cout << "\t -> xcd_counter(): " << std::dec << temp_xcd_counter_value << "\n";
|
||||
std::cout << "\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user