mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-03 17:53:11 +00:00
Dynamic intensity for GPUs should be calculated on a per device basis. Clean up the code to only calculate it if required as well.
This commit is contained in:
parent
17ba2dca63
commit
eaf1505381
@ -1350,34 +1350,32 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
_clState *clState = clStates[thr_id];
|
_clState *clState = clStates[thr_id];
|
||||||
const cl_kernel *kernel = &clState->kernel;
|
const cl_kernel *kernel = &clState->kernel;
|
||||||
|
|
||||||
double gpu_ms_average = 7;
|
|
||||||
cl_int status;
|
cl_int status;
|
||||||
|
|
||||||
size_t globalThreads[1];
|
size_t globalThreads[1];
|
||||||
size_t localThreads[1] = { clState->wsize };
|
size_t localThreads[1] = { clState->wsize };
|
||||||
unsigned int threads;
|
unsigned int threads;
|
||||||
unsigned int hashes;
|
unsigned int hashes;
|
||||||
|
|
||||||
|
gettimeofday(&gpu->tv_gpustart, NULL);
|
||||||
struct timeval tv_gpustart, tv_gpuend, diff;
|
|
||||||
suseconds_t gpu_us;
|
|
||||||
|
|
||||||
gettimeofday(&tv_gpustart, NULL);
|
|
||||||
timeval_subtract(&diff, &tv_gpustart, &tv_gpuend);
|
|
||||||
/* This finish flushes the readbuffer set with CL_FALSE later */
|
/* This finish flushes the readbuffer set with CL_FALSE later */
|
||||||
clFinish(clState->commandQueue);
|
clFinish(clState->commandQueue);
|
||||||
gettimeofday(&tv_gpuend, NULL);
|
gettimeofday(&gpu->tv_gpuend, NULL);
|
||||||
timeval_subtract(&diff, &tv_gpuend, &tv_gpustart);
|
|
||||||
gpu_us = diff.tv_sec * 1000000 + diff.tv_usec;
|
|
||||||
decay_time(&gpu_ms_average, gpu_us / 1000);
|
|
||||||
if (gpu->dynamic) {
|
if (gpu->dynamic) {
|
||||||
|
struct timeval diff;
|
||||||
|
suseconds_t gpu_ms;
|
||||||
|
|
||||||
|
timersub(&gpu->tv_gpuend, &gpu->tv_gpustart, &diff);
|
||||||
|
gpu_ms = diff.tv_sec * 1000 + diff.tv_usec / 1000;
|
||||||
|
gpu->gpu_ms_average = (gpu->gpu_ms_average + gpu_ms * 0.63) / 1.63;
|
||||||
|
|
||||||
/* Try to not let the GPU be out for longer than 6ms, but
|
/* Try to not let the GPU be out for longer than 6ms, but
|
||||||
* increase intensity when the system is idle, unless
|
* increase intensity when the system is idle, unless
|
||||||
* dynamic is disabled. */
|
* dynamic is disabled. */
|
||||||
if (gpu_ms_average > opt_dynamic_interval) {
|
if (gpu->gpu_ms_average > opt_dynamic_interval) {
|
||||||
if (gpu->intensity > MIN_INTENSITY)
|
if (gpu->intensity > MIN_INTENSITY)
|
||||||
--gpu->intensity;
|
--gpu->intensity;
|
||||||
} else if (gpu_ms_average < ((opt_dynamic_interval / 2) ? : 1)) {
|
} else if (gpu->gpu_ms_average < ((opt_dynamic_interval / 2) ? : 1)) {
|
||||||
if (gpu->intensity < MAX_INTENSITY)
|
if (gpu->intensity < MAX_INTENSITY)
|
||||||
++gpu->intensity;
|
++gpu->intensity;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user