Merge xmrig v6.3.3
This commit is contained in:
commit
a6b6f22d08
25 changed files with 192 additions and 94 deletions
|
@ -152,7 +152,9 @@ public:
|
|||
}
|
||||
|
||||
if (!CudaLib::init(cuda.loader())) {
|
||||
return printDisabled(kLabel, RED_S " (failed to load CUDA plugin)");
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") RED_BOLD("disabled ") RED("(%s)"), kLabel, CudaLib::lastError());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
runtimeVersion = CudaLib::runtimeVersion();
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
if (BUILD_STATIC AND XMRIG_OS_UNIX AND WITH_CUDA)
|
||||
message(WARNING "CUDA backend is not compatible with static build, use -DWITH_CUDA=OFF to suppress this warning")
|
||||
|
||||
set(WITH_CUDA OFF)
|
||||
endif()
|
||||
|
||||
if (WITH_CUDA)
|
||||
add_definitions(/DXMRIG_FEATURE_CUDA)
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/io/Env.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/Process.h"
|
||||
#include "crypto/rx/RxAlgo.h"
|
||||
|
||||
|
||||
|
@ -46,6 +47,14 @@ enum Version : uint32_t
|
|||
|
||||
static uv_lib_t cudaLib;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
static String defaultLoader = "/System/Library/Frameworks/OpenCL.framework/OpenCL";
|
||||
#elif defined(_WIN32)
|
||||
static String defaultLoader = "xmrig-cuda.dll";
|
||||
#else
|
||||
static String defaultLoader = "libxmrig-cuda.so";
|
||||
#endif
|
||||
|
||||
|
||||
static const char *kAlloc = "alloc";
|
||||
static const char *kAstroBWTHash = "astroBWTHash";
|
||||
|
@ -125,11 +134,12 @@ static setJob_v2_t pSetJob_v2 = nullptr;
|
|||
static version_t pVersion = nullptr;
|
||||
|
||||
|
||||
#define DLSYM(x) if (uv_dlsym(&cudaLib, k##x, reinterpret_cast<void**>(&p##x)) == -1) { throw std::runtime_error("symbol not found (" #x ")"); }
|
||||
#define DLSYM(x) if (uv_dlsym(&cudaLib, k##x, reinterpret_cast<void**>(&p##x)) == -1) { throw std::runtime_error(std::string("symbol not found: ") + k##x); }
|
||||
|
||||
|
||||
bool CudaLib::m_initialized = false;
|
||||
bool CudaLib::m_ready = false;
|
||||
String CudaLib::m_error;
|
||||
String CudaLib::m_loader;
|
||||
|
||||
|
||||
|
@ -139,9 +149,22 @@ String CudaLib::m_loader;
|
|||
bool xmrig::CudaLib::init(const char *fileName)
|
||||
{
|
||||
if (!m_initialized) {
|
||||
m_loader = fileName == nullptr ? defaultLoader() : Env::expand(fileName);
|
||||
m_ready = uv_dlopen(m_loader, &cudaLib) == 0 && load();
|
||||
m_initialized = true;
|
||||
m_loader = fileName == nullptr ? defaultLoader : Env::expand(fileName);
|
||||
|
||||
if (!open()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
load();
|
||||
} catch (std::exception &ex) {
|
||||
m_error = (std::string(m_loader) + ": " + ex.what()).c_str();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ready = true;
|
||||
}
|
||||
|
||||
return m_ready;
|
||||
|
@ -150,7 +173,7 @@ bool xmrig::CudaLib::init(const char *fileName)
|
|||
|
||||
const char *xmrig::CudaLib::lastError() noexcept
|
||||
{
|
||||
return uv_dlerror(&cudaLib);
|
||||
return m_error;
|
||||
}
|
||||
|
||||
|
||||
|
@ -344,66 +367,70 @@ void xmrig::CudaLib::release(nvid_ctx *ctx) noexcept
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::load()
|
||||
bool xmrig::CudaLib::open()
|
||||
{
|
||||
if (uv_dlsym(&cudaLib, kVersion, reinterpret_cast<void**>(&pVersion)) == -1) {
|
||||
m_error = nullptr;
|
||||
|
||||
if (uv_dlopen(m_loader, &cudaLib) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_OS_LINUX
|
||||
if (m_loader == defaultLoader) {
|
||||
m_loader = Process::location(Process::ExeLocation, m_loader);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (uv_dlopen(m_loader, &cudaLib) == 0) {
|
||||
return true;
|
||||
}
|
||||
# endif
|
||||
|
||||
m_error = uv_dlerror(&cudaLib);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaLib::load()
|
||||
{
|
||||
DLSYM(Version);
|
||||
|
||||
if (pVersion(ApiVersion) != 3U) {
|
||||
return false;
|
||||
throw std::runtime_error("API version mismatch");
|
||||
}
|
||||
|
||||
uv_dlsym(&cudaLib, kDeviceInfo_v2, reinterpret_cast<void**>(&pDeviceInfo_v2));
|
||||
uv_dlsym(&cudaLib, kSetJob_v2, reinterpret_cast<void**>(&pSetJob_v2));
|
||||
DLSYM(Alloc);
|
||||
DLSYM(CnHash);
|
||||
DLSYM(DeviceCount);
|
||||
DLSYM(DeviceInit);
|
||||
DLSYM(DeviceInt);
|
||||
DLSYM(DeviceName);
|
||||
DLSYM(DeviceUint);
|
||||
DLSYM(DeviceUlong);
|
||||
DLSYM(Init);
|
||||
DLSYM(LastError);
|
||||
DLSYM(PluginVersion);
|
||||
DLSYM(Release);
|
||||
DLSYM(RxHash);
|
||||
DLSYM(RxPrepare);
|
||||
DLSYM(AstroBWTHash);
|
||||
DLSYM(AstroBWTPrepare);
|
||||
DLSYM(KawPowHash);
|
||||
DLSYM(KawPowPrepare_v2);
|
||||
DLSYM(KawPowStopHash);
|
||||
|
||||
try {
|
||||
DLSYM(Alloc);
|
||||
DLSYM(CnHash);
|
||||
DLSYM(DeviceCount);
|
||||
DLSYM(DeviceInit);
|
||||
DLSYM(DeviceInt);
|
||||
DLSYM(DeviceName);
|
||||
DLSYM(DeviceUint);
|
||||
DLSYM(DeviceUlong);
|
||||
DLSYM(Init);
|
||||
DLSYM(LastError);
|
||||
DLSYM(PluginVersion);
|
||||
DLSYM(Release);
|
||||
DLSYM(RxHash);
|
||||
DLSYM(RxPrepare);
|
||||
DLSYM(AstroBWTHash);
|
||||
DLSYM(AstroBWTPrepare);
|
||||
DLSYM(KawPowHash);
|
||||
DLSYM(KawPowPrepare_v2);
|
||||
DLSYM(KawPowStopHash);
|
||||
DLSYM(Version);
|
||||
uv_dlsym(&cudaLib, kDeviceInfo_v2, reinterpret_cast<void**>(&pDeviceInfo_v2));
|
||||
if (!pDeviceInfo_v2) {
|
||||
DLSYM(DeviceInfo);
|
||||
}
|
||||
|
||||
if (!pDeviceInfo_v2) {
|
||||
DLSYM(DeviceInfo);
|
||||
}
|
||||
|
||||
if (!pSetJob_v2) {
|
||||
DLSYM(SetJob);
|
||||
}
|
||||
} catch (std::exception &ex) {
|
||||
LOG_ERR("Error loading CUDA library: %s", ex.what());
|
||||
return false;
|
||||
uv_dlsym(&cudaLib, kSetJob_v2, reinterpret_cast<void**>(&pSetJob_v2));
|
||||
if (!pSetJob_v2) {
|
||||
DLSYM(SetJob);
|
||||
}
|
||||
|
||||
pInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
xmrig::String xmrig::CudaLib::defaultLoader()
|
||||
{
|
||||
# if defined(__APPLE__)
|
||||
return "/System/Library/Frameworks/OpenCL.framework/OpenCL"; // FIXME
|
||||
# elif defined(_WIN32)
|
||||
return "xmrig-cuda.dll";
|
||||
# else
|
||||
return "libxmrig-cuda.so";
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -99,11 +99,12 @@ public:
|
|||
static void release(nvid_ctx *ctx) noexcept;
|
||||
|
||||
private:
|
||||
static bool load();
|
||||
static String defaultLoader();
|
||||
static bool open();
|
||||
static void load();
|
||||
|
||||
static bool m_initialized;
|
||||
static bool m_ready;
|
||||
static String m_error;
|
||||
static String m_loader;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
if (BUILD_STATIC AND XMRIG_OS_UNIX AND WITH_OPENCL)
|
||||
message(WARNING "OpenCL backend is not compatible with static build, use -DWITH_OPENCL=OFF to suppress this warning")
|
||||
|
||||
set(WITH_OPENCL OFF)
|
||||
endif()
|
||||
|
||||
if (WITH_OPENCL)
|
||||
add_definitions(/DCL_TARGET_OPENCL_VERSION=200)
|
||||
add_definitions(/DCL_USE_DEPRECATED_OPENCL_1_2_APIS)
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
static uv_lib_t oclLib;
|
||||
|
||||
static const char *kErrorTemplate = MAGENTA_BG_BOLD(WHITE_BOLD_S " ocl ") RED(" error ") RED_BOLD("%s") RED(" when calling ") RED_BOLD("%s");
|
||||
static const char *kErrorTemplate = MAGENTA_BG_BOLD(WHITE_BOLD_S " opencl ") RED(" error ") RED_BOLD("%s") RED(" when calling ") RED_BOLD("%s");
|
||||
|
||||
static const char *kBuildProgram = "clBuildProgram";
|
||||
static const char *kCreateBuffer = "clCreateBuffer";
|
||||
|
|
|
@ -81,7 +81,13 @@ private:
|
|||
#define CLEAR CSI "0m" // all attributes off
|
||||
#define BRIGHT_BLACK_S CSI "0;90m" // somewhat MD.GRAY
|
||||
#define BLACK_S CSI "0;30m"
|
||||
#define BLACK_BOLD_S CSI "1;30m" // another name for GRAY
|
||||
|
||||
#ifdef XMRIG_OS_APPLE
|
||||
# define BLACK_BOLD_S CSI "0;37m"
|
||||
#else
|
||||
# define BLACK_BOLD_S CSI "1;30m" // another name for GRAY
|
||||
#endif
|
||||
|
||||
#define RED_S CSI "0;31m"
|
||||
#define RED_BOLD_S CSI "1;31m"
|
||||
#define GREEN_S CSI "0;32m"
|
||||
|
|
|
@ -84,7 +84,7 @@ static int showVersion()
|
|||
# if defined(LIBRESSL_VERSION_TEXT)
|
||||
printf("LibreSSL/%s\n", LIBRESSL_VERSION_TEXT + 9);
|
||||
# elif defined(OPENSSL_VERSION_TEXT)
|
||||
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
||||
constexpr const char *v = &OPENSSL_VERSION_TEXT[8];
|
||||
printf("OpenSSL/%.*s\n", static_cast<int>(strchr(v, ' ') - v), v);
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ void xmrig::BaseConfig::printVersions()
|
|||
snprintf(buf, sizeof buf, "LibreSSL/%s ", LIBRESSL_VERSION_TEXT + 9);
|
||||
libs += buf;
|
||||
# elif defined(OPENSSL_VERSION_TEXT)
|
||||
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
||||
constexpr const char *v = &OPENSSL_VERSION_TEXT[8];
|
||||
snprintf(buf, sizeof buf, "OpenSSL/%.*s ", static_cast<int>(strchr(v, ' ') - v), v);
|
||||
libs += buf;
|
||||
# endif
|
||||
|
|
|
@ -29,13 +29,20 @@ namespace xmrig {
|
|||
class HttpListener : public IHttpListener
|
||||
{
|
||||
public:
|
||||
inline HttpListener(IHttpListener *listener, const char *tag = nullptr) : m_tag(tag), m_listener(listener) {}
|
||||
inline HttpListener(IHttpListener *listener, const char *tag = nullptr) :
|
||||
# ifdef APP_DEBUG
|
||||
m_tag(tag),
|
||||
# endif
|
||||
m_listener(listener)
|
||||
{}
|
||||
|
||||
protected:
|
||||
void onHttpData(const HttpData &data) override;
|
||||
|
||||
private:
|
||||
# ifdef APP_DEBUG
|
||||
const char *m_tag;
|
||||
# endif
|
||||
IHttpListener *m_listener;
|
||||
};
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
void setDiff(uint64_t diff);
|
||||
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
|
||||
inline bool isValid() const { return (m_size > 0 && m_diff > 0) || !m_poolWallet.isEmpty(); }
|
||||
inline bool setId(const char *id) { return m_id = id; }
|
||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||
inline const Buffer &seed() const { return m_seed; }
|
||||
|
|
|
@ -91,7 +91,7 @@ bool KPCache::init(uint32_t epoch)
|
|||
const uint32_t a = (cache_nodes * i) / n;
|
||||
const uint32_t b = (cache_nodes * (i + 1)) / n;
|
||||
|
||||
threads.emplace_back([this, a, b, cache_nodes, &cache]() {
|
||||
threads.emplace_back([this, a, b, &cache]() {
|
||||
uint32_t j = a;
|
||||
for (; j + 4 <= b; j += 4) ethash_calculate_dag_item4_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache);
|
||||
for (; j < b; ++j) ethash_calculate_dag_item_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache);
|
||||
|
|
|
@ -235,7 +235,9 @@ RandomX_ConfigurationBase::RandomX_ConfigurationBase()
|
|||
# endif
|
||||
}
|
||||
|
||||
#ifdef XMRIG_ARMv8
|
||||
static uint32_t Log2(size_t value) { return (value > 1) ? (Log2(value / 2) + 1) : 0; }
|
||||
#endif
|
||||
|
||||
void RandomX_ConfigurationBase::Apply()
|
||||
{
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
for (const auto kv : m_datasets) {
|
||||
for (const auto &kv : m_datasets) {
|
||||
if (kv.second->isOneGbPages()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig miner"
|
||||
#define APP_VERSION "6.3.2-mo1"
|
||||
#define APP_VERSION "6.3.3-mo1"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com"
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#define APP_VER_MAJOR 6
|
||||
#define APP_VER_MINOR 3
|
||||
#define APP_VER_PATCH 2
|
||||
#define APP_VER_PATCH 3
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1920)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue