1
0
mirror of https://github.com/GOSTSec/ccminer synced 2025-03-09 12:01:09 +00:00

api: report per thread cpu hash checks (ACC/REJ)

+ update all algos for that...
This commit is contained in:
Tanguy Pruvot 2017-02-07 06:25:29 +01:00
parent 4da35e0bcf
commit c66e8622b3
43 changed files with 122 additions and 30 deletions

View File

@ -561,6 +561,8 @@ extern "C" int scanhash_blake256(int thr_id, struct work* work, uint32_t max_non
return work->valid_nonces;
}
else if (vhashcpu[6] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -529,8 +529,10 @@ extern "C" int scanhash_blake2s(int thr_id, struct work *work, uint32_t max_nonc
}
pdata[19] = max(work->nonces[0], work->nonces[1]); // next scan start
return rc;
} else if (vhashcpu[7] > ptarget[7]) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", resNonces[0]);
} else if (vhashcpu[6] > ptarget[6]) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", resNonces[0]);
}
}

View File

@ -100,6 +100,8 @@ extern "C" int scanhash_bmw(int thr_id, struct work* work, uint32_t max_nonce, u
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -435,13 +435,17 @@ extern "C" int scanhash_decred(int thr_id, struct work* work, uint32_t max_nonce
work->nonces[0], work->sharediff[0], n, work->nonces[1], work->sharediff[1]);
} else if (vhash[6] > ptarget[6]) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result %u for %08x does not validate on CPU!", n, resNonces[n]);
}
}
return work->valid_nonces;
} else if (vhash[6] > ptarget[6]) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", resNonces[1]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", resNonces[1]);
}
}
*pnonce += throughput;

View File

@ -91,6 +91,8 @@ extern "C" int scanhash_keccak256(int thr_id, struct work* work, uint32_t max_no
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -451,7 +451,9 @@ extern "C" int scanhash_vanilla(int thr_id, struct work* work, uint32_t max_nonc
return work->valid_nonces;
}
else if (vhashcpu[6] > Htarg) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]);
pdata[19] = work->nonces[0] + 1;
continue;
}

View File

@ -245,7 +245,9 @@ extern "C" int scanhash_jackpot(int thr_id, struct work *work, uint32_t max_nonc
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;
}

10
api.cpp
View File

@ -129,11 +129,6 @@ static void gpustatus(int thr_id)
cgpu->gpu_power = gpu_power(cgpu); // mWatts
cgpu->gpu_plimit = gpu_plimit(cgpu); // mW or %
#endif
// todo: per gpu
cgpu->accepted = p->accepted_count;
cgpu->rejected = p->rejected_count;
cgpu->khashes = stats_get_speed(thr_id, 0.0) / 1000.0;
if (cgpu->monitor.gpu_power) {
cgpu->gpu_power = cgpu->monitor.gpu_power;
@ -148,13 +143,14 @@ static void gpustatus(int thr_id)
"POWER=%u;FAN=%hu;RPM=%hu;"
"FREQ=%u;MEMFREQ=%u;GPUF=%u;MEMF=%u;"
"KHS=%.2f;KHW=%.5f;PLIM=%u;"
"HWF=%d;I=%.1f;THR=%u|",
"ACC=%u;REJ=%u;HWF=%u;I=%.1f;THR=%u|",
gpuid, cgpu->gpu_bus, card, cgpu->gpu_temp,
cgpu->gpu_power, cgpu->gpu_fan, cgpu->gpu_fan_rpm,
cgpu->gpu_clock/1000, cgpu->gpu_memclock/1000, // base freqs in MHz
cgpu->monitor.gpu_clock, cgpu->monitor.gpu_memclock, // current
cgpu->khashes, khashes_per_watt, cgpu->gpu_plimit,
cgpu->hw_errors, cgpu->intensity, cgpu->throughput);
cgpu->accepted, (unsigned) cgpu->rejected, (unsigned) cgpu->hw_errors,
cgpu->intensity, cgpu->throughput);
// append to buffer for multi gpus
strcat(buffer, buf);

View File

@ -2183,6 +2183,8 @@ static void *miner_thread(void *userdata)
if (err != cudaSuccess && !opt_quiet)
gpulog(LOG_WARNING, thr_id, "%s", cudaGetErrorString(err));
work.valid_nonces = 0;
/* scan nonces for a proof-of-work hash */
switch (opt_algo) {
@ -2447,6 +2449,8 @@ static void *miner_thread(void *userdata)
if (firstwork_time == 0)
firstwork_time = time(NULL);
if (cgpu) cgpu->accepted += work.valid_nonces;
/* if nonce found, submit work */
if (rc > 0 && !opt_benchmark) {
uint32_t curnonce = nonceptr[0]; // current scan position

View File

@ -119,12 +119,14 @@ extern "C" int scanhash_cryptolight(int thr_id, struct work* work, uint32_t max_
res++;
work->nonces[1] = resNonces[1];
} else if (vhash[7] > Htarg) {
gpulog(LOG_WARNING, thr_id, "result for second nonce %08x does not validate on CPU!", resNonces[1]);
gpu_increment_reject(thr_id);
}
}
goto done;
} else if (vhash[7] > Htarg) {
gpulog(LOG_WARNING, thr_id, "result for nonce %08x does not validate on CPU!", resNonces[0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for nonce %08x does not validate on CPU!", resNonces[0]);
}
}

View File

@ -135,11 +135,15 @@ extern "C" int scanhash_cryptonight(int thr_id, struct work* work, uint32_t max_
if(vhash[7] <= Htarg && fulltest(vhash, ptarget)) {
res++;
work->nonces[1] = resNonces[1];
} else {
gpu_increment_reject(thr_id);
}
}
goto done;
} else if (vhash[7] > Htarg) {
gpulog(LOG_WARNING, thr_id, "result for nonce %08x does not validate on CPU!", resNonces[0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for nonce %08x does not validate on CPU!", resNonces[0]);
}
}

View File

@ -318,6 +318,10 @@ extern "C" int scanhash_wildkeccak(int thr_id, struct work* work, uint32_t max_n
}
work->valid_nonces = 1;
return 1;
} else if (vhash[7] > ptarget[7]) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for nonce %08x does not validate on CPU!", h_retnonce[0]);
}
}

View File

@ -61,25 +61,28 @@ int scanhash_groestlcoin(int thr_id, struct work *work, uint32_t max_nonce, unsi
groestlcoin_cpu_setBlock(thr_id, endiandata, (void*)ptarget);
do {
uint32_t foundNounce = UINT32_MAX;
memset(work->nonces, 0xff, sizeof(work->nonces));
*hashes_done = pdata[19] - start_nonce + throughput;
// GPU hash
groestlcoin_cpu_hash(thr_id, throughput, pdata[19], &foundNounce);
groestlcoin_cpu_hash(thr_id, throughput, pdata[19], &work->nonces[0]);
if (foundNounce < UINT32_MAX && bench_algo < 0)
if (work->nonces[0] < UINT32_MAX && bench_algo < 0)
{
uint32_t _ALIGN(64) vhash[8];
endiandata[19] = swab32(foundNounce);
endiandata[19] = swab32(work->nonces[0]);
groestlhash(vhash, endiandata);
if (vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)) {
work->valid_nonces = 1;
work_set_target_ratio(work, vhash);
pdata[19] = foundNounce;
return true;
pdata[19] = work->nonces[0] + 1; // cursor
return work->valid_nonces;
} else if (vhash[7] > ptarget[7]) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNounce);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
}
}

View File

@ -296,7 +296,9 @@ int scanhash_heavy(int thr_id, struct work *work, uint32_t max_nonce, unsigned l
pdata[19] += nonce - pdata[19];
heavycoin_hash((uchar*)vhash, (uchar*)pdata, blocklen);
if (memcmp(vhash, foundhash, 32)) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", nonce);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", nonce);
} else {
work_set_target_ratio(work, vhash);
rc = 1;

View File

@ -201,6 +201,8 @@ extern "C" int scanhash_lbry(int thr_id, struct work *work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", resNonces[0]);
cudaMemset(d_resNonce[thr_id], 0xFF, 2 * sizeof(uint32_t));
}

View File

@ -155,6 +155,8 @@ extern "C" int scanhash_lyra2(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -162,6 +162,8 @@ extern "C" int scanhash_lyra2v2(int thr_id, struct work* work, uint32_t max_nonc
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -360,6 +360,7 @@ extern void free_scrypt_jane(int thr_id);
/* api related */
void *api_thread(void *userdata);
void api_set_throughput(int thr_id, uint32_t throughput);
void gpu_increment_reject(int thr_id);
struct monitor_info {
uint32_t gpu_temp;
@ -377,9 +378,9 @@ struct monitor_info {
struct cgpu_info {
uint8_t gpu_id;
uint8_t thr_id;
int accepted;
int rejected;
int hw_errors;
uint16_t hw_errors;
unsigned accepted;
uint32_t rejected;
double khashes;
int has_monitoring;
float gpu_temp;

View File

@ -94,7 +94,9 @@ int scanhash_myriad(int thr_id, struct work *work, uint32_t max_nonce, unsigned
return work->valid_nonces;
}
else if (vhash[7] > ptarget[7]) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;
}

View File

@ -86,6 +86,8 @@ int scanhash_neoscrypt(int thr_id, struct work* work, uint32_t max_nonce, unsign
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "nonce %08x does not validate on CPU!", work->nonces[0]);
}
}

View File

@ -123,6 +123,8 @@ extern "C" int scanhash_pentablake(int thr_id, struct work *work, uint32_t max_n
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -138,6 +138,8 @@ extern "C" int scanhash_nist5(int thr_id, struct work *work, uint32_t max_nonce,
goto out;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -289,6 +289,8 @@ extern "C" int scanhash_quark(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > ptarget[7]) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -120,6 +120,8 @@ extern "C" int scanhash_deep(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -96,6 +96,8 @@ extern "C" int scanhash_luffa(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -136,6 +136,8 @@ extern "C" int scanhash_qubit(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -244,6 +244,8 @@ int scanhash_sia(int thr_id, struct work *work, uint32_t max_nonce, unsigned lon
work->valid_nonces++;
pdata[8] = work->nonces[0] + 1;
}
} else {
gpu_increment_reject(thr_id);
}
if (work->nonces[1] != UINT32_MAX) {
@ -263,6 +265,8 @@ int scanhash_sia(int thr_id, struct work *work, uint32_t max_nonce, unsigned lon
work->valid_nonces++;
pdata[8] = work->nonces[1] + 1;
}
} else {
gpu_increment_reject(thr_id);
}
}
if (work->valid_nonces) {

View File

@ -439,7 +439,9 @@ extern "C" int scanhash_skeincoin(int thr_id, struct work* work, uint32_t max_no
return work->valid_nonces;
}
else if (vhash[7] > ptarget[7]) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;
}

View File

@ -110,7 +110,9 @@ int scanhash_skein2(int thr_id, struct work* work, uint32_t max_nonce, unsigned
return work->valid_nonces;
}
else if (vhash[7] > ptarget[7]) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;
}

View File

@ -1628,6 +1628,12 @@ static bool stratum_get_algo(struct stratum_ctx *sctx, json_t *id, json_t *param
extern char driver_version[32];
extern int cuda_arch[MAX_GPUS];
void gpu_increment_reject(int thr_id)
{
struct cgpu_info *gpu = &thr_info[thr_id].gpu;
if (gpu) gpu->rejected++;
}
static bool json_object_set_error(json_t *result, int code, const char *msg)
{
json_t *val = json_object();

View File

@ -204,6 +204,8 @@ extern "C" int scanhash_c11(int thr_id, struct work* work, uint32_t max_nonce, u
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -149,6 +149,8 @@ extern "C" int scanhash_fresh(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
}
}

View File

@ -142,6 +142,8 @@ extern "C" int scanhash_s3(int thr_id, struct work* work, uint32_t max_nonce, un
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -202,6 +202,7 @@ extern "C" int scanhash_sib(int thr_id, struct work* work, uint32_t max_nonce, u
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;

View File

@ -143,6 +143,7 @@ extern "C" int scanhash_veltor(int thr_id, struct work* work, uint32_t max_nonce
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[0]);
cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t));

View File

@ -192,6 +192,8 @@ extern "C" int scanhash_x11(int thr_id, struct work* work, uint32_t max_nonce, u
}
return work->valid_nonces;
} else {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -373,6 +373,8 @@ extern "C" int scanhash_x11evo(int thr_id, struct work* work, uint32_t max_nonce
}
return work->valid_nonces;
} else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -208,6 +208,8 @@ extern "C" int scanhash_x13(int thr_id, struct work* work, uint32_t max_nonce, u
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -127,6 +127,8 @@ extern "C" int scanhash_whirl(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -224,6 +224,8 @@ extern "C" int scanhash_x14(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -230,6 +230,8 @@ extern "C" int scanhash_x15(int thr_id, struct work* work, uint32_t max_nonce,
return work->valid_nonces;
}
else if (vhash[7] > Htarg) {
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[19] = work->nonces[0] + 1;
continue;

View File

@ -255,11 +255,13 @@ extern "C" int scanhash_x17(int thr_id, struct work* work, uint32_t max_nonce, u
}
else if (vhash[7] > Htarg) {
// x11+ coins could do some random error, but not on retry
gpu_increment_reject(thr_id);
if (!warn) {
warn++;
pdata[19] = work->nonces[0] + 1;
continue;
} else {
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
warn = 0;
}

4
zr5.cu
View File

@ -468,7 +468,9 @@ extern "C" int scanhash_zr5(int thr_id, struct work *work,
return work->valid_nonces;
}
else if (vhash[7] > ptarget[7]) {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
gpu_increment_reject(thr_id);
if (!opt_quiet)
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", work->nonces[0]);
pdata[0] = oldp0;
}
} else