Skip to content

Commit

Permalink
handle cryptonight light variant
Browse files Browse the repository at this point in the history
Signed-off-by: Tanguy Pruvot <[email protected]>
  • Loading branch information
tpruvot committed Jan 9, 2017
1 parent 39aad5a commit 93adb56
Show file tree
Hide file tree
Showing 20 changed files with 905 additions and 55 deletions.
8 changes: 6 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ ccminer_SOURCES = elist.h miner.h compat.h \
Algo256/blake2s.cu sph/blake2s.c \
Algo256/bmw.cu Algo256/cuda_bmw.cu \
crypto/xmr-rpc.cpp crypto/wildkeccak-cpu.cpp crypto/wildkeccak.cu \
crypto/cryptonight.cu crypto/cuda_cryptonight_core.cu crypto/cuda_cryptonight_extra.cu \
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/jackpotcoin.cu JHA/cuda_jha_keccak512.cu \
JHA/cuda_jha_compactionTest.cu cuda_checkhash.cu \
Expand Down Expand Up @@ -107,7 +108,10 @@ Algo256/blake256.o: Algo256/blake256.cu
Algo256/cuda_bmw.o: Algo256/cuda_bmw.cu
$(NVCC) $(nvcc_FLAGS) --maxrregcount=76 -o $@ -c $<

crypto/cuda_cryptonight_extra.o: crypto/cuda_cryptonight_extra.cu
crypto/cryptonight-core.o: crypto/cryptonight-core.cu
$(NVCC) $(nvcc_FLAGS) --maxrregcount=64 -o $@ -c $<

crypto/cryptonight-extra.o: crypto/cryptonight-extra.cu
$(NVCC) $(nvcc_FLAGS) -o $@ -c $<

heavy/cuda_hefty1.o: heavy/cuda_hefty1.cu
Expand Down
17 changes: 13 additions & 4 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

ccminer 2.0 (December 2016) "Boolberry's WildKeccak RPC 2.0"
ccminer 2.0 (January 2016) "Cryptonight & other RPC 2.0 algos"
---------------------------------------------------------------

***************************************************************
Expand All @@ -8,8 +8,12 @@ If you find this tool useful and like to support its continuous

tpruvot@github:
BTC : 1AJdfCpLWPNoAMDfHF1wD5y8VgKSSTHxPo
DRK : XeVrkPrWB7pDbdFLfKhF1Z3xpqhsx6wkH3
ZRC : ZEcubH2xp2mpuwxMjy7wZThr5AzLGu3mqT
DCR : DsUCcACGcyP8McNMRXQwbtpDxaVUYLDQDeU
LBC : bKe6pLqELL3HHSbpJXxSdn5RrY2bfrkRhF

Alexis:
BTC : 14EgXD7fPYD4sHBXWUi46VeiTVXNq765B8
XVC : Vr5oCen8NrY6ekBWFaaWjCUFBH4dyiS57W

DJM34:
BTC donation address: 1NENYmxwZGHsKFmyjTc5WferTn5VTFb7Ze
Expand Down Expand Up @@ -52,6 +56,8 @@ Vanilla (Blake256 8-rounds - double sha256)
Vertcoin Lyra2RE
Ziftrcoin (ZR5)
Boolberry (Wild Keccak)
Monero (Cryptonight)
Aeon (Cryptonight-light)

where some of these coins have a VERY NOTABLE nVidia advantage
over competing AMD (OpenCL Only) implementations.
Expand All @@ -74,6 +80,8 @@ its command line interface and options.
blakecoin use to mine Old Blake 256
blake2s use to mine Nevacoin (Blake2-S 256)
bmw use to mine Midnight
cryptolight use to mine AEON cryptonight (MEM/2)
cryptonight use to mine XMR cryptonight
c11/flax use to mine Chaincoin and Flax
decred use to mine Decred 180 bytes Blake256-14
deep use to mine Deepcoin
Expand Down Expand Up @@ -186,9 +194,10 @@ Scrypt specific options:
--no-autotune disable auto-tuning of kernel launch parameters


Boolberry specific:
XMR and Wildkeccak specific:
-l, --launch-config gives the launch configuration for each kernel
in a comma separated list, one per device.
Wildkeccak specific:
-k, --scratchpad url Url used to download the scratchpad cache.


Expand Down
4 changes: 4 additions & 0 deletions algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum sha_algos {
ALGO_BLAKE2S,
ALGO_BMW,
ALGO_C11,
ALGO_CRYPTOLIGHT,
ALGO_CRYPTONIGHT,
ALGO_DEEP,
ALGO_DECRED,
Expand Down Expand Up @@ -63,6 +64,7 @@ static const char *algo_names[] = {
"blake2s",
"bmw",
"c11",
"cryptolight",
"cryptonight",
"deep",
"decred",
Expand Down Expand Up @@ -123,6 +125,8 @@ static inline int algo_to_int(char* arg)
// some aliases...
if (!strcasecmp("all", arg))
i = ALGO_AUTO;
else if (!strcasecmp("cryptonight-light", arg))
i = ALGO_CRYPTOLIGHT;
else if (!strcasecmp("flax", arg))
i = ALGO_C11;
else if (!strcasecmp("diamond", arg))
Expand Down
1 change: 1 addition & 0 deletions bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void algo_free_all(int thr_id)
free_blake2s(thr_id);
free_bmw(thr_id);
free_c11(thr_id);
free_cryptolight(thr_id);
free_cryptonight(thr_id);
free_decred(thr_id);
free_deep(thr_id);
Expand Down
18 changes: 13 additions & 5 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ Options:\n\
blake2s Blake2-S 256 (NEVA)\n\
blakecoin Fast Blake 256 (8 rounds)\n\
bmw BMW 256\n\
cryptolight AEON cryptonight (MEM/2)\n\
cryptonight XMR cryptonight\n\
c11/flax X11 variant\n\
decred Decred Blake256\n\
deep Deepcoin\n\
Expand Down Expand Up @@ -620,6 +622,7 @@ static bool work_decode(const json_t *val, struct work *work)
data_size = 80;
adata_sz = data_size / 4;
break;
case ALGO_CRYPTOLIGHT:
case ALGO_CRYPTONIGHT:
case ALGO_WILDKECCAK:
return rpc2_job_decode(val, work);
Expand Down Expand Up @@ -1767,7 +1770,7 @@ static void *miner_thread(void *userdata)
nonceptr = (uint32_t*) (((char*)work.data) + 1);
wcmpoft = 2;
wcmplen = 32;
} else if (opt_algo == ALGO_CRYPTONIGHT) {
} else if (opt_algo == ALGO_CRYPTOLIGHT || opt_algo == ALGO_CRYPTONIGHT) {
nonceptr = (uint32_t*) (((char*)work.data) + 39);
wcmplen = 39;
}
Expand Down Expand Up @@ -1802,7 +1805,7 @@ static void *miner_thread(void *userdata)
extrajob = false;
if (stratum_gen_work(&stratum, &g_work))
g_work_time = time(NULL);
if (opt_algo == ALGO_CRYPTONIGHT)
if (opt_algo == ALGO_CRYPTONIGHT || opt_algo == ALGO_CRYPTOLIGHT)
nonceptr[0] += 0x100000;
}
} else {
Expand Down Expand Up @@ -1845,7 +1848,7 @@ static void *miner_thread(void *userdata)
wcmplen -= 4;
}

if (opt_algo == ALGO_CRYPTONIGHT) {
if (opt_algo == ALGO_CRYPTONIGHT || opt_algo == ALGO_CRYPTOLIGHT) {
uint32_t oldpos = nonceptr[0];
if (memcmp(&work.data[wcmpoft], &g_work.data[wcmpoft], wcmplen)) {
memcpy(&work, &g_work, sizeof(struct work));
Expand Down Expand Up @@ -2097,6 +2100,7 @@ static void *miner_thread(void *userdata)
case ALGO_VELTOR:
minmax = 0x80000;
break;
case ALGO_CRYPTOLIGHT:
case ALGO_CRYPTONIGHT:
case ALGO_SCRYPT_JANE:
minmax = 0x1000;
Expand Down Expand Up @@ -2160,6 +2164,9 @@ static void *miner_thread(void *userdata)
case ALGO_C11:
rc = scanhash_c11(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_CRYPTOLIGHT:
rc = scanhash_cryptolight(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_CRYPTONIGHT:
rc = scanhash_cryptonight(thr_id, &work, max_nonce, &hashes_done);
break;
Expand Down Expand Up @@ -2306,6 +2313,7 @@ static void *miner_thread(void *userdata)
// todo: update all algos to use work->nonces and pdata[19] as counter
switch (opt_algo) {
case ALGO_BLAKE2S:
case ALGO_CRYPTOLIGHT:
case ALGO_CRYPTONIGHT:
case ALGO_DECRED:
case ALGO_LBRY:
Expand Down Expand Up @@ -2830,7 +2838,7 @@ static void show_usage_and_exit(int status)
if (opt_algo == ALGO_SCRYPT || opt_algo == ALGO_SCRYPT_JANE) {
printf(scrypt_usage);
}
if (opt_algo == ALGO_WILDKECCAK || opt_algo == ALGO_CRYPTONIGHT) {
if (opt_algo == ALGO_CRYPTONIGHT || opt_algo == ALGO_CRYPTOLIGHT || opt_algo == ALGO_WILDKECCAK) {
printf(xmr_usage);
}
proper_exit(status);
Expand Down Expand Up @@ -3685,7 +3693,7 @@ int main(int argc, char *argv[])
allow_mininginfo = false;
}

if (opt_algo == ALGO_CRYPTONIGHT) {
if (opt_algo == ALGO_CRYPTONIGHT || opt_algo == ALGO_CRYPTOLIGHT) {
rpc2_init();
if (!opt_quiet) applog(LOG_INFO, "Using JSON-RPC 2.0");
}
Expand Down
16 changes: 10 additions & 6 deletions ccminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
<ClCompile Include="crypto\xmr-rpc.cpp" />
<ClCompile Include="crypto\aesb.cpp" />
<ClCompile Include="crypto\oaes_lib.cpp" />
<ClCompile Include="crypto\cryptolight-cpu.cpp" />
<ClCompile Include="crypto\cryptonight-cpu.cpp" />
<ClCompile Include="crypto\cpu\c_keccak.c" />
<ClCompile Include="nvapi.cpp" />
Expand Down Expand Up @@ -265,13 +266,15 @@
<CudaCompile Include="Algo256\cuda_bmw.cu">
<MaxRegCount>76</MaxRegCount>
</CudaCompile>
<CudaCompile Include="crypto\cryptonight.cu">
<MaxRegCount>128</MaxRegCount>
<CudaCompile Include="crypto\cryptolight.cu" />
<CudaCompile Include="crypto\cryptolight-core.cu">
<MaxRegCount>64</MaxRegCount>
</CudaCompile>
<CudaCompile Include="crypto\cuda_cryptonight_core.cu">
<MaxRegCount>128</MaxRegCount>
<CudaCompile Include="crypto\cryptonight.cu" />
<CudaCompile Include="crypto\cryptonight-core.cu">
<MaxRegCount>64</MaxRegCount>
</CudaCompile>
<CudaCompile Include="crypto\cuda_cryptonight_extra.cu">
<CudaCompile Include="crypto\cryptonight-extra.cu">
<MaxRegCount>255</MaxRegCount>
</CudaCompile>
<ClInclude Include="crypto\cn_aes.cuh" />
Expand Down Expand Up @@ -335,8 +338,9 @@
<ClInclude Include="compat\unistd.h" />
<ClInclude Include="compat\winansi.h" />
<ClInclude Include="compat\ccminer-config.h" />
<ClInclude Include="crypto\mman.h" />
<ClInclude Include="crypto\cryptolight.h" />
<ClInclude Include="crypto\cryptonight.h" />
<ClInclude Include="crypto\mman.h" />
<ClInclude Include="crypto\wildkeccak.h" />
<ClInclude Include="crypto\xmr-rpc.h" />
<ClInclude Include="cuda_groestlcoin.h" />
Expand Down
12 changes: 9 additions & 3 deletions ccminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -823,13 +823,19 @@
<CudaCompile Include="sia\sia.cu">
<Filter>Source Files\sia</Filter>
</CudaCompile>
<CudaCompile Include="crypto\cryptolight.cu">
<Filter>Source Files\CUDA\xmr</Filter>
</CudaCompile>
<CudaCompile Include="crypto\cryptolight-core.cu">
<Filter>Source Files\CUDA\xmr</Filter>
</CudaCompile>
<CudaCompile Include="crypto\cryptonight.cu">
<Filter>Source Files\CUDA\xmr</Filter>
</CudaCompile>
<CudaCompile Include="crypto\cuda_cryptonight_core.cu">
<CudaCompile Include="crypto\cryptonight-core.cu">
<Filter>Source Files\CUDA\xmr</Filter>
</CudaCompile>
<CudaCompile Include="crypto\cuda_cryptonight_extra.cu">
<CudaCompile Include="crypto\cryptonight-extra.cu">
<Filter>Source Files\CUDA\xmr</Filter>
</CudaCompile>
<CudaCompile Include="crypto\wildkeccak.cu">
Expand All @@ -851,4 +857,4 @@
<Filter>Ressources</Filter>
</Text>
</ItemGroup>
</Project>
</Project>
Loading

0 comments on commit 93adb56

Please sign in to comment.