Added CudaWorker and CudaLaunchData.

This commit is contained in:
XMRig 2019-10-26 17:37:54 +07:00
parent d4a3024996
commit bb2cc0deb7
14 changed files with 567 additions and 28 deletions

View file

@ -24,6 +24,7 @@
#include "backend/cuda/CudaConfig.h"
#include "backend/common/Tags.h"
#include "backend/cuda/CudaConfig_gen.h"
#include "backend/cuda/wrappers/CudaLib.h"
#include "base/io/json/Json.h"
@ -61,6 +62,30 @@ rapidjson::Value xmrig::CudaConfig::toJSON(rapidjson::Document &doc) const
}
std::vector<xmrig::CudaLaunchData> xmrig::CudaConfig::get(const Miner *miner, const Algorithm &algorithm, const std::vector<CudaDevice> &devices) const
{
std::vector<CudaLaunchData> out;
const auto &threads = m_threads.get(algorithm);
if (threads.isEmpty()) {
return out;
}
out.reserve(threads.count() * 2);
for (const auto &thread : threads.data()) {
if (thread.index() >= devices.size()) {
LOG_INFO("%s" YELLOW(" skip non-existing device with index ") YELLOW_BOLD("%u"), cuda_tag(), thread.index());
continue;
}
out.emplace_back(miner, algorithm, thread, devices[thread.index()]);
}
return out;
}
void xmrig::CudaConfig::read(const rapidjson::Value &value)
{
if (value.IsObject()) {