mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-10 23:08:02 +00:00
api: add nvapi and nvml ids for C# tools
This commit is contained in:
parent
aa74aa33e2
commit
e2ac7a2a75
5
api.cpp
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
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
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
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…
Reference in New Issue
Block a user