From 4a76ca5cb6e1f555621effec3880465124f2e386 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Fri, 3 Aug 2018 20:01:14 +0200 Subject: [PATCH] bench: handle cryptonight variants + V100 fix --- bench.cpp | 16 ++++++++++++++++ ccminer.cpp | 3 +++ crypto/cryptonight.cu | 9 ++++++--- equi/equihash.cpp | 3 +-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/bench.cpp b/bench.cpp index 894fd8a..e573a08 100644 --- a/bench.cpp +++ b/bench.cpp @@ -156,6 +156,22 @@ bool bench_algo_switch_next(int thr_id) if (algo == ALGO_SCRYPT) algo++; if (algo == ALGO_SCRYPT_JANE) algo++; + // Set cryptonight variant + switch (algo) { + case ALGO_MONERO: + cryptonight_fork = 7; + break; + case ALGO_GRAFT: + cryptonight_fork = 8; + break; + case ALGO_STELLITE: + cryptonight_fork = 3; + break; + case ALGO_CRYPTONIGHT: + cryptonight_fork = 1; + break; + } + // free current algo memory and track mem usage mused = cuda_available_memory(thr_id); algo_free_all(thr_id); diff --git a/ccminer.cpp b/ccminer.cpp index c2b34f8..f4c1039 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -2384,6 +2384,9 @@ static void *miner_thread(void *userdata) case ALGO_CRYPTOLIGHT: rc = scanhash_cryptolight(thr_id, &work, max_nonce, &hashes_done, 1); break; + case ALGO_MONERO: + case ALGO_STELLITE: + case ALGO_GRAFT: case ALGO_CRYPTONIGHT: { int cn_variant = 0; diff --git a/crypto/cryptonight.cu b/crypto/cryptonight.cu index 52d0e97..2c3a6cd 100644 --- a/crypto/cryptonight.cu +++ b/crypto/cryptonight.cu @@ -50,8 +50,11 @@ extern "C" int scanhash_cryptonight(int thr_id, struct work* work, uint32_t max_ gpulog_init(LOG_INFO, thr_id, "%s, %d MB available, %hd SMX", device_name[dev_id], mem, device_mpcount[dev_id]); - if (!device_config[thr_id] && strcmp(device_name[dev_id], "TITAN V") == 0) { - device_config[thr_id] = strdup("80x24"); + if (!device_config[thr_id]) { + if(strcmp(device_name[dev_id], "TITAN V") == 0) + device_config[thr_id] = strdup("80x24"); + if(strstr(device_name[dev_id], "V100")) + device_config[thr_id] = strdup("80x24"); } if (device_config[thr_id]) { @@ -83,7 +86,7 @@ extern "C" int scanhash_cryptonight(int thr_id, struct work* work, uint32_t max_ CUDA_LOG_ERROR(); } - const size_t alloc = MEMORY * throughput; + const size_t alloc = MEMORY * size_t(throughput); cryptonight_extra_init(thr_id); cudaMalloc(&d_long_state[thr_id], alloc); diff --git a/equi/equihash.cpp b/equi/equihash.cpp index c9ac1fc..3209546 100644 --- a/equi/equihash.cpp +++ b/equi/equihash.cpp @@ -183,8 +183,7 @@ extern "C" int scanhash_equihash(int thr_id, struct work *work, uint32_t max_non return -1; } size_t memSz = solvers[thr_id]->equi_mem_sz / (1024*1024); - gpus_intensity[thr_id] = (uint32_t) solvers[thr_id]->throughput; - api_set_throughput(thr_id, gpus_intensity[thr_id]); + api_set_throughput(thr_id, (uint32_t) solvers[thr_id]->throughput); gpulog(LOG_DEBUG, thr_id, "Allocated %u MB of context memory", (u32) memSz); cuda_get_arch(thr_id); init[thr_id] = true;