Fixes when compiling with both NVML and DCGM.
NVML temp code updated (driver version ~555 and up)
This commit is contained in:
+9
-7
@@ -25,8 +25,8 @@ void print_nvml_clock_reason(int compact, struct card_info *card)
|
||||
unsigned long long reasons = get_nvml_clock_reasons(card);
|
||||
int single_reason = 1;
|
||||
|
||||
for (int i = 0; i < (sizeof(clock_reason_names) / sizeof(struct clock_reason)); i++) {
|
||||
if (reasons & clock_reason_names[i].mask) {
|
||||
for (int i = 0; i < (sizeof(nvml_clock_reason_names) / sizeof(struct clock_reason)); i++) {
|
||||
if (reasons & nvml_clock_reason_names[i].mask) {
|
||||
if (!single_reason) {
|
||||
if (compact)
|
||||
printf(",");
|
||||
@@ -36,9 +36,9 @@ void print_nvml_clock_reason(int compact, struct card_info *card)
|
||||
single_reason = 0;
|
||||
|
||||
if (compact)
|
||||
printf("%s", clock_reason_names[i].short_name);
|
||||
printf("%s", nvml_clock_reason_names[i].short_name);
|
||||
else
|
||||
printf("%s", clock_reason_names[i].long_name);
|
||||
printf("%s", nvml_clock_reason_names[i].long_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,13 +56,15 @@ unsigned int get_nvml_temp(struct card_info *card)
|
||||
if (card->nvml_device == NULL)
|
||||
return 0;
|
||||
|
||||
unsigned int temp;
|
||||
nvmlReturn_t result = nvmlDeviceGetTemperature(*(nvmlDevice_t*)(card->nvml_device), NVML_TEMPERATURE_GPU, &temp);
|
||||
nvmlTemperature_t temp;
|
||||
temp.version = nvmlTemperature_v1;
|
||||
temp.sensorType = NVML_TEMPERATURE_GPU;
|
||||
nvmlReturn_t result = nvmlDeviceGetTemperatureV(*(nvmlDevice_t*)(card->nvml_device), &temp);
|
||||
if (result != NVML_SUCCESS) {
|
||||
printf("Failed to get temperature for card at %s: %s\n", card->pci_id, nvmlErrorString(result));
|
||||
return 0;
|
||||
}
|
||||
return temp;
|
||||
return temp.temperature;
|
||||
}
|
||||
|
||||
unsigned long long get_nvml_clock_reasons(struct card_info *card)
|
||||
|
||||
Reference in New Issue
Block a user