Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

Commit

Permalink
api: report per thread cpu hash checks (ACC/REJ)
Browse files Browse the repository at this point in the history
+ update all algos for that...
  • Loading branch information
tpruvot committed Feb 7, 2017
1 parent 4da35e0 commit c66e862
Show file tree
Hide file tree
Showing 43 changed files with 122 additions and 30 deletions.
2 changes: 2 additions & 0 deletions Algo256/blake256.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions Algo256/blake2s.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down
2 changes: 2 additions & 0 deletions Algo256/bmw.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion Algo256/decred.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Algo256/keccak256.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion Algo256/vanilla.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion JHA/jackpotcoin.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 3 additions & 7 deletions api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions crypto/cryptolight.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down
6 changes: 5 additions & 1 deletion crypto/cryptonight.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down
4 changes: 4 additions & 0 deletions crypto/wildkeccak.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down
17 changes: 10 additions & 7 deletions groestlcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down
4 changes: 3 additions & 1 deletion heavy/heavy.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions lbry/lbry.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 2 additions & 0 deletions lyra2/lyra2RE.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions lyra2/lyra2REv2.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion myriadgroestl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions neoscrypt/neoscrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
Expand Down
2 changes: 2 additions & 0 deletions pentablake.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions quark/nist5.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions quark/quarkcoin.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions qubit/deep.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions qubit/luffa.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions qubit/qubit.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions sia/sia.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion skein.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion skein2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit c66e862

Please sign in to comment.