mirror of
https://github.com/xmrig/xmrig.git
synced 2026-06-20 03:24:37 -04:00
Compare commits
5 Commits
554b60966b
...
ff53be5f3b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff53be5f3b | ||
|
|
6981e68ae3 | ||
|
|
c7e541d84f | ||
|
|
a2ae17b4c4 | ||
|
|
c0bce256e1 |
@@ -10,7 +10,7 @@
|
|||||||
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight 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.
|
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight 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
|
## Mining backends
|
||||||
- **CPU** (x64/ARMv7/ARMv8)
|
- **CPU** (x86/x64/ARMv7/ARMv8)
|
||||||
- **OpenCL** for AMD GPUs.
|
- **OpenCL** for AMD GPUs.
|
||||||
- **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda).
|
- **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda).
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} /* namespace xmrig */
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
#endif /* XMRIG_CPU_H */
|
#endif // XMRIG_CPU_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2021 XMRig <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,6 +26,12 @@
|
|||||||
#include "crypto/common/Assembly.h"
|
#include "crypto/common/Assembly.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
using hwloc_const_bitmap_t = const struct hwloc_bitmap_s *;
|
||||||
|
using hwloc_topology_t = struct hwloc_topology *;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
@@ -116,10 +122,16 @@ public:
|
|||||||
virtual size_t threads() const = 0;
|
virtual size_t threads() const = 0;
|
||||||
virtual Vendor vendor() const = 0;
|
virtual Vendor vendor() const = 0;
|
||||||
virtual uint32_t model() const = 0;
|
virtual uint32_t model() const = 0;
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
virtual bool membind(hwloc_const_bitmap_t nodeset) = 0;
|
||||||
|
virtual const std::vector<uint32_t> &nodeset() const = 0;
|
||||||
|
virtual hwloc_topology_t topology() const = 0;
|
||||||
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} /* namespace xmrig */
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
#endif // XMRIG_CPUINFO_H
|
#endif // XMRIG_CPUINFO_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright (c) 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2021 XMRig <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -72,11 +72,10 @@ protected:
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
Arch m_arch = ARCH_UNKNOWN;
|
Arch m_arch = ARCH_UNKNOWN;
|
||||||
bool m_jccErratum = false;
|
bool m_jccErratum = false;
|
||||||
char m_brand[64 + 6]{};
|
char m_brand[64 + 6]{};
|
||||||
size_t m_threads;
|
size_t m_threads = 0;
|
||||||
std::vector<int32_t> m_units;
|
std::vector<int32_t> m_units;
|
||||||
Vendor m_vendor = VENDOR_UNKNOWN;
|
Vendor m_vendor = VENDOR_UNKNOWN;
|
||||||
|
|
||||||
@@ -94,7 +93,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} /* namespace xmrig */
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
#endif /* XMRIG_BASICCPUINFO_H */
|
#endif // XMRIG_BASICCPUINFO_H
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ static inline int hwloc_obj_type_is_cache(hwloc_obj_type_t type)
|
|||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
uint32_t HwlocCpuInfo::m_features = 0;
|
|
||||||
|
|
||||||
|
|
||||||
template <typename func>
|
template <typename func>
|
||||||
static inline void findCache(hwloc_obj_t obj, unsigned min, unsigned max, func lambda)
|
static inline void findCache(hwloc_obj_t obj, unsigned min, unsigned max, func lambda)
|
||||||
{
|
{
|
||||||
@@ -172,10 +169,6 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo()
|
|||||||
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
|
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
|
||||||
|
|
||||||
if (m_nodes > 1) {
|
if (m_nodes > 1) {
|
||||||
if (hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
|
|
||||||
m_features |= SET_THISTHREAD_MEMBIND;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_nodeset.reserve(m_nodes);
|
m_nodeset.reserve(m_nodes);
|
||||||
hwloc_obj_t node = nullptr;
|
hwloc_obj_t node = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "backend/cpu/platform/BasicCpuInfo.h"
|
#include "backend/cpu/platform/BasicCpuInfo.h"
|
||||||
#include "base/tools/Object.h"
|
|
||||||
|
|
||||||
|
|
||||||
using hwloc_const_bitmap_t = const struct hwloc_bitmap_s *;
|
using hwloc_obj_t = struct hwloc_obj *;
|
||||||
using hwloc_obj_t = struct hwloc_obj *;
|
|
||||||
using hwloc_topology_t = struct hwloc_topology *;
|
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
@@ -37,39 +34,27 @@ class HwlocCpuInfo : public BasicCpuInfo
|
|||||||
public:
|
public:
|
||||||
XMRIG_DISABLE_COPY_MOVE(HwlocCpuInfo)
|
XMRIG_DISABLE_COPY_MOVE(HwlocCpuInfo)
|
||||||
|
|
||||||
|
|
||||||
enum Feature : uint32_t {
|
|
||||||
SET_THISTHREAD_MEMBIND = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
HwlocCpuInfo();
|
HwlocCpuInfo();
|
||||||
~HwlocCpuInfo() override;
|
~HwlocCpuInfo() override;
|
||||||
|
|
||||||
static inline bool hasFeature(Feature feature) { return m_features & feature; }
|
|
||||||
|
|
||||||
inline const std::vector<uint32_t> &nodeset() const { return m_nodeset; }
|
|
||||||
inline hwloc_topology_t topology() const { return m_topology; }
|
|
||||||
|
|
||||||
bool membind(hwloc_const_bitmap_t nodeset);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool membind(hwloc_const_bitmap_t nodeset) override;
|
||||||
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
|
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
|
||||||
|
|
||||||
inline const char *backend() const override { return m_backend; }
|
inline const char *backend() const override { return m_backend; }
|
||||||
inline size_t cores() const override { return m_cores; }
|
inline const std::vector<uint32_t> &nodeset() const override { return m_nodeset; }
|
||||||
inline size_t L2() const override { return m_cache[2]; }
|
inline hwloc_topology_t topology() const override { return m_topology; }
|
||||||
inline size_t L3() const override { return m_cache[3]; }
|
inline size_t cores() const override { return m_cores; }
|
||||||
inline size_t nodes() const override { return m_nodes; }
|
inline size_t L2() const override { return m_cache[2]; }
|
||||||
inline size_t packages() const override { return m_packages; }
|
inline size_t L3() const override { return m_cache[3]; }
|
||||||
|
inline size_t nodes() const override { return m_nodes; }
|
||||||
|
inline size_t packages() const override { return m_packages; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CpuThreads allThreads(const Algorithm &algorithm, uint32_t limit) const;
|
CpuThreads allThreads(const Algorithm &algorithm, uint32_t limit) const;
|
||||||
void processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const;
|
void processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const;
|
||||||
void setThreads(size_t threads);
|
void setThreads(size_t threads);
|
||||||
|
|
||||||
static uint32_t m_features;
|
|
||||||
|
|
||||||
char m_backend[20] = { 0 };
|
char m_backend[20] = { 0 };
|
||||||
hwloc_topology_t m_topology = nullptr;
|
hwloc_topology_t m_topology = nullptr;
|
||||||
size_t m_cache[5] = { 0 };
|
size_t m_cache[5] = { 0 };
|
||||||
@@ -80,7 +65,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} /* namespace xmrig */
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
#endif /* XMRIG_HWLOCCPUINFO_H */
|
#endif // XMRIG_HWLOCCPUINFO_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,9 +16,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "base/kernel/Platform.h"
|
#include "base/kernel/Platform.h"
|
||||||
#include "backend/cpu/platform/HwlocCpuInfo.h"
|
|
||||||
#include "backend/cpu/Cpu.h"
|
#include "backend/cpu/Cpu.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -29,20 +27,21 @@
|
|||||||
#ifndef XMRIG_OS_APPLE
|
#ifndef XMRIG_OS_APPLE
|
||||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||||
{
|
{
|
||||||
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info());
|
auto topology = Cpu::info()->topology();
|
||||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(cpu_id));
|
auto pu = hwloc_get_pu_obj_by_os_index(topology, static_cast<unsigned>(cpu_id));
|
||||||
|
|
||||||
if (pu == nullptr) {
|
if (pu == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) >= 0) {
|
if (hwloc_set_cpubind(topology, pu->cpuset, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) >= 0) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool result = (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0);
|
const bool result = (hwloc_set_cpubind(topology, pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright (c) 2018-2019 tevador <tevador@gmail.com>
|
* Copyright (c) 2018-2019 tevador <tevador@gmail.com>
|
||||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,10 +18,8 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "crypto/common/VirtualMemory.h"
|
#include "crypto/common/VirtualMemory.h"
|
||||||
#include "backend/cpu/Cpu.h"
|
#include "backend/cpu/Cpu.h"
|
||||||
#include "backend/cpu/platform/HwlocCpuInfo.h"
|
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -34,10 +32,9 @@ uint32_t xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info());
|
auto pu = hwloc_get_pu_obj_by_os_index(Cpu::info()->topology(), static_cast<unsigned>(affinity));
|
||||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(affinity));
|
|
||||||
|
|
||||||
if (pu == nullptr || !cpu->membind(pu->nodeset)) {
|
if (pu == nullptr || !Cpu::info()->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);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
|
|
||||||
#ifdef XMRIG_FEATURE_HWLOC
|
#ifdef XMRIG_FEATURE_HWLOC
|
||||||
# include "base/kernel/Platform.h"
|
# include "base/kernel/Platform.h"
|
||||||
# include "backend/cpu/platform/HwlocCpuInfo.h"
|
|
||||||
# include <hwloc.h>
|
# include <hwloc.h>
|
||||||
|
|
||||||
# if HWLOC_API_VERSION < 0x20000
|
# if HWLOC_API_VERSION < 0x20000
|
||||||
@@ -90,7 +89,7 @@ CORE_HASH(14, whirlpool );
|
|||||||
|
|
||||||
#undef CORE_HASH
|
#undef CORE_HASH
|
||||||
|
|
||||||
typedef void (*core_hash_func)(const uint8_t* data, size_t size, uint8_t* output);
|
using core_hash_func = void (*)(const uint8_t* data, size_t size, uint8_t* output);
|
||||||
static const core_hash_func core_hash[15] = { h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14 };
|
static const core_hash_func core_hash[15] = { h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14 };
|
||||||
|
|
||||||
namespace xmrig
|
namespace xmrig
|
||||||
@@ -169,6 +168,8 @@ static struct AlgoTune
|
|||||||
|
|
||||||
struct HelperThread
|
struct HelperThread
|
||||||
{
|
{
|
||||||
|
XMRIG_DISABLE_COPY_MOVE_DEFAULT(HelperThread)
|
||||||
|
|
||||||
HelperThread(hwloc_bitmap_t cpu_set, int priority, bool is8MB) : m_cpuSet(cpu_set), m_priority(priority), 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_mutex_init(&m_mutex);
|
||||||
@@ -198,14 +199,17 @@ struct HelperThread
|
|||||||
|
|
||||||
struct TaskBase
|
struct TaskBase
|
||||||
{
|
{
|
||||||
virtual ~TaskBase() {}
|
XMRIG_DISABLE_COPY_MOVE(TaskBase)
|
||||||
virtual void run() = 0;
|
|
||||||
|
TaskBase() = default;
|
||||||
|
virtual ~TaskBase() = default;
|
||||||
|
virtual void run() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Task : TaskBase
|
struct Task : TaskBase
|
||||||
{
|
{
|
||||||
inline Task(T&& task) : m_task(std::move(task))
|
explicit inline Task(T&& task) : m_task(std::move(task))
|
||||||
{
|
{
|
||||||
static_assert(sizeof(Task) <= 128, "Task struct is too large");
|
static_assert(sizeof(Task) <= 128, "Task struct is too large");
|
||||||
}
|
}
|
||||||
@@ -223,7 +227,7 @@ struct HelperThread
|
|||||||
inline void launch_task(T&& task)
|
inline void launch_task(T&& task)
|
||||||
{
|
{
|
||||||
uv_mutex_lock(&m_mutex);
|
uv_mutex_lock(&m_mutex);
|
||||||
new (&m_tasks[m_numTasks++]) Task<T>(std::move(task));
|
new (&m_tasks[m_numTasks++]) Task<T>(std::forward<T>(task));
|
||||||
uv_cond_signal(&m_cond);
|
uv_cond_signal(&m_cond);
|
||||||
uv_mutex_unlock(&m_mutex);
|
uv_mutex_unlock(&m_mutex);
|
||||||
}
|
}
|
||||||
@@ -238,7 +242,7 @@ struct HelperThread
|
|||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
if (hwloc_bitmap_weight(m_cpuSet) > 0) {
|
if (hwloc_bitmap_weight(m_cpuSet) > 0) {
|
||||||
hwloc_topology_t topology = reinterpret_cast<HwlocCpuInfo*>(Cpu::info())->topology();
|
hwloc_topology_t topology = Cpu::info()->topology();
|
||||||
if (hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) < 0) {
|
if (hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) < 0) {
|
||||||
hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD);
|
hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD);
|
||||||
}
|
}
|
||||||
@@ -292,9 +296,9 @@ void benchmark()
|
|||||||
// Try to avoid CPU core 0 because many system threads use it and can interfere
|
// Try to avoid CPU core 0 because many system threads use it and can interfere
|
||||||
uint32_t thread_index1 = (Cpu::info()->threads() > 2) ? 2 : 0;
|
uint32_t thread_index1 = (Cpu::info()->threads() > 2) ? 2 : 0;
|
||||||
|
|
||||||
hwloc_topology_t topology = reinterpret_cast<HwlocCpuInfo*>(Cpu::info())->topology();
|
hwloc_topology_t topology = Cpu::info()->topology();
|
||||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, thread_index1);
|
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, thread_index1);
|
||||||
hwloc_obj_t pu2;
|
hwloc_obj_t pu2 = nullptr;
|
||||||
hwloc_get_closest_objs(topology, pu, &pu2, 1);
|
hwloc_get_closest_objs(topology, pu, &pu2, 1);
|
||||||
uint32_t thread_index2 = pu2 ? pu2->os_index : thread_index1;
|
uint32_t thread_index2 = pu2 ? pu2->os_index : thread_index1;
|
||||||
|
|
||||||
@@ -485,8 +489,7 @@ HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::v
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cpu_index >= 0) {
|
if (cpu_index >= 0) {
|
||||||
hwloc_topology_t topology = reinterpret_cast<HwlocCpuInfo*>(Cpu::info())->topology();
|
hwloc_obj_t root = hwloc_get_root_obj(Cpu::info()->topology());
|
||||||
hwloc_obj_t root = hwloc_get_root_obj(topology);
|
|
||||||
|
|
||||||
bool is8MB = false;
|
bool is8MB = false;
|
||||||
|
|
||||||
@@ -585,9 +588,13 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
|
|||||||
uint8_t tmp[64 * N];
|
uint8_t tmp[64 * N];
|
||||||
|
|
||||||
if (helper && (tune[cn_indices[0]].threads == 2) && (tune[cn_indices[1]].threads == 2) && (tune[cn_indices[2]].threads == 2)) {
|
if (helper && (tune[cn_indices[0]].threads == 2) && (tune[cn_indices[1]].threads == 2) && (tune[cn_indices[2]].threads == 2)) {
|
||||||
const size_t n = N / 2;
|
constexpr size_t n = N / 2;
|
||||||
|
|
||||||
|
helper->launch_task([av, data, size, &ctx_memory, ctx, &cn_indices, &core_indices, &tmp, output, tune]() {
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
constexpr size_t n = N / 2;
|
||||||
|
# endif
|
||||||
|
|
||||||
helper->launch_task([n, av, data, size, &ctx_memory, ctx, &cn_indices, &core_indices, &tmp, output, tune]() {
|
|
||||||
const uint8_t* input = data;
|
const uint8_t* input = data;
|
||||||
size_t input_size = size;
|
size_t input_size = size;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,11 +22,6 @@
|
|||||||
#include "base/io/json/Json.h"
|
#include "base/io/json/Json.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef XMRIG_FEATURE_HWLOC
|
|
||||||
# include "backend/cpu/platform/HwlocCpuInfo.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -190,7 +185,7 @@ std::vector<uint32_t> xmrig::RxConfig::nodeset() const
|
|||||||
return m_nodeset;
|
return m_nodeset;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (m_numa && Cpu::info()->nodes() > 1) ? static_cast<HwlocCpuInfo *>(Cpu::info())->nodeset() : std::vector<uint32_t>();
|
return (m_numa && Cpu::info()->nodes() > 1) ? Cpu::info()->nodeset() : std::vector<uint32_t>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -123,7 +123,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} /* namespace xmrig */
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
#endif /* XMRIG_RXCONFIG_H */
|
#endif // XMRIG_RXCONFIG_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018-2019 tevador <tevador@gmail.com>
|
* Copyright (c) 2018-2019 tevador <tevador@gmail.com>
|
||||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "crypto/rx/RxNUMAStorage.h"
|
#include "crypto/rx/RxNUMAStorage.h"
|
||||||
#include "backend/cpu/Cpu.h"
|
#include "backend/cpu/Cpu.h"
|
||||||
#include "backend/cpu/platform/HwlocCpuInfo.h"
|
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
#include "base/io/log/Tags.h"
|
#include "base/io/log/Tags.h"
|
||||||
#include "base/kernel/Platform.h"
|
#include "base/kernel/Platform.h"
|
||||||
@@ -45,13 +44,12 @@ static std::mutex mutex;
|
|||||||
|
|
||||||
static bool bindToNUMANode(uint32_t nodeId)
|
static bool bindToNUMANode(uint32_t nodeId)
|
||||||
{
|
{
|
||||||
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info());
|
auto node = hwloc_get_numanode_obj_by_os_index(Cpu::info()->topology(), nodeId);
|
||||||
hwloc_obj_t node = hwloc_get_numanode_obj_by_os_index(cpu->topology(), nodeId);
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpu->membind(node->nodeset)) {
|
if (Cpu::info()->membind(node->nodeset)) {
|
||||||
Platform::setThreadAffinity(static_cast<uint64_t>(hwloc_bitmap_first(node->cpuset)));
|
Platform::setThreadAffinity(static_cast<uint64_t>(hwloc_bitmap_first(node->cpuset)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user