mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 14:04:25 +00:00
Optimise loop and make debug debug only.
This commit is contained in:
parent
fa4c10b1d9
commit
f05270b8c8
11
cpu-miner.c
11
cpu-miner.c
@ -814,26 +814,25 @@ static void *gpuminer_thread(void *userdata)
|
|||||||
BUFFERSIZE, res, 0, NULL, NULL);
|
BUFFERSIZE, res, 0, NULL, NULL);
|
||||||
if (unlikely(status != CL_SUCCESS))
|
if (unlikely(status != CL_SUCCESS))
|
||||||
{ applog(LOG_ERR, "Error: clEnqueueReadBuffer failed. (clEnqueueReadBuffer)"); goto out;}
|
{ applog(LOG_ERR, "Error: clEnqueueReadBuffer failed. (clEnqueueReadBuffer)"); goto out;}
|
||||||
for (i = 0; i < 128; i++) {
|
if (unlikely(res[127])) {
|
||||||
int found = false;
|
/* 127 is used as a flag to say nonces exist */
|
||||||
|
for (i = 0; i < 127; i++) {
|
||||||
if (res[i]) {
|
if (res[i]) {
|
||||||
uint32_t start = res[i];
|
uint32_t start = res[i];
|
||||||
uint32_t my_g, my_nonce;
|
uint32_t my_g, my_nonce;
|
||||||
|
|
||||||
applog(LOG_INFO, "GPU Found something?");
|
applog(LOG_INFO, "GPU Found something?");
|
||||||
my_g = postcalc_hash(mythr, &work->blk, work, start, start + 1026, &my_nonce, &h0count);
|
my_g = postcalc_hash(mythr, &work->blk, work, start, start + 1026, &my_nonce, &h0count);
|
||||||
found = true;
|
|
||||||
res[i] = 0;
|
res[i] = 0;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (found) {
|
|
||||||
/* Clear the buffer again */
|
/* Clear the buffer again */
|
||||||
status = clEnqueueWriteBuffer(clState->commandQueue, clState->outputBuffer, CL_TRUE, 0,
|
status = clEnqueueWriteBuffer(clState->commandQueue, clState->outputBuffer, CL_TRUE, 0,
|
||||||
BUFFERSIZE, res, 0, NULL, NULL);
|
BUFFERSIZE, res, 0, NULL, NULL);
|
||||||
if (unlikely(status != CL_SUCCESS))
|
if (unlikely(status != CL_SUCCESS))
|
||||||
{ applog(LOG_ERR, "Error: clEnqueueWriteBuffer failed."); goto out; }
|
{ applog(LOG_ERR, "Error: clEnqueueWriteBuffer failed."); goto out; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gettimeofday(&tv_end, NULL);
|
gettimeofday(&tv_end, NULL);
|
||||||
timeval_subtract(&diff, &tv_end, &tv_start);
|
timeval_subtract(&diff, &tv_end, &tv_start);
|
||||||
|
3
ocl.c
3
ocl.c
@ -308,7 +308,8 @@ _clState *initCl(int gpu, char *name, size_t nameSize) {
|
|||||||
/* copy over all of the generated binaries. */
|
/* copy over all of the generated binaries. */
|
||||||
binaries = (char **)malloc( sizeof(char *)*nDevices );
|
binaries = (char **)malloc( sizeof(char *)*nDevices );
|
||||||
for( i = 0; i < nDevices; i++ ) {
|
for( i = 0; i < nDevices; i++ ) {
|
||||||
printf("binary size %d : %d\n", i, binary_sizes[i]);
|
if (opt_debug)
|
||||||
|
applog(LOG_DEBUG, "binary size %d : %d\n", i, binary_sizes[i]);
|
||||||
if( binary_sizes[i] != 0 )
|
if( binary_sizes[i] != 0 )
|
||||||
binaries[i] = (char *)malloc( sizeof(char)*binary_sizes[i] );
|
binaries[i] = (char *)malloc( sizeof(char)*binary_sizes[i] );
|
||||||
else
|
else
|
||||||
|
@ -629,9 +629,10 @@ A = A + E;
|
|||||||
H = H + D;
|
H = H + D;
|
||||||
|
|
||||||
if (H==0xa41f32e7) {
|
if (H==0xa41f32e7) {
|
||||||
for (it = 0; it != 128; it++) {
|
for (it = 0; it != 127; it++) {
|
||||||
if (!output[it]) {
|
if (!output[it]) {
|
||||||
output[it] = tnonce;
|
output[it] = tnonce;
|
||||||
|
output[127] = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user