1
0
mirror of https://github.com/GOSTSec/ccminer synced 2025-01-10 14:57:53 +00:00

api: add nvapi and nvml ids for C# tools

This commit is contained in:
Tanguy Pruvot 2014-11-23 11:06:14 +01:00
parent aa74aa33e2
commit e2ac7a2a75
4 changed files with 26 additions and 3 deletions

View File

@ -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);
}

View File

@ -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];
};

View File

@ -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)

1
nvml.h
View File

@ -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