From 5fb84189b2297997676907e23f81af9313e9cad4 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Thu, 3 Dec 2015 14:14:25 +0100 Subject: [PATCH] nvml: fix possible mismatch of vendor names (x64) seen on a weird motherboard with a PCI Express Switch (MSI XPower Z87) On this motherboard, the first/top device pci id is the highest one... --- nvml.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nvml.cpp b/nvml.cpp index cc55bb5..9ece71a 100644 --- a/nvml.cpp +++ b/nvml.cpp @@ -935,7 +935,7 @@ int nvapi_init() if (ret == NVAPI_OK && busId == device_bus_ids[g]) { nvapi_dev_map[g] = i; if (opt_debug) - applog(LOG_DEBUG, "CUDA GPU#%d matches NVAPI GPU %d by busId %u", + applog(LOG_DEBUG, "CUDA GPU %d matches NVAPI GPU %d by busId %u", g, i, busId); break; } @@ -1099,7 +1099,7 @@ static int translate_vendor_id(uint16_t vid, char *vendorname) return vid; } } - if (opt_debug) + if (opt_debug && vid != 0x10DE) applog(LOG_DEBUG, "nvml: Unknown vendor %04x\n", vid); return 0; } @@ -1154,7 +1154,8 @@ int gpu_vendor(uint8_t pci_bus_id, char *vendorname) if (hnvml) { // may not be initialized on start... for (int id=0; id < hnvml->nvml_gpucount; id++) { if (hnvml->nvml_pci_bus_id[id] == pci_bus_id) { - nvml_get_info(hnvml, id, vid, pid); + int dev_id = hnvml->nvml_cuda_device_id[id]; + nvml_get_info(hnvml, dev_id, vid, pid); } } } else {