Show GPU # when compute error happens

This commit is contained in:
SChernykh 2020-06-11 19:45:41 +02:00
parent f7d1d50a25
commit 5324761e06
6 changed files with 21 additions and 13 deletions

View file

@ -27,6 +27,7 @@
#include "backend/cuda/CudaWorker.h"
#include "backend/common/Tags.h"
#include "backend/cuda/runners/CudaCnRunner.h"
#include "backend/cuda/wrappers/CudaDevice.h"
#include "base/io/log/Log.h"
#include "base/tools/Chrono.h"
#include "core/Miner.h"
@ -71,7 +72,8 @@ static inline uint32_t roundSize(uint32_t intensity) { return kReserveCount / in
xmrig::CudaWorker::CudaWorker(size_t id, const CudaLaunchData &data) :
Worker(id, data.thread.affinity(), -1),
m_algorithm(data.algorithm),
m_miner(data.miner)
m_miner(data.miner),
m_deviceIndex(data.device.index())
{
switch (m_algorithm.family()) {
case Algorithm::RANDOM_X:
@ -165,7 +167,7 @@ void xmrig::CudaWorker::start()
}
if (foundCount) {
JobResults::submit(m_job.currentJob(), foundNonce, foundCount);
JobResults::submit(m_job.currentJob(), foundNonce, foundCount, m_deviceIndex);
}
const size_t batch_size = intensity();

View file

@ -66,6 +66,7 @@ private:
const Miner *m_miner;
ICudaRunner *m_runner = nullptr;
WorkerJob<1> m_job;
uint32_t m_deviceIndex;
};

View file

@ -79,7 +79,8 @@ xmrig::OclWorker::OclWorker(size_t id, const OclLaunchData &data) :
m_algorithm(data.algorithm),
m_miner(data.miner),
m_intensity(data.thread.intensity()),
m_sharedData(OclSharedState::get(data.device.index()))
m_sharedData(OclSharedState::get(data.device.index())),
m_deviceIndex(data.device.index())
{
switch (m_algorithm.family()) {
case Algorithm::RANDOM_X:
@ -200,7 +201,7 @@ void xmrig::OclWorker::start()
}
if (results[0xFF] > 0) {
JobResults::submit(m_job.currentJob(), results, results[0xFF]);
JobResults::submit(m_job.currentJob(), results, results[0xFF], m_deviceIndex);
}
if (!Nonce::isOutdated(Nonce::OPENCL, m_job.sequence()) && !m_job.nextRound(roundSize(runnerRoundSize), runnerRoundSize)) {

View file

@ -69,6 +69,7 @@ private:
IOclRunner *m_runner = nullptr;
OclSharedData &m_sharedData;
WorkerJob<1> m_job;
uint32_t m_deviceIndex;
};

View file

@ -29,6 +29,7 @@
#include "base/tools/Object.h"
#include "net/interfaces/IJobResultListener.h"
#include "net/JobResult.h"
#include "backend/common/Tags.h"
#ifdef XMRIG_ALGO_RANDOMX
@ -66,15 +67,17 @@ namespace xmrig {
class JobBundle
{
public:
inline JobBundle(const Job &job, uint32_t *results, size_t count) :
inline JobBundle(const Job &job, uint32_t *results, size_t count, uint32_t device_index) :
job(job),
nonces(count)
nonces(count),
device_index(device_index)
{
memcpy(nonces.data(), results, sizeof(uint32_t) * count);
}
Job job;
std::vector<uint32_t> nonces;
uint32_t device_index;
};
@ -101,7 +104,7 @@ static inline void checkHash(const JobBundle &bundle, std::vector<JobResult> &re
results.emplace_back(bundle.job, nonce, hash);
}
else {
LOG_ERR("COMPUTE ERROR"); // TODO Extend information.
LOG_ERR("%s " RED_S "GPU #%u COMPUTE ERROR", backend_tag(bundle.job.backend()), bundle.device_index);
errors++;
}
}
@ -165,7 +168,7 @@ static void getResults(JobBundle &bundle, std::vector<JobResult> &results, uint3
results.emplace_back(bundle.job, full_nonce, (uint8_t*)output, bundle.job.blob(), (uint8_t*)mix_hash);
}
else {
LOG_ERR("COMPUTE ERROR"); // TODO Extend information.
LOG_ERR("%s " RED_S "GPU #%u COMPUTE ERROR", backend_tag(bundle.job.backend()), bundle.device_index);
++errors;
}
}
@ -221,10 +224,10 @@ public:
# if defined(XMRIG_FEATURE_OPENCL) || defined(XMRIG_FEATURE_CUDA)
inline void submit(const Job &job, uint32_t *results, size_t count)
inline void submit(const Job &job, uint32_t *results, size_t count, uint32_t device_index)
{
std::lock_guard<std::mutex> lock(m_mutex);
m_bundles.emplace_back(job, results, count);
m_bundles.emplace_back(job, results, count, device_index);
uv_async_send(m_async);
}
@ -351,10 +354,10 @@ void xmrig::JobResults::submit(const JobResult &result)
#if defined(XMRIG_FEATURE_OPENCL) || defined(XMRIG_FEATURE_CUDA)
void xmrig::JobResults::submit(const Job &job, uint32_t *results, size_t count)
void xmrig::JobResults::submit(const Job &job, uint32_t *results, size_t count, uint32_t device_index)
{
if (handler) {
handler->submit(job, results, count);
handler->submit(job, results, count, device_index);
}
}
#endif

View file

@ -49,7 +49,7 @@ public:
static void submit(const JobResult &result);
# if defined(XMRIG_FEATURE_OPENCL) || defined(XMRIG_FEATURE_CUDA)
static void submit(const Job &job, uint32_t *results, size_t count);
static void submit(const Job &job, uint32_t *results, size_t count, uint32_t device_index);
# endif
};