|
|
|
@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
|
|
|
|
|
#include <string.h> |
|
|
|
|
#include <stdint.h> |
|
|
|
|
#include <cuda_runtime.h> |
|
|
|
|
#include <openssl/sha.h> |
|
|
|
|
|
|
|
|
|
#include "uint256.h" |
|
|
|
@ -36,11 +37,11 @@ static bool init[MAX_GPUS] = { 0 };
@@ -36,11 +37,11 @@ static bool init[MAX_GPUS] = { 0 };
|
|
|
|
|
extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t *ptarget, |
|
|
|
|
uint32_t max_nonce, unsigned long *hashes_done) |
|
|
|
|
{ |
|
|
|
|
uint32_t start_nonce = pdata[19]++; |
|
|
|
|
uint32_t start_nonce = pdata[19]; |
|
|
|
|
uint32_t throughput = device_intensity(thr_id, __func__, 1 << 19); // 256*256*8
|
|
|
|
|
throughput = min(throughput, max_nonce - start_nonce); |
|
|
|
|
|
|
|
|
|
uint32_t *outputHash = (uint32_t*)malloc(throughput * 16 * sizeof(uint32_t)); |
|
|
|
|
uint32_t *outputHash = (uint32_t*)malloc(throughput * 64); |
|
|
|
|
|
|
|
|
|
if (opt_benchmark) |
|
|
|
|
((uint32_t*)ptarget)[7] = 0x000000ff; |
|
|
|
@ -48,6 +49,7 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t
@@ -48,6 +49,7 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t
|
|
|
|
|
// init
|
|
|
|
|
if(!init[thr_id]) |
|
|
|
|
{ |
|
|
|
|
cudaSetDevice(device_map[thr_id]); |
|
|
|
|
groestlcoin_cpu_init(thr_id, throughput); |
|
|
|
|
init[thr_id] = true; |
|
|
|
|
} |
|
|
|
@ -62,27 +64,25 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t
@@ -62,27 +64,25 @@ 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]; |
|
|
|
|
uint32_t foundNounce = UINT32_MAX; |
|
|
|
|
|
|
|
|
|
*hashes_done = pdata[19] - start_nonce + throughput; |
|
|
|
|
|
|
|
|
|
groestlcoin_cpu_hash(thr_id, throughput, pdata[19], outputHash, &foundNounce); |
|
|
|
|
|
|
|
|
|
if(foundNounce < 0xffffffff) |
|
|
|
|
if(foundNounce < UINT32_MAX) |
|
|
|
|
{ |
|
|
|
|
uint32_t tmpHash[8]; |
|
|
|
|
uint32_t _ALIGN(64) tmpHash[8]; |
|
|
|
|
endiandata[19] = SWAP32(foundNounce); |
|
|
|
|
groestlhash(tmpHash, endiandata); |
|
|
|
|
|
|
|
|
|
if (tmpHash[7] <= Htarg && fulltest(tmpHash, ptarget)) { |
|
|
|
|
if (tmpHash[7] <= ptarget[7] && fulltest(tmpHash, ptarget)) { |
|
|
|
|
pdata[19] = foundNounce; |
|
|
|
|
*hashes_done = foundNounce - start_nonce + 1; |
|
|
|
|
free(outputHash); |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
applog(LOG_WARNING, "GPU #%d: result for nonce %08x does not validate on CPU!", device_map[thr_id], foundNounce); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foundNounce = 0xffffffff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pdata[19] + throughput < pdata[19]) |
|
|
|
@ -91,7 +91,6 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t
@@ -91,7 +91,6 @@ 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 + 1; |
|
|
|
|
free(outputHash); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|