Implemented OclLaunchData creation.

This commit is contained in:
XMRig 2019-08-24 00:14:41 +07:00
parent 55e12fb34b
commit 797d90c4dd
7 changed files with 53 additions and 52 deletions

View file

@ -263,7 +263,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
const CpuConfig &cpu = d_ptr->controller->config()->cpu();
std::vector<CpuLaunchData> threads = cpu.get(d_ptr->controller->miner(), job.algorithm());
if (d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
if (!d_ptr->threads.empty() && d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
return;
}
@ -271,11 +271,9 @@ void xmrig::CpuBackend::setJob(const Job &job)
d_ptr->profileName = cpu.threads().profileName(job.algorithm());
if (d_ptr->profileName.isNull() || threads.empty()) {
d_ptr->workers.stop();
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), tag);
LOG_WARN(YELLOW_BOLD_S "CPU disabled, no suitable configuration for algo %s", job.algorithm().shortName());
return;
return stop();
}
d_ptr->threads = std::move(threads);
@ -314,6 +312,10 @@ void xmrig::CpuBackend::start(IWorker *worker)
void xmrig::CpuBackend::stop()
{
if (d_ptr->threads.empty()) {
return;
}
const uint64_t ts = Chrono::steadyMSecs();
d_ptr->workers.stop();

View file

@ -121,7 +121,7 @@ std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, cons
out.reserve(threads.count());
for (const CpuThread &thread : threads.data()) {
out.push_back(CpuLaunchData(miner, algorithm, *this, thread));
out.emplace_back(miner, algorithm, *this, thread);
}
return out;