Merge branch 'dev'
This commit is contained in:
commit
d0f88c6068
28 changed files with 65 additions and 72 deletions
|
@ -1,3 +1,8 @@
|
|||
# v5.1.1
|
||||
- [#1365](https://github.com/xmrig/xmrig/issues/1365) Fixed various system response/stability issues.
|
||||
- Added new CPU option `yield` and command line equivalent `--cpu-no-yield`.
|
||||
- [#1363](https://github.com/xmrig/xmrig/issues/1363) Fixed wrong priority of main miner thread.
|
||||
|
||||
# v5.1.0
|
||||
- [#1351](https://github.com/xmrig/xmrig/pull/1351) RandomX optimizations and fixes.
|
||||
- Improved RandomX performance (up to +6-7% on Intel CPUs, +2-3% on Ryzen CPUs)
|
||||
|
|
|
@ -59,6 +59,7 @@ CPU backend:
|
|||
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)
|
||||
--cpu-max-threads-hint=N maximum CPU threads count (in percentage) hint for autoconfig
|
||||
--cpu-memory-pool=N number of 2 MB pages for persistent memory pool, -1 (auto), 0 (disable)
|
||||
--cpu-no-yield prefer maximum hashrate rather than system response/stability
|
||||
--no-huge-pages disable huge pages support
|
||||
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer
|
||||
--randomx-init=N threads count to initialize RandomX dataset
|
||||
|
|
|
@ -99,4 +99,7 @@ Allow override automatically detected Argon2 implementation, this option added m
|
|||
Maximum CPU threads count (in percentage) hint for autoconfig. [CPU_MAX_USAGE.md](CPU_MAX_USAGE.md)
|
||||
|
||||
#### `memory-pool` (since v4.3.0)
|
||||
Use continuous, persistent memory block for mining threads, useful for preserve huge pages allocation while algorithm swithing. Default value `false` (feature disabled) or `true` or specific count of 2 MB huge pages.
|
||||
Use continuous, persistent memory block for mining threads, useful for preserve huge pages allocation while algorithm swithing. Possible values `false` (feature disabled, by default) or `true` or specific count of 2 MB huge pages.
|
||||
|
||||
#### `yield` (since v5.1.1)
|
||||
Prefer system better system response/stability `true` (default value) or maximum hashrate `false`.
|
||||
|
|
|
@ -90,8 +90,6 @@ int xmrig::App::exec()
|
|||
|
||||
m_controller->start();
|
||||
|
||||
Platform::setThreadPriority(5);
|
||||
|
||||
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
uv_loop_close(uv_default_loop());
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
|
||||
#include "backend/common/Hashrate.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
@ -157,13 +158,7 @@ const char *xmrig::Hashrate::format(double h, char *buf, size_t size)
|
|||
|
||||
rapidjson::Value xmrig::Hashrate::normalize(double d)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
if (!std::isnormal(d)) {
|
||||
return Value(kNullType);
|
||||
}
|
||||
|
||||
return Value(floor(d * 100.0) / 100.0);
|
||||
return Json::normalize(d, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ static const char *kHwAes = "hw-aes";
|
|||
static const char *kMaxThreadsHint = "max-threads-hint";
|
||||
static const char *kMemoryPool = "memory-pool";
|
||||
static const char *kPriority = "priority";
|
||||
static const char *kYield = "yield";
|
||||
|
||||
#ifdef XMRIG_FEATURE_ASM
|
||||
static const char *kAsm = "asm";
|
||||
|
@ -70,6 +71,7 @@ rapidjson::Value xmrig::CpuConfig::toJSON(rapidjson::Document &doc) const
|
|||
obj.AddMember(StringRef(kHwAes), m_aes == AES_AUTO ? Value(kNullType) : Value(m_aes == AES_HW), allocator);
|
||||
obj.AddMember(StringRef(kPriority), priority() != -1 ? Value(priority()) : Value(kNullType), allocator);
|
||||
obj.AddMember(StringRef(kMemoryPool), m_memoryPool < 1 ? Value(m_memoryPool < 0) : Value(m_memoryPool), allocator);
|
||||
obj.AddMember(StringRef(kYield), m_yield, allocator);
|
||||
|
||||
if (m_threads.isEmpty()) {
|
||||
obj.AddMember(StringRef(kMaxThreadsHint), m_limit, allocator);
|
||||
|
@ -120,6 +122,7 @@ void xmrig::CpuConfig::read(const rapidjson::Value &value)
|
|||
m_enabled = Json::getBool(value, kEnabled, m_enabled);
|
||||
m_hugePages = Json::getBool(value, kHugePages, m_hugePages);
|
||||
m_limit = Json::getUint(value, kMaxThreadsHint, m_limit);
|
||||
m_yield = Json::getBool(value, kYield, m_yield);
|
||||
|
||||
setAesMode(Json::getValue(value, kHwAes));
|
||||
setPriority(Json::getInt(value, kPriority, -1));
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
inline bool isEnabled() const { return m_enabled; }
|
||||
inline bool isHugePages() const { return m_hugePages; }
|
||||
inline bool isShouldSave() const { return m_shouldSave; }
|
||||
inline bool isYield() const { return m_yield; }
|
||||
inline const Assembly &assembly() const { return m_assembly; }
|
||||
inline const String &argon2Impl() const { return m_argon2Impl; }
|
||||
inline const Threads<CpuThreads> &threads() const { return m_threads; }
|
||||
|
@ -72,6 +73,7 @@ private:
|
|||
bool m_enabled = true;
|
||||
bool m_hugePages = true;
|
||||
bool m_shouldSave = false;
|
||||
bool m_yield = true;
|
||||
int m_memoryPool = 0;
|
||||
int m_priority = -1;
|
||||
String m_argon2Impl;
|
||||
|
|
|
@ -38,6 +38,7 @@ xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorit
|
|||
assembly(config.assembly()),
|
||||
hugePages(config.isHugePages()),
|
||||
hwAES(config.isHwAES()),
|
||||
yield(config.isYield()),
|
||||
priority(config.priority()),
|
||||
affinity(thread.affinity()),
|
||||
miner(miner),
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
const Assembly assembly;
|
||||
const bool hugePages;
|
||||
const bool hwAES;
|
||||
const bool yield;
|
||||
const int priority;
|
||||
const int64_t affinity;
|
||||
const Miner *miner;
|
||||
|
|
|
@ -58,6 +58,7 @@ xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
|
|||
m_algorithm(data.algorithm),
|
||||
m_assembly(data.assembly),
|
||||
m_hwAES(data.hwAES),
|
||||
m_yield(data.yield),
|
||||
m_av(data.av()),
|
||||
m_miner(data.miner),
|
||||
m_ctx()
|
||||
|
@ -236,6 +237,10 @@ void xmrig::CpuWorker<N>::start()
|
|||
}
|
||||
|
||||
m_count += N;
|
||||
|
||||
if (m_yield) {
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
|
||||
consumeJob();
|
||||
|
|
|
@ -71,6 +71,7 @@ private:
|
|||
const Algorithm m_algorithm;
|
||||
const Assembly m_assembly;
|
||||
const bool m_hwAES;
|
||||
const bool m_yield;
|
||||
const CnHash::AlgoVariant m_av;
|
||||
const Miner *m_miner;
|
||||
cryptonight_ctx *m_ctx[N];
|
||||
|
|
|
@ -31,10 +31,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
#include "3rdparty/http-parser/http_parser.h"
|
||||
#include "base/api/Api.h"
|
||||
#include "3rdparty/http-parser/http_parser.h"
|
||||
#include "base/api/interfaces/IApiListener.h"
|
||||
#include "base/api/requests/HttpApiRequest.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/kernel/Base.h"
|
||||
#include "base/tools/Buffer.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
|
@ -73,9 +74,10 @@ static rapidjson::Value getResources(rapidjson::Document &doc)
|
|||
|
||||
double loadavg[3] = { 0.0 };
|
||||
uv_loadavg(loadavg);
|
||||
load_average.PushBack(loadavg[0], allocator);
|
||||
load_average.PushBack(loadavg[1], allocator);
|
||||
load_average.PushBack(loadavg[2], allocator);
|
||||
|
||||
for (double value : loadavg) {
|
||||
load_average.PushBack(Json::normalize(value, true), allocator);
|
||||
}
|
||||
|
||||
out.AddMember("memory", memory, allocator);
|
||||
out.AddMember("load_average", load_average, allocator);
|
||||
|
@ -182,6 +184,9 @@ void xmrig::Api::exec(IApiRequest &request)
|
|||
# endif
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
features.PushBack("opencl", allocator);
|
||||
# endif
|
||||
# ifdef XMRIG_FEATURE_CUDA
|
||||
features.PushBack("cuda", allocator);
|
||||
# endif
|
||||
reply.AddMember("features", features, allocator);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -154,6 +155,18 @@ unsigned xmrig::Json::getUint(const rapidjson::Value &obj, const char *key, unsi
|
|||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::Json::normalize(double value, bool zero)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
if (!std::isnormal(value)) {
|
||||
return zero ? Value(0.0) : Value(kNullType);
|
||||
}
|
||||
|
||||
return Value(floor(value * 100.0) / 100.0);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::JsonReader::isEmpty() const
|
||||
{
|
||||
return !m_obj.IsObject() || m_obj.ObjectEmpty();
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
|
||||
static bool get(const char *fileName, rapidjson::Document &doc);
|
||||
static bool save(const char *fileName, const rapidjson::Document &doc);
|
||||
|
||||
static rapidjson::Value normalize(double value, bool zero);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -176,10 +176,6 @@ int xmrig::Base::init()
|
|||
|
||||
Platform::init(config()->userAgent());
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
Platform::setProcessPriority(config()->cpu().priority());
|
||||
# endif
|
||||
|
||||
if (isBackground()) {
|
||||
Log::background = true;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ public:
|
|||
static uint32_t setTimerResolution(uint32_t resolution);
|
||||
static void init(const char *userAgent);
|
||||
static void restoreTimerResolution();
|
||||
static void setProcessPriority(int priority);
|
||||
static void setThreadPriority(int priority);
|
||||
|
||||
static inline const char *userAgent() { return m_userAgent; }
|
||||
|
|
|
@ -83,11 +83,6 @@ void xmrig::Platform::restoreTimerResolution()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setProcessPriority(int priority)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setThreadPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
|
|
|
@ -111,11 +111,6 @@ void xmrig::Platform::restoreTimerResolution()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setProcessPriority(int priority)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setThreadPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
|
|
|
@ -131,43 +131,6 @@ void xmrig::Platform::restoreTimerResolution()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setProcessPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD prio = IDLE_PRIORITY_CLASS;
|
||||
switch (priority)
|
||||
{
|
||||
case 1:
|
||||
prio = BELOW_NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
prio = NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
prio = ABOVE_NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
prio = HIGH_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
prio = REALTIME_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SetPriorityClass(GetCurrentProcess(), prio);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setThreadPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
RandomXModeKey = 1029,
|
||||
CPUMaxThreadsKey = 1026,
|
||||
MemoryPoolKey = 1027,
|
||||
YieldKey = 1030,
|
||||
|
||||
// xmrig amd
|
||||
OclPlatformKey = 1400,
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
"hw-aes": null,
|
||||
"priority": null,
|
||||
"memory-pool": false,
|
||||
"yield": true,
|
||||
"max-threads-hint": 100,
|
||||
"asm": true,
|
||||
"argon2-impl": null,
|
||||
|
|
|
@ -263,6 +263,11 @@ public:
|
|||
xmrig::Miner::Miner(Controller *controller)
|
||||
: d_ptr(new MinerPrivate(controller))
|
||||
{
|
||||
const int priority = controller->config()->cpu().priority();
|
||||
if (priority >= 0) {
|
||||
Platform::setThreadPriority(std::min(priority + 1, 5));
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
Rx::init(this);
|
||||
# endif
|
||||
|
|
|
@ -147,7 +147,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
|||
|
||||
case IConfig::MemoryPoolKey: /* --cpu-memory-pool */
|
||||
return set(doc, kCpu, "memory-pool", static_cast<int64_t>(strtol(arg, nullptr, 10)));
|
||||
break;
|
||||
|
||||
case IConfig::YieldKey: /* --cpu-no-yield */
|
||||
return set(doc, kCpu, "yield", false);
|
||||
|
||||
# ifdef XMRIG_FEATURE_ASM
|
||||
case IConfig::AssemblyKey: /* --asm */
|
||||
|
|
|
@ -50,6 +50,7 @@ R"===(
|
|||
"colors": true,
|
||||
"randomx": {
|
||||
"init": -1,
|
||||
"mode": "auto",
|
||||
"numa": true
|
||||
},
|
||||
"cpu": {
|
||||
|
@ -58,6 +59,7 @@ R"===(
|
|||
"hw-aes": null,
|
||||
"priority": null,
|
||||
"memory-pool": false,
|
||||
"yield": true,
|
||||
"max-threads-hint": 100,
|
||||
"asm": true,
|
||||
"argon2-impl": null,
|
||||
|
|
|
@ -86,6 +86,7 @@ static const option options[] = {
|
|||
{ "max-cpu-usage", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
||||
{ "cpu-max-threads-hint", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
||||
{ "cpu-memory-pool", 1, nullptr, IConfig::MemoryPoolKey },
|
||||
{ "cpu-no-yield", 0, nullptr, IConfig::YieldKey },
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
{ "tls", 0, nullptr, IConfig::TlsKey },
|
||||
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },
|
||||
|
|
|
@ -80,6 +80,7 @@ static inline const std::string &usage()
|
|||
u += " --cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n";
|
||||
u += " --cpu-max-threads-hint=N maximum CPU threads count (in percentage) hint for autoconfig\n";
|
||||
u += " --cpu-memory-pool=N number of 2 MB pages for persistent memory pool, -1 (auto), 0 (disable)\n";
|
||||
u += " --cpu-no-yield prefer maximum hashrate rather than system response/stability\n";
|
||||
u += " --no-huge-pages disable huge pages support\n";
|
||||
u += " --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer\n";
|
||||
|
||||
|
|
|
@ -43,9 +43,6 @@ uint32_t xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
|
|||
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info());
|
||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(affinity));
|
||||
|
||||
char *buffer;
|
||||
hwloc_bitmap_asprintf(&buffer, pu->cpuset);
|
||||
|
||||
if (pu == nullptr || !cpu->membind(pu->nodeset)) {
|
||||
LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory\"", affinity);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig miner"
|
||||
#define APP_VERSION "5.1.0"
|
||||
#define APP_VERSION "5.1.1-dev"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#define APP_VER_MAJOR 5
|
||||
#define APP_VER_MINOR 1
|
||||
#define APP_VER_PATCH 0
|
||||
#define APP_VER_PATCH 1
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1920)
|
||||
|
|
Loading…
Reference in a new issue