diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b12f5151..3982d64a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ # v6.17.0 - [#2411](https://github.com/xmrig/xmrig/pull/2411) Added support for Yada (`rx/yada` algorithm). + +# v6.16.3 +- [#2778](https://github.com/xmrig/xmrig/pull/2778) Fixed `READY threads X/X` display after algorithm switching. +- [#2782](https://github.com/xmrig/xmrig/pull/2782) Updated GhostRider documentation. +- [#2815](https://github.com/xmrig/xmrig/pull/2815) Fixed `cn-heavy` in 32-bit builds. +- [#2827](https://github.com/xmrig/xmrig/pull/2827) GhostRider: set correct priority for helper threads. +- [#2837](https://github.com/xmrig/xmrig/pull/2837) RandomX: don't restart mining threads when the seed changes. +- [#2848](https://github.com/xmrig/xmrig/pull/2848) GhostRider: added support for `client.reconnect` method. +- [#2856](https://github.com/xmrig/xmrig/pull/2856) Fix for short responses from some Raptoreum pools. +- [#2873](https://github.com/xmrig/xmrig/pull/2873) Fixed GhostRider benchmark on single-core systems. +- [#2882](https://github.com/xmrig/xmrig/pull/2882) Fixed ARMv7 compilation. +- [#2893](https://github.com/xmrig/xmrig/pull/2893) KawPow OpenCL: use separate UV loop for building programs. + + # v6.16.2 - [#2751](https://github.com/xmrig/xmrig/pull/2751) Fixed crash on CPUs supporting VAES and running GCC-compiled xmrig. - [#2761](https://github.com/xmrig/xmrig/pull/2761) Fixed broken auto-tuning in GCC Windows build. diff --git a/README.md b/README.md index dddb39608..066aa0ab3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![GitHub stars](https://img.shields.io/github/stars/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/stargazers) [![GitHub forks](https://img.shields.io/github/forks/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/network) -XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and AstroBWT unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD. +XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight, AstroBWT and [GhostRider](https://github.com/xmrig/xmrig/tree/master/src/crypto/ghostrider#readme) unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD. ## Mining backends - **CPU** (x64/ARMv8) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index ff5943a13..e9e0e3958 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -26,8 +26,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM8_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM8_CXX_FLAGS} -flax-vector-conversions") elseif (ARM_TARGET EQUAL 7) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -flax-vector-conversions") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfpu=neon") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon -flax-vector-conversions") else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") diff --git a/scripts/rtm_ghostrider_example.cmd b/scripts/rtm_ghostrider_example.cmd index f4c4342ef..8b1f4999c 100644 --- a/scripts/rtm_ghostrider_example.cmd +++ b/scripts/rtm_ghostrider_example.cmd @@ -16,5 +16,8 @@ :: Smaller pools also often have smaller fees/payout limits. cd %~dp0 +:: Use this command line to connect to non-SSL port xmrig.exe -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x +:: Or use this command line to connect to an SSL port +:: xmrig.exe -a gr -o rtm.suprnova.cc:4273 --tls -u WALLET_ADDRESS -p x pause diff --git a/src/backend/common/WorkerJob.h b/src/backend/common/WorkerJob.h index 8ff3ccdc9..7057c3571 100644 --- a/src/backend/common/WorkerJob.h +++ b/src/backend/common/WorkerJob.h @@ -30,6 +30,7 @@ #include "base/net/stratum/Job.h" +#include "base/tools/Alignment.h" #include "crypto/common/Nonce.h" @@ -77,7 +78,7 @@ public: } else { for (size_t i = 0; i < N; ++i) { - *nonce(i) += roundSize; + writeUnaligned(nonce(i), readUnaligned(nonce(i)) + roundSize); } } @@ -136,11 +137,11 @@ inline bool xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize) return false; } if (nonceSize() == sizeof(uint64_t)) { - m_jobs[index()].nonce()[1] = n[1]; + writeUnaligned(m_jobs[index()].nonce() + 1, readUnaligned(n + 1)); } } else { - *n += roundSize; + writeUnaligned(n, readUnaligned(n) + roundSize); } return true; diff --git a/src/backend/cpu/CpuBackend.cpp b/src/backend/cpu/CpuBackend.cpp index 101975650..16db4e5e2 100644 --- a/src/backend/cpu/CpuBackend.cpp +++ b/src/backend/cpu/CpuBackend.cpp @@ -76,12 +76,13 @@ public: { m_workersMemory.clear(); m_hugePages.reset(); - m_memory = memory; - m_started = 0; - m_errors = 0; - m_threads = threads.size(); - m_ways = 0; - m_ts = Chrono::steadyMSecs(); + m_memory = memory; + m_started = 0; + m_totalStarted = 0; + m_errors = 0; + m_threads = threads.size(); + m_ways = 0; + m_ts = Chrono::steadyMSecs(); } inline bool started(IWorker *worker, bool ready) diff --git a/src/backend/cpu/CpuWorker.cpp b/src/backend/cpu/CpuWorker.cpp index 32a7a6be6..86201e506 100644 --- a/src/backend/cpu/CpuWorker.cpp +++ b/src/backend/cpu/CpuWorker.cpp @@ -23,6 +23,7 @@ #include "backend/cpu/Cpu.h" #include "backend/cpu/CpuWorker.h" +#include "base/tools/Alignment.h" #include "base/tools/Chrono.h" #include "core/config/Config.h" #include "core/Miner.h" @@ -100,7 +101,7 @@ xmrig::CpuWorker::CpuWorker(size_t id, const CpuLaunchData &data) : } # ifdef XMRIG_ALGO_GHOSTRIDER - m_ghHelper = ghostrider::create_helper_thread(affinity(), data.affinities); + m_ghHelper = ghostrider::create_helper_thread(affinity(), data.priority, data.affinities); # endif } @@ -134,7 +135,7 @@ void xmrig::CpuWorker::allocateRandomX_VM() RxDataset *dataset = Rx::dataset(m_job.currentJob(), node()); while (dataset == nullptr) { - std::this_thread::sleep_for(std::chrono::milliseconds(200)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); if (Nonce::sequence(Nonce::CPU) == 0) { return; @@ -246,7 +247,7 @@ void xmrig::CpuWorker::start() while (Nonce::sequence(Nonce::CPU) > 0) { if (Nonce::isPaused()) { do { - std::this_thread::sleep_for(std::chrono::milliseconds(200)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); } while (Nonce::isPaused() && Nonce::sequence(Nonce::CPU) > 0); @@ -271,7 +272,7 @@ void xmrig::CpuWorker::start() uint32_t current_job_nonces[N]; for (size_t i = 0; i < N; ++i) { - current_job_nonces[i] = *m_job.nonce(i); + current_job_nonces[i] = readUnaligned(m_job.nonce(i)); } # ifdef XMRIG_FEATURE_BENCHMARK diff --git a/src/backend/cuda/CudaWorker.cpp b/src/backend/cuda/CudaWorker.cpp index 725d59c95..5c51b9a6c 100644 --- a/src/backend/cuda/CudaWorker.cpp +++ b/src/backend/cuda/CudaWorker.cpp @@ -22,6 +22,7 @@ #include "backend/cuda/runners/CudaCnRunner.h" #include "backend/cuda/wrappers/CudaDevice.h" #include "base/io/log/Log.h" +#include "base/tools/Alignment.h" #include "base/tools/Chrono.h" #include "core/Miner.h" #include "crypto/common/Nonce.h" @@ -152,7 +153,7 @@ void xmrig::CudaWorker::start() uint32_t foundNonce[16] = { 0 }; uint32_t foundCount = 0; - if (!m_runner->run(*m_job.nonce(), &foundCount, foundNonce)) { + if (!m_runner->run(readUnaligned(m_job.nonce()), &foundCount, foundNonce)) { return; } diff --git a/src/backend/opencl/OclWorker.cpp b/src/backend/opencl/OclWorker.cpp index d2563d8ff..d9977a403 100644 --- a/src/backend/opencl/OclWorker.cpp +++ b/src/backend/opencl/OclWorker.cpp @@ -23,6 +23,7 @@ #include "backend/opencl/runners/tools/OclSharedData.h" #include "backend/opencl/runners/tools/OclSharedState.h" #include "base/io/log/Log.h" +#include "base/tools/Alignment.h" #include "base/tools/Chrono.h" #include "core/Miner.h" #include "crypto/common/Nonce.h" @@ -179,7 +180,7 @@ void xmrig::OclWorker::start() const uint64_t t = Chrono::steadyMSecs(); try { - m_runner->run(*m_job.nonce(), results); + m_runner->run(readUnaligned(m_job.nonce()), results); } catch (std::exception &ex) { printError(id(), ex.what()); diff --git a/src/backend/opencl/runners/tools/OclKawPow.cpp b/src/backend/opencl/runners/tools/OclKawPow.cpp index 40b2b9795..a7e8df3aa 100644 --- a/src/backend/opencl/runners/tools/OclKawPow.cpp +++ b/src/backend/opencl/runners/tools/OclKawPow.cpp @@ -153,9 +153,35 @@ static KawPowCache cache; #define mix_dst() ("mix[" + std::to_string(mix_seq_dst[(mix_seq_dst_cnt++) % KPHash::REGS]) + "]") #define mix_cache() ("mix[" + std::to_string(mix_seq_cache[(mix_seq_cache_cnt++) % KPHash::REGS]) + "]") +class KawPowBaton : public Baton +{ +public: + inline KawPowBaton(const IOclRunner& runner, uint64_t period, uint32_t worksize) : + runner(runner), + period(period), + worksize(worksize) + {} + + const IOclRunner& runner; + const uint64_t period; + const uint32_t worksize; +}; + + class KawPowBuilder { public: + ~KawPowBuilder() + { + if (m_loop) { + uv_async_send(&m_shutdownAsync); + uv_thread_join(&m_loopThread); + delete m_loop; + } + } + + void build_async(const IOclRunner& runner, uint64_t period, uint32_t worksize); + cl_kernel build(const IOclRunner &runner, uint64_t period, uint32_t worksize) { std::lock_guard lock(m_mutex); @@ -368,40 +394,54 @@ private: st.jcong = 69069 * st.jcong + 1234567; return ((MWC ^ st.jcong) + st.jsr); } -}; +private: + uv_loop_t* m_loop = nullptr; + uv_thread_t m_loopThread = {}; + uv_async_t m_shutdownAsync = {}; -class KawPowBaton : public Baton -{ -public: - inline KawPowBaton(const IOclRunner &runner, uint64_t period, uint32_t worksize) : - runner(runner), - period(period), - worksize(worksize) - {} - - const IOclRunner &runner; - const uint64_t period; - const uint32_t worksize; + static void loop(void* data) + { + KawPowBuilder* builder = static_cast(data); + uv_run(builder->m_loop, UV_RUN_DEFAULT); + uv_loop_close(builder->m_loop); + } }; static KawPowBuilder builder; +void KawPowBuilder::build_async(const IOclRunner& runner, uint64_t period, uint32_t worksize) +{ + std::lock_guard lock(m_mutex); + + if (!m_loop) { + m_loop = new uv_loop_t{}; + uv_loop_init(m_loop); + uv_async_init(m_loop, &m_shutdownAsync, [](uv_async_t* handle) { uv_close(reinterpret_cast(handle), nullptr); }); + uv_thread_create(&m_loopThread, loop, this); + } + + KawPowBaton* baton = new KawPowBaton(runner, period, worksize); + + uv_queue_work(m_loop, &baton->req, + [](uv_work_t* req) { + KawPowBaton* baton = static_cast(req->data); + builder.build(baton->runner, baton->period, baton->worksize); + }, + [](uv_work_t* req, int) { delete static_cast(req->data); } + ); +} + + cl_kernel OclKawPow::get(const IOclRunner &runner, uint64_t height, uint32_t worksize) { const uint64_t period = height / KPHash::PERIOD_LENGTH; - KawPowBaton* baton = new KawPowBaton(runner, period + 1, worksize); - - uv_queue_work(uv_default_loop(), &baton->req, - [](uv_work_t *req) { - KawPowBaton* baton = static_cast(req->data); - builder.build(baton->runner, baton->period, baton->worksize); - }, - [](uv_work_t *req, int) { delete static_cast(req->data); } - ); + if (!cache.search(runner, period + 1, worksize)) { + builder.build_async(runner, period + 1, worksize); + } cl_kernel kernel = cache.search(runner, period, worksize); if (kernel) { diff --git a/src/base/base.cmake b/src/base/base.cmake index db26e2e98..0f4f87255 100644 --- a/src/base/base.cmake +++ b/src/base/base.cmake @@ -68,6 +68,7 @@ set(HEADERS_BASE src/base/net/tools/MemPool.h src/base/net/tools/NetBuffer.h src/base/net/tools/Storage.h + src/base/tools/Alignment.h src/base/tools/Arguments.h src/base/tools/Baton.h src/base/tools/bswap_64.h diff --git a/src/base/net/stratum/Client.cpp b/src/base/net/stratum/Client.cpp index db6ceca38..7abb72533 100644 --- a/src/base/net/stratum/Client.cpp +++ b/src/base/net/stratum/Client.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef XMRIG_FEATURE_TLS @@ -660,7 +661,7 @@ void xmrig::Client::parse(char *line, size_t len) LOG_DEBUG("[%s] received (%d bytes): \"%.*s\"", url(), len, static_cast(len), line); - if (len < 32 || line[0] != '{') { + if (len < 22 || line[0] != '{') { if (!isQuiet()) { LOG_ERR("%s " RED("JSON decode failed"), tag()); } @@ -683,12 +684,48 @@ void xmrig::Client::parse(char *line, size_t len) const auto &id = Json::getValue(doc, "id"); const auto &error = Json::getValue(doc, "error"); + const char *method = Json::getString(doc, "method"); + + if (method && strcmp(method, "client.reconnect") == 0) { + const auto ¶ms = Json::getValue(doc, "params"); + if (!params.IsArray()) { + LOG_ERR("%s " RED("invalid client.reconnect notification: params is not an array"), tag()); + return; + } + + auto arr = params.GetArray(); + + if (arr.Empty()) { + LOG_ERR("%s " RED("invalid client.reconnect notification: params array is empty"), tag()); + return; + } + + if (arr.Size() != 2) { + LOG_ERR("%s " RED("invalid client.reconnect notification: params array has wrong size"), tag()); + return; + } + + if (!arr[0].IsString()) { + LOG_ERR("%s " RED("invalid client.reconnect notification: host is not a string"), tag()); + return; + } + + if (!arr[1].IsString()) { + LOG_ERR("%s " RED("invalid client.reconnect notification: port is not a string"), tag()); + return; + } + + std::stringstream s; + s << arr[0].GetString() << ":" << arr[1].GetString(); + LOG_WARN("%s " YELLOW("client.reconnect to %s"), tag(), s.str().c_str()); + setPoolUrl(s.str().c_str()); + return reconnect(); + } if (id.IsInt64()) { return parseResponse(id.GetInt64(), Json::getValue(doc, "result"), error); } - const char *method = Json::getString(doc, "method"); if (!method) { return; } diff --git a/src/base/net/stratum/Client.h b/src/base/net/stratum/Client.h index e1f5d7562..300db138a 100644 --- a/src/base/net/stratum/Client.h +++ b/src/base/net/stratum/Client.h @@ -84,6 +84,7 @@ protected: inline const char *url() const { return m_pool.url(); } inline const String &rpcId() const { return m_rpcId; } inline void setRpcId(const char *id) { m_rpcId = id; } + inline void setPoolUrl(const char *url) { m_pool.setUrl(url); } virtual bool parseLogin(const rapidjson::Value &result, int *code); virtual void login(); diff --git a/src/base/net/stratum/Job.cpp b/src/base/net/stratum/Job.cpp index 197f7926a..f3cb73646 100644 --- a/src/base/net/stratum/Job.cpp +++ b/src/base/net/stratum/Job.cpp @@ -30,6 +30,7 @@ #include "base/net/stratum/Job.h" +#include "base/tools/Alignment.h" #include "base/tools/Buffer.h" #include "base/tools/Cvt.h" #include "base/tools/cryptonote/BlockTemplate.h" @@ -73,7 +74,7 @@ bool xmrig::Job::setBlob(const char *blob) return false; } - if (*nonce() != 0 && !m_nicehash) { + if (readUnaligned(nonce()) != 0 && !m_nicehash) { m_nicehash = true; } diff --git a/src/base/net/stratum/Pool.h b/src/base/net/stratum/Pool.h index 865d3db56..78684510f 100644 --- a/src/base/net/stratum/Pool.h +++ b/src/base/net/stratum/Pool.h @@ -111,6 +111,7 @@ public: inline int zmq_port() const { return m_zmqPort; } inline uint64_t pollInterval() const { return m_pollInterval; } inline void setAlgo(const Algorithm &algorithm) { m_algorithm = algorithm; } + inline void setUrl(const char *url) { m_url = Url(url); } inline void setPassword(const String &password) { m_password = password; } inline void setProxy(const ProxyUrl &proxy) { m_proxy = proxy; } inline void setRigId(const String &rigId) { m_rigId = rigId; } diff --git a/src/base/tools/Alignment.h b/src/base/tools/Alignment.h new file mode 100644 index 000000000..00316af9d --- /dev/null +++ b/src/base/tools/Alignment.h @@ -0,0 +1,53 @@ +/* XMRig + * Copyright (c) 2018-2022 SChernykh + * Copyright (c) 2016-2022 XMRig , + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef XMRIG_ALIGNMENT_H +#define XMRIG_ALIGNMENT_H + + +#include +#include + + +namespace xmrig { + + +template +inline T readUnaligned(const T* ptr) +{ + static_assert(std::is_integral::value, "Integer type required"); + + T result; + memcpy(&result, ptr, sizeof(T)); + return result; +} + + +template +inline void writeUnaligned(T* ptr, T data) +{ + static_assert(std::is_integral::value, "Integer type required"); + + memcpy(ptr, &data, sizeof(T)); +} + + +} /* namespace xmrig */ + + +#endif /* XMRIG_ALIGNMENT_H */ diff --git a/src/config.json b/src/config.json index e25c57673..19b9bc588 100644 --- a/src/config.json +++ b/src/config.json @@ -94,6 +94,10 @@ "ciphersuites": null, "dhparam": null }, + "dns": { + "ipv6": false, + "ttl": 30 + }, "user-agent": null, "verbose": 0, "watch": true, diff --git a/src/core/Miner.cpp b/src/core/Miner.cpp index 78ed1f6a5..8bfccd642 100644 --- a/src/core/Miner.cpp +++ b/src/core/Miner.cpp @@ -553,7 +553,13 @@ void xmrig::Miner::setJob(const Job &job, bool donate) # ifdef XMRIG_ALGO_RANDOMX if (job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) { - stop(); + if (d_ptr->algorithm != job.algorithm()) { + stop(); + } + else { + Nonce::pause(true); + Nonce::touch(); + } } # endif diff --git a/src/crypto/cn/CryptoNight_x86.h b/src/crypto/cn/CryptoNight_x86.h index 0d27f5e2b..434c7363b 100644 --- a/src/crypto/cn/CryptoNight_x86.h +++ b/src/crypto/cn/CryptoNight_x86.h @@ -808,7 +808,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si int64_t d5; -# if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 8)) +# if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 8)) || !defined(XMRIG_64_BIT) d5 = d | 5; # else // Workaround for stupid GCC which converts to 32 bit before doing "| 5" and then converts back to 64 bit diff --git a/src/crypto/cn/sse2neon.h b/src/crypto/cn/sse2neon.h index e41d8c18b..36bc16853 100644 --- a/src/crypto/cn/sse2neon.h +++ b/src/crypto/cn/sse2neon.h @@ -344,7 +344,7 @@ typedef union ALIGN_STRUCT(16) SIMDVec { // Older gcc does not define vld1q_u8_x4 type #if defined(__GNUC__) && !defined(__clang__) && \ - ((__GNUC__ <= 10 && defined(__arm__)) || \ + ((__GNUC__ <= 11 && defined(__arm__)) || \ (__GNUC__ == 10 && __GNUC_MINOR__ < 3 && defined(__aarch64__)) || \ (__GNUC__ <= 9 && defined(__aarch64__))) FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p) diff --git a/src/crypto/common/Nonce.cpp b/src/crypto/common/Nonce.cpp index e2e51c2c2..feb487866 100644 --- a/src/crypto/common/Nonce.cpp +++ b/src/crypto/common/Nonce.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +#include "base/tools/Alignment.h" #include "crypto/common/Nonce.h" @@ -53,10 +54,10 @@ bool xmrig::Nonce::next(uint8_t index, uint32_t *nonce, uint32_t reserveCount, u continue; } - *nonce = (nonce[0] & ~mask) | counter; + writeUnaligned(nonce, static_cast((readUnaligned(nonce) & ~mask) | counter)); if (mask > 0xFFFFFFFFULL) { - nonce[1] = (nonce[1] & (~mask >> 32)) | (counter >> 32); + writeUnaligned(nonce + 1, static_cast((readUnaligned(nonce + 1) & (~mask >> 32)) | (counter >> 32))); } return true; diff --git a/src/crypto/ghostrider/README.md b/src/crypto/ghostrider/README.md index b1614abd4..4a34f0761 100644 --- a/src/crypto/ghostrider/README.md +++ b/src/crypto/ghostrider/README.md @@ -6,12 +6,12 @@ No tuning is required - auto-config works well on most CPUs! ### Sample command line (non-SSL port) ``` -xmrig -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS +xmrig -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x ``` ### Sample command line (SSL port) ``` -xmrig -a gr -o us.flockpool.com:5555 --tls -u WALLET_ADDRESS +xmrig -a gr -o rtm.suprnova.cc:4273 --tls -u WALLET_ADDRESS -p x ``` You can use **rtm_ghostrider_example.cmd** as a template and put pool URL and your wallet address there. The general XMRig documentation is available [here](https://xmrig.com/docs/miner). diff --git a/src/crypto/ghostrider/ghostrider.cpp b/src/crypto/ghostrider/ghostrider.cpp index 9f403d3aa..505378c02 100644 --- a/src/crypto/ghostrider/ghostrider.cpp +++ b/src/crypto/ghostrider/ghostrider.cpp @@ -166,7 +166,7 @@ static struct AlgoTune struct HelperThread { - HelperThread(hwloc_bitmap_t cpu_set, bool is8MB) : m_cpuSet(cpu_set), m_is8MB(is8MB) + HelperThread(hwloc_bitmap_t cpu_set, int priority, bool is8MB) : m_cpuSet(cpu_set), m_priority(priority), m_is8MB(is8MB) { uv_mutex_init(&m_mutex); uv_cond_init(&m_cond); @@ -241,6 +241,8 @@ struct HelperThread } } + Platform::setThreadPriority(m_priority); + uv_mutex_lock(&m_mutex); m_ready = true; @@ -268,6 +270,7 @@ struct HelperThread volatile bool m_ready = false; volatile bool m_finished = false; hwloc_bitmap_t m_cpuSet = {}; + int m_priority = -1; bool m_is8MB = false; std::thread* m_thread = nullptr; @@ -290,13 +293,14 @@ void benchmark() hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, thread_index1); hwloc_obj_t pu2; hwloc_get_closest_objs(topology, pu, &pu2, 1); - uint32_t thread_index2 = pu2->os_index; + uint32_t thread_index2 = pu2 ? pu2->os_index : thread_index1; if (thread_index2 < thread_index1) { std::swap(thread_index1, thread_index2); } Platform::setThreadAffinity(thread_index1); + Platform::setThreadPriority(3); constexpr uint32_t N = 1U << 21; @@ -375,7 +379,7 @@ void benchmark() hwloc_bitmap_t helper_set = hwloc_bitmap_alloc(); hwloc_bitmap_set(helper_set, thread_index2); - HelperThread* helper = new HelperThread(helper_set, false); + HelperThread* helper = new HelperThread(helper_set, 3, false); for (uint32_t algo = 0; algo < 6; ++algo) { for (uint64_t step : { 1, 2, 4}) { @@ -465,7 +469,7 @@ static inline bool findByType(hwloc_obj_t obj, hwloc_obj_type_t type, func lambd } -HelperThread* create_helper_thread(int64_t cpu_index, const std::vector& affinities) +HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::vector& affinities) { #ifndef XMRIG_ARM hwloc_bitmap_t helper_cpu_set = hwloc_bitmap_alloc(); @@ -520,7 +524,7 @@ HelperThread* create_helper_thread(int64_t cpu_index, const std::vector }); if (hwloc_bitmap_weight(helper_cpu_set) > 0) { - return new HelperThread(helper_cpu_set, is8MB); + return new HelperThread(helper_cpu_set, priority, is8MB); } } } @@ -761,7 +765,7 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct void benchmark() {} -HelperThread* create_helper_thread(int64_t, const std::vector&) { return nullptr; } +HelperThread* create_helper_thread(int64_t, int, const std::vector&) { return nullptr; } void destroy_helper_thread(HelperThread*) {} diff --git a/src/crypto/ghostrider/ghostrider.h b/src/crypto/ghostrider/ghostrider.h index 081e4f6f1..e6c08df1b 100644 --- a/src/crypto/ghostrider/ghostrider.h +++ b/src/crypto/ghostrider/ghostrider.h @@ -39,7 +39,7 @@ namespace ghostrider struct HelperThread; void benchmark(); -HelperThread* create_helper_thread(int64_t cpu_index, const std::vector& affinities); +HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::vector& affinities); void destroy_helper_thread(HelperThread* t); void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ctx** ctx, HelperThread* helper, bool verbose = true); diff --git a/src/crypto/rx/RxQueue.cpp b/src/crypto/rx/RxQueue.cpp index 86b633275..489a7bc7d 100644 --- a/src/crypto/rx/RxQueue.cpp +++ b/src/crypto/rx/RxQueue.cpp @@ -154,6 +154,8 @@ void xmrig::RxQueue::backgroundInit() continue; } + // Update seed here again in case there was more than one item in the queue + m_seed = item.seed; m_state = STATE_IDLE; m_async->send(); } diff --git a/src/net/JobResult.h b/src/net/JobResult.h index 614baf14a..c7dbf6c53 100644 --- a/src/net/JobResult.h +++ b/src/net/JobResult.h @@ -45,12 +45,12 @@ public: inline JobResult(const Job &job, uint64_t nonce, const uint8_t *result, const uint8_t* header_hash = nullptr, const uint8_t *mix_hash = nullptr, const uint8_t* miner_signature = nullptr) : algorithm(job.algorithm()), + index(job.index()), clientId(job.clientId()), jobId(job.id()), backend(job.backend()), nonce(nonce), - diff(job.diff()), - index(job.index()) + diff(job.diff()) { memcpy(m_result, result, sizeof(m_result)); @@ -70,12 +70,12 @@ public: inline JobResult(const Job &job) : algorithm(job.algorithm()), + index(job.index()), clientId(job.clientId()), jobId(job.id()), backend(job.backend()), nonce(0), - diff(0), - index(job.index()) + diff(0) { } @@ -88,12 +88,12 @@ public: inline const uint8_t *minerSignature() const { return m_hasMinerSignature ? m_minerSignature : nullptr; } const Algorithm algorithm; + const uint8_t index; const String clientId; const String jobId; const uint32_t backend; const uint64_t nonce; const uint64_t diff; - const uint8_t index; private: uint8_t m_result[32] = { 0 };