Browse Source

Dynamic intensity for GPUs should be calculated on a per device basis. Clean up the code to only calculate it if required as well.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
eaf1505381
  1. 26
      driver-opencl.c
  2. 4
      miner.h

26
driver-opencl.c

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

4
miner.h

@ -342,6 +342,10 @@ struct cgpu_info {
cl_uint vwidth; cl_uint vwidth;
size_t work_size; size_t work_size;
enum cl_kernels kernel; enum cl_kernels kernel;
struct timeval tv_gpustart;;
struct timeval tv_gpuend;
double gpu_ms_average;
#endif #endif
float temp; float temp;

Loading…
Cancel
Save