diff --git a/api.cpp b/api.cpp index a303ad2..cd3f3b0 100644 --- a/api.cpp +++ b/api.cpp @@ -232,6 +232,7 @@ static void gpuhwinfos(int gpu_id) cgpu->gpu_fan = gpu_fanpercent(cgpu); cgpu->gpu_pstate = gpu_pstate(cgpu); gpu_info(cgpu); + gpu_nvids(cgpu); #endif gpu_clocks(cgpu); @@ -244,10 +245,10 @@ static void gpuhwinfos(int gpu_id) snprintf(buf, sizeof(buf), "GPU=%d;BUS=%hd;CARD=%s;MEM=%lu;" "TEMP=%.1f;FAN=%d;FREQ=%d;MEMFREQ=%d;PST=%s;" - "VID=%hx;PID=%hx;BIOS=%s|", + "VID=%hx;PID=%hx;NVML=%d;NVAPI=%d;BIOS=%s|", gpu_id, cgpu->gpu_bus, card, cgpu->gpu_mem, cgpu->gpu_temp, cgpu->gpu_fan, cgpu->gpu_clock, cgpu->gpu_memclock, - pstate, cgpu->gpu_vid, cgpu->gpu_pid, cgpu->gpu_desc); + pstate, cgpu->gpu_vid, cgpu->gpu_pid, cgpu->nvml_id, cgpu->nvapi_id, cgpu->gpu_desc); strcat(buffer, buf); } diff --git a/miner.h b/miner.h index 4c84c87..3022dbe 100644 --- a/miner.h +++ b/miner.h @@ -385,9 +385,12 @@ struct cgpu_info { double gpu_vddc; int16_t gpu_pstate; int16_t gpu_bus; - uint16_t gpu_vid; uint16_t gpu_pid; + + int8_t nvml_id; + int8_t nvapi_id; + char gpu_desc[64]; }; diff --git a/nvml.cpp b/nvml.cpp index 07217aa..c44f75e 100644 --- a/nvml.cpp +++ b/nvml.cpp @@ -643,6 +643,24 @@ int gpu_info(struct cgpu_info *gpu) return 0; } +int gpu_nvids(struct cgpu_info *gpu) +{ + int id = gpu->gpu_id; + + gpu->nvml_id = -1; + gpu->nvapi_id = -1; + + if (id < 0) + return -1; + + if (hnvml && id < hnvml->nvml_gpucount) + gpu->nvml_id = (int8_t) hnvml->cuda_nvml_device_id[id]; +#ifdef WIN32 + gpu->nvapi_id = (int8_t) nvapi_dev_map[id]; +#endif + return 0; +} + #endif /* USE_WRAPNVML */ int gpu_clocks(struct cgpu_info *gpu) diff --git a/nvml.h b/nvml.h index 16f367d..6a60ab9 100644 --- a/nvml.h +++ b/nvml.h @@ -140,6 +140,7 @@ unsigned int gpu_usage(struct cgpu_info *gpu); int gpu_pstate(struct cgpu_info *gpu); int gpu_busid(struct cgpu_info *gpu); +int gpu_nvids(struct cgpu_info *gpu); int gpu_info(struct cgpu_info *gpu); #endif