diff --git a/src/backend/cuda/CudaWorker.cpp b/src/backend/cuda/CudaWorker.cpp index 5ec4a3de5..c8cb6f73e 100644 --- a/src/backend/cuda/CudaWorker.cpp +++ b/src/backend/cuda/CudaWorker.cpp @@ -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(); diff --git a/src/backend/cuda/CudaWorker.h b/src/backend/cuda/CudaWorker.h index d18b66815..3f4e713ab 100644 --- a/src/backend/cuda/CudaWorker.h +++ b/src/backend/cuda/CudaWorker.h @@ -66,6 +66,7 @@ private: const Miner *m_miner; ICudaRunner *m_runner = nullptr; WorkerJob<1> m_job; + uint32_t m_deviceIndex; }; diff --git a/src/backend/opencl/OclWorker.cpp b/src/backend/opencl/OclWorker.cpp index b652bd69f..0526e9a78 100644 --- a/src/backend/opencl/OclWorker.cpp +++ b/src/backend/opencl/OclWorker.cpp @@ -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)) { diff --git a/src/backend/opencl/OclWorker.h b/src/backend/opencl/OclWorker.h index 64708e9d4..fc666f80e 100644 --- a/src/backend/opencl/OclWorker.h +++ b/src/backend/opencl/OclWorker.h @@ -69,6 +69,7 @@ private: IOclRunner *m_runner = nullptr; OclSharedData &m_sharedData; WorkerJob<1> m_job; + uint32_t m_deviceIndex; }; diff --git a/src/net/JobResults.cpp b/src/net/JobResults.cpp index 2fe89e84d..66502bad0 100644 --- a/src/net/JobResults.cpp +++ b/src/net/JobResults.cpp @@ -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 nonces; + uint32_t device_index; }; @@ -101,7 +104,7 @@ static inline void checkHash(const JobBundle &bundle, std::vector &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 &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 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 diff --git a/src/net/JobResults.h b/src/net/JobResults.h index 1b32e5bdb..5ca243d73 100644 --- a/src/net/JobResults.h +++ b/src/net/JobResults.h @@ -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 };