mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-10 21:04:37 +00:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
a789316bbb
22 changed files with 51 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
|
# v5.1.0
|
||||||
- [#1351](https://github.com/xmrig/xmrig/pull/1351) RandomX optimizations and fixes.
|
- [#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)
|
- 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-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-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-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
|
--no-huge-pages disable huge pages support
|
||||||
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer
|
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer
|
||||||
--randomx-init=N threads count to initialize RandomX dataset
|
--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)
|
Maximum CPU threads count (in percentage) hint for autoconfig. [CPU_MAX_USAGE.md](CPU_MAX_USAGE.md)
|
||||||
|
|
||||||
#### `memory-pool` (since v4.3.0)
|
#### `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();
|
m_controller->start();
|
||||||
|
|
||||||
Platform::setThreadPriority(5);
|
|
||||||
|
|
||||||
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||||
uv_loop_close(uv_default_loop());
|
uv_loop_close(uv_default_loop());
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "backend/common/Hashrate.h"
|
#include "backend/common/Hashrate.h"
|
||||||
|
#include "base/io/json/Json.h"
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "base/tools/Handle.h"
|
#include "base/tools/Handle.h"
|
||||||
#include "rapidjson/document.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)
|
rapidjson::Value xmrig::Hashrate::normalize(double d)
|
||||||
{
|
{
|
||||||
using namespace rapidjson;
|
return Json::normalize(d, false);
|
||||||
|
|
||||||
if (!std::isnormal(d)) {
|
|
||||||
return Value(kNullType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Value(floor(d * 100.0) / 100.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ private:
|
||||||
bool m_enabled = true;
|
bool m_enabled = true;
|
||||||
bool m_hugePages = true;
|
bool m_hugePages = true;
|
||||||
bool m_shouldSave = false;
|
bool m_shouldSave = false;
|
||||||
bool m_yield = false;
|
bool m_yield = true;
|
||||||
int m_memoryPool = 0;
|
int m_memoryPool = 0;
|
||||||
int m_priority = -1;
|
int m_priority = -1;
|
||||||
String m_argon2Impl;
|
String m_argon2Impl;
|
||||||
|
|
|
@ -31,10 +31,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "3rdparty/http-parser/http_parser.h"
|
|
||||||
#include "base/api/Api.h"
|
#include "base/api/Api.h"
|
||||||
|
#include "3rdparty/http-parser/http_parser.h"
|
||||||
#include "base/api/interfaces/IApiListener.h"
|
#include "base/api/interfaces/IApiListener.h"
|
||||||
#include "base/api/requests/HttpApiRequest.h"
|
#include "base/api/requests/HttpApiRequest.h"
|
||||||
|
#include "base/io/json/Json.h"
|
||||||
#include "base/kernel/Base.h"
|
#include "base/kernel/Base.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Buffer.h"
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
|
@ -73,9 +74,10 @@ static rapidjson::Value getResources(rapidjson::Document &doc)
|
||||||
|
|
||||||
double loadavg[3] = { 0.0 };
|
double loadavg[3] = { 0.0 };
|
||||||
uv_loadavg(loadavg);
|
uv_loadavg(loadavg);
|
||||||
load_average.PushBack(loadavg[0], allocator);
|
|
||||||
load_average.PushBack(loadavg[1], allocator);
|
for (double value : loadavg) {
|
||||||
load_average.PushBack(loadavg[2], allocator);
|
load_average.PushBack(Json::normalize(value, true), allocator);
|
||||||
|
}
|
||||||
|
|
||||||
out.AddMember("memory", memory, allocator);
|
out.AddMember("memory", memory, allocator);
|
||||||
out.AddMember("load_average", load_average, allocator);
|
out.AddMember("load_average", load_average, allocator);
|
||||||
|
@ -182,6 +184,9 @@ void xmrig::Api::exec(IApiRequest &request)
|
||||||
# endif
|
# endif
|
||||||
# ifdef XMRIG_FEATURE_OPENCL
|
# ifdef XMRIG_FEATURE_OPENCL
|
||||||
features.PushBack("opencl", allocator);
|
features.PushBack("opencl", allocator);
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_FEATURE_CUDA
|
||||||
|
features.PushBack("cuda", allocator);
|
||||||
# endif
|
# endif
|
||||||
reply.AddMember("features", features, allocator);
|
reply.AddMember("features", features, allocator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
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
|
bool xmrig::JsonReader::isEmpty() const
|
||||||
{
|
{
|
||||||
return !m_obj.IsObject() || m_obj.ObjectEmpty();
|
return !m_obj.IsObject() || m_obj.ObjectEmpty();
|
||||||
|
|
|
@ -48,6 +48,8 @@ public:
|
||||||
|
|
||||||
static bool get(const char *fileName, rapidjson::Document &doc);
|
static bool get(const char *fileName, rapidjson::Document &doc);
|
||||||
static bool save(const char *fileName, const 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());
|
Platform::init(config()->userAgent());
|
||||||
|
|
||||||
# ifndef XMRIG_PROXY_PROJECT
|
|
||||||
Platform::setProcessPriority(config()->cpu().priority());
|
|
||||||
# endif
|
|
||||||
|
|
||||||
if (isBackground()) {
|
if (isBackground()) {
|
||||||
Log::background = true;
|
Log::background = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ public:
|
||||||
static uint32_t setTimerResolution(uint32_t resolution);
|
static uint32_t setTimerResolution(uint32_t resolution);
|
||||||
static void init(const char *userAgent);
|
static void init(const char *userAgent);
|
||||||
static void restoreTimerResolution();
|
static void restoreTimerResolution();
|
||||||
static void setProcessPriority(int priority);
|
|
||||||
static void setThreadPriority(int priority);
|
static void setThreadPriority(int priority);
|
||||||
|
|
||||||
static inline const char *userAgent() { return m_userAgent; }
|
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)
|
void xmrig::Platform::setThreadPriority(int priority)
|
||||||
{
|
{
|
||||||
if (priority == -1) {
|
if (priority == -1) {
|
||||||
|
|
|
@ -111,11 +111,6 @@ void xmrig::Platform::restoreTimerResolution()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Platform::setProcessPriority(int priority)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Platform::setThreadPriority(int priority)
|
void xmrig::Platform::setThreadPriority(int priority)
|
||||||
{
|
{
|
||||||
if (priority == -1) {
|
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)
|
void xmrig::Platform::setThreadPriority(int priority)
|
||||||
{
|
{
|
||||||
if (priority == -1) {
|
if (priority == -1) {
|
||||||
|
|
|
@ -92,6 +92,7 @@ public:
|
||||||
RandomXModeKey = 1029,
|
RandomXModeKey = 1029,
|
||||||
CPUMaxThreadsKey = 1026,
|
CPUMaxThreadsKey = 1026,
|
||||||
MemoryPoolKey = 1027,
|
MemoryPoolKey = 1027,
|
||||||
|
YieldKey = 1030,
|
||||||
|
|
||||||
// xmrig amd
|
// xmrig amd
|
||||||
OclPlatformKey = 1400,
|
OclPlatformKey = 1400,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
"hw-aes": null,
|
"hw-aes": null,
|
||||||
"priority": null,
|
"priority": null,
|
||||||
"memory-pool": false,
|
"memory-pool": false,
|
||||||
"yield": false,
|
"yield": true,
|
||||||
"max-threads-hint": 100,
|
"max-threads-hint": 100,
|
||||||
"asm": true,
|
"asm": true,
|
||||||
"argon2-impl": null,
|
"argon2-impl": null,
|
||||||
|
|
|
@ -263,6 +263,11 @@ public:
|
||||||
xmrig::Miner::Miner(Controller *controller)
|
xmrig::Miner::Miner(Controller *controller)
|
||||||
: d_ptr(new MinerPrivate(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
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
Rx::init(this);
|
Rx::init(this);
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -147,7 +147,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
||||||
|
|
||||||
case IConfig::MemoryPoolKey: /* --cpu-memory-pool */
|
case IConfig::MemoryPoolKey: /* --cpu-memory-pool */
|
||||||
return set(doc, kCpu, "memory-pool", static_cast<int64_t>(strtol(arg, nullptr, 10)));
|
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
|
# ifdef XMRIG_FEATURE_ASM
|
||||||
case IConfig::AssemblyKey: /* --asm */
|
case IConfig::AssemblyKey: /* --asm */
|
||||||
|
|
|
@ -50,6 +50,7 @@ R"===(
|
||||||
"colors": true,
|
"colors": true,
|
||||||
"randomx": {
|
"randomx": {
|
||||||
"init": -1,
|
"init": -1,
|
||||||
|
"mode": "auto",
|
||||||
"numa": true
|
"numa": true
|
||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
|
@ -58,6 +59,7 @@ R"===(
|
||||||
"hw-aes": null,
|
"hw-aes": null,
|
||||||
"priority": null,
|
"priority": null,
|
||||||
"memory-pool": false,
|
"memory-pool": false,
|
||||||
|
"yield": true,
|
||||||
"max-threads-hint": 100,
|
"max-threads-hint": 100,
|
||||||
"asm": true,
|
"asm": true,
|
||||||
"argon2-impl": null,
|
"argon2-impl": null,
|
||||||
|
|
|
@ -86,6 +86,7 @@ static const option options[] = {
|
||||||
{ "max-cpu-usage", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
{ "max-cpu-usage", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
||||||
{ "cpu-max-threads-hint", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
{ "cpu-max-threads-hint", 1, nullptr, IConfig::CPUMaxThreadsKey },
|
||||||
{ "cpu-memory-pool", 1, nullptr, IConfig::MemoryPoolKey },
|
{ "cpu-memory-pool", 1, nullptr, IConfig::MemoryPoolKey },
|
||||||
|
{ "cpu-no-yield", 0, nullptr, IConfig::YieldKey },
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
{ "tls", 0, nullptr, IConfig::TlsKey },
|
{ "tls", 0, nullptr, IConfig::TlsKey },
|
||||||
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },
|
{ "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-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-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-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 += " --no-huge-pages disable huge pages support\n";
|
||||||
u += " --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer\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());
|
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info());
|
||||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(affinity));
|
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)) {
|
if (pu == nullptr || !cpu->membind(pu->nodeset)) {
|
||||||
LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory\"", affinity);
|
LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory\"", affinity);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue