Added support for reading VRAM and HotSpot temperatures.

This commit is contained in:
2025-02-03 06:15:26 -08:00
parent 54885e16f0
commit 8d4a8f7ee1
11 changed files with 200 additions and 34 deletions
+51 -5
View File
@@ -9,6 +9,10 @@
#include "nvidia-sensors.h"
#endif
#ifdef USE_LIBPCI
#include "gddr6.h"
#endif
#include "icx3.h"
#include "evga-card.h"
@@ -141,6 +145,12 @@ int main (int argc, char **argv)
#ifdef USE_NVML
init_nvml();
#endif
/* PCI init for VRAM/hotspot temps */
#ifdef USE_LIBPCI
for (int i = 0; i < gpu_count; i++)
init_gddr6(&gpus[i]);
#endif
/* print sensor info */
if (print_info) {
@@ -183,22 +193,58 @@ void print_gpu_info(int gpu_num, struct card_info *gpu, int compact) {
printf("#%d ", gpu_num);
print_icx3_fans_oneline(gpu);
printf(" GPU");
#ifdef USE_NVML
print_nvml_temp(1, gpu);
printf(" %3d", get_nvml_temp(gpu));
#endif
print_icx3_temps_oneline(gpu);
printf("°C");
float icx_temp_sensors[ICX3_NUM_TEMP_SENSORS] = {};
get_temp_sensors(icx_temp_sensors, gpu);
for (int i = 0; i < ICX3_NUM_TEMP_SENSORS; i++) {
if (i > 0 && strncmp(icx3_temp_sensor_names[i], icx3_temp_sensor_names[i-1], 3))
printf(" %.3s", icx3_temp_sensor_names[i]);
#ifdef USE_LIBPCI
if (strncmp(icx3_temp_sensor_names[i], "MEM1", 4) == 0)
printf(" %3.0f", get_vram_temp(gpu)); /* Print the VRAM temp before the rest of the memory sensors */
#endif
printf(" %3.0f", icx_temp_sensors[i]);
}
#ifdef USE_LIBPCI
printf(" HOT %3.0f", get_hotspot_temp(gpu));
#endif
printf("°C ");
#ifdef USE_NVML
print_nvml_clock_reason(1, gpu);
#endif
} else {
/* One line per GPU sensor */
printf("#%d: %s (%s) @ %s\n", gpu_num, gpu->card_name, gpu->i2c_dev_path, gpu->pci_id);
print_icx3_fans(gpu);
#ifdef USE_NVML
print_nvml_temp(0, gpu);
printf("GPU1: %+d°C\n", get_nvml_temp(gpu));
#endif
print_icx3_temps(gpu);
float icx_temp_sensors[ICX3_NUM_TEMP_SENSORS] = {};
get_temp_sensors(icx_temp_sensors, gpu);
for (int i = 0; i < ICX3_NUM_TEMP_SENSORS; i++) {
#ifdef USE_LIBPCI
if (strncmp(icx3_temp_sensor_names[i], "MEM1", 4) == 0)
printf("VRAM: +%.0f°C\n", get_vram_temp(gpu)); /* Print the VRAM temp before the rest of the memory sensors */
#endif
printf("%s: %+.1f°C\n",
icx3_temp_sensor_names[i],
icx_temp_sensors[i]);
}
#ifdef USE_LIBPCI
printf("HotSpot: +%.0f°C\n", get_hotspot_temp(gpu));
#endif
#ifdef USE_NVML
print_nvml_clock_reason(0, gpu);
#endif