Merge of xmrig v6.5.0
This commit is contained in:
commit
a57d1bbbda
86 changed files with 15293 additions and 490 deletions
|
@ -18,9 +18,16 @@
|
|||
|
||||
|
||||
#include "backend/common/Benchmark.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "backend/common/interfaces/IBackend.h"
|
||||
#include "backend/common/interfaces/IWorker.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/net/http/Fetch.h"
|
||||
#include "base/net/http/HttpData.h"
|
||||
#include "base/net/http/HttpListener.h"
|
||||
#include "base/net/stratum/benchmark/BenchConfig.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
|
||||
|
||||
|
@ -39,6 +46,21 @@ static uint64_t hashCheck[2][10] = {
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::Benchmark::Benchmark(const Job &job, size_t workers, const IBackend *backend) :
|
||||
m_algo(job.algorithm()),
|
||||
m_backend(backend),
|
||||
m_workers(workers),
|
||||
m_id(job.id()),
|
||||
m_token(job.benchToken()),
|
||||
m_end(job.benchSize()),
|
||||
m_hash(job.benchHash())
|
||||
{
|
||||
if (!m_token.isEmpty()) {
|
||||
m_httpListener = std::make_shared<HttpListener>(this, Tags::bench());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Benchmark::finish(uint64_t totalHashCount)
|
||||
{
|
||||
m_reset = true;
|
||||
|
@ -48,18 +70,27 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
|
|||
return false;
|
||||
}
|
||||
|
||||
const double dt = (m_doneTime - m_startTime) / 1000.0;
|
||||
uint64_t checkData = 0;
|
||||
const uint32_t N = (m_end / 1000000) - 1;
|
||||
|
||||
if (((m_algo == Algorithm::RX_0) || (m_algo == Algorithm::RX_WOW)) && ((m_end % 1000000) == 0) && (N < 10)) {
|
||||
checkData = hashCheck[(m_algo == Algorithm::RX_0) ? 0 : 1][N];
|
||||
}
|
||||
|
||||
const char *color = checkData ? ((m_data == checkData) ? GREEN_BOLD_S : RED_BOLD_S) : BLACK_BOLD_S;
|
||||
const double dt = static_cast<double>(m_doneTime - m_startTime) / 1000.0;
|
||||
uint64_t checkData = referenceHash();
|
||||
const char *color = checkData ? ((m_data == checkData) ? GREEN_BOLD_S : RED_BOLD_S) : BLACK_BOLD_S;
|
||||
|
||||
LOG_NOTICE("%s " WHITE_BOLD("benchmark finished in ") CYAN_BOLD("%.3f seconds") WHITE_BOLD_S " hash sum = " CLEAR "%s%016" PRIX64 CLEAR, Tags::bench(), dt, color, m_data);
|
||||
LOG_INFO("%s " WHITE_BOLD("press ") MAGENTA_BOLD("Ctrl+C") WHITE_BOLD(" to exit"), Tags::bench());
|
||||
|
||||
if (!m_token.isEmpty()) {
|
||||
using namespace rapidjson;
|
||||
|
||||
Document doc(kObjectType);
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
doc.AddMember("steady_done_ts", m_doneTime, allocator);
|
||||
doc.AddMember(StringRef(BenchConfig::kHash), Value(fmt::format("{:016X}", m_data).c_str(), allocator), allocator);
|
||||
doc.AddMember("backend", m_backend->toJSON(doc), allocator);
|
||||
|
||||
send(doc);
|
||||
}
|
||||
else {
|
||||
printExit();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -68,6 +99,15 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
|
|||
void xmrig::Benchmark::start()
|
||||
{
|
||||
m_startTime = Chrono::steadyMSecs();
|
||||
|
||||
if (!m_token.isEmpty()) {
|
||||
using namespace rapidjson;
|
||||
|
||||
Document doc(kObjectType);
|
||||
doc.AddMember("steady_start_ts", m_startTime, doc.GetAllocator());
|
||||
|
||||
send(doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +117,7 @@ void xmrig::Benchmark::printProgress() const
|
|||
return;
|
||||
}
|
||||
|
||||
const double dt = (Chrono::steadyMSecs() - m_startTime) / 1000.0;
|
||||
const double dt = static_cast<double>(Chrono::steadyMSecs() - m_startTime) / 1000.0;
|
||||
const double percent = static_cast<double>(m_current) / m_end * 100.0;
|
||||
|
||||
LOG_NOTICE("%s " MAGENTA_BOLD("%5.2f%% ") CYAN_BOLD("%" PRIu64) CYAN("/%" PRIu64) BLACK_BOLD(" (%.3fs)"), Tags::bench(), percent, m_current, m_end, dt);
|
||||
|
@ -101,3 +141,64 @@ void xmrig::Benchmark::tick(IWorker *worker)
|
|||
m_data ^= worker->benchData();
|
||||
m_doneTime = std::max(doneTime, m_doneTime);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Benchmark::onHttpData(const HttpData &data)
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
|
||||
try {
|
||||
doc = data.json();
|
||||
} catch (const std::exception &ex) {
|
||||
return setError(ex.what());
|
||||
}
|
||||
|
||||
if (data.status != 200) {
|
||||
return setError(data.statusName());
|
||||
}
|
||||
|
||||
if (m_doneTime) {
|
||||
LOG_NOTICE("%s " WHITE_BOLD("benchmark submitted ") CYAN_BOLD("https://xmrig.com/benchmark/%s"), Tags::bench(), m_id.data());
|
||||
printExit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint64_t xmrig::Benchmark::referenceHash() const
|
||||
{
|
||||
if (m_hash) {
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
if (!m_token.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint32_t N = (m_end / 1000000) - 1;
|
||||
if (((m_algo == Algorithm::RX_0) || (m_algo == Algorithm::RX_WOW)) && ((m_end % 1000000) == 0) && (N < 10)) {
|
||||
return hashCheck[(m_algo == Algorithm::RX_0) ? 0 : 1][N];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Benchmark::printExit()
|
||||
{
|
||||
LOG_INFO("%s " WHITE_BOLD("press ") MAGENTA_BOLD("Ctrl+C") WHITE_BOLD(" to exit"), Tags::bench());
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Benchmark::send(const rapidjson::Value &body)
|
||||
{
|
||||
FetchRequest req(HTTP_PATCH, BenchConfig::kApiHost, BenchConfig::kApiPort, fmt::format("/1/benchmark/{}", m_id).c_str(), body, BenchConfig::kApiTLS, true);
|
||||
req.headers.insert({ "Authorization", fmt::format("Bearer {}", m_token)});
|
||||
|
||||
fetch(std::move(req), m_httpListener);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Benchmark::setError(const char *message)
|
||||
{
|
||||
LOG_ERR("%s " RED("benchmark failed ") RED_BOLD("\"%s\""), Tags::bench(), message);
|
||||
}
|
||||
|
|
|
@ -20,34 +20,54 @@
|
|||
#define XMRIG_BENCHMARK_H
|
||||
|
||||
|
||||
#include "base/tools/Object.h"
|
||||
#include "base/crypto/Algorithm.h"
|
||||
#include "base/kernel/interfaces/IHttpListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "base/tools/String.h"
|
||||
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class IBackend;
|
||||
class IWorker;
|
||||
class Job;
|
||||
|
||||
|
||||
class Benchmark
|
||||
class Benchmark : public IHttpListener
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Benchmark)
|
||||
|
||||
Benchmark(uint32_t end, const Algorithm &algo, size_t workers) : m_algo(algo), m_workers(workers), m_end(end) {}
|
||||
~Benchmark() = default;
|
||||
Benchmark(const Job &job, size_t workers, const IBackend *backend);
|
||||
~Benchmark() override = default;
|
||||
|
||||
bool finish(uint64_t totalHashCount);
|
||||
void printProgress() const;
|
||||
void start();
|
||||
void tick(IWorker *worker);
|
||||
|
||||
protected:
|
||||
void onHttpData(const HttpData &data) override;
|
||||
|
||||
private:
|
||||
uint64_t referenceHash() const;
|
||||
void printExit();
|
||||
void send(const rapidjson::Value &body);
|
||||
void setError(const char *message);
|
||||
|
||||
bool m_reset = false;
|
||||
const Algorithm m_algo = Algorithm::RX_0;
|
||||
const size_t m_workers = 0;
|
||||
const uint64_t m_end = 0;
|
||||
const Algorithm m_algo;
|
||||
const IBackend *m_backend;
|
||||
const size_t m_workers;
|
||||
const String m_id;
|
||||
const String m_token;
|
||||
const uint64_t m_end;
|
||||
const uint64_t m_hash;
|
||||
std::shared_ptr<IHttpListener> m_httpListener;
|
||||
uint32_t m_done = 0;
|
||||
uint64_t m_current = 0;
|
||||
uint64_t m_data = 0;
|
||||
|
|
|
@ -87,13 +87,6 @@ xmrig::Workers<T>::~Workers()
|
|||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
xmrig::Benchmark *xmrig::Workers<T>::benchmark() const
|
||||
{
|
||||
return d_ptr->benchmark.get();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
static void getHashrateData(xmrig::IWorker* worker, uint64_t& hashCount, uint64_t& timeStamp)
|
||||
{
|
||||
|
@ -168,41 +161,6 @@ void xmrig::Workers<T>::setBackend(IBackend *backend)
|
|||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void xmrig::Workers<T>::start(const std::vector<T> &data)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (!data.empty() && data.front().benchSize) {
|
||||
d_ptr->benchmark = std::make_shared<Benchmark>(data.front().benchSize, data.front().algorithm, data.size());
|
||||
}
|
||||
# endif
|
||||
|
||||
for (const T &item : data) {
|
||||
m_workers.push_back(new Thread<T>(d_ptr->backend, m_workers.size(), item));
|
||||
}
|
||||
|
||||
d_ptr->hashrate = std::make_shared<Hashrate>(m_workers.size());
|
||||
Nonce::touch(T::backend());
|
||||
|
||||
for (Thread<T> *worker : m_workers) {
|
||||
worker->start(Workers<T>::onReady);
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (!d_ptr->benchmark)
|
||||
# endif
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (d_ptr->benchmark) {
|
||||
d_ptr->benchmark->start();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void xmrig::Workers<T>::stop()
|
||||
{
|
||||
|
@ -219,6 +177,22 @@ void xmrig::Workers<T>::stop()
|
|||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||
template<class T>
|
||||
void xmrig::Workers<T>::start(const std::vector<T> &data, const std::shared_ptr<Benchmark> &benchmark)
|
||||
{
|
||||
if (!benchmark) {
|
||||
return start(data, true);
|
||||
}
|
||||
|
||||
start(data, false);
|
||||
|
||||
d_ptr->benchmark = benchmark;
|
||||
d_ptr->benchmark->start();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template<class T>
|
||||
xmrig::IWorker *xmrig::Workers<T>::create(Thread<T> *)
|
||||
{
|
||||
|
@ -250,6 +224,29 @@ void xmrig::Workers<T>::onReady(void *arg)
|
|||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void xmrig::Workers<T>::start(const std::vector<T> &data, bool sleep)
|
||||
{
|
||||
for (const auto &item : data) {
|
||||
m_workers.push_back(new Thread<T>(d_ptr->backend, m_workers.size(), item));
|
||||
}
|
||||
|
||||
d_ptr->hashrate = std::make_shared<Hashrate>(m_workers.size());
|
||||
Nonce::touch(T::backend());
|
||||
|
||||
for (auto worker : m_workers) {
|
||||
worker->start(Workers<T>::onReady);
|
||||
|
||||
// This sleep is important for optimal caching!
|
||||
// Threads must allocate scratchpads in order so that adjacent cores will use adjacent scratchpads
|
||||
// Sub-optimal caching can result in up to 0.5% hashrate penalty
|
||||
if (sleep) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
|
|
|
@ -59,18 +59,24 @@ public:
|
|||
Workers();
|
||||
~Workers();
|
||||
|
||||
Benchmark *benchmark() const;
|
||||
inline void start(const std::vector<T> &data) { start(data, true); }
|
||||
|
||||
bool tick(uint64_t ticks);
|
||||
const Hashrate *hashrate() const;
|
||||
void jobEarlyNotification(const Job&);
|
||||
void setBackend(IBackend *backend);
|
||||
void start(const std::vector<T> &data);
|
||||
void stop();
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
void start(const std::vector<T> &data, const std::shared_ptr<Benchmark> &benchmark);
|
||||
# endif
|
||||
|
||||
private:
|
||||
static IWorker *create(Thread<T> *handle);
|
||||
static void onReady(void *arg);
|
||||
|
||||
void start(const std::vector<T> &data, bool sleep);
|
||||
|
||||
std::vector<Thread<T> *> m_workers;
|
||||
WorkersPrivate *d_ptr;
|
||||
};
|
||||
|
|
|
@ -138,10 +138,7 @@ private:
|
|||
class CpuBackendPrivate
|
||||
{
|
||||
public:
|
||||
inline CpuBackendPrivate(Controller *controller) :
|
||||
controller(controller)
|
||||
{
|
||||
}
|
||||
inline CpuBackendPrivate(Controller *controller) : controller(controller) {}
|
||||
|
||||
|
||||
inline void start()
|
||||
|
@ -155,7 +152,12 @@ public:
|
|||
);
|
||||
|
||||
status.start(threads, algo.l3());
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
workers.start(threads, benchmark);
|
||||
# else
|
||||
workers.start(threads);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,6 +206,10 @@ public:
|
|||
std::vector<CpuLaunchData> threads;
|
||||
String profileName;
|
||||
Workers<CpuLaunchData> workers;
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
std::shared_ptr<Benchmark> benchmark;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -338,9 +344,15 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
return stop();
|
||||
}
|
||||
|
||||
const CpuConfig &cpu = d_ptr->controller->config()->cpu();
|
||||
const auto &cpu = d_ptr->controller->config()->cpu();
|
||||
|
||||
std::vector<CpuLaunchData> threads = cpu.get(d_ptr->controller->miner(), job.algorithm(), d_ptr->controller->config()->pools().benchSize());
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
uint32_t benchSize = job.benchSize();
|
||||
# else
|
||||
constexpr uint32_t benchSize = 0;
|
||||
# endif
|
||||
|
||||
auto threads = cpu.get(d_ptr->controller->miner(), job.algorithm(), benchSize);
|
||||
if (!d_ptr->threads.empty() && d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
|
||||
return;
|
||||
}
|
||||
|
@ -356,6 +368,12 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
|
||||
stop();
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (benchSize) {
|
||||
d_ptr->benchmark = std::make_shared<Benchmark>(job, threads.size(), this);
|
||||
}
|
||||
# endif
|
||||
|
||||
d_ptr->threads = std::move(threads);
|
||||
d_ptr->start();
|
||||
}
|
||||
|
@ -412,6 +430,7 @@ rapidjson::Value xmrig::CpuBackend::toJSON(rapidjson::Document &doc) const
|
|||
out.AddMember("profile", profileName().toJSON(), allocator);
|
||||
out.AddMember("hw-aes", cpu.isHwAES(), allocator);
|
||||
out.AddMember("priority", cpu.priority(), allocator);
|
||||
out.AddMember("msr", Rx::isMSR(), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_ASM
|
||||
const Assembly assembly = Cpu::assembly(cpu.assembly());
|
||||
|
@ -469,15 +488,14 @@ void xmrig::CpuBackend::handleRequest(IApiRequest &request)
|
|||
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||
xmrig::Benchmark *xmrig::CpuBackend::benchmark() const
|
||||
{
|
||||
return d_ptr->workers.benchmark();
|
||||
return d_ptr->benchmark.get();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuBackend::printBenchProgress() const
|
||||
{
|
||||
auto benchmark = d_ptr->workers.benchmark();
|
||||
if (benchmark) {
|
||||
benchmark->printProgress();
|
||||
if (d_ptr->benchmark) {
|
||||
d_ptr->benchmark->printProgress();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <support@xmrig.com>
|
||||
* Copyright (c) 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <support@xmrig.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -346,6 +341,12 @@ rapidjson::Value xmrig::BasicCpuInfo::toJSON(rapidjson::Document &doc) const
|
|||
out.AddMember("assembly", "none", allocator);
|
||||
# endif
|
||||
|
||||
# if defined(__x86_64__) || defined(_M_AMD64)
|
||||
out.AddMember("arch", "x86_64", allocator);
|
||||
# else
|
||||
out.AddMember("arch", "x86", allocator);
|
||||
# endif
|
||||
|
||||
Value flags(kArrayType);
|
||||
|
||||
for (size_t i = 0; i < flagNames.size(); ++i) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <support@xmrig.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -103,6 +103,12 @@ rapidjson::Value xmrig::BasicCpuInfo::toJSON(rapidjson::Document &doc) const
|
|||
out.AddMember("msr", "none", allocator);
|
||||
out.AddMember("assembly", "none", allocator);
|
||||
|
||||
# ifdef XMRIG_ARMv8
|
||||
out.AddMember("arch", "aarch64", allocator);
|
||||
# else
|
||||
out.AddMember("arch", "aarch32", allocator);
|
||||
# endif
|
||||
|
||||
Value flags(kArrayType);
|
||||
|
||||
if (hasAES()) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright 2018 Riku Voipio <riku.voipio@iki.fi>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <support@xmrig.com>
|
||||
* Copyright (c) 2018 Riku Voipio <riku.voipio@iki.fi>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <support@xmrig.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -19,6 +19,7 @@
|
|||
|
||||
|
||||
#include "base/tools/String.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
|
||||
|
||||
#include <cstdio>
|
||||
|
@ -289,7 +290,8 @@ static bool arm_cpu_decode(lscpu_desc *desc)
|
|||
|
||||
for (size_t i = 0; impl.parts[i].id != -1; ++i) {
|
||||
if (impl.parts[i].id == model) {
|
||||
desc->model = impl.parts[i].name;
|
||||
desc->vendor = impl.name;
|
||||
desc->model = impl.parts[i].name;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -304,7 +306,7 @@ String cpu_name_arm()
|
|||
{
|
||||
lscpu_desc desc;
|
||||
if (read_basicinfo(&desc) && arm_cpu_decode(&desc)) {
|
||||
return desc.model;
|
||||
return fmt::format("{} {}", desc.vendor, desc.model).c_str();
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -61,7 +61,6 @@ static const char *kAstroBWTHash = "astroBWTHash";
|
|||
static const char *kAstroBWTPrepare = "astroBWTPrepare";
|
||||
static const char *kCnHash = "cnHash";
|
||||
static const char *kDeviceCount = "deviceCount";
|
||||
static const char *kDeviceInfo = "deviceInfo";
|
||||
static const char *kDeviceInfo_v2 = "deviceInfo_v2";
|
||||
static const char *kDeviceInit = "deviceInit";
|
||||
static const char *kDeviceInt = "deviceInt";
|
||||
|
@ -77,7 +76,6 @@ static const char *kRxPrepare = "rxPrepare";
|
|||
static const char *kKawPowHash = "kawPowHash";
|
||||
static const char *kKawPowPrepare_v2 = "kawPowPrepare_v2";
|
||||
static const char *kKawPowStopHash = "kawPowStopHash";
|
||||
static const char *kSetJob = "setJob";
|
||||
static const char *kSetJob_v2 = "setJob_v2";
|
||||
static const char *kVersion = "version";
|
||||
|
||||
|
@ -87,7 +85,6 @@ using astroBWTHash_t = bool (*)(nvid_ctx *, u
|
|||
using astroBWTPrepare_t = bool (*)(nvid_ctx *, uint32_t);
|
||||
using cnHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint64_t, uint32_t *, uint32_t *);
|
||||
using deviceCount_t = uint32_t (*)();
|
||||
using deviceInfo_t = int32_t (*)(nvid_ctx *, int32_t, int32_t, int32_t, int32_t);
|
||||
using deviceInfo_v2_t = bool (*)(nvid_ctx *, int32_t, int32_t, const char *, int32_t);
|
||||
using deviceInit_t = bool (*)(nvid_ctx *);
|
||||
using deviceInt_t = int32_t (*)(nvid_ctx *, CudaLib::DeviceProperty);
|
||||
|
@ -103,7 +100,6 @@ using rxPrepare_t = bool (*)(nvid_ctx *, c
|
|||
using kawPowHash_t = bool (*)(nvid_ctx *, uint8_t*, uint64_t, uint32_t *, uint32_t *, uint32_t *);
|
||||
using kawPowPrepare_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const void *, size_t, uint32_t, const uint64_t*);
|
||||
using kawPowStopHash_t = bool (*)(nvid_ctx *);
|
||||
using setJob_t = bool (*)(nvid_ctx *, const void *, size_t, int32_t);
|
||||
using setJob_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const char *);
|
||||
using version_t = uint32_t (*)(Version);
|
||||
|
||||
|
@ -113,7 +109,6 @@ static astroBWTHash_t pAstroBWTHash = nullptr;
|
|||
static astroBWTPrepare_t pAstroBWTPrepare = nullptr;
|
||||
static cnHash_t pCnHash = nullptr;
|
||||
static deviceCount_t pDeviceCount = nullptr;
|
||||
static deviceInfo_t pDeviceInfo = nullptr;
|
||||
static deviceInfo_v2_t pDeviceInfo_v2 = nullptr;
|
||||
static deviceInit_t pDeviceInit = nullptr;
|
||||
static deviceInt_t pDeviceInt = nullptr;
|
||||
|
@ -129,7 +124,6 @@ static rxPrepare_t pRxPrepare = nullptr;
|
|||
static kawPowHash_t pKawPowHash = nullptr;
|
||||
static kawPowPrepare_v2_t pKawPowPrepare_v2 = nullptr;
|
||||
static kawPowStopHash_t pKawPowStopHash = nullptr;
|
||||
static setJob_t pSetJob = nullptr;
|
||||
static setJob_v2_t pSetJob_v2 = nullptr;
|
||||
static version_t pVersion = nullptr;
|
||||
|
||||
|
@ -205,11 +199,7 @@ bool xmrig::CudaLib::deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads,
|
|||
{
|
||||
const Algorithm algo = RxAlgo::id(algorithm);
|
||||
|
||||
if (pDeviceInfo_v2) {
|
||||
return pDeviceInfo_v2(ctx, blocks, threads, algo.isValid() ? algo.shortName() : nullptr, dataset_host);
|
||||
}
|
||||
|
||||
return pDeviceInfo(ctx, blocks, threads, algo, dataset_host) == 0;
|
||||
return pDeviceInfo_v2(ctx, blocks, threads, algo.isValid() ? algo.shortName() : nullptr, dataset_host);
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,11 +242,8 @@ bool xmrig::CudaLib::kawPowStopHash(nvid_ctx *ctx) noexcept
|
|||
bool xmrig::CudaLib::setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept
|
||||
{
|
||||
const Algorithm algo = RxAlgo::id(algorithm);
|
||||
if (pSetJob_v2) {
|
||||
return pSetJob_v2(ctx, data, size, algo.shortName());
|
||||
}
|
||||
|
||||
return pSetJob(ctx, data, size, algo);
|
||||
return pSetJob_v2(ctx, data, size, algo.shortName());
|
||||
}
|
||||
|
||||
|
||||
|
@ -421,16 +408,8 @@ void xmrig::CudaLib::load()
|
|||
DLSYM(KawPowHash);
|
||||
DLSYM(KawPowPrepare_v2);
|
||||
DLSYM(KawPowStopHash);
|
||||
|
||||
uv_dlsym(&cudaLib, kDeviceInfo_v2, reinterpret_cast<void**>(&pDeviceInfo_v2));
|
||||
if (!pDeviceInfo_v2) {
|
||||
DLSYM(DeviceInfo);
|
||||
}
|
||||
|
||||
uv_dlsym(&cudaLib, kSetJob_v2, reinterpret_cast<void**>(&pSetJob_v2));
|
||||
if (!pSetJob_v2) {
|
||||
DLSYM(SetJob);
|
||||
}
|
||||
DLSYM(DeviceInfo_v2);
|
||||
DLSYM(SetJob_v2);
|
||||
|
||||
pInit();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue