Build "src/base" as static library.

This commit is contained in:
XMRig 2021-08-30 23:06:16 +07:00
parent e1f0737a59
commit cac1e4aa5e
No known key found for this signature in database
GPG key ID: 446A53638BE94409
181 changed files with 874 additions and 591 deletions

View file

@ -1,2 +0,0 @@
#include "os.h"
#warning "fmt/posix.h is deprecated; use fmt/os.h instead"

View file

@ -27,7 +27,6 @@
#include "backend/common/Workers.h"
#include "backend/cpu/Cpu.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/net/stratum/Job.h"
#include "base/tools/Chrono.h"
#include "base/tools/String.h"
@ -104,13 +103,13 @@ public:
inline void print() const
{
if (m_started == 0) {
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), Tags::cpu());
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), cpu_tag());
return;
}
LOG_INFO("%s" GREEN_BOLD(" READY") " threads %s%zu/%zu (%zu)" CLEAR " huge pages %s%1.0f%% %zu/%zu" CLEAR " memory " CYAN_BOLD("%zu KB") BLACK_BOLD(" (%" PRIu64 " ms)"),
Tags::cpu(),
cpu_tag(),
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
m_started, m_threads, m_ways,
(m_hugePages.isFullyAllocated() ? GREEN_BOLD_S : (m_hugePages.allocated == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
@ -142,7 +141,7 @@ public:
inline void start()
{
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
Tags::cpu(),
cpu_tag(),
profileName.data(),
threads.size(),
threads.size() > 1 ? "s" : "",
@ -228,13 +227,15 @@ const char *xmrig::backend_tag(uint32_t backend)
}
# endif
return Tags::cpu();
return cpu_tag();
}
const char *xmrig::cpu_tag()
{
return Tags::cpu();
static const char *tag = CYAN_BG_BOLD(WHITE_BOLD_S " cpu ");
return tag;
}
@ -294,7 +295,7 @@ void xmrig::CpuBackend::prepare(const Job &nextJob)
if ((f == Algorithm::ARGON2) || (f == Algorithm::RANDOM_X)) {
if (argon2::Impl::select(d_ptr->controller->config()->cpu().argon2Impl())) {
LOG_INFO("%s use " WHITE_BOLD("argon2") " implementation " CSI "1;%dm" "%s",
Tags::cpu(),
cpu_tag(),
argon2::Impl::name() == "default" ? 33 : 32,
argon2::Impl::name().data()
);
@ -357,7 +358,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
d_ptr->profileName = cpu.threads().profileName(job.algorithm());
if (d_ptr->profileName.isNull() || threads.empty()) {
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::cpu());
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), cpu_tag());
return stop();
}
@ -402,7 +403,7 @@ void xmrig::CpuBackend::stop()
d_ptr->workers.stop();
d_ptr->threads.clear();
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), Tags::cpu(), Chrono::steadyMSecs() - ts);
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), cpu_tag(), Chrono::steadyMSecs() - ts);
}

View file

@ -32,7 +32,6 @@
#include "backend/cuda/wrappers/CudaDevice.h"
#include "backend/cuda/wrappers/CudaLib.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/net/stratum/Job.h"
#include "base/tools/Chrono.h"
#include "base/tools/String.h"
@ -106,13 +105,13 @@ public:
inline void print() const
{
if (m_started == 0) {
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), Tags::nvidia());
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), cuda_tag());
return;
}
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " "%s%zu/%zu" BLACK_BOLD(" (%" PRIu64 " ms)"),
Tags::nvidia(),
cuda_tag(),
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
m_started,
m_threads,
@ -209,7 +208,7 @@ public:
inline void start(const Job &job)
{
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
Tags::nvidia(),
cuda_tag(),
profileName.data(),
threads.size(),
threads.size() > 1 ? "s" : "",
@ -278,7 +277,7 @@ public:
}
LOG_INFO("%s" CYAN_BOLD(" #%u") YELLOW(" %s") MAGENTA_BOLD("%4uW") CSI "1;%um %2uC" CLEAR WHITE_BOLD("%s") "%s",
Tags::nvidia(),
cuda_tag(),
device.index(),
device.topology().toString().data(),
health.power,
@ -309,7 +308,9 @@ public:
const char *xmrig::cuda_tag()
{
return Tags::nvidia();
static const char *tag = GREEN_BG_BOLD(WHITE_BOLD_S " nvidia ");
return tag;
}
@ -449,7 +450,7 @@ void xmrig::CudaBackend::setJob(const Job &job)
d_ptr->profileName = cuda.threads().profileName(job.algorithm());
if (d_ptr->profileName.isNull() || threads.empty()) {
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::nvidia());
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), cuda_tag());
return stop();
}
@ -490,7 +491,7 @@ void xmrig::CudaBackend::stop()
d_ptr->workers.stop();
d_ptr->threads.clear();
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), Tags::nvidia(), Chrono::steadyMSecs() - ts);
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), cuda_tag(), Chrono::steadyMSecs() - ts);
}

View file

@ -18,10 +18,10 @@
#include "backend/cuda/runners/CudaKawPowRunner.h"
#include "3rdparty/libethash/data_sizes.h"
#include "backend/common/Tags.h"
#include "backend/cuda/CudaLaunchData.h"
#include "backend/cuda/wrappers/CudaLib.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/net/stratum/Job.h"
#include "base/tools/Chrono.h"
#include "crypto/kawpow/KPCache.h"
@ -61,12 +61,12 @@ bool xmrig::CudaKawPowRunner::set(const Job &job, uint8_t *blob)
const bool result = CudaLib::kawPowPrepare(m_ctx, cache.data(), cache.size(), cache.l1_cache(), KPCache::dag_size(epoch), height, dag_sizes);
if (!result) {
LOG_ERR("%s " YELLOW("KawPow") RED(" failed to initialize DAG: ") RED_BOLD("%s"), Tags::nvidia(), CudaLib::lastError(m_ctx));
LOG_ERR("%s " YELLOW("KawPow") RED(" failed to initialize DAG: ") RED_BOLD("%s"), cuda_tag(), CudaLib::lastError(m_ctx));
}
else {
const int64_t dt = Chrono::steadyMSecs() - start_ms;
if (dt > 1000) {
LOG_INFO("%s " YELLOW("KawPow") " DAG for epoch " WHITE_BOLD("%u") " calculated " BLACK_BOLD("(%" PRIu64 "ms)"), Tags::nvidia(), epoch, dt);
LOG_INFO("%s " YELLOW("KawPow") " DAG for epoch " WHITE_BOLD("%u") " calculated " BLACK_BOLD("(%" PRIu64 "ms)"), cuda_tag(), epoch, dt);
}
}

View file

@ -34,7 +34,6 @@
#include "backend/opencl/wrappers/OclContext.h"
#include "backend/opencl/wrappers/OclLib.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/net/stratum/Job.h"
#include "base/tools/Chrono.h"
#include "base/tools/String.h"
@ -102,13 +101,13 @@ public:
inline void print() const
{
if (m_started == 0) {
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), Tags::opencl());
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), ocl_tag());
return;
}
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " "%s%zu/%zu" BLACK_BOLD(" (%" PRIu64 " ms)"),
Tags::opencl(),
ocl_tag(),
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
m_started,
m_threads,
@ -193,7 +192,7 @@ public:
inline void start(const Job &job)
{
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
Tags::opencl(),
ocl_tag(),
profileName.data(),
threads.size(),
threads.size() > 1 ? "s" : "",
@ -253,7 +252,7 @@ public:
const auto health = AdlLib::health(device);
LOG_INFO("%s" CYAN_BOLD(" #%u") YELLOW(" %s") MAGENTA_BOLD("%4uW") CSI "1;%um %2uC" CYAN_BOLD(" %4u") CYAN("RPM") WHITE_BOLD(" %u/%u") "MHz",
Tags::opencl(),
ocl_tag(),
device.index(),
device.topology().toString().data(),
health.power,
@ -285,7 +284,9 @@ public:
const char *xmrig::ocl_tag()
{
return Tags::opencl();
static const char *tag = MAGENTA_BG_BOLD(WHITE_BOLD_S " opencl ");
return tag;
}
@ -425,13 +426,13 @@ void xmrig::OclBackend::setJob(const Job &job)
d_ptr->profileName = cl.threads().profileName(job.algorithm());
if (d_ptr->profileName.isNull() || threads.empty()) {
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::opencl());
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), ocl_tag());
return stop();
}
if (!d_ptr->context.init(d_ptr->devices, threads)) {
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (OpenCL context unavailable)"), Tags::opencl());
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (OpenCL context unavailable)"), ocl_tag());
return stop();
}
@ -474,7 +475,7 @@ void xmrig::OclBackend::stop()
OclSharedState::release();
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), Tags::opencl(), Chrono::steadyMSecs() - ts);
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), ocl_tag(), Chrono::steadyMSecs() - ts);
}

View file

@ -26,7 +26,6 @@
#include "backend/opencl/wrappers/OclLib.h"
#include "base/io/log/Log.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/net/stratum/Job.h"
#include "base/tools/Chrono.h"
#include "crypto/common/VirtualMemory.h"
@ -159,7 +158,7 @@ void OclKawPowRunner::set(const Job &job, uint8_t *blob)
OclLib::finish(m_queue);
LOG_INFO("%s " YELLOW("KawPow") " DAG for epoch " WHITE_BOLD("%u") " calculated " BLACK_BOLD("(%" PRIu64 "ms)"), Tags::opencl(), epoch, Chrono::steadyMSecs() - start_ms);
LOG_INFO("%s " YELLOW("KawPow") " DAG for epoch " WHITE_BOLD("%u") " calculated " BLACK_BOLD("(%" PRIu64 "ms)"), ocl_tag(), epoch, Chrono::steadyMSecs() - start_ms);
}
const uint64_t target = job.target();

View file

@ -19,6 +19,7 @@
#include "backend/opencl/runners/tools/OclKawPow.h"
#include "3rdparty/libethash/data_sizes.h"
#include "3rdparty/libethash/ethash_internal.h"
#include "backend/common/Tags.h"
#include "backend/opencl/cl/kawpow/kawpow_cl.h"
#include "backend/opencl/interfaces/IOclRunner.h"
#include "backend/opencl/OclCache.h"
@ -27,7 +28,6 @@
#include "backend/opencl/wrappers/OclError.h"
#include "backend/opencl/wrappers/OclLib.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/tools/Baton.h"
#include "base/tools/Chrono.h"
#include "crypto/kawpow/KPHash.h"
@ -202,7 +202,7 @@ public:
return nullptr;
}
LOG_INFO("%s " YELLOW("KawPow") " program for period " WHITE_BOLD("%" PRIu64) " compiled " BLACK_BOLD("(%" PRIu64 "ms)"), Tags::opencl(), period, Chrono::steadyMSecs() - ts);
LOG_INFO("%s " YELLOW("KawPow") " program for period " WHITE_BOLD("%" PRIu64) " compiled " BLACK_BOLD("(%" PRIu64 "ms)"), ocl_tag(), period, Chrono::steadyMSecs() - ts);
cache.add(runner.algorithm(), period, worksize, runner.deviceIndex(), program, kernel);

Some files were not shown because too many files have changed in this diff Show more