@ -65,6 +65,8 @@ extern "C" void nist5hash(void *state, const void *input)
memcpy(state, hash, 32);
memcpy(state, hash, 32);
}
}
static bool init[8] = { 0 };
extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata,
extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce,
const uint32_t *ptarget, uint32_t max_nonce,
unsigned long *hashes_done)
unsigned long *hashes_done)
@ -77,18 +79,19 @@ extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata,
int throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*4096
int throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*4096
throughput = min(throughput, (int) (max_nonce - first_nonce));
throughput = min(throughput, (int) (max_nonce - first_nonce));
static bool init[8] = {0,0,0,0,0,0,0,0};
if (!init[thr_id])
if (!init[thr_id])
{
{
cudaSetDevice(device_map[thr_id]);
cudaSetDevice(device_map[thr_id]);
// Konstanten kopieren, Speicher belegen
// Konstanten kopieren, Speicher belegen
cudaMalloc(&d_hash[thr_id], 16 * sizeof(uint32_t) * throughput);
quark_blake512_cpu_init(thr_id, throughput);
quark_blake512_cpu_init(thr_id, throughput);
quark_groestl512_cpu_init(thr_id, throughput);
quark_groestl512_cpu_init(thr_id, throughput);
quark_jh512_cpu_init(thr_id, throughput);
quark_jh512_cpu_init(thr_id, throughput);
quark_keccak512_cpu_init(thr_id, throughput);
quark_keccak512_cpu_init(thr_id, throughput);
quark_skein512_cpu_init(thr_id, throughput);
quark_skein512_cpu_init(thr_id, throughput);
CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 16 * sizeof(uint32_t) * throughput));
cuda_check_cpu_init(thr_id, throughput);
cuda_check_cpu_init(thr_id, throughput);
init[thr_id] = true;
init[thr_id] = true;
}
}