From 7acf987aba1b78195a0daead7feb8bfda9af1221 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 10 Nov 2014 16:47:01 +0100 Subject: [PATCH] Add intensity to last algos and fix quark speed --- fuguecoin.cpp | 24 ++++++++++++++++-------- myriadgroestl.cpp | 25 +++++++++++++------------ pentablake.cu | 3 ++- quark/quarkcoin.cu | 6 +++--- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/fuguecoin.cpp b/fuguecoin.cpp index 9d58a55..eedd330 100644 --- a/fuguecoin.cpp +++ b/fuguecoin.cpp @@ -1,11 +1,11 @@ #include "uint256.h" #include "sph/sph_fugue.h" -#include "cpuminer-config.h" #include "miner.h" #include #include +#include #include extern "C" void my_fugue256_init(void *cc); @@ -24,8 +24,11 @@ extern "C" int scanhash_fugue256(int thr_id, uint32_t *pdata, const uint32_t *pt uint32_t max_nonce, unsigned long *hashes_done) { uint32_t start_nonce = pdata[19]++; - const uint32_t Htarg = ptarget[7]; - const uint32_t throughPut = 4096 * 128; + uint32_t throughPut = opt_work_size ? opt_work_size : (1 << 19); + throughPut = std::min(throughPut, max_nonce - start_nonce); + + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0xf; // init static bool init[8] = { false, false, false, false, false, false, false, false }; @@ -51,6 +54,8 @@ extern "C" int scanhash_fugue256(int thr_id, uint32_t *pdata, const uint32_t *pt if(foundNounce < 0xffffffff) { uint32_t hash[8]; + const uint32_t Htarg = ptarget[7]; + endiandata[19] = SWAP32(foundNounce); sph_fugue256_context ctx_fugue; sph_fugue256_init(&ctx_fugue); @@ -60,20 +65,23 @@ extern "C" int scanhash_fugue256(int thr_id, uint32_t *pdata, const uint32_t *pt if (hash[7] <= Htarg && fulltest(hash, ptarget)) { pdata[19] = foundNounce; - *hashes_done = foundNounce - start_nonce; + *hashes_done = foundNounce - start_nonce + 1; return 1; } else { applog(LOG_INFO, "GPU #%d: result for nonce $%08X does not validate on CPU!", thr_id, foundNounce); } } - if (pdata[19] + throughPut < pdata[19]) + if ((uint64_t) pdata[19] + throughPut > (uint64_t) max_nonce) { pdata[19] = max_nonce; - else pdata[19] += throughPut; + break; + } + + pdata[19] += throughPut; - } while (pdata[19] < max_nonce && !work_restart[thr_id].restart); + } while (!work_restart[thr_id].restart); - *hashes_done = pdata[19] - start_nonce; + *hashes_done = pdata[19] - start_nonce + 1; return 0; } diff --git a/myriadgroestl.cpp b/myriadgroestl.cpp index c689513..75da442 100644 --- a/myriadgroestl.cpp +++ b/myriadgroestl.cpp @@ -1,14 +1,12 @@ #include "uint256.h" #include "sph/sph_groestl.h" -#include "cpuminer-config.h" #include "miner.h" #include #include #include - -extern bool opt_benchmark; +#include void myriadgroestl_cpu_init(int thr_id, int threads); void myriadgroestl_cpu_setBlock(int thr_id, void *data, void *pTargetIn); @@ -44,15 +42,15 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar ((uint32_t*)ptarget)[7] = 0x000000ff; uint32_t start_nonce = pdata[19]++; - const uint32_t throughPut = 128 * 1024; + + uint32_t throughPut = opt_work_size ? opt_work_size : (1 << 17); + throughPut = std::min(throughPut, max_nonce - start_nonce); uint32_t *outputHash = (uint32_t*)malloc(throughPut * 16 * sizeof(uint32_t)); if (opt_benchmark) ((uint32_t*)ptarget)[7] = 0x0000ff; - const uint32_t Htarg = ptarget[7]; - // init static bool init[8] = { false, false, false, false, false, false, false, false }; if(!init[thr_id]) @@ -74,6 +72,7 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar do { // GPU uint32_t foundNounce = 0xFFFFFFFF; + const uint32_t Htarg = ptarget[7]; myriadgroestl_cpu_hash(thr_id, throughPut, pdata[19], outputHash, &foundNounce); @@ -85,7 +84,7 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar if (tmpHash[7] <= Htarg && fulltest(tmpHash, ptarget)) { pdata[19] = foundNounce; - *hashes_done = foundNounce - start_nonce; + *hashes_done = foundNounce - start_nonce + 1; free(outputHash); return true; } else { @@ -95,13 +94,15 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar foundNounce = 0xffffffff; } - if (pdata[19] + throughPut < pdata[19]) + if ((uint64_t) pdata[19] + throughPut > (uint64_t) max_nonce) { pdata[19] = max_nonce; - else pdata[19] += throughPut; + break; + } + pdata[19] += throughPut; - } while (pdata[19] < max_nonce && !work_restart[thr_id].restart); - - *hashes_done = pdata[19] - start_nonce; + } while (!work_restart[thr_id].restart); + + *hashes_done = pdata[19] - start_nonce + 1; free(outputHash); return 0; } diff --git a/pentablake.cu b/pentablake.cu index 344cbdd..1059f5a 100644 --- a/pentablake.cu +++ b/pentablake.cu @@ -496,9 +496,10 @@ extern "C" int scanhash_pentablake(int thr_id, uint32_t *pdata, const uint32_t * { const uint32_t first_nonce = pdata[19]; static bool init[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - uint32_t throughput = min(128 * 2560, max_nonce - first_nonce); uint32_t endiandata[20]; int rc = 0; + int throughput = opt_work_size ? opt_work_size : (128 * 2560); // 18.5 + throughput = min(throughput, max_nonce - first_nonce); if (extra_results[0] != MAXU) { // possible extra result found in previous call diff --git a/quark/quarkcoin.cu b/quark/quarkcoin.cu index 2604461..636b68e 100644 --- a/quark/quarkcoin.cu +++ b/quark/quarkcoin.cu @@ -141,7 +141,7 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata, throughput = min(throughput, max_nonce - first_nonce); if (opt_benchmark) - ((uint32_t*)ptarget)[7] = 0x00FF; + ((uint32_t*)ptarget)[7] = 0x00F; if (!init[thr_id]) { @@ -239,7 +239,7 @@ extern "C" int scanhash_quark(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; return 1; } else { applog(LOG_INFO, "GPU #%d: result for nonce $%08X does not validate on CPU!", thr_id, foundNonce); @@ -250,6 +250,6 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata, } while (pdata[19] < max_nonce && !work_restart[thr_id].restart); - *hashes_done = (pdata[19] - first_nonce + 1)/2; + *hashes_done = pdata[19] - first_nonce + 1; return 0; }