mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-25 13:09:28 +00:00
Merge branch 'evo' into beta
This commit is contained in:
commit
f2dca8193b
9 changed files with 102 additions and 25 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
# v2.99.3-beta
|
||||||
|
- [#1082](https://github.com/xmrig/xmrig/issues/1082) Fixed hwloc auto configuration on AMD FX CPUs.
|
||||||
|
- Added command line option `--export-topology` for export hwloc topology to a XML file.
|
||||||
|
|
||||||
# v2.99.2-beta
|
# v2.99.2-beta
|
||||||
- [#1077](https://github.com/xmrig/xmrig/issues/1077) Added NUMA support via **hwloc**.
|
- [#1077](https://github.com/xmrig/xmrig/issues/1077) Added NUMA support via **hwloc**.
|
||||||
- Fixed miner freeze when switch between RandomX variants.
|
- Fixed miner freeze when switch between RandomX variants.
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "core/config/Config.h"
|
#include "core/config/Config.h"
|
||||||
#include "core/Controller.h"
|
#include "core/Controller.h"
|
||||||
#include "crypto/common/Algorithm.h"
|
|
||||||
#include "crypto/common/keccak.h"
|
#include "crypto/common/keccak.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
@ -54,8 +53,8 @@ xmrig::Api::Api(Base *base) :
|
||||||
m_base(base),
|
m_base(base),
|
||||||
m_id(),
|
m_id(),
|
||||||
m_workerId(),
|
m_workerId(),
|
||||||
m_httpd(nullptr),
|
m_timestamp(Chrono::currentMSecsSinceEpoch()),
|
||||||
m_timestamp(Chrono::steadyMSecs())
|
m_httpd(nullptr)
|
||||||
{
|
{
|
||||||
base->addListener(this);
|
base->addListener(this);
|
||||||
|
|
||||||
|
@ -120,7 +119,7 @@ void xmrig::Api::exec(IApiRequest &request)
|
||||||
request.accept();
|
request.accept();
|
||||||
request.reply().AddMember("id", StringRef(m_id), allocator);
|
request.reply().AddMember("id", StringRef(m_id), allocator);
|
||||||
request.reply().AddMember("worker_id", StringRef(m_workerId), allocator);
|
request.reply().AddMember("worker_id", StringRef(m_workerId), allocator);
|
||||||
request.reply().AddMember("uptime", (Chrono::steadyMSecs() - m_timestamp) / 1000, allocator);
|
request.reply().AddMember("uptime", (Chrono::currentMSecsSinceEpoch() - m_timestamp) / 1000, allocator);
|
||||||
|
|
||||||
Value features(kArrayType);
|
Value features(kArrayType);
|
||||||
# ifdef XMRIG_FEATURE_API
|
# ifdef XMRIG_FEATURE_API
|
||||||
|
@ -135,6 +134,9 @@ void xmrig::Api::exec(IApiRequest &request)
|
||||||
# ifdef XMRIG_FEATURE_LIBCPUID
|
# ifdef XMRIG_FEATURE_LIBCPUID
|
||||||
features.PushBack("cpuid", allocator);
|
features.PushBack("cpuid", allocator);
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
features.PushBack("hwloc", allocator);
|
||||||
|
# endif
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
features.PushBack("tls", allocator);
|
features.PushBack("tls", allocator);
|
||||||
# endif
|
# endif
|
||||||
|
@ -181,8 +183,8 @@ void xmrig::Api::genId(const String &id)
|
||||||
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
|
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
|
||||||
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, strlen(APP_KIND));
|
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, strlen(APP_KIND));
|
||||||
|
|
||||||
xmrig::keccak(input, inSize, hash);
|
keccak(input, inSize, hash);
|
||||||
xmrig::Buffer::toHex(hash, 8, m_id);
|
Buffer::toHex(hash, 8, m_id);
|
||||||
|
|
||||||
delete [] input;
|
delete [] input;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -69,9 +69,9 @@ private:
|
||||||
Base *m_base;
|
Base *m_base;
|
||||||
char m_id[32];
|
char m_id[32];
|
||||||
char m_workerId[128];
|
char m_workerId[128];
|
||||||
|
const uint64_t m_timestamp;
|
||||||
Httpd *m_httpd;
|
Httpd *m_httpd;
|
||||||
std::vector<IApiListener *> m_listeners;
|
std::vector<IApiListener *> m_listeners;
|
||||||
uint64_t m_timestamp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "backend/cpu/platform/HwlocCpuInfo.h"
|
#include "backend/cpu/platform/HwlocCpuInfo.h"
|
||||||
|
#include "base/io/log/Log.h"
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
@ -84,6 +85,15 @@ static inline void findByType(hwloc_obj_t obj, hwloc_obj_type_t type, func lambd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline std::vector<hwloc_obj_t> findByType(hwloc_obj_t obj, hwloc_obj_type_t type)
|
||||||
|
{
|
||||||
|
std::vector<hwloc_obj_t> out;
|
||||||
|
findByType(obj, type, [&out](hwloc_obj_t found) { out.emplace_back(found); });
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline size_t countByType(hwloc_topology_t topology, hwloc_obj_type_t type)
|
static inline size_t countByType(hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||||
{
|
{
|
||||||
const int count = hwloc_get_nbobjs_by_type(topology, type);
|
const int count = hwloc_get_nbobjs_by_type(topology, type);
|
||||||
|
@ -132,8 +142,7 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
std::vector<hwloc_obj_t> packages;
|
const std::vector<hwloc_obj_t> packages = findByType(hwloc_get_root_obj(m_topology), HWLOC_OBJ_PACKAGE);
|
||||||
findByType(hwloc_get_root_obj(m_topology), HWLOC_OBJ_PACKAGE, [&packages](hwloc_obj_t found) { packages.emplace_back(found); });
|
|
||||||
if (packages.size()) {
|
if (packages.size()) {
|
||||||
const char *value = hwloc_obj_get_info_by_name(packages[0], "CPUModel");
|
const char *value = hwloc_obj_get_info_by_name(packages[0], "CPUModel");
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -193,6 +202,12 @@ xmrig::CpuThreads xmrig::HwlocCpuInfo::threads(const Algorithm &algorithm) const
|
||||||
processTopLevelCache(cache, algorithm, threads);
|
processTopLevelCache(cache, algorithm, threads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (threads.empty()) {
|
||||||
|
LOG_WARN("hwloc auto configuration for algorithm \"%s\" failed.", algorithm.shortName());
|
||||||
|
|
||||||
|
return BasicCpuInfo::threads(algorithm);
|
||||||
|
}
|
||||||
|
|
||||||
return threads;
|
return threads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,14 +264,9 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
||||||
|
|
||||||
if (cacheHashes >= PUs) {
|
if (cacheHashes >= PUs) {
|
||||||
for (hwloc_obj_t core : cores) {
|
for (hwloc_obj_t core : cores) {
|
||||||
if (core->arity == 0) {
|
const std::vector<hwloc_obj_t> units = findByType(core, HWLOC_OBJ_PU);
|
||||||
continue;
|
for (hwloc_obj_t pu : units) {
|
||||||
}
|
threads.push_back(CpuThread(1, pu->os_index));
|
||||||
|
|
||||||
for (unsigned i = 0; i < core->arity; ++i) {
|
|
||||||
if (core->children[i]->type == HWLOC_OBJ_PU) {
|
|
||||||
threads.push_back(CpuThread(1, core->children[i]->os_index));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +278,8 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
||||||
bool allocated_pu = false;
|
bool allocated_pu = false;
|
||||||
|
|
||||||
for (hwloc_obj_t core : cores) {
|
for (hwloc_obj_t core : cores) {
|
||||||
if (core->arity <= pu_id || core->children[pu_id]->type != HWLOC_OBJ_PU) {
|
const std::vector<hwloc_obj_t> units = findByType(core, HWLOC_OBJ_PU);
|
||||||
|
if (units.size() <= pu_id) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +287,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
||||||
PUs--;
|
PUs--;
|
||||||
|
|
||||||
allocated_pu = true;
|
allocated_pu = true;
|
||||||
threads.push_back(CpuThread(1, core->children[pu_id]->os_index));
|
threads.push_back(CpuThread(1, units[pu_id]->os_index));
|
||||||
|
|
||||||
if (cacheHashes == 0) {
|
if (cacheHashes == 0) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
static int showVersion()
|
static int showVersion()
|
||||||
{
|
{
|
||||||
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
|
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
|
||||||
|
@ -92,6 +95,36 @@ static int showVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
static int exportTopology(const Process &process)
|
||||||
|
{
|
||||||
|
const String path = process.location(Process::ExeLocation, "topology.xml");
|
||||||
|
|
||||||
|
hwloc_topology_t topology;
|
||||||
|
hwloc_topology_init(&topology);
|
||||||
|
hwloc_topology_load(topology);
|
||||||
|
|
||||||
|
# if HWLOC_API_VERSION >= 0x20000
|
||||||
|
if (hwloc_topology_export_xml(topology, path, 0) == -1) {
|
||||||
|
# else
|
||||||
|
if (hwloc_topology_export_xml(topology, path) == -1) {
|
||||||
|
# endif
|
||||||
|
printf("failed to export hwloc topology.\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("hwloc topology successfully exported to \"%s\"\n", path.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
hwloc_topology_destroy(topology);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
xmrig::Entry::Id xmrig::Entry::get(const Process &process)
|
xmrig::Entry::Id xmrig::Entry::get(const Process &process)
|
||||||
{
|
{
|
||||||
const Arguments &args = process.arguments();
|
const Arguments &args = process.arguments();
|
||||||
|
@ -103,11 +136,17 @@ xmrig::Entry::Id xmrig::Entry::get(const Process &process)
|
||||||
return Version;
|
return Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
if (args.hasArg("--export-topology")) {
|
||||||
|
return Topo;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int xmrig::Entry::exec(const Process &, Id id)
|
int xmrig::Entry::exec(const Process &process, Id id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case Usage:
|
case Usage:
|
||||||
|
@ -117,6 +156,11 @@ int xmrig::Entry::exec(const Process &, Id id)
|
||||||
case Version:
|
case Version:
|
||||||
return showVersion();
|
return showVersion();
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
case Topo:
|
||||||
|
return exportTopology(process);
|
||||||
|
# endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,8 @@ public:
|
||||||
enum Id {
|
enum Id {
|
||||||
Default,
|
Default,
|
||||||
Usage,
|
Usage,
|
||||||
Version
|
Version,
|
||||||
|
Topo
|
||||||
};
|
};
|
||||||
|
|
||||||
static Id get(const Process &process);
|
static Id get(const Process &process);
|
||||||
|
|
|
@ -113,6 +113,10 @@ Options:\n\
|
||||||
--randomx-init=N threads count to initialize RandomX dataset\n\
|
--randomx-init=N threads count to initialize RandomX dataset\n\
|
||||||
--randomx-no-numa disable NUMA support for RandomX\n"
|
--randomx-no-numa disable NUMA support for RandomX\n"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
"\
|
||||||
|
--export-topology export hwloc topology to a XML file and exit\n"
|
||||||
|
#endif
|
||||||
"\
|
"\
|
||||||
--dry-run test configuration and exit\n\
|
--dry-run test configuration and exit\n\
|
||||||
-h, --help display this help and exit\n\
|
-h, --help display this help and exit\n\
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
#include "crypto/cn/CnAlgo.h"
|
#include "crypto/cn/CnAlgo.h"
|
||||||
#include "crypto/common/Algorithm.h"
|
#include "crypto/common/Algorithm.h"
|
||||||
#include "crypto/rx/RxAlgo.h"
|
|
||||||
#include "rapidjson/document.h"
|
#include "rapidjson/document.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +139,19 @@ size_t xmrig::Algorithm::memory() const
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if (f == RANDOM_X) {
|
if (f == RANDOM_X) {
|
||||||
return RxAlgo::l3(m_id);
|
constexpr size_t oneMiB = 0x100000;
|
||||||
|
|
||||||
|
switch (m_id) {
|
||||||
|
case RX_0:
|
||||||
|
case RX_LOKI:
|
||||||
|
return oneMiB * 2;
|
||||||
|
|
||||||
|
case RX_WOW:
|
||||||
|
return oneMiB;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#define APP_ID "xmrig"
|
#define APP_ID "xmrig"
|
||||||
#define APP_NAME "XMRig"
|
#define APP_NAME "XMRig"
|
||||||
#define APP_DESC "XMRig CPU miner"
|
#define APP_DESC "XMRig CPU miner"
|
||||||
#define APP_VERSION "2.99.2-beta"
|
#define APP_VERSION "2.99.3-evo"
|
||||||
#define APP_DOMAIN "xmrig.com"
|
#define APP_DOMAIN "xmrig.com"
|
||||||
#define APP_SITE "www.xmrig.com"
|
#define APP_SITE "www.xmrig.com"
|
||||||
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#define APP_VER_MAJOR 2
|
#define APP_VER_MAJOR 2
|
||||||
#define APP_VER_MINOR 99
|
#define APP_VER_MINOR 99
|
||||||
#define APP_VER_PATCH 2
|
#define APP_VER_PATCH 3
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# if (_MSC_VER >= 1920)
|
# if (_MSC_VER >= 1920)
|
||||||
|
|
Loading…
Reference in a new issue