From f73f5f6a2ebe7b8f5b0488f4cb2e921adb92da6f Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 23 Jun 2015 14:36:32 +0200 Subject: [PATCH] nvml: use the right nvmlDeviceGetPciInfo_v2 api so... pciutils branch is no more required on windows :p --- ccminer.cpp | 1 + nvml.cpp | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ccminer.cpp b/ccminer.cpp index 84fc3cf..010886a 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -3231,6 +3231,7 @@ int main(int argc, char *argv[]) /* nvml is currently not the best choice on Windows (only in x64) */ hnvml = nvml_create(); if (hnvml) { + cuda_devicenames(); // refresh gpu vendor name applog(LOG_INFO, "NVML GPU monitoring enabled."); for (int n=0; n < opt_n_threads; n++) { if (nvml_set_clocks(hnvml, device_map[n]) == 1) diff --git a/nvml.cpp b/nvml.cpp index 1ace9b6..38b91e8 100644 --- a/nvml.cpp +++ b/nvml.cpp @@ -147,7 +147,7 @@ nvml_handle * nvml_create() nvmlh->nvmlDeviceGetClockInfo = (nvmlReturn_t (*)(nvmlDevice_t, nvmlClockType_t, unsigned int *clock)) wrap_dlsym(nvmlh->nvml_dll, "nvmlDeviceGetClockInfo"); nvmlh->nvmlDeviceGetPciInfo = (nvmlReturn_t (*)(nvmlDevice_t, nvmlPciInfo_t *)) - wrap_dlsym(nvmlh->nvml_dll, "nvmlDeviceGetPciInfo"); + wrap_dlsym(nvmlh->nvml_dll, "nvmlDeviceGetPciInfo_v2"); nvmlh->nvmlDeviceGetName = (nvmlReturn_t (*)(nvmlDevice_t, char *, int)) wrap_dlsym(nvmlh->nvml_dll, "nvmlDeviceGetName"); nvmlh->nvmlDeviceGetTemperature = (nvmlReturn_t (*)(nvmlDevice_t, int, unsigned int *)) @@ -232,7 +232,7 @@ nvml_handle * nvml_create() nvmlh->nvml_pci_domain_id[i] = pciinfo.domain; nvmlh->nvml_pci_bus_id[i] = pciinfo.bus; nvmlh->nvml_pci_device_id[i] = pciinfo.device; - nvmlh->nvml_pci_subsys_id[i] = pciinfo.pci_device_id; /* pci_subsystem_id broken (0xccccccccc) */ + nvmlh->nvml_pci_subsys_id[i] = pciinfo.pci_subsystem_id; nvmlh->app_clocks[i] = NVML_FEATURE_UNKNOWN; if (nvmlh->nvmlDeviceSetAPIRestriction) { @@ -890,11 +890,6 @@ unsigned int gpu_power(struct cgpu_info *gpu) static int translate_vendor_id(uint16_t vid, char *vendorname) { - bool identified = false; - - if (!vendorname) - return -EINVAL; - struct VENDORS { const uint16_t vid; const char *name; @@ -908,13 +903,16 @@ static int translate_vendor_id(uint16_t vid, char *vendorname) { 0, "" } }; + if (!vendorname) + return -EINVAL; + for(int v=0; v < ARRAY_SIZE(vendors); v++) { if (vid == vendors[v].vid) { strcpy(vendorname, vendors[v].name); return vid; } } - if (!identified && opt_debug) + if (opt_debug) applog(LOG_DEBUG, "nvml: Unknown vendor %04x\n", vid); return 0; }