From 7a4e1bb32787cd5d912d2f4ce2a16ca476d164fc Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 10 Nov 2014 17:42:08 +0100 Subject: [PATCH] Reduce keccak, deep & anime intensity + handle groestl -i param default intensity was the max supported by the card, and perf is not really better. I prefer to let it one under for cards with lower memory (1GB) --- README.txt | 3 ++- cpu-miner.c | 6 ++++-- groestlcoin.cpp | 37 ++++++++++++++++++++++--------------- keccak/keccak256.cu | 4 ++-- quark/animecoin.cu | 2 +- qubit/deep.cu | 4 ++-- qubit/doom.cu | 2 +- 7 files changed, 34 insertions(+), 24 deletions(-) diff --git a/README.txt b/README.txt index e23306b..bea7d7c 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,5 @@ -ccMiner release 1.4.7-tpruvot (Nov 2014) - "Blake update" +ccMiner release 1.4.7-tpruvot (Nov 2014) - "Blake Intensity" --------------------------------------------------------------- *************************************************************** @@ -158,6 +158,7 @@ features. Rewrite blake algo Add the -i (gpu threads/intensity parameter) Add some X11 optimisations based on sp_ commits + Fix quark reported hashrate and benchmark mode for some algos Update windows prebuilt curl to 7.38.0 Oct. 26th 2014 v1.4.6 diff --git a/cpu-miner.c b/cpu-miner.c index 0aee756..8d3f632 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -1090,9 +1090,11 @@ static void *miner_thread(void *userdata) case ALGO_BLAKECOIN: max64 = 0x3ffffffLL; break; - case ALGO_JACKPOT: case ALGO_BLAKE: - /* based on the 750Ti hashrate (100kH) */ + case ALGO_DOOM: + case ALGO_JACKPOT: + case ALGO_KECCAK: + case ALGO_LUFFA_DOOM: max64 = 0x1ffffffLL; break; default: diff --git a/groestlcoin.cpp b/groestlcoin.cpp index d38f4c7..cde1c49 100644 --- a/groestlcoin.cpp +++ b/groestlcoin.cpp @@ -1,18 +1,25 @@ #include "uint256.h" #include "sph/sph_groestl.h" -#include "cpuminer-config.h" #include "miner.h" #include #include -#include "cuda_groestlcoin.h" +#include #include +#include "cuda_groestlcoin.h" + #define SWAP32(x) \ ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) | \ (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu)) +#ifdef _MSC_VER +#define MIN min +#else +#define MIN std::min +#endif + void sha256func(unsigned char *hash, const unsigned char *data, int len) { uint32_t S[16], T[16]; @@ -48,7 +55,6 @@ extern "C" void groestlhash(void *state, const void *input) //these uint512 in the c++ source of the client are backed by an array of uint32 uint32_t hashA[16], hashB[16]; - sph_groestl512_init(&ctx_groestl[0]); sph_groestl512 (&ctx_groestl[0], input, 80); //6 sph_groestl512_close(&ctx_groestl[0], hashA); //7 @@ -65,15 +71,15 @@ extern bool opt_benchmark; extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done) { - if (opt_benchmark) - ((uint32_t*)ptarget)[7] = 0x000000ff; - uint32_t start_nonce = pdata[19]++; - const uint32_t Htarg = ptarget[7]; - const uint32_t throughPut = 4096 * 128; - //const uint32_t throughPut = 1; + uint32_t throughPut = opt_work_size ? opt_work_size : (1 << 19); // 256*2048 + throughPut = MIN(throughPut, max_nonce - start_nonce); + uint32_t *outputHash = (uint32_t*)malloc(throughPut * 16 * sizeof(uint32_t)); + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0x000000ff; + // init static bool init[8] = { false, false, false, false, false, false, false, false }; if(!init[thr_id]) @@ -93,6 +99,7 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t do { // GPU uint32_t foundNounce = 0xFFFFFFFF; + const uint32_t Htarg = ptarget[7]; groestlcoin_cpu_hash(thr_id, throughPut, pdata[19], outputHash, &foundNounce); @@ -101,11 +108,11 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t uint32_t tmpHash[8]; endiandata[19] = SWAP32(foundNounce); groestlhash(tmpHash, endiandata); - if (tmpHash[7] <= Htarg && - fulltest(tmpHash, ptarget)) { - pdata[19] = foundNounce; - *hashes_done = foundNounce - start_nonce; - free(outputHash); + + if (tmpHash[7] <= Htarg && fulltest(tmpHash, ptarget)) { + pdata[19] = foundNounce; + *hashes_done = foundNounce - start_nonce + 1; + free(outputHash); return true; } else { applog(LOG_INFO, "GPU #%d: result for nonce $%08X does not validate on CPU!", thr_id, foundNounce); @@ -120,7 +127,7 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t } while (pdata[19] < max_nonce && !work_restart[thr_id].restart); - *hashes_done = pdata[19] - start_nonce; + *hashes_done = pdata[19] - start_nonce + 1; free(outputHash); return 0; } diff --git a/keccak/keccak256.cu b/keccak/keccak256.cu index 3d4c8cc..b95e984 100644 --- a/keccak/keccak256.cu +++ b/keccak/keccak256.cu @@ -44,9 +44,9 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata, const uint32_t first_nonce = pdata[19]; if (opt_benchmark) - ((uint32_t*)ptarget)[7] = 0x000f; + ((uint32_t*)ptarget)[7] = 0x0005; - int throughput = opt_work_size ? opt_work_size : (1 << 22); // 256*256*8*8 + int throughput = opt_work_size ? opt_work_size : (1 << 21); // 256*256*8*4 throughput = min(throughput, max_nonce - first_nonce); static bool init[8] = {0,0,0,0,0,0,0,0}; diff --git a/quark/animecoin.cu b/quark/animecoin.cu index b461e92..dc24bb3 100644 --- a/quark/animecoin.cu +++ b/quark/animecoin.cu @@ -170,7 +170,7 @@ extern "C" int scanhash_anime(int thr_id, uint32_t *pdata, ((uint32_t*)ptarget)[7] = 0x00000f; const uint32_t Htarg = ptarget[7]; - int throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*2048*2 + int throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*2048 throughput = min(throughput, max_nonce - first_nonce); static bool init[8] = {0,0,0,0,0,0,0,0}; diff --git a/qubit/deep.cu b/qubit/deep.cu index 538a851..44cff7c 100644 --- a/qubit/deep.cu +++ b/qubit/deep.cu @@ -62,11 +62,11 @@ extern "C" int scanhash_deep(int thr_id, uint32_t *pdata, const uint32_t first_nonce = pdata[19]; static bool init[8] = {0,0,0,0,0,0,0,0}; uint32_t endiandata[20]; - int throughput = opt_work_size ? opt_work_size : (1 << 22); // 256*256*8*8 + int throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8 throughput = min(throughput, max_nonce - first_nonce); if (opt_benchmark) - ((uint32_t*)ptarget)[7] = 0x0000ff; + ((uint32_t*)ptarget)[7] = 0x0000f; if (!init[thr_id]) { diff --git a/qubit/doom.cu b/qubit/doom.cu index f8254b3..4e40626 100644 --- a/qubit/doom.cu +++ b/qubit/doom.cu @@ -46,7 +46,7 @@ extern "C" int scanhash_doom(int thr_id, uint32_t *pdata, throughput = min(throughput, max_nonce - first_nonce); if (opt_benchmark) - ((uint32_t*)ptarget)[7] = 0x0000ff; + ((uint32_t*)ptarget)[7] = 0x0000f; if (!init[thr_id]) {