Added version information to API.
This commit is contained in:
parent
9dfa38f1e7
commit
b1eac17d60
3 changed files with 20 additions and 4 deletions
|
@ -136,8 +136,8 @@ public:
|
||||||
return printDisabled(RED_S " (failed to load CUDA plugin)");
|
return printDisabled(RED_S " (failed to load CUDA plugin)");
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t runtimeVersion = CudaLib::runtimeVersion();
|
runtimeVersion = CudaLib::runtimeVersion();
|
||||||
const uint32_t driverVersion = CudaLib::driverVersion();
|
driverVersion = CudaLib::driverVersion();
|
||||||
|
|
||||||
if (!runtimeVersion || !driverVersion || !CudaLib::deviceCount()) {
|
if (!runtimeVersion || !driverVersion || !CudaLib::deviceCount()) {
|
||||||
return printDisabled(RED_S " (no devices)");
|
return printDisabled(RED_S " (no devices)");
|
||||||
|
@ -147,8 +147,8 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%u.%u") "/" WHITE_BOLD("%u.%u") BLACK_BOLD("/%s"), "CUDA",
|
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s") "/" WHITE_BOLD("%s") BLACK_BOLD("/%s"), "CUDA",
|
||||||
runtimeVersion / 1000, runtimeVersion % 100, driverVersion / 1000, driverVersion % 100, CudaLib::pluginVersion());
|
CudaLib::version(runtimeVersion).c_str(), CudaLib::version(driverVersion).c_str(), CudaLib::pluginVersion());
|
||||||
|
|
||||||
devices = CudaLib::devices(cuda.bfactor(), cuda.bsleep());
|
devices = CudaLib::devices(cuda.bfactor(), cuda.bsleep());
|
||||||
|
|
||||||
|
@ -210,6 +210,8 @@ public:
|
||||||
std::vector<CudaDevice> devices;
|
std::vector<CudaDevice> devices;
|
||||||
std::vector<CudaLaunchData> threads;
|
std::vector<CudaLaunchData> threads;
|
||||||
String profileName;
|
String profileName;
|
||||||
|
uint32_t driverVersion = 0;
|
||||||
|
uint32_t runtimeVersion = 0;
|
||||||
Workers<CudaLaunchData> workers;
|
Workers<CudaLaunchData> workers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -390,6 +392,12 @@ rapidjson::Value xmrig::CudaBackend::toJSON(rapidjson::Document &doc) const
|
||||||
out.AddMember("algo", d_ptr->algo.toJSON(), allocator);
|
out.AddMember("algo", d_ptr->algo.toJSON(), allocator);
|
||||||
out.AddMember("profile", profileName().toJSON(), allocator);
|
out.AddMember("profile", profileName().toJSON(), allocator);
|
||||||
|
|
||||||
|
Value versions(kObjectType);
|
||||||
|
versions.AddMember("runtime", Value(CudaLib::version(d_ptr->runtimeVersion).c_str(), allocator), allocator);
|
||||||
|
versions.AddMember("driver", Value(CudaLib::version(d_ptr->driverVersion).c_str(), allocator), allocator);
|
||||||
|
versions.AddMember("plugin", String(CudaLib::pluginVersion()).toJSON(doc), allocator);
|
||||||
|
out.AddMember("versions", versions, allocator);
|
||||||
|
|
||||||
if (d_ptr->threads.empty() || !hashrate()) {
|
if (d_ptr->threads.empty() || !hashrate()) {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,12 @@ nvid_ctx *xmrig::CudaLib::alloc(uint32_t id, int32_t bfactor, int32_t bsleep) no
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string xmrig::CudaLib::version(uint32_t version)
|
||||||
|
{
|
||||||
|
return std::to_string(version / 1000) + "." + std::to_string((version % 1000) / 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<xmrig::CudaDevice> xmrig::CudaLib::devices(int32_t bfactor, int32_t bsleep) noexcept
|
std::vector<xmrig::CudaDevice> xmrig::CudaLib::devices(int32_t bfactor, int32_t bsleep) noexcept
|
||||||
{
|
{
|
||||||
const uint32_t count = deviceCount();
|
const uint32_t count = deviceCount();
|
||||||
|
|
|
@ -35,6 +35,7 @@ using nvid_ctx = struct nvid_ctx;
|
||||||
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
@ -81,6 +82,7 @@ public:
|
||||||
static int deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm) noexcept;
|
static int deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm) noexcept;
|
||||||
static int32_t deviceInt(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
static int32_t deviceInt(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
||||||
static nvid_ctx *alloc(uint32_t id, int32_t bfactor, int32_t bsleep) noexcept;
|
static nvid_ctx *alloc(uint32_t id, int32_t bfactor, int32_t bsleep) noexcept;
|
||||||
|
static std::string version(uint32_t version);
|
||||||
static std::vector<CudaDevice> devices(int32_t bfactor, int32_t bsleep) noexcept;
|
static std::vector<CudaDevice> devices(int32_t bfactor, int32_t bsleep) noexcept;
|
||||||
static uint32_t deviceCount() noexcept;
|
static uint32_t deviceCount() noexcept;
|
||||||
static uint32_t deviceUint(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
static uint32_t deviceUint(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue