Browse Source

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)
master
Tanguy Pruvot 10 years ago
parent
commit
a35b150b7f
  1. 28
      JHA/jackpotcoin.cu
  2. 6
      cpu-miner.c

28
JHA/jackpotcoin.cu

@ -85,9 +85,6 @@ extern "C" unsigned int jackpothash(void *state, const void *input)
return round; return round;
} }
extern bool opt_benchmark;
extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce, const uint32_t *ptarget, uint32_t max_nonce,
unsigned long *hashes_done) 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]; const uint32_t first_nonce = pdata[19];
if (opt_benchmark) 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); throughput = min(throughput, max_nonce - first_nonce);
static bool init[8] = {0,0,0,0,0,0,0,0}; 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]); cudaSetDevice(device_map[thr_id]);
// Konstanten kopieren, Speicher belegen CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 16 * sizeof(uint32_t) * throughput));
cudaMalloc(&d_hash[thr_id], 16 * sizeof(uint32_t) * throughput);
jackpot_keccak512_cpu_init(thr_id, throughput); jackpot_keccak512_cpu_init(thr_id, throughput);
jackpot_compactTest_cpu_init(thr_id, throughput); jackpot_compactTest_cpu_init(thr_id, throughput);
quark_blake512_cpu_init(thr_id, throughput); quark_blake512_cpu_init(thr_id, throughput);
quark_groestl512_cpu_init(thr_id, throughput); quark_groestl512_cpu_init(thr_id, throughput);
quark_jh512_cpu_init(thr_id, throughput); quark_jh512_cpu_init(thr_id, throughput);
quark_skein512_cpu_init(thr_id, throughput); quark_skein512_cpu_init(thr_id, throughput);
cuda_check_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_branch1Nonces[thr_id], sizeof(uint32_t)*throughput*2);
cudaMalloc(&d_branch2Nonces[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); 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; 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)) { if ((vhash64[7]<=Htarg) && fulltest(vhash64, ptarget)) {
pdata[19] = foundNonce; 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); //applog(LOG_INFO, "GPU #%d: result for nonce $%08X does validate on CPU (%d rounds)!", thr_id, foundNonce, rounds);
return 1; return 1;
} else { } 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; 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; return 0;
} }

6
cpu-miner.c

@ -1087,12 +1087,10 @@ static void *miner_thread(void *userdata)
/* should not be set too high, /* should not be set too high,
else you can miss multiple nounces */ else you can miss multiple nounces */
switch (opt_algo) { switch (opt_algo) {
case ALGO_JACKPOT:
max64 = 0x1fffLL;
break;
case ALGO_BLAKECOIN: case ALGO_BLAKECOIN:
max64 = 0x3ffffffLL; max64 = 0x3ffffffLL;
break; break;
case ALGO_JACKPOT:
case ALGO_BLAKE: case ALGO_BLAKE:
/* based on the 750Ti hashrate (100kH) */ /* based on the 750Ti hashrate (100kH) */
max64 = 0x1ffffffLL; max64 = 0x1ffffffLL;
@ -1304,7 +1302,7 @@ continue_scan:
sprintf(s, thr_hashrates[thr_id] >= 1e6 ? "%.0f" : "%.2f", sprintf(s, thr_hashrates[thr_id] >= 1e6 ? "%.0f" : "%.2f",
1e-3 * thr_hashrates[thr_id]); 1e-3 * thr_hashrates[thr_id]);
applog(LOG_INFO, "GPU #%d: %s, %s kH/s", 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) { if (thr_id == opt_n_threads - 1) {
double hashrate = 0.; double hashrate = 0.;

Loading…
Cancel
Save