#1273 Fixed crash when use "GET /2/backends" API endpoint with disabled CUDA.
This commit is contained in:
parent
e450e62b40
commit
2abea46a87
2 changed files with 16 additions and 13 deletions
|
@ -474,19 +474,21 @@ rapidjson::Value xmrig::CudaBackend::toJSON(rapidjson::Document &doc) const
|
|||
out.AddMember("algo", d_ptr->algo.toJSON(), allocator);
|
||||
out.AddMember("profile", profileName().toJSON(), allocator);
|
||||
|
||||
Value versions(kObjectType);
|
||||
versions.AddMember("cuda-runtime", Value(CudaLib::version(d_ptr->runtimeVersion).c_str(), allocator), allocator);
|
||||
versions.AddMember("cuda-driver", Value(CudaLib::version(d_ptr->driverVersion).c_str(), allocator), allocator);
|
||||
versions.AddMember("plugin", String(CudaLib::pluginVersion()).toJSON(doc), allocator);
|
||||
if (CudaLib::isReady()) {
|
||||
Value versions(kObjectType);
|
||||
versions.AddMember("cuda-runtime", Value(CudaLib::version(d_ptr->runtimeVersion).c_str(), allocator), allocator);
|
||||
versions.AddMember("cuda-driver", Value(CudaLib::version(d_ptr->driverVersion).c_str(), allocator), allocator);
|
||||
versions.AddMember("plugin", String(CudaLib::pluginVersion()).toJSON(doc), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (NvmlLib::isReady()) {
|
||||
versions.AddMember("nvml", StringRef(NvmlLib::version()), allocator);
|
||||
versions.AddMember("driver", StringRef(NvmlLib::driverVersion()), allocator);
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (NvmlLib::isReady()) {
|
||||
versions.AddMember("nvml", StringRef(NvmlLib::version()), allocator);
|
||||
versions.AddMember("driver", StringRef(NvmlLib::driverVersion()), allocator);
|
||||
}
|
||||
# endif
|
||||
|
||||
out.AddMember("versions", versions, allocator);
|
||||
}
|
||||
# endif
|
||||
|
||||
out.AddMember("versions", versions, allocator);
|
||||
|
||||
if (d_ptr->threads.empty() || !hashrate()) {
|
||||
return out;
|
||||
|
|
|
@ -69,8 +69,9 @@ public:
|
|||
static const char *lastError() noexcept;
|
||||
static void close();
|
||||
|
||||
static inline bool isInitialized() { return m_initialized; }
|
||||
static inline const String &loader() { return m_loader; }
|
||||
static inline bool isInitialized() { return m_initialized; }
|
||||
static inline bool isReady() noexcept { return m_ready; }
|
||||
static inline const String &loader() { return m_loader; }
|
||||
|
||||
static bool cnHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t height, uint64_t target, uint32_t *rescount, uint32_t *resnonce);
|
||||
static bool deviceInit(nvid_ctx *ctx) noexcept;
|
||||
|
|
Loading…
Reference in a new issue