mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-09 20:39:27 +00:00
Added maxIntensity method to Algorithm.
This commit is contained in:
parent
42dc914eec
commit
fd9039928b
3 changed files with 23 additions and 24 deletions
|
@ -163,36 +163,16 @@ void xmrig::Workers<T>::onReady(void *arg)
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
#if defined (XMRIG_ALGO_RANDOMX) || defined (XMRIG_ALGO_CN_GPU)
|
|
||||||
static void printIntensityWarning(Thread<CpuLaunchData> *handle)
|
|
||||||
{
|
|
||||||
LOG_WARN("CPU thread %zu warning: \"intensity %d not supported for %s algorithm\".", handle->index(), handle->config().intensity, handle->config().algorithm.shortName());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
xmrig::IWorker *xmrig::Workers<CpuLaunchData>::create(Thread<CpuLaunchData> *handle)
|
xmrig::IWorker *xmrig::Workers<CpuLaunchData>::create(Thread<CpuLaunchData> *handle)
|
||||||
{
|
{
|
||||||
const int intensity = handle->config().intensity;
|
const int intensity = handle->config().intensity;
|
||||||
|
|
||||||
# if defined (XMRIG_ALGO_RANDOMX) || defined (XMRIG_ALGO_CN_GPU)
|
# if defined(XMRIG_ALGO_RANDOMX) || defined(XMRIG_ALGO_CN_GPU)
|
||||||
if (intensity > 1) {
|
if (intensity > handle->config().algorithm.maxIntensity()) {
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
LOG_WARN("CPU thread %zu warning: \"intensity %d not supported for %s algorithm\".", handle->index(), handle->config().intensity, handle->config().algorithm.shortName());
|
||||||
if (handle->config().algorithm.family() == Algorithm::RANDOM_X) {
|
|
||||||
printIntensityWarning(handle);
|
|
||||||
|
|
||||||
return new CpuWorker<1>(handle->index(), handle->config());
|
return new CpuWorker<1>(handle->index(), handle->config());
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_CN_GPU
|
|
||||||
if (handle->config().algorithm == Algorithm::CN_GPU) {
|
|
||||||
printIntensityWarning(handle);
|
|
||||||
|
|
||||||
return new CpuWorker<1>(handle->index(), handle->config());
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,24 @@ static AlgoName const algorithm_names[] = {
|
||||||
} /* namespace xmrig */
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
int xmrig::Algorithm::maxIntensity() const
|
||||||
|
{
|
||||||
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
|
if (family() == RANDOM_X) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
|
if (m_id == CN_GPU) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rapidjson::Value xmrig::Algorithm::toJSON() const
|
rapidjson::Value xmrig::Algorithm::toJSON() const
|
||||||
{
|
{
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
|
|
@ -102,6 +102,7 @@ public:
|
||||||
inline bool operator==(const Algorithm &other) const { return isEqual(other); }
|
inline bool operator==(const Algorithm &other) const { return isEqual(other); }
|
||||||
inline operator Algorithm::Id() const { return m_id; }
|
inline operator Algorithm::Id() const { return m_id; }
|
||||||
|
|
||||||
|
int maxIntensity() const;
|
||||||
rapidjson::Value toJSON() const;
|
rapidjson::Value toJSON() const;
|
||||||
size_t memory() const;
|
size_t memory() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue