mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-26 20:46:20 +00:00
Fixed auto configuration without hwloc.
This commit is contained in:
parent
be251a2ec1
commit
4583d979db
4 changed files with 46 additions and 7 deletions
|
@ -110,6 +110,16 @@ xmrig::CpuThreads::CpuThreads(const rapidjson::Value &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::CpuThreads::CpuThreads(size_t count, int intensity)
|
||||||
|
{
|
||||||
|
m_data.reserve(count);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < count; ++i) {
|
||||||
|
add(-1, intensity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rapidjson::Value xmrig::CpuThreads::toJSON(rapidjson::Document &doc) const
|
rapidjson::Value xmrig::CpuThreads::toJSON(rapidjson::Document &doc) const
|
||||||
{
|
{
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
inline CpuThreads(size_t count) : m_data(count) {}
|
inline CpuThreads(size_t count) : m_data(count) {}
|
||||||
|
|
||||||
CpuThreads(const rapidjson::Value &value);
|
CpuThreads(const rapidjson::Value &value);
|
||||||
|
CpuThreads(size_t count, int intensity);
|
||||||
|
|
||||||
inline bool isEmpty() const { return m_data.empty(); }
|
inline bool isEmpty() const { return m_data.empty(); }
|
||||||
inline const std::vector<CpuThread> &data() const { return m_data; }
|
inline const std::vector<CpuThread> &data() const { return m_data; }
|
||||||
|
|
|
@ -112,7 +112,7 @@ xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
|
||||||
xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm) const
|
xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm) const
|
||||||
{
|
{
|
||||||
if (threads() == 1) {
|
if (threads() == 1) {
|
||||||
return CpuThreads(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_CN_GPU
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
@ -132,7 +132,7 @@ xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm) co
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache) {
|
if (cache) {
|
||||||
const size_t memory = algorithm.memory();
|
const size_t memory = algorithm.l3();
|
||||||
assert(memory > 0);
|
assert(memory > 0);
|
||||||
|
|
||||||
count = cache / memory;
|
count = cache / memory;
|
||||||
|
@ -145,5 +145,13 @@ xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm) co
|
||||||
count = threads() / 2;
|
count = threads() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CpuThreads(std::max<size_t>(std::min<size_t>(count, threads()), 1));
|
int intensity = algorithm.maxIntensity() == 1 ? -1 : 1;
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_PICO
|
||||||
|
if (algorithm == Algorithm::CN_PICO_0 && (count / cores()) >= 2) {
|
||||||
|
intensity = 2;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return CpuThreads(std::max<size_t>(std::min<size_t>(count, threads()), 1), intensity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,13 +194,33 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm) const
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (algorithm.family() == Algorithm::CN_LITE || algorithm.family() == Algorithm::CN_PICO) {
|
# ifdef XMRIG_ALGO_CN_LITE
|
||||||
return count;
|
if (algorithm.family() == Algorithm::CN_LITE) {
|
||||||
|
return CpuThreads(count, 1);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_PICO
|
||||||
|
if (algorithm.family() == Algorithm::CN_PICO) {
|
||||||
|
return CpuThreads(count, 2);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_HEAVY
|
||||||
if (algorithm.family() == Algorithm::CN_HEAVY) {
|
if (algorithm.family() == Algorithm::CN_HEAVY) {
|
||||||
return std::max<size_t>(count / 4, 1);
|
return CpuThreads(std::max<size_t>(count / 4, 1), 1);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
return std::max<size_t>(count / 2, 1);
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
|
if (algorithm.family() == Algorithm::RANDOM_X) {
|
||||||
|
if (algorithm == Algorithm::RX_WOW) {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::max<size_t>(count / 2, 1);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return CpuThreads(std::max<size_t>(count / 2, 1), 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue