Added support for multi-algorithm CPU threads settings.
This commit is contained in:
parent
83fdbbf29c
commit
b92807e8d8
24 changed files with 595 additions and 109 deletions
|
@ -36,7 +36,7 @@
|
|||
#include "rapidjson/document.h"
|
||||
#include "rapidjson/filewritestream.h"
|
||||
#include "rapidjson/prettywriter.h"
|
||||
#include "workers/CpuThread.h"
|
||||
#include "workers/CpuThreadLegacy.h"
|
||||
|
||||
|
||||
xmrig::Config::Config() :
|
||||
|
@ -125,7 +125,7 @@ bool xmrig::Config::finalize()
|
|||
m_threads.mode = Advanced;
|
||||
|
||||
for (size_t i = 0; i < m_threads.cpu.size(); ++i) {
|
||||
m_threads.list.push_back(CpuThread::createFromData(i, algorithm, m_threads.cpu[i], m_cpu.priority(), !m_cpu.isHwAES()));
|
||||
m_threads.list.push_back(CpuThreadLegacy::createFromData(i, algorithm, m_threads.cpu[i], m_cpu.priority(), !m_cpu.isHwAES()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -134,7 +134,7 @@ bool xmrig::Config::finalize()
|
|||
const AlgoVariant av = getAlgoVariant();
|
||||
m_threads.mode = m_threads.count ? Simple : Automatic;
|
||||
|
||||
const size_t size = CpuThread::multiway(av) * CnAlgo<>::memory(algorithm) / 1024; // FIXME MEMORY
|
||||
const size_t size = CpuThreadLegacy::multiway(av) * CnAlgo<>::memory(algorithm) / 1024; // FIXME MEMORY
|
||||
|
||||
if (!m_threads.count) {
|
||||
m_threads.count = Cpu::info()->optimalThreadsCount(size, 100);
|
||||
|
@ -147,7 +147,7 @@ bool xmrig::Config::finalize()
|
|||
// }
|
||||
|
||||
for (size_t i = 0; i < m_threads.count; ++i) {
|
||||
m_threads.list.push_back(CpuThread::createFromAV(i, algorithm, av, m_threads.mask, m_cpu.priority(), m_cpu.assembly()));
|
||||
m_threads.list.push_back(CpuThreadLegacy::createFromAV(i, algorithm, av, m_threads.mask, m_cpu.priority(), m_cpu.assembly()));
|
||||
}
|
||||
|
||||
m_shouldSave = m_threads.mode == Automatic;
|
||||
|
@ -175,7 +175,7 @@ void xmrig::Config::setThreads(const rapidjson::Value &threads)
|
|||
}
|
||||
|
||||
if (value.HasMember("low_power_mode")) {
|
||||
auto data = CpuThread::parse(value);
|
||||
auto data = CpuThreadLegacy::parse(value);
|
||||
|
||||
if (data.valid) {
|
||||
m_threads.cpu.push_back(std::move(data));
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "base/kernel/config/BaseConfig.h"
|
||||
#include "common/xmrig.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
#include "workers/CpuThread.h"
|
||||
#include "workers/CpuThreadLegacy.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
void getJSON(rapidjson::Document &doc) const override;
|
||||
|
||||
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
||||
inline bool isShouldSave() const { return (m_shouldSave || m_upgrade) && isAutoSave(); }
|
||||
inline bool isShouldSave() const { return (m_shouldSave || m_upgrade || m_cpu.isShouldSave()) && isAutoSave(); }
|
||||
inline const CpuConfig &cpu() const { return m_cpu; }
|
||||
inline const std::vector<IThread *> &threads() const { return m_threads.list; }
|
||||
inline int threadsCount() const { return static_cast<int>(m_threads.list.size()); }
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
|
||||
int64_t mask;
|
||||
size_t count;
|
||||
std::vector<CpuThread::Data> cpu;
|
||||
std::vector<CpuThreadLegacy::Data> cpu;
|
||||
std::vector<IThread *> list;
|
||||
ThreadsMode mode;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue