Skip to content

Commit

Permalink
fix quark and jackpot algos
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed May 14, 2017
1 parent 81d5f4e commit e584f28
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 16 deletions.
6 changes: 2 additions & 4 deletions JHA/jackpotcoin.cu
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ extern void jackpot_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32

extern uint32_t cuda_check_hash_branch(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_inputHash, int order);

// Original jackpothash Funktion aus einem miner Quelltext
extern "C" unsigned int jackpothash(void *state, const void *input)
// CPU HASH JHA v8
extern "C" void jackpothash(void *state, const void *input)
{
uint32_t hash[16];
unsigned int rnd;
Expand Down Expand Up @@ -71,8 +71,6 @@ extern "C" unsigned int jackpothash(void *state, const void *input)
}
}
memcpy(state, hash, 32);

return rnd;
}

static bool init[MAX_GPUS] = { 0 };
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ccminer_SOURCES = elist.h miner.h compat.h \
crypto/cryptolight.cu crypto/cryptolight-core.cu crypto/cryptolight-cpu.cpp \
crypto/cryptonight.cu crypto/cryptonight-core.cu crypto/cryptonight-extra.cu \
crypto/cryptonight-cpu.cpp crypto/oaes_lib.cpp crypto/aesb.cpp crypto/cpu/c_keccak.c \
JHA/jha.cu JHA/cuda_jha_keccak512.cu \
JHA/jha.cu JHA/jackpotcoin.cu JHA/cuda_jha_keccak512.cu \
JHA/cuda_jha_compactionTest.cu cuda_checkhash.cu \
quark/cuda_jh512.cu quark/cuda_quark_blake512.cu quark/cuda_quark_groestl512.cu quark/cuda_skein512.cu \
quark/cuda_bmw512.cu quark/cuda_quark_keccak512.cu \
Expand Down
6 changes: 4 additions & 2 deletions algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum sha_algos {
ALGO_HEAVY, /* Heavycoin hash */
ALGO_HMQ1725,
ALGO_KECCAK,
ALGO_JACKPOT,
ALGO_JHA,
ALGO_LBRY,
ALGO_LUFFA,
Expand Down Expand Up @@ -83,6 +84,7 @@ static const char *algo_names[] = {
"heavy",
"hmq1725",
"keccak",
"jackpot",
"jha",
"lbry",
"luffa",
Expand Down Expand Up @@ -151,8 +153,8 @@ static inline int algo_to_int(char* arg)
i = ALGO_LUFFA;
else if (!strcasecmp("hmq17", arg))
i = ALGO_HMQ1725;
else if (!strcasecmp("jackpot", arg))
i = ALGO_JHA;
//else if (!strcasecmp("jackpot", arg))
// i = ALGO_JHA;
else if (!strcasecmp("lyra2re", arg))
i = ALGO_LYRA2;
else if (!strcasecmp("lyra2rev2", arg))
Expand Down
2 changes: 1 addition & 1 deletion bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void algo_free_all(int thr_id)
free_groestlcoin(thr_id);
free_heavy(thr_id);
free_hmq17(thr_id);
//free_jackpot(thr_id);
free_jackpot(thr_id);
free_jha(thr_id);
free_lbry(thr_id);
free_luffa(thr_id);
Expand Down
11 changes: 9 additions & 2 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Options:\n\
groestl Groestlcoin\n\
heavy Heavycoin\n\
hmq1725 Doubloons / Espers\n\
jackpot Jackpot\n\
jha JHA v8 (JackpotCoin)\n\
keccak Keccak-256 (Maxcoin)\n\
lbry LBRY Credits (Sha/Ripemd)\n\
luffa Joincoin\n\
Expand Down Expand Up @@ -1612,6 +1612,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)

switch (opt_algo) {
case ALGO_HMQ1725:
case ALGO_JACKPOT:
case ALGO_JHA:
case ALGO_NEOSCRYPT:
case ALGO_SCRYPT:
Expand Down Expand Up @@ -2128,6 +2129,7 @@ static void *miner_thread(void *userdata)
case ALGO_C11:
case ALGO_DEEP:
case ALGO_HEAVY:
case ALGO_JACKPOT:
case ALGO_JHA:
case ALGO_LYRA2v2:
case ALGO_S3:
Expand Down Expand Up @@ -2269,9 +2271,14 @@ static void *miner_thread(void *userdata)
case ALGO_KECCAK:
rc = scanhash_keccak256(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_JACKPOT:
rc = scanhash_jackpot(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_JHA:
rc = scanhash_jha(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_LBRY:
rc = scanhash_lbry(thr_id, &work, max_nonce, &hashes_done);
break;
Expand Down Expand Up @@ -2426,7 +2433,7 @@ static void *miner_thread(void *userdata)
/* hashrate factors for some algos */
double rate_factor = 1.0;
switch (opt_algo) {
//case ALGO_JACKPOT:
case ALGO_JACKPOT:
case ALGO_QUARK:
// to stay comparable to other ccminer forks or pools
rate_factor = 0.5;
Expand Down
1 change: 1 addition & 0 deletions ccminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@
<CudaCompile Include="heavy\bastion.cu" />
<CudaCompile Include="heavy\cuda_bastion.cu" />
<CudaCompile Include="JHA\jha.cu" />
<CudaCompile Include="JHA\jackpotcoin.cu" />
<CudaCompile Include="JHA\cuda_jha_compactionTest.cu">
<AdditionalOptions>-Xptxas "-abi=yes" %(AdditionalOptions)</AdditionalOptions>
</CudaCompile>
Expand Down
3 changes: 3 additions & 0 deletions ccminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,9 @@
<CudaCompile Include="JHA\jha.cu">
<Filter>Source Files\CUDA\JHA</Filter>
</CudaCompile>
<CudaCompile Include="JHA\jackpotcoin.cu">
<Filter>Source Files\CUDA\JHA</Filter>
</CudaCompile>
<CudaCompile Include="cuda_myriadgroestl.cu">
<Filter>Source Files\CUDA</Filter>
</CudaCompile>
Expand Down
2 changes: 1 addition & 1 deletion miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ void fugue256_hash(unsigned char* output, const unsigned char* input, int len);
void heavycoin_hash(unsigned char* output, const unsigned char* input, int len);
void hmq17hash(void *output, const void *input);
void keccak256_hash(void *state, const void *input);
unsigned int jackpothash(void *state, const void *input);
void jackpothash(void *state, const void *input);
void groestlhash(void *state, const void *input);
void jha_hash(void *output, const void *input);
void lbry_hash(void *output, const void *input);
Expand Down
2 changes: 1 addition & 1 deletion quark/cuda_quark.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extern void quark_doublegroestl512_cpu_hash_64(int thr_id, uint32_t threads, uin
extern void quark_groestl512_cpu_free(int thr_id);

extern void quark_skein512_cpu_init(int thr_id, uint32_t threads);
extern void quark_skein512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_hash, int order);
extern void quark_skein512_cpu_hash_64(int thr_id, const uint32_t threads, const uint32_t startNonce, uint32_t *d_nonceVector, uint32_t *d_hash, int order);

extern void quark_keccak512_cpu_init(int thr_id, uint32_t threads);
extern void quark_keccak512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_hash, int order);
Expand Down
8 changes: 4 additions & 4 deletions quark/cuda_skein512.cu
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ __launch_bounds__(TPB52, 3)
#else
__launch_bounds__(TPB50, 5)
#endif
void quark_skein512_gpu_hash_64(const uint32_t threads,uint64_t* __restrict__ g_hash, const uint32_t *const __restrict__ g_nonceVector)
void quark_skein512_gpu_hash_64(const uint32_t threads, const uint32_t startNonce, uint64_t* __restrict__ g_hash, const uint32_t *const __restrict__ g_nonceVector)
{
const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x);

Expand All @@ -472,7 +472,7 @@ void quark_skein512_gpu_hash_64(const uint32_t threads,uint64_t* __restrict__ g_
// Skein
uint2 p[8], h[9];

const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread];
const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread] - startNonce;

uint64_t *Hash = &g_hash[hashPosition<<3];

Expand Down Expand Up @@ -756,15 +756,15 @@ void quark_skein512_gpu_hash_64(const uint32_t threads,uint64_t* __restrict__ g_

__host__
//void quark_skein512_cpu_hash_64(int thr_id,uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash)
void quark_skein512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_hash, int order)
void quark_skein512_cpu_hash_64(int thr_id, const uint32_t threads, const uint32_t startNonce, uint32_t *d_nonceVector, uint32_t *d_hash, int order)
{
uint32_t tpb = TPB52;
int dev_id = device_map[thr_id];

if (device_sm[dev_id] <= 500) tpb = TPB50;
const dim3 grid((threads + tpb-1)/tpb);
const dim3 block(tpb);
quark_skein512_gpu_hash_64 << <grid, block >> >(threads, (uint64_t*)d_hash, d_nonceVector);
quark_skein512_gpu_hash_64 <<<grid, block >>>(threads, startNonce, (uint64_t*)d_hash, d_nonceVector);

}

Expand Down

0 comments on commit e584f28

Please sign in to comment.