Browse Source

whirlpoolx: try to fix linux hashrates

bug reported by PVMining with a lot of cards (not seen here)
master
Tanguy Pruvot 10 years ago
parent
commit
10d4f4a96a
  1. 13
      ccminer.cpp
  2. 27
      x15/whirlpoolx.cu

13
ccminer.cpp

@ -1253,6 +1253,7 @@ static void *miner_thread(void *userdata) @@ -1253,6 +1253,7 @@ static void *miner_thread(void *userdata)
switch (opt_algo) {
case ALGO_BLAKECOIN:
case ALGO_BLAKE:
case ALGO_WHIRLPOOLX:
minmax = 0x80000000U;
break;
case ALGO_KECCAK:
@ -2235,14 +2236,10 @@ int main(int argc, char *argv[]) @@ -2235,14 +2236,10 @@ int main(int argc, char *argv[])
#else
printf(" Built with the nVidia CUDA SDK 6.5\n\n");
#endif
printf(" Originally based on pooler cpuminer,\n");
printf(" CUDA support by Christian Buchner and Christian H.\n");
printf(" Originally based on cudaminer by Christian Buchner and Christian H.,\n");
printf(" Include some of djm34 additions and sp optimisations\n");
printf("BTC donation address: 1AJdfCpLWPNoAMDfHF1wD5y8VgKSSTHxPo\n\n");
printf(" Whirlpoolx support by Provos Alexis.\n");
printf("VNL donation address: VrjvyQJ9d1Bfte5kVSA8qfZoYdN2C6weCG\n\n");
rpc_user = strdup("");
rpc_pass = strdup("");
rpc_url = strdup("");
@ -2290,6 +2287,12 @@ int main(int argc, char *argv[]) @@ -2290,6 +2287,12 @@ int main(int argc, char *argv[])
}
}
// extra credits..
if (opt_algo == ALGO_WHIRLPOOLX) {
printf(" Whirlpoolx support by Alexis Provos.\n");
printf("VNL donation address: VrjvyQJ9d1Bfte5kVSA8qfZoYdN2C6weCG\n\n");
}
if (!opt_benchmark && !strlen(rpc_url)) {
fprintf(stderr, "%s: no URL supplied\n", argv[0]);
show_usage_and_exit(1);

27
x15/whirlpoolx.cu

@ -39,11 +39,11 @@ extern "C" void whirlxHash(void *state, const void *input) @@ -39,11 +39,11 @@ extern "C" void whirlxHash(void *state, const void *input)
static bool init[MAX_GPUS] = { 0 };
extern "C" int scanhash_whirlpoolx(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
uint64_t n = first_nonce;
uint32_t endiandata[20];
uint32_t throughput = device_intensity(thr_id, __func__, 1U << 22);
throughput = min(throughput, max_nonce - first_nonce);
@ -67,12 +67,7 @@ extern "C" int scanhash_whirlpoolx(int thr_id, uint32_t *pdata, const uint32_t * @@ -67,12 +67,7 @@ extern "C" int scanhash_whirlpoolx(int thr_id, uint32_t *pdata, const uint32_t *
whirlpoolx_setBlock_80((void*)endiandata, ptarget);
whirlpoolx_precompute();
do {
uint32_t foundNonce = UINT32_MAX;
if((n+throughput) >= max_nonce) {
// Preventing glitch
throughput = (uint32_t) (max_nonce-n);
}
foundNonce = whirlpoolx_cpu_hash(thr_id, throughput, (uint32_t) n);
uint32_t foundNonce = whirlpoolx_cpu_hash(thr_id, throughput, pdata[19]);
if (foundNonce != UINT32_MAX)
{
const uint32_t Htarg = ptarget[7];
@ -81,10 +76,9 @@ extern "C" int scanhash_whirlpoolx(int thr_id, uint32_t *pdata, const uint32_t * @@ -81,10 +76,9 @@ extern "C" int scanhash_whirlpoolx(int thr_id, uint32_t *pdata, const uint32_t *
whirlxHash(vhash64, endiandata);
if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {
int res = 1;
*hashes_done = (unsigned long)(n - first_nonce + throughput);
*hashes_done = pdata[19] - first_nonce + throughput;
pdata[19] = foundNonce;
return res;
return 1;
}
else if (vhash64[7] > Htarg) {
applog(LOG_INFO, "GPU #%d: result for %08x is not in range: %x > %x", thr_id, foundNonce, vhash64[7], Htarg);
@ -93,9 +87,16 @@ extern "C" int scanhash_whirlpoolx(int thr_id, uint32_t *pdata, const uint32_t * @@ -93,9 +87,16 @@ extern "C" int scanhash_whirlpoolx(int thr_id, uint32_t *pdata, const uint32_t *
applog(LOG_INFO, "GPU #%d: result for %08x does not validate on CPU!", thr_id, foundNonce);
}
}
n += throughput;
} while (n < max_nonce && !work_restart[thr_id].restart);
*hashes_done = (unsigned long)(n - first_nonce);
pdata[19] += throughput;
if (((uint64_t)pdata[19]+throughput) >= max_nonce) {
break;
}
} while (!work_restart[thr_id].restart);
*(hashes_done) = pdata[19] - first_nonce + 1;
return 0;
}

Loading…
Cancel
Save