Print detailed information about OpenCL threads.

This commit is contained in:
XMRig 2019-09-05 13:00:40 +07:00
parent 1ad30d50a6
commit 0e362f38bc
4 changed files with 38 additions and 9 deletions

View file

@ -54,7 +54,7 @@ namespace xmrig {
extern template class Threads<OclThreads>; extern template class Threads<OclThreads>;
constexpr const size_t oneGiB = 1024u * 1024u * 1024u; constexpr const size_t oneMiB = 1024u * 1024u;
static const char *tag = MAGENTA_BG_BOLD(WHITE_BOLD_S " ocl "); static const char *tag = MAGENTA_BG_BOLD(WHITE_BOLD_S " ocl ");
static const String kType = "opencl"; static const String kType = "opencl";
static std::mutex mutex; static std::mutex mutex;
@ -122,14 +122,14 @@ public:
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu ") WHITE_BOLD("%s") "/" WHITE_BOLD("%s"), "OPENCL", platform.index(), platform.name().data(), platform.version().data()); Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu ") WHITE_BOLD("%s") "/" WHITE_BOLD("%s"), "OPENCL", platform.index(), platform.name().data(), platform.version().data());
for (const OclDevice &device : devices) { for (const OclDevice &device : devices) {
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu") YELLOW(" %s") " %s " WHITE_BOLD("%uMHz") " cu:" WHITE_BOLD("%u") " mem:" CYAN("%1.2f/%1.2f") " GB", "OPENCL GPU", Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu") YELLOW(" %s") " %s " WHITE_BOLD("%uMHz") " cu:" WHITE_BOLD("%u") " mem:" CYAN("%zu/%zu") " MB", "OPENCL GPU",
device.index(), device.index(),
device.hasTopology() ? device.topology().toString().data() : "n/a", device.hasTopology() ? device.topology().toString().data() : "n/a",
device.printableName().data(), device.printableName().data(),
device.clock(), device.clock(),
device.computeUnits(), device.computeUnits(),
static_cast<double>(device.freeMem()) / oneGiB, device.freeMem() / oneMiB,
static_cast<double>(device.globalMem()) / oneGiB); device.globalMem() / oneMiB);
} }
} }
@ -143,6 +143,27 @@ public:
algo.l3() / 1024 algo.l3() / 1024
); );
Log::print(WHITE_BOLD("| # | GPU | BUS ID | I | W | SI | MC | U | MEM | NAME"));
size_t i = 0;
for (const auto &data : threads) {
Log::print("|" CYAN_BOLD("%3zu") " |" CYAN_BOLD("%4u") " |" YELLOW(" %7s") " |" CYAN_BOLD("%5u") " |" CYAN_BOLD("%3u") " |"
CYAN_BOLD("%3u") " |" CYAN_BOLD("%3s") " |" CYAN_BOLD("%3u") " |" CYAN("%5zu") " | %s",
i,
data.thread.index(),
data.device.hasTopology() ? data.device.topology().toString().data() : "n/a",
data.thread.intensity(),
data.thread.worksize(),
data.thread.stridedIndex(),
data.thread.stridedIndex() == 2 ? std::to_string(data.thread.memChunk()).c_str() : "-",
data.thread.unrollFactor(),
data.thread.intensity() * algo.l3() / oneMiB,
data.device.printableName().data()
);
i++;
}
status.start(threads.size()); status.start(threads.size());
workers.start(threads); workers.start(threads);
} }
@ -339,8 +360,7 @@ rapidjson::Value xmrig::OclBackend::toJSON(rapidjson::Document &doc) const
size_t i = 0; size_t i = 0;
for (const OclLaunchData &data : d_ptr->threads) { for (const OclLaunchData &data : d_ptr->threads) {
Value thread(kObjectType); Value thread = data.thread.toJSON(doc);
thread.AddMember("intensity", data.thread.intensity(), allocator);
thread.AddMember("affinity", data.affinity, allocator); thread.AddMember("affinity", data.affinity, allocator);
Value hashrate(kArrayType); Value hashrate(kArrayType);

View file

@ -43,9 +43,16 @@ class Miner;
class OclBackend : public IBackend class OclBackend : public IBackend
{ {
public: public:
OclBackend() = delete;
OclBackend(const OclBackend &other) = delete;
OclBackend(Controller *controller); OclBackend(Controller *controller);
OclBackend(OclBackend &&other) = delete;
~OclBackend() override; ~OclBackend() override;
OclBackend &operator=(const OclBackend &other) = delete;
OclBackend &operator=(OclBackend &&other) = delete;
protected: protected:
bool isEnabled() const override; bool isEnabled() const override;
bool isEnabled(const Algorithm &algorithm) const override; bool isEnabled(const Algorithm &algorithm) const override;

View file

@ -67,8 +67,8 @@ static cl_program createFromSource(const IOclRunner *runner)
return nullptr; return nullptr;
} }
LOG_INFO("%s GPU " WHITE_BOLD("#%zu") " " GREEN_BOLD("compilation completed") BLACK_BOLD( " (%.3fs)"), LOG_INFO("%s GPU " WHITE_BOLD("#%zu") " " GREEN_BOLD("compilation completed") BLACK_BOLD(" (%" PRIu64 " ms)"),
tag, runner->data().device.index(), (Chrono::steadyMSecs() - ts) / 1000.0); tag, runner->data().device.index(), Chrono::steadyMSecs() - ts);
return program; return program;
} }

View file

@ -42,6 +42,8 @@ template<Algorithm::Id ALGO = Algorithm::INVALID>
class CnAlgo class CnAlgo
{ {
public: public:
constexpr CnAlgo() {};
constexpr inline Algorithm::Id base() const { static_assert(ALGO > Algorithm::INVALID && ALGO < Algorithm::RX_0, "invalid CRYPTONIGHT algorithm"); return Algorithm::CN_2; } constexpr inline Algorithm::Id base() const { static_assert(ALGO > Algorithm::INVALID && ALGO < Algorithm::RX_0, "invalid CRYPTONIGHT algorithm"); return Algorithm::CN_2; }
constexpr inline bool isHeavy() const { return memory() == CN_MEMORY * 2; } constexpr inline bool isHeavy() const { return memory() == CN_MEMORY * 2; }
constexpr inline bool isR() const { return ALGO == Algorithm::CN_R; } constexpr inline bool isR() const { return ALGO == Algorithm::CN_R; }