From a35b150b7fc48a72665a3aacd71226d46a42ed99 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 10 Nov 2014 14:18:34 +0100 Subject: [PATCH] fix for jackpot hash max nounce was too low (bad cpu miner copy/paste i guess) hash speed was not right also... (was divided per 2) --- JHA/jackpotcoin.cu | 28 +++++++++++++++++----------- cpu-miner.c | 6 ++---- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/JHA/jackpotcoin.cu b/JHA/jackpotcoin.cu index 9050edb..faa7f93 100644 --- a/JHA/jackpotcoin.cu +++ b/JHA/jackpotcoin.cu @@ -85,9 +85,6 @@ extern "C" unsigned int jackpothash(void *state, const void *input) return round; } - -extern bool opt_benchmark; - extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done) @@ -95,9 +92,9 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, const uint32_t first_nonce = pdata[19]; if (opt_benchmark) - ((uint32_t*)ptarget)[7] = 0x0000ff; + ((uint32_t*)ptarget)[7] = 0x000f; - int throughput = opt_work_size ? opt_work_size : (1 << 22); // 256*4096*4 + int throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*4096 throughput = min(throughput, max_nonce - first_nonce); static bool init[8] = {0,0,0,0,0,0,0,0}; @@ -105,19 +102,23 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, { cudaSetDevice(device_map[thr_id]); - // Konstanten kopieren, Speicher belegen - cudaMalloc(&d_hash[thr_id], 16 * sizeof(uint32_t) * throughput); + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 16 * sizeof(uint32_t) * throughput)); + jackpot_keccak512_cpu_init(thr_id, throughput); jackpot_compactTest_cpu_init(thr_id, throughput); quark_blake512_cpu_init(thr_id, throughput); quark_groestl512_cpu_init(thr_id, throughput); quark_jh512_cpu_init(thr_id, throughput); quark_skein512_cpu_init(thr_id, throughput); + cuda_check_cpu_init(thr_id, throughput); - cudaMalloc(&d_jackpotNonces[thr_id], sizeof(uint32_t)*throughput*2); + cudaMalloc(&d_branch1Nonces[thr_id], sizeof(uint32_t)*throughput*2); cudaMalloc(&d_branch2Nonces[thr_id], sizeof(uint32_t)*throughput*2); cudaMalloc(&d_branch3Nonces[thr_id], sizeof(uint32_t)*throughput*2); + + CUDA_SAFE_CALL(cudaMalloc(&d_jackpotNonces[thr_id], sizeof(uint32_t)*throughput*2)); + init[thr_id] = true; } @@ -220,7 +221,7 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, if ((vhash64[7]<=Htarg) && fulltest(vhash64, ptarget)) { pdata[19] = foundNonce; - *hashes_done = (foundNonce - first_nonce + 1)/2; + *hashes_done = foundNonce - first_nonce + 1; //applog(LOG_INFO, "GPU #%d: result for nonce $%08X does validate on CPU (%d rounds)!", thr_id, foundNonce, rounds); return 1; } else { @@ -228,10 +229,15 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, } } + if ((uint64_t) pdata[19] + throughput > (uint64_t) max_nonce) { + pdata[19] = max_nonce; + break; + } + pdata[19] += throughput; - } while (pdata[19] < max_nonce && !work_restart[thr_id].restart); + } while (!work_restart[thr_id].restart); - *hashes_done = (pdata[19] - first_nonce + 1)/2; + *hashes_done = pdata[19] - first_nonce + 1; return 0; } diff --git a/cpu-miner.c b/cpu-miner.c index aa37c4f..0aee756 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -1087,12 +1087,10 @@ static void *miner_thread(void *userdata) /* should not be set too high, else you can miss multiple nounces */ switch (opt_algo) { - case ALGO_JACKPOT: - max64 = 0x1fffLL; - break; case ALGO_BLAKECOIN: max64 = 0x3ffffffLL; break; + case ALGO_JACKPOT: case ALGO_BLAKE: /* based on the 750Ti hashrate (100kH) */ max64 = 0x1ffffffLL; @@ -1304,7 +1302,7 @@ continue_scan: sprintf(s, thr_hashrates[thr_id] >= 1e6 ? "%.0f" : "%.2f", 1e-3 * thr_hashrates[thr_id]); applog(LOG_INFO, "GPU #%d: %s, %s kH/s", - device_map[thr_id], device_name[thr_id], s); + device_map[thr_id], device_name[device_map[thr_id]], s); } if (thr_id == opt_n_threads - 1) { double hashrate = 0.;