From 5929d463122ab0b7d302780e3ae6e42368b8ae5e Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sun, 17 Nov 2019 17:02:57 +0100 Subject: [PATCH 1/9] fix CI - update to cuda9 (required for xmr-stak-rx) --- .appveyor.yml | 19 ++++++++++--------- .travis.yml | 10 +++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index fee8f6524..4a8a2251f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ # image -image: Visual Studio 2015 +image: Visual Studio 2017 # build platform platform: x64 @@ -9,20 +9,21 @@ clone_folder: c:\xmr-stak install: - mkdir c:\xmr-stak-dep - - curl -sL https://github.com/fireice-uk/xmr-stak-dep/releases/download/v1/xmr-stak-dep.zip -o xmr-stak-dep.zip - - 7z x xmr-stak-dep.zip -o"c:\xmr-stak-dep" -y > nul - - appveyor DownloadFile https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_windows-exe -FileName cuda_8.0.44_windows.exe - - cuda_8.0.44_windows.exe -s compiler_8.0 cudart_8.0 nvrtc_8.0 nvrtc_dev_8.0 - - set PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;%PATH% + - curl -sL https://github.com/fireice-uk/xmr-stak-dep/releases/download/v2/xmr-stak-dep.zip -o xmr-stak-dep.zip + - 7z x xmr-stak-dep.zip -o"c:\" -y > nul + - dir c:\xmr-stak-dep + - appveyor DownloadFile "https://developer.nvidia.com/compute/cuda/10.1/Prod/network_installers/cuda_10.1.105_win10_network.exe" -FileName install_cuda.exe + - install_cuda.exe -s nvcc_10.1 cudart_10.1 + - set PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;%PATH% - nvcc -V build_script: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsMSBuildCmd.bat" + - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.11 - cd c:\xmr-stak - mkdir build - cd build - set CMAKE_PREFIX_PATH=C:\xmr-stak-dep\hwloc;C:\xmr-stak-dep\libmicrohttpd;C:\xmr-stak-dep\openssl; - - cmake -G "Visual Studio 14 2015 Win64" -T v140,host=x64 .. -DCUDA_ARCH=30 + - cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 .. -DCUDA_ARCH=35 - cmake --build . --config Release --target install test_script: @@ -30,4 +31,4 @@ test_script: - dir - copy C:\xmr-stak-dep\openssl\bin\* . - set XMRSTAK_NOWAIT=1 - - xmr-stak.exe --help --noUAC + - xmr-stak-rx.exe --help --noUAC diff --git a/.travis.yml b/.travis.yml index f263e86ad..84457a415 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ language: cpp cache: apt: true directories: - - $HOME/.cache/cuda + - $HOME/.cache/cuda9 addons: apt: @@ -21,7 +21,7 @@ addons: env: global: - - CUDA_ROOT: $HOME/.cache/cuda + - CUDA_ROOT: $HOME/.cache/cuda9 matrix: include: @@ -106,11 +106,11 @@ install: if [ $NVCC_FOUND -ne 0 ]; then mkdir -p $CUDA_ROOT && cd $CUDA_ROOT && - travis_retry wget https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_linux-run && + travis_retry wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run && ls -la && chmod u+x *-run && - ./cuda_8.0.44_linux-run --silent --toolkit --toolkitpath=$CUDA_ROOT && - rm -rf ./cuda_8.0.44_linux-run $CUDA_ROOT/{samples,jre,doc,share} && + ./cuda_9.0.176_384.81_linux-run --silent --toolkit --toolkitpath=$CUDA_ROOT && + rm -rf ./cuda_9.0.176_384.81_linux-run $CUDA_ROOT/{samples,jre,doc,share} && cd -; fi fi; From 115a25604263691da5e172939b6326194d2ea95d Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Mon, 25 Nov 2019 21:27:04 +0100 Subject: [PATCH 2/9] fix travis Somehow the cuda travis test fails with linking issues. I can not reproduce the issue. - disable for now the CUDA test --- .travis.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84457a415..099d9ee73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,21 +25,21 @@ env: matrix: include: - - os: linux - compiler: gcc - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - *default_packages - - gcc-5 - - g++-5 - env: - - CMAKE_CXX_COMPILER=g++-5 - - CMAKE_C_COMPILER=gcc-5 - - XMRSTAK_CMAKE_FLAGS="-DCUDA_ARCH=30 -DOpenCL_ENABLE=OFF" - +# - os: linux +# compiler: gcc +# addons: +# apt: +# sources: +# - ubuntu-toolchain-r-test +# packages: +# - *default_packages +# - gcc-5 +# - g++-5 +# env: +# - CMAKE_CXX_COMPILER=g++-5 +# - CMAKE_C_COMPILER=gcc-5 +# - XMRSTAK_CMAKE_FLAGS="-DCUDA_ARCH=30 -DOpenCL_ENABLE=OFF" +# - os: linux compiler: gcc addons: @@ -123,4 +123,4 @@ script: cmake -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${XMRSTAK_CMAKE_FLAGS} .; fi; - make VERBOSE=1 install - - ./bin/xmr-stak --help + - ./bin/xmr-stak-rx --help From 1d46d5b4133e82b5bbba4c21f54f20846647c87a Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sun, 17 Nov 2019 17:27:14 +0100 Subject: [PATCH 3/9] add currency names add `monero`, `loki` and `wownero` as currencies --- xmrstak/jconf.cpp | 7 +++++-- xmrstak/pools.tpl | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xmrstak/jconf.cpp b/xmrstak/jconf.cpp index cc3f1937a..43ec81702 100644 --- a/xmrstak/jconf.cpp +++ b/xmrstak/jconf.cpp @@ -100,10 +100,13 @@ configVal oConfigValues[] = { constexpr size_t iConfigCnt = (sizeof(oConfigValues) / sizeof(oConfigValues[0])); xmrstak::coin_selection coins[] = { - // name, userpool, devpool, default_pool_suggestion + // name, userpool, default_pool_suggestion + {"loki", {POW(randomX_loki)}, {POW(randomX_loki)}, nullptr}, + {"monero", {POW(randomX)}, {POW(randomX)}, nullptr}, {"randomx", {POW(randomX)}, {POW(randomX)}, nullptr}, {"randomx_loki", {POW(randomX_loki)}, {POW(randomX_loki)}, nullptr}, - {"randomx_wow", {POW(randomX_wow)}, {POW(randomX_wow)}, nullptr} + {"randomx_wow", {POW(randomX_wow)}, {POW(randomX_wow)}, nullptr}, + {"wownero", {POW(randomX_wow)}, {POW(randomX_wow)}, nullptr} }; constexpr size_t coin_algo_size = (sizeof(coins) / sizeof(coins[0])); diff --git a/xmrstak/pools.tpl b/xmrstak/pools.tpl index dc75ce03e..d28cddd7a 100644 --- a/xmrstak/pools.tpl +++ b/xmrstak/pools.tpl @@ -21,7 +21,7 @@ POOLCONF], * * loki * monero - * wow + * wownero * * Native algorithms which do not depend on any block versions: * From dedc3fe9016c77bd27f4ccbdf3bc3418d5f1e9ba Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sun, 17 Nov 2019 17:35:57 +0100 Subject: [PATCH 4/9] advertice disabling self test - advertice the cli option `--noTest` --- xmrstak/backend/cpu/minethd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index caaa17865..6813df4bd 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -283,7 +283,7 @@ bool minethd::self_test() xmrstak::globalStates::inst().iThreadCount = 1; if(algo == POW(randomX)) { - printer::inst()->print_msg(L0, "start self test for 'randomx'"); + printer::inst()->print_msg(L0, "start self test for 'randomx' (can be disabled with the command line option '--noTest')"); minethd::cn_on_new_job set_job; func_multi_selector<1>(ctx, set_job, ::jconf::inst()->HaveHardwareAes(), algo); miner_work work; @@ -295,7 +295,7 @@ bool minethd::self_test() } else if(algo == POW(randomX_loki)) { - printer::inst()->print_msg(L0, "start self test for 'randomx_loki'"); + printer::inst()->print_msg(L0, "start self test for 'randomx_loki' (can be disabled with the command line option '--noTest')"); minethd::cn_on_new_job set_job; func_multi_selector<1>(ctx, set_job, ::jconf::inst()->HaveHardwareAes(), algo); miner_work work; @@ -307,7 +307,7 @@ bool minethd::self_test() } else if(algo == POW(randomX_wow)) { - printer::inst()->print_msg(L0, "start self test for 'randomx_wow'"); + printer::inst()->print_msg(L0, "start self test for 'randomx_wow' (can be disabled with the command line option '--noTest')"); minethd::cn_on_new_job set_job; func_multi_selector<1>(ctx, set_job, ::jconf::inst()->HaveHardwareAes(), algo); miner_work work; From 06b03cd9b04c66fd095e2a0868cb908089563678 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sun, 17 Nov 2019 19:11:24 +0100 Subject: [PATCH 5/9] fix hwloc warning - fix warning depricated `hwloc_set_membind_nodeset` (since hwloc 2.0) --- xmrstak/backend/cpu/hwlocMemory.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xmrstak/backend/cpu/hwlocMemory.cpp b/xmrstak/backend/cpu/hwlocMemory.cpp index 804edc55d..067f27975 100644 --- a/xmrstak/backend/cpu/hwlocMemory.cpp +++ b/xmrstak/backend/cpu/hwlocMemory.cpp @@ -6,6 +6,24 @@ #include +static __hwloc_inline int +xmrstak_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) +{ +#if HWLOC_API_VERSION >= 0x20000 + return hwloc_set_membind( + topology, + nodeset, + policy, + flags| HWLOC_MEMBIND_BYNODESET); +#else + return hwloc_set_membind_nodeset( + topology, + nodeset, + policy, + flags); +#endif +} + /** pin memory to NUMA node * * Set the default memory policy for the current thread to bind memory to the @@ -37,7 +55,7 @@ void bindMemoryToNUMANode(size_t puId) hwloc_obj_t pu = hwloc_get_obj_by_depth(topology, depth, i); if(pu->os_index == puId) { - if(0 > hwloc_set_membind_nodeset( + if(0 > xmrstak_set_membind_nodeset( topology, pu->nodeset, HWLOC_MEMBIND_BIND, From d51fa86b4913536d395a17390ffab41d6e51ce02 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sun, 17 Nov 2019 19:48:27 +0100 Subject: [PATCH 6/9] fix tsl not used on first start - during the start of the miner and the guided setup the tls settings was ignored. - fix that parameters from the guided start is passed to the parameter singelton --- xmrstak/cli/cli-miner.cpp | 12 ++++++------ xmrstak/misc/executor.cpp | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 996de42eb..19e797a4c 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -219,7 +219,7 @@ void do_guided_pool_config() configTpl.set(std::string(tpl)); bool prompted = false; - auto& currency = params::inst().currency; + auto currency = params::inst().currency; if(currency.empty() || !jconf::IsOnAlgoList(currency)) { prompt_once(prompted); @@ -236,7 +236,7 @@ void do_guided_pool_config() currency = tmp; } - auto& pool = params::inst().poolURL; + auto pool = params::inst().poolURL; bool userSetPool = true; if(pool.empty()) { @@ -247,7 +247,7 @@ void do_guided_pool_config() std::cin >> pool; } - auto& userName = params::inst().poolUsername; + auto userName = params::inst().poolUsername; if(userName.empty()) { prompt_once(prompted); @@ -257,7 +257,7 @@ void do_guided_pool_config() } bool stdin_flushed = false; - auto& passwd = params::inst().poolPasswd; + auto passwd = params::inst().poolPasswd; if(passwd.empty() && !params::inst().userSetPwd) { prompt_once(prompted); @@ -271,7 +271,7 @@ void do_guided_pool_config() getline(std::cin, passwd); } - auto& rigid = params::inst().poolRigid; + auto rigid = params::inst().poolRigid; if(rigid.empty() && !params::inst().userSetRigid) { if(!use_simple_start()) @@ -366,7 +366,7 @@ void do_guided_config() configTpl.set(std::string(tpl)); bool prompted = false; - auto& http_port = params::inst().httpd_port; + auto http_port = params::inst().httpd_port; if(http_port == params::httpd_port_unset) { http_port = params::httpd_port_disabled; diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp index 248032a27..f668a77d3 100644 --- a/xmrstak/misc/executor.cpp +++ b/xmrstak/misc/executor.cpp @@ -525,8 +525,9 @@ void executor::ex_main() const char* rigid = params.userSetRigid ? params.poolRigid.c_str() : cfg.sRigId; const char* pwd = params.userSetPwd ? params.poolPasswd.c_str() : cfg.sPasswd; bool nicehash = cfg.nicehash || params.nicehashMode; + bool tls = params.poolUseTls; - pools.emplace_back(i, cfg.sPoolAddr, wallet, rigid, pwd, 9.9, params.poolUseTls, cfg.tls_fingerprint, nicehash); + pools.emplace_back(i, cfg.sPoolAddr, wallet, rigid, pwd, 9.9, tls, cfg.tls_fingerprint, nicehash); } else pools.emplace_back(i, cfg.sPoolAddr, cfg.sWalletAddr, cfg.sRigId, cfg.sPasswd, cfg.weight, cfg.tls, cfg.tls_fingerprint, cfg.nicehash); From 3cb5cda2f3dc67caa1346f0f41ab9ef1440d006a Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Wed, 20 Nov 2019 19:43:49 +0100 Subject: [PATCH 7/9] fix miner benchmark mode The block version must be greater than 0. This PR also remove some not used functions. --- xmrstak/backend/cpu/crypto/cryptonight_aesni.h | 1 + xmrstak/backend/cpu/minethd.cpp | 6 ------ xmrstak/backend/cpu/minethd.hpp | 1 - xmrstak/cli/cli-miner.cpp | 6 ++++++ xmrstak/net/socket.cpp | 1 - 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/xmrstak/backend/cpu/crypto/cryptonight_aesni.h b/xmrstak/backend/cpu/crypto/cryptonight_aesni.h index aed4284ae..795d1c643 100644 --- a/xmrstak/backend/cpu/crypto/cryptonight_aesni.h +++ b/xmrstak/backend/cpu/crypto/cryptonight_aesni.h @@ -167,6 +167,7 @@ struct RandomX_generator } else if(algorithm_switched) { + printer::inst()->print_msg(LDEBUG,"%s switched to %s",ctx[0]->last_algo.Name().c_str(), POW(ALGO).Name().c_str()); // remove old vm and re-initialize the full randomx context for(size_t i = 0; i < N; i++) { diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index caaa17865..e3a85359e 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -480,12 +480,6 @@ void minethd::func_multi_selector(cryptonight_ctx** ctx, minethd::cn_on_new_job& on_new_job = nullptr; } -void minethd::func_selector(cryptonight_ctx** ctx, bool bHaveAes, const xmrstak_algo& algo) -{ - minethd::cn_on_new_job dm; - func_multi_selector<1>(ctx, dm, bHaveAes, algo); // for testing us eauto, must be removed before the release -} - void minethd::work_main() { multiway_work_main<1u>(); diff --git a/xmrstak/backend/cpu/minethd.hpp b/xmrstak/backend/cpu/minethd.hpp index 38d9bb60c..f1ac749eb 100644 --- a/xmrstak/backend/cpu/minethd.hpp +++ b/xmrstak/backend/cpu/minethd.hpp @@ -24,7 +24,6 @@ class minethd : public iBackend typedef void (*cn_on_new_job)(const miner_work&, cryptonight_ctx**); - static void func_selector(cryptonight_ctx**, bool bHaveAes, const xmrstak_algo& algo); static bool thd_setaffinity(std::thread::native_handle_type h, uint64_t cpu_id); static cryptonight_ctx* minethd_alloc_ctx(); diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 996de42eb..69d469c82 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -943,6 +943,12 @@ int do_benchmark(int block_version, int wait_sec, int work_sec) printer::inst()->print_msg(L0, "Prepare benchmark for block version %d", block_version); + if(block_version <= 0) + { + printer::inst()->print_msg(L0, "Block version must be >0, current value is %u.", block_version); + return 1; + } + uint8_t work[128]; memset(work, 0, 128); work[0] = static_cast(block_version); diff --git a/xmrstak/net/socket.cpp b/xmrstak/net/socket.cpp index a169a4b16..7b0023208 100644 --- a/xmrstak/net/socket.cpp +++ b/xmrstak/net/socket.cpp @@ -46,7 +46,6 @@ class callback_holder bool set_socket_error(const char*, size_t len) { return true; } bool set_socket_error(const char*) { return true; } const char* get_tls_fp() { return ""; } - bool is_dev_pool() { false; } const char* get_pool_addr() { return "";} ; }; From c8770b98934dc99b90c811cfa32d0f89bbd74a05 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sun, 24 Nov 2019 20:31:05 +0100 Subject: [PATCH 8/9] NVIDIA: fix auto adjustment fix #2564 - add the dataset size to the maximum allowed memory usage --- xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu index b3f2f903d..b38b39676 100644 --- a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu +++ b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu @@ -322,6 +322,12 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) hashMemSize = std::max(hashMemSize, algo.Mem()); } + const size_t dataset_size = getRandomXDatasetSize(); + /* increase maxMemUsage by the dataset because the upper limits are + * only for the scratchpad and does not take the randomX dataset into account. + */ + maxMemUsage += dataset_size; + #ifdef WIN32 /* We use in windows bfactor (split slow kernel into smaller parts) to avoid * that windows is killing long running kernel. @@ -346,7 +352,6 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) size_t availableMem = freeMemory - (128u * byteToMiB) - 200u; size_t limitedMemory = std::min(availableMem, maxMemUsage); - const size_t dataset_size = getRandomXDatasetSize(); if(limitedMemory <= dataset_size) limitedMemory = 0; else From 57a3cfda5714d76355653646eca0540277c97a62 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Mon, 25 Nov 2019 21:57:22 +0100 Subject: [PATCH 9/9] version increase to 1.0.1-rx --- xmrstak/version.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmrstak/version.cpp b/xmrstak/version.cpp index d3abb1e07..cdcf82132 100644 --- a/xmrstak/version.cpp +++ b/xmrstak/version.cpp @@ -20,7 +20,7 @@ #endif #define XMR_STAK_NAME "xmr-stak-rx" -#define XMR_STAK_VERSION "1.0.0-rx" +#define XMR_STAK_VERSION "1.0.1-rx" #if defined(_WIN32) #define OS_TYPE "win"