Browse Source

Add intensity to last algos and fix quark speed

2upstream
Tanguy Pruvot 10 years ago
parent
commit
7acf987aba
  1. 24
      fuguecoin.cpp
  2. 23
      myriadgroestl.cpp
  3. 3
      pentablake.cu
  4. 6
      quark/quarkcoin.cu

24
fuguecoin.cpp

@ -1,11 +1,11 @@
#include "uint256.h" #include "uint256.h"
#include "sph/sph_fugue.h" #include "sph/sph_fugue.h"
#include "cpuminer-config.h"
#include "miner.h" #include "miner.h"
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <algorithm>
#include <cuda_fugue256.h> #include <cuda_fugue256.h>
extern "C" void my_fugue256_init(void *cc); 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 max_nonce, unsigned long *hashes_done)
{ {
uint32_t start_nonce = pdata[19]++; uint32_t start_nonce = pdata[19]++;
const uint32_t Htarg = ptarget[7]; uint32_t throughPut = opt_work_size ? opt_work_size : (1 << 19);
const uint32_t throughPut = 4096 * 128; throughPut = std::min(throughPut, max_nonce - start_nonce);
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0xf;
// init // init
static bool init[8] = { false, false, false, false, false, false, false, false }; 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) if(foundNounce < 0xffffffff)
{ {
uint32_t hash[8]; uint32_t hash[8];
const uint32_t Htarg = ptarget[7];
endiandata[19] = SWAP32(foundNounce); endiandata[19] = SWAP32(foundNounce);
sph_fugue256_context ctx_fugue; sph_fugue256_context ctx_fugue;
sph_fugue256_init(&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)) if (hash[7] <= Htarg && fulltest(hash, ptarget))
{ {
pdata[19] = foundNounce; pdata[19] = foundNounce;
*hashes_done = foundNounce - start_nonce; *hashes_done = foundNounce - start_nonce + 1;
return 1; return 1;
} else { } else {
applog(LOG_INFO, "GPU #%d: result for nonce $%08X does not validate on CPU!", thr_id, foundNounce); 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; 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; return 0;
} }

23
myriadgroestl.cpp

@ -1,14 +1,12 @@
#include "uint256.h" #include "uint256.h"
#include "sph/sph_groestl.h" #include "sph/sph_groestl.h"
#include "cpuminer-config.h"
#include "miner.h" #include "miner.h"
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <openssl/sha.h> #include <openssl/sha.h>
#include <algorithm>
extern bool opt_benchmark;
void myriadgroestl_cpu_init(int thr_id, int threads); void myriadgroestl_cpu_init(int thr_id, int threads);
void myriadgroestl_cpu_setBlock(int thr_id, void *data, void *pTargetIn); 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*)ptarget)[7] = 0x000000ff;
uint32_t start_nonce = pdata[19]++; 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)); uint32_t *outputHash = (uint32_t*)malloc(throughPut * 16 * sizeof(uint32_t));
if (opt_benchmark) if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff; ((uint32_t*)ptarget)[7] = 0x0000ff;
const uint32_t Htarg = ptarget[7];
// init // init
static bool init[8] = { false, false, false, false, false, false, false, false }; static bool init[8] = { false, false, false, false, false, false, false, false };
if(!init[thr_id]) if(!init[thr_id])
@ -74,6 +72,7 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar
do { do {
// GPU // GPU
uint32_t foundNounce = 0xFFFFFFFF; uint32_t foundNounce = 0xFFFFFFFF;
const uint32_t Htarg = ptarget[7];
myriadgroestl_cpu_hash(thr_id, throughPut, pdata[19], outputHash, &foundNounce); 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 && if (tmpHash[7] <= Htarg &&
fulltest(tmpHash, ptarget)) { fulltest(tmpHash, ptarget)) {
pdata[19] = foundNounce; pdata[19] = foundNounce;
*hashes_done = foundNounce - start_nonce; *hashes_done = foundNounce - start_nonce + 1;
free(outputHash); free(outputHash);
return true; return true;
} else { } else {
@ -95,13 +94,15 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar
foundNounce = 0xffffffff; foundNounce = 0xffffffff;
} }
if (pdata[19] + throughPut < pdata[19]) if ((uint64_t) pdata[19] + throughPut > (uint64_t) max_nonce) {
pdata[19] = 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;
free(outputHash); free(outputHash);
return 0; return 0;
} }

3
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]; const uint32_t first_nonce = pdata[19];
static bool init[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 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]; uint32_t endiandata[20];
int rc = 0; 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) { if (extra_results[0] != MAXU) {
// possible extra result found in previous call // possible extra result found in previous call

6
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); throughput = min(throughput, max_nonce - first_nonce);
if (opt_benchmark) if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x00FF; ((uint32_t*)ptarget)[7] = 0x00F;
if (!init[thr_id]) 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)) { 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;
return 1; return 1;
} else { } else {
applog(LOG_INFO, "GPU #%d: result for nonce $%08X does not validate on CPU!", thr_id, foundNonce); 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); } 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; return 0;
} }

Loading…
Cancel
Save