fix intel gpu debug (#231)
* fix intel debug * set path to the same --------- Co-authored-by: Meliox <na>
This commit is contained in:
parent
ac007f5f38
commit
edcd445e59
@ -5,7 +5,7 @@ use warnings;
|
||||
use Exporter 'import';
|
||||
|
||||
use PVE::PVEMod::Config qw(%config $process_type $pve_mod_working_dir);
|
||||
use PVE::PVEMod::Utils qw(debug check_executable setup_collector_signals safe_read_json safe_write_json);
|
||||
use PVE::PVEMod::Utils qw(debug check_executable setup_collector_signals safe_write_json);
|
||||
use PVE::PVEMod::Store qw(update_intel_gpu_rrd);
|
||||
|
||||
our @EXPORT_OK = qw(
|
||||
@ -19,30 +19,28 @@ our @EXPORT_OK = qw(
|
||||
|
||||
sub get_intel_gpu_devices {
|
||||
my @devices = ();
|
||||
my $fh;
|
||||
|
||||
# Parse: "card0 Intel Alderlake_n (Gen12) pci:vendor=8086,device=46D0,card=0"
|
||||
# or: "card0 Intel Alderlake_n (Gen12) pci:0000:00:02.0"
|
||||
|
||||
if ($config{debug}{intel_mode} && -f $config{debug}{intel_devices_file}) {
|
||||
debug(__LINE__, "Debug mode: reading Intel GPU devices from $config{debug}{intel_devices_file}");
|
||||
my $data = safe_read_json($config{debug}{intel_devices_file});
|
||||
if ($data && ref $data eq 'ARRAY') {
|
||||
for my $dev (@$data) {
|
||||
push @devices, {
|
||||
card => $dev->{card},
|
||||
name => $dev->{name},
|
||||
path => $dev->{path},
|
||||
drm_path => $dev->{drm_path},
|
||||
};
|
||||
debug(__LINE__, "Found Intel device (debug): $dev->{card} -> $dev->{name} ($dev->{path})");
|
||||
}
|
||||
} else {
|
||||
debug(__LINE__, "Failed to parse debug file $config{debug}{intel_devices_file}");
|
||||
my $file = $config{debug}{intel_devices_file};
|
||||
debug(__LINE__, "Debug mode: reading Intel GPU devices from $file");
|
||||
unless (open $fh, '<', $file) {
|
||||
debug(__LINE__, "Failed to open debug file $file: $!");
|
||||
return @devices;
|
||||
}
|
||||
} else {
|
||||
debug(__LINE__, "Getting Intel GPU devices");
|
||||
if (open my $fh, '-|', 'intel_gpu_top -L') {
|
||||
unless (open $fh, '-|', 'intel_gpu_top -L') {
|
||||
debug(__LINE__, "Failed to run intel_gpu_top -L: $!");
|
||||
return @devices;
|
||||
}
|
||||
}
|
||||
|
||||
while (<$fh>) {
|
||||
chomp;
|
||||
# Parse: "card0 Intel Alderlake_n (Gen12) pci:vendor=8086,device=46D0,card=0"
|
||||
# or: "card0 Intel Alderlake_n (Gen12) pci:0000:00:02.0"
|
||||
if (/^(card\d+)\s+(.+?)\s+(pci:[^\s]+)/) {
|
||||
my ($card, $name, $path) = ($1, $2, $3);
|
||||
push @devices, {
|
||||
@ -55,10 +53,6 @@ sub get_intel_gpu_devices {
|
||||
}
|
||||
}
|
||||
close $fh;
|
||||
} else {
|
||||
debug(__LINE__, "Failed to run intel_gpu_top -L: $!");
|
||||
}
|
||||
}
|
||||
|
||||
return @devices;
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@ our %config = (
|
||||
lm_sensors_mode => 0,
|
||||
lm_sensors_output_file => '/tmp/sensors-output.json',
|
||||
intel_mode => 0,
|
||||
intel_devices_file => '/tmp/intel-gpu-devices.json',
|
||||
intel_output_file => '/tmp/intel-gpu-output.json',
|
||||
intel_devices_file => '/tmp/intel-gpu-devices.txt',
|
||||
intel_output_file => '/tmp/intel-gpu-top-output.txt',
|
||||
nvidia_mode => 0,
|
||||
nvidia_devices_file => '/tmp/nvidia-smi-devices.csv',
|
||||
nvidia_output_file => '/tmp/nvidia-smi-output.csv',
|
||||
|
||||
@ -71,7 +71,7 @@ node_info_defaults() {
|
||||
ENABLE_UPS=0; UPS_DEVICE_NAME="ups@localhost"
|
||||
ENABLE_SYSTEM_INFO=0; SYSTEM_INFO_TYPE=1
|
||||
DEBUG_LM_SENSORS=0; DEBUG_LM_SENSORS_FILE="/tmp/sensors-output.json"
|
||||
DEBUG_INTEL=0; DEBUG_INTEL_FILE="/tmp/intel-gpu-devices.json"
|
||||
DEBUG_INTEL=0; DEBUG_INTEL_FILE="/tmp/intel-gpu-devices.txt"
|
||||
DEBUG_INTEL_OUTPUT_FILE="/tmp/intel-gpu-top-output.txt"
|
||||
DEBUG_NVIDIA=0; DEBUG_NVIDIA_OUTPUT_FILE="/tmp/nvidia-smi-output.csv"
|
||||
DEBUG_NVIDIA_DEVICES_FILE="/tmp/nvidia-smi-devices.csv"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user