Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboarded AMD SMI for Linux and added more metrics #344

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Description": "Default Monitors for AMD GPU systems.",
"Metadata": {
"SupportedPlatforms": "linux-x64,win-x64",
"SupportedPlatforms": "linux-x64, win-x64",
"SupportedOperatingSystems": "CBL-Mariner,CentOS,Debian,RedHat,Suse,Ubuntu,Windows"
},
"Parameters": {
Expand All @@ -12,9 +12,19 @@
{
"Type": "AmdSmiMonitor",
"Parameters": {
"Scenario": "AmdGpuCounters",
"MonitorFrequency": "$.Parameters.MonitorFrequency",
"MonitorWarmupPeriod": "$.Parameters.MonitorWarmupPeriod"
"Scenario": "AmdGpuCounters",
"Subsystem": "metric",
"MonitorFrequency": "$.Parameters.MonitorFrequency",
"MonitorWarmupPeriod": "$.Parameters.MonitorWarmupPeriod"
}
},
{
"Type": "AmdSmiMonitor",
"Parameters": {
"Scenario": "AmdGpuCounters",
"Subsystem": "xgmi",
"MonitorFrequency": "$.Parameters.MonitorFrequency",
"MonitorWarmupPeriod": "$.Parameters.MonitorWarmupPeriod"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace VirtualClient.Monitors
{
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using VirtualClient.Common;
using VirtualClient.Contracts;

[TestFixture]
[Category("Unit")]
public class AmdSmiMetricQueryGpuParserUnitTests
{
[Test]
public void AmdSmiMetricQueryGpuParserParsesMetricsCorrectly()
{
string workingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string outputPath = Path.Combine(workingDirectory, "Examples", "amd-smi", "metric.csv");
string rawText = File.ReadAllText(outputPath);

AmdSmiMetricQueryGpuParser testParser = new AmdSmiMetricQueryGpuParser(rawText);
IList<Metric> metrics = testParser.Parse();

MetricAssert.Exists(metrics, "utilization.gpu [%]", 98, "%");
MetricAssert.Exists(metrics, "framebuffer.total [MB]", 14928, "MB");
MetricAssert.Exists(metrics, "framebuffer.used [MB]", 363, "MB");

}

[Test]
public void AmdSmiMetricQueryGpuParserParsesMetricsCorrectly_MI300X()
{
string workingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string outputPath = Path.Combine(workingDirectory, "Examples", "amd-smi", "metric-8xMI300X.csv");
string rawText = File.ReadAllText(outputPath);

AmdSmiMetricQueryGpuParser testParser = new AmdSmiMetricQueryGpuParser(rawText);
IList<Metric> metrics = testParser.Parse();

MetricAssert.Exists(metrics, "utilization.gpu", 0, "%");
MetricAssert.Exists(metrics, "utilization.memory", 0, "%");
MetricAssert.Exists(metrics, "temperature.gpu", 36, "celsius");
MetricAssert.Exists(metrics, "temperature.memory", 30, "celsius");
MetricAssert.Exists(metrics, "power.draw.average", 133, "W");
MetricAssert.Exists(metrics, "gfx_clk_avg", 132.125, "MHz");
MetricAssert.Exists(metrics, "mem_clk", 900, "MHz");
MetricAssert.Exists(metrics, "video_vclk_avg", 29, "MHz");
MetricAssert.Exists(metrics, "video_dclk_avg", 22, "MHz");
MetricAssert.Exists(metrics, "pcie_bw", 24, "MB/s");
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace VirtualClient.Monitors
{
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using VirtualClient.Common;
using VirtualClient.Contracts;

[TestFixture]
[Category("Unit")]
public class AmdSmiXGMIQueryGpuParserUnitTests
{
[Test]
public void AmdSmiXGMIQueryGpuParserParsesMetricsCorrectly()
{
string workingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string outputPath = Path.Combine(workingDirectory, "Examples", "amd-smi", "xgmi-8xMI300X.json");
string rawText = File.ReadAllText(outputPath);

AmdSmiXGMIQueryGpuParser testParser = new AmdSmiXGMIQueryGpuParser(rawText);
IList<Metric> metrics = testParser.Parse();

Assert.AreEqual(8, metrics.Count);
MetricAssert.Exists(metrics, "xgmi_0_data", 14, "KB");
MetricAssert.Exists(metrics, "xgmi_1_data", 12, "KB");
MetricAssert.Exists(metrics, "xgmi_2_data", 10, "KB");
MetricAssert.Exists(metrics, "xgmi_3_data", 9, "KB");
MetricAssert.Exists(metrics, "xgmi_4_data", 9, "KB");
MetricAssert.Exists(metrics, "xgmi_5_data", 8, "KB");
MetricAssert.Exists(metrics, "xgmi_6_data", 6, "KB");
MetricAssert.Exists(metrics, "xgmi_7_data", 6, "KB");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
gpu,gfx_activity,umc_activity,mm_activity,vcn_activity,jpeg_activity,socket_power,gfx_voltage,soc_voltage,mem_voltage,power_management,throttle_status,gfx_0_clk,gfx_0_min_clk,gfx_0_max_clk,gfx_0_clk_locked,gfx_0_deep_sleep,gfx_1_clk,gfx_1_min_clk,gfx_1_max_clk,gfx_1_clk_locked,gfx_1_deep_sleep,gfx_2_clk,gfx_2_min_clk,gfx_2_max_clk,gfx_2_clk_locked,gfx_2_deep_sleep,gfx_3_clk,gfx_3_min_clk,gfx_3_max_clk,gfx_3_clk_locked,gfx_3_deep_sleep,gfx_4_clk,gfx_4_min_clk,gfx_4_max_clk,gfx_4_clk_locked,gfx_4_deep_sleep,gfx_5_clk,gfx_5_min_clk,gfx_5_max_clk,gfx_5_clk_locked,gfx_5_deep_sleep,gfx_6_clk,gfx_6_min_clk,gfx_6_max_clk,gfx_6_clk_locked,gfx_6_deep_sleep,gfx_7_clk,gfx_7_min_clk,gfx_7_max_clk,gfx_7_clk_locked,gfx_7_deep_sleep,mem_0_clk,mem_0_min_clk,mem_0_max_clk,mem_0_clk_locked,mem_0_deep_sleep,vclk_0_clk,vclk_0_min_clk,vclk_0_max_clk,vclk_0_clk_locked,vclk_0_deep_sleep,vclk_1_clk,vclk_1_min_clk,vclk_1_max_clk,vclk_1_clk_locked,vclk_1_deep_sleep,vclk_2_clk,vclk_2_min_clk,vclk_2_max_clk,vclk_2_clk_locked,vclk_2_deep_sleep,vclk_3_clk,vclk_3_min_clk,vclk_3_max_clk,vclk_3_clk_locked,vclk_3_deep_sleep,dclk_0_clk,dclk_0_min_clk,dclk_0_max_clk,dclk_0_clk_locked,dclk_0_deep_sleep,dclk_1_clk,dclk_1_min_clk,dclk_1_max_clk,dclk_1_clk_locked,dclk_1_deep_sleep,dclk_2_clk,dclk_2_min_clk,dclk_2_max_clk,dclk_2_clk_locked,dclk_2_deep_sleep,dclk_3_clk,dclk_3_min_clk,dclk_3_max_clk,dclk_3_clk_locked,dclk_3_deep_sleep,edge,hotspot,mem,width,speed,bandwidth,replay_count,l0_to_recovery_count,replay_roll_over_count,nak_sent_count,nak_received_count,current_bandwidth_sent,current_bandwidth_received,max_packet_size,total_correctable_count,total_uncorrectable_count,total_deferred_count,cache_correctable_count,cache_uncorrectable_count,UMC_correctable_count,UMC_uncorrectable_count,UMC_deferred_count,SDMA_correctable_count,SDMA_uncorrectable_count,SDMA_deferred_count,GFX_correctable_count,GFX_uncorrectable_count,GFX_deferred_count,MMHUB_correctable_count,MMHUB_uncorrectable_count,MMHUB_deferred_count,PCIE_BIF_correctable_count,PCIE_BIF_uncorrectable_count,PCIE_BIF_deferred_count,HDP_correctable_count,HDP_uncorrectable_count,HDP_deferred_count,XGMI_WAFL_correctable_count,XGMI_WAFL_uncorrectable_count,XGMI_WAFL_deferred_count,max,rpm,usage,point_0_frequency,point_0_voltage,point_1_frequency,point_1_voltage,point_2_frequency,point_2_voltage,overdrive,perf_level,xgmi_err,total_energy_consumption,total_vram,used_vram,free_vram,total_visible_vram,used_visible_vram,free_visible_vram,total_gtt,used_gtt,free_gtt
0,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",133,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,133,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,36,30,16,N/A,192,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,12119300.381,196592,283,196309,196592,283,196309,1031932,20,1031912
1,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",139,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,133,500,2100,DISABLED,ENABLED,133,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,133,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,35,29,16,N/A,157,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,12648636.191,196592,283,196309,196592,283,196309,1031932,20,1031912
2,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",133,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,32,29,16,N/A,106,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,12142639.892,196592,283,196309,196592,283,196309,1031932,20,1031912
3,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",132,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,36,28,16,N/A,192,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,12086086.983,196592,283,196309,196592,283,196309,1031932,20,1031912
4,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",136,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,133,500,2100,DISABLED,ENABLED,133,500,2100,DISABLED,ENABLED,134,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,36,29,16,N/A,145,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,12403534.5,196592,283,196309,196592,283,196309,1031932,20,1031912
5,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",132,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,35,29,16,N/A,107,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,12011883.234,196592,283,196309,196592,283,196309,1031932,20,1031912
6,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",132,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,131,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,36,29,16,N/A,94,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,11987029.516,196592,283,196309,196592,283,196309,1031932,20,1031912
7,0,0,N/A,"[0, 0, 0, 0]","[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",134,N/A,N/A,N/A,ENABLED,UNTHROTTLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,132,500,2100,DISABLED,ENABLED,900,900,1300,N/A,DISABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,29,914,1333,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,22,711,1143,N/A,ENABLED,N/A,37,31,16,N/A,90,0,1,0,0,0,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,AMDSMI_DEV_PERF_LEVEL_AUTO,N/A,12193331.537,196592,283,196309,196592,283,196309,1031932,20,1031912
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gpu,gfx_usage,mem_usage,mm_usage_list,fb_total,fb_used,gfx_cur_clk,mem_cur_clk,mm1_cur_clk,mm2_cur_clk
0,98,1,[0, 0],14928,363,N/A,N/A,N/A,N/A
Binary file not shown.
Loading
Loading