Skip to content

Commit

Permalink
Adds x16s to miner
Browse files Browse the repository at this point in the history
  • Loading branch information
a1i3nj03 committed Apr 10, 2018
1 parent 6b8a89d commit 08bc087
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 89 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ccminer_SOURCES = elist.h miner.h compat.h \
x13/hsr.cu x13/cuda_hsr_sm3.cu x13/sm3.c \
x15/x14.cu x15/x15.cu x15/cuda_x14_shabal512.cu x15/cuda_x14_shabal512_alexis.cu x15/cuda_x15_whirlpool.cu \
x15/whirlpool.cu x15/cuda_x15_whirlpool_sm3.cu \
x16r/x16r.cu x16r/cuda_x16_echo512.cu x16r/cuda_x16_fugue512.cu \
x16r/x16r.cu x16/x16s.cu x16r/cuda_x16_echo512.cu x16r/cuda_x16_fugue512.cu \
x16r/cuda_x16_shabal512.cu x16r/cuda_x16_simd512_80.cu \
x17/x17.cu x17/hmq17.cu x17/cuda_x17_haval256.cu x17/cuda_x17_sha512.cu \
x11/phi.cu x11/cuda_streebog_maxwell.cu \
Expand Down
2 changes: 2 additions & 0 deletions algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ enum sha_algos {
ALGO_X14,
ALGO_X15,
ALGO_X16R,
ALGO_X16S,
ALGO_X17,
ALGO_VANILLA,
ALGO_VELTOR,
Expand Down Expand Up @@ -130,6 +131,7 @@ static const char *algo_names[] = {
"x14",
"x15",
"x16r",
"x16s",
"x17",
"vanilla",
"veltor",
Expand Down
5 changes: 3 additions & 2 deletions api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ static void api()
char *wskey = NULL;
n = recv(c, &buf[0], SOCK_REC_BUFSZ, 0);

fail = SOCKETFAIL(n);
fail = SOCKETFAIL(n) || n < 0;
if (fail)
buf[0] = '\0';
else if (n > 0 && buf[n-1] == '\n') {
Expand All @@ -1261,7 +1261,8 @@ static void api()
if (n > 0 && buf[n-1] == '\r')
buf[n-1] = '\0';
}
buf[n] = '\0';
else
buf[n] = '\0';

//if (opt_debug && opt_protocol && n > 0)
// applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]);
Expand Down
20 changes: 13 additions & 7 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool use_colors = true;
int use_pok = 0;
static bool opt_background = false;
bool opt_quiet = false;
int opt_maxlograte = 5;//3;
int opt_maxlograte = 3;
static int opt_retries = -1;
static int opt_fail_pause = 30;
int opt_time_limit = -1;
Expand Down Expand Up @@ -301,6 +301,7 @@ Options:\n\
x14 X14\n\
x15 X15\n\
x16r X16R (Raven)\n\
x16s X16S\n\
x17 X17\n\
wildkeccak Boolberry\n\
zr5 ZR5 (ZiftrCoin)\n\
Expand Down Expand Up @@ -683,24 +684,25 @@ static void calc_network_diff(struct work *work)
int16_t shift = (swab32(nbits) & 0xff); // 0x1c = 28

uint64_t diffone = 0x0000FFFF00000000ull;
/*

double d = (double)0x0000ffff / (double)bits;

for (int m=shift; m < 29; m++) d *= 256.0;
for (int m=29; m < shift; m++) d /= 256.0;
*/

/*
uint32_t d = 0x0000ffff / bits;
for (int m = shift; m < 29; m++) d <<= 8;
for (int m = 29; m < shift; m++) d >>= 8;

*/
// if (opt_algo == ALGO_DECRED && shift == 28) d *= 256.0;
if (opt_debug_diff)
applog(LOG_DEBUG, "net diff: %u -> shift %u, bits %08x", d, shift, bits);
// applog(LOG_DEBUG, "net diff: %f -> shift %u, bits %08x", d, shift, bits);
// applog(LOG_DEBUG, "net diff: %u -> shift %u, bits %08x", d, shift, bits);
applog(LOG_DEBUG, "net diff: %f -> shift %u, bits %08x", d, shift, bits);

net_diff = (double)d;
net_diff = d;
// net_diff = (double)d;
}

/* decode data from getwork (wallets and longpoll pools) */
Expand Down Expand Up @@ -1755,6 +1757,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
// case ALGO_TIMETRAVEL:
// case ALGO_BITCORE:
case ALGO_X16R:
case ALGO_X16S:
work_set_target(work, sctx->job.diff / (256.0 * opt_difficulty));//(256.0 * opt_difficulty));
break;
#if 0
Expand Down Expand Up @@ -2503,6 +2506,9 @@ static void *miner_thread(void *userdata)
rc = scanhash_x15(thr_id, &work, max_nonce, &hashes_done);
break;
#endif
case ALGO_X16S:
rc = scanhash_x16s(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_X16R:
// try{
rc = scanhash_x16r(thr_id, &work, max_nonce, &hashes_done);
Expand Down
1 change: 1 addition & 0 deletions ccminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@
<CudaCompile Include="x16r\cuda_x16_fugue512.cu" />
<CudaCompile Include="x16r\cuda_x16_shabal512.cu" />
<CudaCompile Include="x16r\cuda_x16_simd512_80.cu" />
<CudaCompile Include="x16\x16s.cu" />
<CudaCompile Include="zr5.cu" />
<CudaCompile Include="heavy\cuda_blake512.cu">
</CudaCompile>
Expand Down
1 change: 1 addition & 0 deletions ccminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@
<Filter>Source Files\CUDA\x13</Filter>
</CudaCompile>
<CudaCompile Include="x13\cuda_x13_hamsi512_alexis.cu" />
<CudaCompile Include="x16\x16s.cu" />
</ItemGroup>
<ItemGroup>
<Image Include="res\ccminer.ico">
Expand Down
3 changes: 3 additions & 0 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ extern int scanhash_x15(int thr_id, struct work* work, uint32_t max_nonce, unsig


extern int scanhash_x16r(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_x16s(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_x17(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_zr5(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);

Expand Down Expand Up @@ -396,6 +397,7 @@ extern void free_x13(int thr_id);
extern void free_x14(int thr_id);
extern void free_x15(int thr_id);
extern void free_x16r(int thr_id);
extern void free_x16s(int thr_id);
extern void free_x17(int thr_id);
extern void free_zr5(int thr_id);
//extern void free_sha256d(int thr_id);
Expand Down Expand Up @@ -942,6 +944,7 @@ void x13hash(void *output, const void *input);
void x14hash(void *output, const void *input);
void x15hash(void *output, const void *input);
void x16r_hash(void *output, const void *input);
void x16s_hash(void *output, const void *input);
void x17hash(void *output, const void *input);
void wildkeccak_hash(void *output, const void *input, uint64_t* scratchpad, uint64_t ssize);
void zr5hash(void *output, const void *input);
Expand Down
3 changes: 3 additions & 0 deletions util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,9 @@ void print_hash_tests(void)
x16r_hash(&hash[0], &buf[0]);
printpfx("X16r", hash);

x16s_hash(&hash[0], &buf[0]);
printpfx("X16s", hash);

x17hash(&hash[0], &buf[0]);
printpfx("X17", hash);

Expand Down
Loading

0 comments on commit 08bc087

Please sign in to comment.