Browse Source

nvml: do average on milliwatts reading

and ignore nvapi percents in pool stats

also allow decimals in intensity
2upstream
Tanguy Pruvot 9 years ago
parent
commit
1c3a95213d
  1. 2
      api.cpp
  2. 5
      nvml.cpp
  3. 8
      util.cpp

2
api.cpp

@ -122,7 +122,7 @@ static void gpustatus(int thr_id)
cgpu->gpu_temp = gpu_temp(cgpu); cgpu->gpu_temp = gpu_temp(cgpu);
cgpu->gpu_fan = (uint16_t) gpu_fanpercent(cgpu); cgpu->gpu_fan = (uint16_t) gpu_fanpercent(cgpu);
cgpu->gpu_fan_rpm = (uint16_t) gpu_fanrpm(cgpu); cgpu->gpu_fan_rpm = (uint16_t) gpu_fanrpm(cgpu);
cgpu->gpu_power = gpu_power(cgpu); cgpu->gpu_power = gpu_power(cgpu); // mWatts
#endif #endif
cuda_gpu_clocks(cgpu); cuda_gpu_clocks(cgpu);

5
nvml.cpp

@ -1050,7 +1050,6 @@ int gpu_busid(struct cgpu_info *gpu)
return busid; return busid;
} }
/* not used in api (too much variable) */
unsigned int gpu_power(struct cgpu_info *gpu) unsigned int gpu_power(struct cgpu_info *gpu)
{ {
unsigned int mw = 0; unsigned int mw = 0;
@ -1065,6 +1064,10 @@ unsigned int gpu_power(struct cgpu_info *gpu)
mw = pct; // to fix mw = pct; // to fix
} }
#endif #endif
if (gpu->gpu_power > 0) {
// average
mw = (gpu->gpu_power + mw) / 2;
}
return mw; return mw;
} }

8
util.cpp

@ -1619,6 +1619,7 @@ static bool stratum_benchdata(json_t *result, json_t *params, int thr_id)
char vid[32], arch[8], driver[32]; char vid[32], arch[8], driver[32];
char *card; char *card;
char os[8]; char os[8];
uint32_t watts = 0;
int dev_id = device_map[thr_id]; int dev_id = device_map[thr_id];
int cuda_ver = cuda_version(); int cuda_ver = cuda_version();
struct cgpu_info *cgpu = &thr_info[thr_id].gpu; struct cgpu_info *cgpu = &thr_info[thr_id].gpu;
@ -1634,7 +1635,8 @@ static bool stratum_benchdata(json_t *result, json_t *params, int thr_id)
#ifdef USE_WRAPNVML #ifdef USE_WRAPNVML
cgpu->has_monitoring = true; cgpu->has_monitoring = true;
cgpu->gpu_power = gpu_power(cgpu); // Watts cgpu->gpu_power = gpu_power(cgpu); // mWatts
watts = (cgpu->gpu_power >= 1000) ? cgpu->gpu_power / 1000 : 0; // ignore nvapi %
gpu_info(cgpu); gpu_info(cgpu);
#endif #endif
cuda_gpu_clocks(cgpu); cuda_gpu_clocks(cgpu);
@ -1656,9 +1658,9 @@ static bool stratum_benchdata(json_t *result, json_t *params, int thr_id)
json_object_set_new(val, "arch", json_string(arch)); json_object_set_new(val, "arch", json_string(arch));
json_object_set_new(val, "freq", json_integer(cgpu->gpu_clock/1000)); json_object_set_new(val, "freq", json_integer(cgpu->gpu_clock/1000));
json_object_set_new(val, "memf", json_integer(cgpu->gpu_memclock/1000)); json_object_set_new(val, "memf", json_integer(cgpu->gpu_memclock/1000));
json_object_set_new(val, "power", json_integer(cgpu->gpu_power/1000)); json_object_set_new(val, "power", json_integer(watts));
json_object_set_new(val, "khashes", json_real(cgpu->khashes)); json_object_set_new(val, "khashes", json_real(cgpu->khashes));
json_object_set_new(val, "intensity", json_integer(cgpu->intensity)); json_object_set_new(val, "intensity", json_real(cgpu->intensity));
json_object_set_new(val, "throughput", json_integer(cgpu->throughput)); json_object_set_new(val, "throughput", json_integer(cgpu->throughput));
json_object_set_new(val, "client", json_string(PACKAGE_NAME "/" PACKAGE_VERSION)); json_object_set_new(val, "client", json_string(PACKAGE_NAME "/" PACKAGE_VERSION));
json_object_set_new(val, "os", json_string(os)); json_object_set_new(val, "os", json_string(os));

Loading…
Cancel
Save