Browse Source

Use the max_hashes variable to determine when to abandon work.

nfactor-troky
ckolivas 13 years ago
parent
commit
c531f1bd04
  1. 5
      cgminer.c
  2. 7
      device-gpu.c

5
cgminer.c

@ -3292,6 +3292,7 @@ void *miner_thread(void *userdata) @@ -3292,6 +3292,7 @@ void *miner_thread(void *userdata)
cycle = (can_roll(work) && should_roll(work)) ? 1 : def_cycle;
gettimeofday(&tv_workstart, NULL);
work->blk.nonce = 0;
cgpu->max_hashes = 0;
if (api->prepare_work && !api->prepare_work(mythr, work)) {
applog(LOG_ERR, "work prepare failed, exiting "
"mining thread %d", thr_id);
@ -3321,6 +3322,8 @@ void *miner_thread(void *userdata) @@ -3321,6 +3322,8 @@ void *miner_thread(void *userdata)
if (unlikely(!hashes))
goto out;
hashes_done += hashes;
if (hashes > cgpu->max_hashes)
cgpu->max_hashes = hashes;
gettimeofday(&tv_end, NULL);
timeval_subtract(&diff, &tv_end, &tv_start);
@ -3380,7 +3383,7 @@ void *miner_thread(void *userdata) @@ -3380,7 +3383,7 @@ void *miner_thread(void *userdata)
}
sdiff.tv_sec = sdiff.tv_usec = 0;
} while (!abandon_work(work, &wdiff, hashes));
} while (!abandon_work(work, &wdiff, cgpu->max_hashes));
}
out:

7
device-gpu.c

@ -1219,7 +1219,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, @@ -1219,7 +1219,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
}
set_threads_hashes(clState->preferred_vwidth, &threads, &hashes, globalThreads,
localThreads[0], gpu->intensity);
if (gpu->dynamic && hashes > gpu->max_hashes)
if (hashes > gpu->max_hashes)
gpu->max_hashes = hashes;
status = thrdata->queue_kernel_parameters(clState, &work->blk);
if (unlikely(status != CL_SUCCESS)) {
@ -1264,10 +1264,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, @@ -1264,10 +1264,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
/* The amount of work scanned can fluctuate when intensity changes
* and since we do this one cycle behind, we increment the work more
* than enough to prevent repeating work */
if (gpu->dynamic)
work->blk.nonce += gpu->max_hashes;
else
work->blk.nonce += hashes;
work->blk.nonce += gpu->max_hashes;
return hashes;
}

Loading…
Cancel
Save