Browse Source

api: add nvapi and nvml ids for C# tools

master
Tanguy Pruvot 10 years ago
parent
commit
e2ac7a2a75
  1. 5
      api.cpp
  2. 5
      miner.h
  3. 18
      nvml.cpp
  4. 1
      nvml.h

5
api.cpp

@ -232,6 +232,7 @@ static void gpuhwinfos(int gpu_id)
cgpu->gpu_fan = gpu_fanpercent(cgpu); cgpu->gpu_fan = gpu_fanpercent(cgpu);
cgpu->gpu_pstate = gpu_pstate(cgpu); cgpu->gpu_pstate = gpu_pstate(cgpu);
gpu_info(cgpu); gpu_info(cgpu);
gpu_nvids(cgpu);
#endif #endif
gpu_clocks(cgpu); 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;" snprintf(buf, sizeof(buf), "GPU=%d;BUS=%hd;CARD=%s;MEM=%lu;"
"TEMP=%.1f;FAN=%d;FREQ=%d;MEMFREQ=%d;PST=%s;" "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, gpu_id, cgpu->gpu_bus, card, cgpu->gpu_mem,
cgpu->gpu_temp, cgpu->gpu_fan, cgpu->gpu_clock, cgpu->gpu_memclock, 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); strcat(buffer, buf);
} }

5
miner.h

@ -385,9 +385,12 @@ struct cgpu_info {
double gpu_vddc; double gpu_vddc;
int16_t gpu_pstate; int16_t gpu_pstate;
int16_t gpu_bus; int16_t gpu_bus;
uint16_t gpu_vid; uint16_t gpu_vid;
uint16_t gpu_pid; uint16_t gpu_pid;
int8_t nvml_id;
int8_t nvapi_id;
char gpu_desc[64]; char gpu_desc[64];
}; };

18
nvml.cpp

@ -643,6 +643,24 @@ int gpu_info(struct cgpu_info *gpu)
return 0; 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 */ #endif /* USE_WRAPNVML */
int gpu_clocks(struct cgpu_info *gpu) int gpu_clocks(struct cgpu_info *gpu)

1
nvml.h

@ -140,6 +140,7 @@ unsigned int gpu_usage(struct cgpu_info *gpu);
int gpu_pstate(struct cgpu_info *gpu); int gpu_pstate(struct cgpu_info *gpu);
int gpu_busid(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); int gpu_info(struct cgpu_info *gpu);
#endif #endif

Loading…
Cancel
Save