Browse Source

Handle intensity param in all algos

and add a check related to start/max nounce params
2upstream
Tanguy Pruvot 10 years ago
parent
commit
11c5ec810d
  1. 6
      JHA/jackpotcoin.cu
  2. 7
      blake32.cu
  3. 6
      cuda_nist5.cu
  4. 10
      heavy/heavy.cu
  5. 8
      keccak/keccak256.cu
  6. 3
      quark/animecoin.cu
  7. 4
      quark/quarkcoin.cu
  8. 3
      qubit/deep.cu
  9. 3
      qubit/doom.cu
  10. 5
      qubit/qubit.cu
  11. 4
      x11/fresh.cu
  12. 9
      x11/s3.cu
  13. 3
      x11/x11.cu
  14. 3
      x13/x13.cu
  15. 8
      x15/whirlpool.cu
  16. 8
      x15/x14.cu
  17. 8
      x15/x15.cu
  18. 7
      x17/x17.cu

6
JHA/jackpotcoin.cu

@ -97,9 +97,8 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, @@ -97,9 +97,8 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;
const uint32_t Htarg = ptarget[7];
const int throughput = 256*4096*4; // 100;
int throughput = opt_work_size ? opt_work_size : (1 << 22); // 256*4096*4
throughput = min(throughput, max_nonce - first_nonce);
static bool init[8] = {0,0,0,0,0,0,0,0};
if (!init[thr_id])
@ -212,6 +211,7 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, @@ -212,6 +211,7 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
{
unsigned int rounds;
uint32_t vhash64[8];
uint32_t Htarg = ptarget[7];
be32enc(&endiandata[19], foundNonce);
// diese jackpothash Funktion gibt die Zahl der Runden zurück

7
blake32.cu

@ -16,7 +16,6 @@ extern "C" { @@ -16,7 +16,6 @@ extern "C" {
/* threads per block and throughput (intensity) */
#define TPB 128
#define INTENSITY (1 << 20) // = 1048576 nonces per call
/* added in sph_blake.c */
extern "C" int blake256_rounds = 14;
@ -393,15 +392,15 @@ extern "C" int scanhash_blake256(int thr_id, uint32_t *pdata, const uint32_t *pt @@ -393,15 +392,15 @@ extern "C" int scanhash_blake256(int thr_id, uint32_t *pdata, const uint32_t *pt
{
const uint32_t first_nonce = pdata[19];
static bool init[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
uint64_t targetHigh = ((uint64_t*)ptarget)[3]; // 0x00000000.0fffffff
uint64_t targetHigh = ((uint64_t*)ptarget)[3];
uint32_t _ALIGN(64) endiandata[20];
#if PRECALC64
uint32_t _ALIGN(64) midstate[8];
#else
uint32_t crcsum;
#endif
/* todo: -i param */
uint32_t throughput = min(INTENSITY, max_nonce - first_nonce);
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 20); // 1048576 nonces per call
throughput = min(throughput, max_nonce - first_nonce);
int rc = 0;

6
cuda_nist5.cu

@ -77,9 +77,8 @@ extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata, @@ -77,9 +77,8 @@ extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata,
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x00FF;
const uint32_t Htarg = ptarget[7];
const int throughput = 256*4096; // 100;
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};
if (!init[thr_id])
@ -119,6 +118,7 @@ extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata, @@ -119,6 +118,7 @@ extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata,
if (foundNonce != 0xffffffff)
{
uint32_t vhash64[8];
uint32_t Htarg = ptarget[7];
be32enc(&endiandata[19], foundNonce);
nist5hash(vhash64, endiandata);

10
heavy/heavy.cu

@ -281,8 +281,10 @@ int scanhash_heavy_cpp(int thr_id, uint32_t *pdata, @@ -281,8 +281,10 @@ int scanhash_heavy_cpp(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce,
unsigned long *hashes_done, uint32_t maxvote, int blocklen)
{
const uint32_t first_nonce = pdata[19]; /* to check */
// CUDA will process thousands of threads.
const int throughput = 4096 * 128;
int throughput = opt_work_size ? opt_work_size : (1 << 19); // 128*4096
throughput = min(throughput, max_nonce - first_nonce);
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x000000ff;
@ -296,8 +298,6 @@ int scanhash_heavy_cpp(int thr_id, uint32_t *pdata, @@ -296,8 +298,6 @@ int scanhash_heavy_cpp(int thr_id, uint32_t *pdata,
int nrmCalls[6];
memset(nrmCalls, 0, sizeof(int) * 6);
uint32_t start_nonce = pdata[19];
// für jeden Hash ein individuelles Target erstellen basierend
// auf dem höchsten Bit, das in ptarget gesetzt ist.
int highbit = findhighbit(ptarget, 8);
@ -418,7 +418,7 @@ int scanhash_heavy_cpp(int thr_id, uint32_t *pdata, @@ -418,7 +418,7 @@ int scanhash_heavy_cpp(int thr_id, uint32_t *pdata,
}
else
{
*hashes_done = pdata[19] - start_nonce;
*hashes_done = pdata[19] - first_nonce;
rc = 1;
goto exit;
}
@ -432,7 +432,7 @@ emptyNonceVector: @@ -432,7 +432,7 @@ emptyNonceVector:
pdata[19] += throughput;
} while (pdata[19] < max_nonce && !work_restart[thr_id].restart);
*hashes_done = pdata[19] - start_nonce;
*hashes_done = pdata[19] - first_nonce;
exit:
cudaFreeHost(cpu_nonceVector);

8
keccak/keccak256.cu

@ -46,9 +46,8 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata, @@ -46,9 +46,8 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata,
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x000f;
const uint32_t Htarg = ptarget[7];
const int throughput = 256*256*8*8;
int throughput = opt_work_size ? opt_work_size : (1 << 22); // 256*256*8*8
throughput = min(throughput, max_nonce - first_nonce);
static bool init[8] = {0,0,0,0,0,0,0,0};
if (!init[thr_id]) {
@ -72,10 +71,9 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata, @@ -72,10 +71,9 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata,
uint32_t foundNonce = keccak256_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id], order++);
if (foundNonce != 0xffffffff)
{
uint32_t vhash64[8];
uint32_t Htarg = ptarget[7];
be32enc(&endiandata[19], foundNonce);
keccak256_hash(vhash64, endiandata);
if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {

3
quark/animecoin.cu

@ -170,7 +170,8 @@ extern "C" int scanhash_anime(int thr_id, uint32_t *pdata, @@ -170,7 +170,8 @@ extern "C" int scanhash_anime(int thr_id, uint32_t *pdata,
((uint32_t*)ptarget)[7] = 0x00000f;
const uint32_t Htarg = ptarget[7];
const int throughput = 256*2048; // 100;
int throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*2048*2
throughput = min(throughput, max_nonce - first_nonce);
static bool init[8] = {0,0,0,0,0,0,0,0};
if (!init[thr_id])

4
quark/quarkcoin.cu

@ -135,9 +135,11 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata, @@ -135,9 +135,11 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*4096; // 100;
static bool init[8] = {0,0,0,0,0,0,0,0};
int throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*4096
throughput = min(throughput, max_nonce - first_nonce);
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x00FF;

3
qubit/deep.cu

@ -60,9 +60,10 @@ extern "C" int scanhash_deep(int thr_id, uint32_t *pdata, @@ -60,9 +60,10 @@ extern "C" int scanhash_deep(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8*8;
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
throughput = min(throughput, max_nonce - first_nonce);
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;

3
qubit/doom.cu

@ -40,9 +40,10 @@ extern "C" int scanhash_doom(int thr_id, uint32_t *pdata, @@ -40,9 +40,10 @@ extern "C" int scanhash_doom(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8*8;
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
throughput = min(throughput, max_nonce - first_nonce);
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;

5
qubit/qubit.cu

@ -78,10 +78,11 @@ extern "C" int scanhash_qubit(int thr_id, uint32_t *pdata, @@ -78,10 +78,11 @@ extern "C" int scanhash_qubit(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8;
static bool init[8] = {0,0,0,0,0,0,0,0};
uint32_t endiandata[20];
const uint32_t first_nonce = pdata[19];
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;

4
x11/fresh.cu

@ -75,10 +75,12 @@ extern "C" int scanhash_fresh(int thr_id, uint32_t *pdata, @@ -75,10 +75,12 @@ extern "C" int scanhash_fresh(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8;
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 << 19); // 256*256*8;
throughput = min(throughput, max_nonce - first_nonce);
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x00ff;

9
x11/s3.cu

@ -57,14 +57,15 @@ extern "C" int scanhash_s3(int thr_id, uint32_t *pdata, @@ -57,14 +57,15 @@ extern "C" int scanhash_s3(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
static bool init[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
#ifdef WIN32
// reduce a bit the intensity on windows
const int throughput = 256 * 256 * 8;
int throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8;
#else
const int throughput = 256 * 256 * 8 * 2;
int throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*256*8*2;
#endif
static bool init[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
throughput = min(throughput, max_nonce - first_nonce);
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0xF;

3
x11/x11.cu

@ -138,8 +138,9 @@ extern "C" int scanhash_x11(int thr_id, uint32_t *pdata, @@ -138,8 +138,9 @@ extern "C" int scanhash_x11(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8;
static bool init[8] = {0,0,0,0,0,0,0,0};
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] = 0x0000f;

3
x13/x13.cu

@ -162,7 +162,8 @@ extern "C" int scanhash_x13(int thr_id, uint32_t *pdata, @@ -162,7 +162,8 @@ extern "C" int scanhash_x13(int thr_id, uint32_t *pdata,
const uint32_t Htarg = ptarget[7];
const int throughput = 256*256*8;
int throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8;
throughput = min(throughput, max_nonce - first_nonce);
static bool init[8] = {0,0,0,0,0,0,0,0};
if (!init[thr_id])

8
x15/whirlpool.cu

@ -56,13 +56,13 @@ extern "C" int scanhash_whc(int thr_id, uint32_t *pdata, @@ -56,13 +56,13 @@ extern "C" int scanhash_whc(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8;
static bool init[8] = {0,0,0,0,0,0,0,0};
uint32_t endiandata[20];
uint32_t Htarg = ptarget[7];
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] = Htarg = 0x0000ff;
((uint32_t*)ptarget)[7] = 0x0000ff;
if (!init[thr_id]) {
cudaSetDevice(device_map[thr_id]);
@ -91,8 +91,8 @@ extern "C" int scanhash_whc(int thr_id, uint32_t *pdata, @@ -91,8 +91,8 @@ extern "C" int scanhash_whc(int thr_id, uint32_t *pdata,
if (foundNonce != 0xffffffff)
{
uint32_t vhash64[8];
uint32_t Htarg = ptarget[7];
be32enc(&endiandata[19], foundNonce);
wcoinhash(vhash64, endiandata);
if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))

8
x15/x14.cu

@ -168,13 +168,14 @@ extern "C" int scanhash_x14(int thr_id, uint32_t *pdata, @@ -168,13 +168,14 @@ extern "C" int scanhash_x14(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8;
static bool init[8] = {0,0,0,0,0,0,0,0};
uint32_t endiandata[20];
uint32_t Htarg = ptarget[7];
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] = Htarg = 0xff;
((uint32_t*)ptarget)[7] = 0xff;
if (!init[thr_id])
{
@ -230,6 +231,7 @@ extern "C" int scanhash_x14(int thr_id, uint32_t *pdata, @@ -230,6 +231,7 @@ extern "C" int scanhash_x14(int thr_id, uint32_t *pdata,
uint32_t vhash64[8];
be32enc(&endiandata[19], foundNonce);
x14hash(vhash64, endiandata);
uint32_t Htarg = ptarget[7];
if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {
pdata[19] = foundNonce;
*hashes_done = foundNonce - first_nonce + 1;

8
x15/x15.cu

@ -177,13 +177,14 @@ extern "C" int scanhash_x15(int thr_id, uint32_t *pdata, @@ -177,13 +177,14 @@ extern "C" int scanhash_x15(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8;
static bool init[8] = {0,0,0,0,0,0,0,0};
uint32_t endiandata[20];
uint32_t Htarg = ptarget[7];
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] = Htarg = 0x00FF;
((uint32_t*)ptarget)[7] = 0x00FF;
if (!init[thr_id])
{
@ -241,6 +242,7 @@ extern "C" int scanhash_x15(int thr_id, uint32_t *pdata, @@ -241,6 +242,7 @@ extern "C" int scanhash_x15(int thr_id, uint32_t *pdata,
{
/* check now with the CPU to confirm */
uint32_t vhash64[8];
uint32_t Htarg = ptarget[7];
be32enc(&endiandata[19], foundNonce);
x15hash(vhash64, endiandata);
if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {

7
x17/x17.cu

@ -197,12 +197,12 @@ extern "C" int scanhash_x17(int thr_id, uint32_t *pdata, @@ -197,12 +197,12 @@ extern "C" int scanhash_x17(int thr_id, uint32_t *pdata,
unsigned long *hashes_done)
{
const uint32_t first_nonce = pdata[19];
const int throughput = 256*256*8;
static bool init[8] = {0,0,0,0,0,0,0,0};
uint32_t Htarg = ptarget[7];
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] = Htarg = 0x00FF;
((uint32_t*)ptarget)[7] = 0x00FF;
if (!init[thr_id])
{
@ -265,6 +265,7 @@ extern "C" int scanhash_x17(int thr_id, uint32_t *pdata, @@ -265,6 +265,7 @@ extern "C" int scanhash_x17(int thr_id, uint32_t *pdata,
if (foundNonce != 0xffffffff)
{
uint32_t vhash64[8];
uint32_t Htarg = ptarget[7];
be32enc(&endiandata[19], foundNonce);
x17hash(vhash64, endiandata);

Loading…
Cancel
Save