From 2604705bab38a0faa404f776af8111dfde7716c8 Mon Sep 17 00:00:00 2001 From: XMRig Date: Tue, 24 Sep 2019 03:14:35 +0700 Subject: [PATCH] Added command line option --opencl. --- .../AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml | 262 ++++++++++++ .../AMD_Opteron_6348_x4_N8_linux_2_0_4.xml | 399 ++++++++++++++++++ src/base/kernel/interfaces/IConfig.h | 1 + src/core/config/ConfigTransform.cpp | 21 +- src/core/config/ConfigTransform.h | 1 + src/core/config/Config_platform.h | 3 + src/core/config/usage.h | 7 +- 7 files changed, 691 insertions(+), 3 deletions(-) create mode 100644 doc/topology/AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml create mode 100644 doc/topology/AMD_Opteron_6348_x4_N8_linux_2_0_4.xml diff --git a/doc/topology/AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml b/doc/topology/AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml new file mode 100644 index 00000000..f3a25ff5 --- /dev/null +++ b/doc/topology/AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/topology/AMD_Opteron_6348_x4_N8_linux_2_0_4.xml b/doc/topology/AMD_Opteron_6348_x4_N8_linux_2_0_4.xml new file mode 100644 index 00000000..909dbcb9 --- /dev/null +++ b/doc/topology/AMD_Opteron_6348_x4_N8_linux_2_0_4.xml @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 2 5 6 + 10 22 16 22 22 10 22 16 16 22 + 10 22 22 16 22 10 + + + diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index 0569a3d1..7823d325 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -100,6 +100,7 @@ public: OclMemChunkKey = 1408, OclUnrollKey = 1409, OclCompModeKey = 1410, + OclKey = 1411, // xmrig-proxy AccessLogFileKey = 'A', diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp index 4dc009ad..fdf70b37 100644 --- a/src/core/config/ConfigTransform.cpp +++ b/src/core/config/ConfigTransform.cpp @@ -35,11 +35,16 @@ namespace xmrig static const char *kAffinity = "affinity"; static const char *kAsterisk = "*"; static const char *kCpu = "cpu"; +static const char *kEnabled = "enabled"; static const char *kIntensity = "intensity"; static const char *kThreads = "threads"; #ifdef XMRIG_ALGO_RANDOMX -static const char *kRandomX = "randomx"; +static const char *kRandomX = "randomx"; +#endif + +#ifdef XMRIG_FEATURE_OPENCL +static const char *kOcl = "opencl"; #endif @@ -104,6 +109,12 @@ void xmrig::ConfigTransform::finalize(rapidjson::Document &doc) doc[kCpu].AddMember(StringRef(kAsterisk), profile, doc.GetAllocator()); } + +# ifdef XMRIG_FEATURE_OPENCL + if (m_opencl) { + set(doc, kOcl, kEnabled, true); + } +# endif } @@ -140,6 +151,12 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const return set(doc, kRandomX, "numa", false); # endif +# ifdef XMRIG_FEATURE_OPENCL + case IConfig::OclKey: /* --opencl */ + m_opencl = true; + break; +# endif + default: break; } @@ -153,7 +170,7 @@ void xmrig::ConfigTransform::transformBoolean(rapidjson::Document &doc, int key, return set(doc, kCpu, "huge-pages", enable); case IConfig::CPUKey: /* --no-cpu */ - return set(doc, kCpu, "enabled", enable); + return set(doc, kCpu, kEnabled, enable); default: break; diff --git a/src/core/config/ConfigTransform.h b/src/core/config/ConfigTransform.h index 7ec3cdec..66c497ab 100644 --- a/src/core/config/ConfigTransform.h +++ b/src/core/config/ConfigTransform.h @@ -42,6 +42,7 @@ private: void transformBoolean(rapidjson::Document &doc, int key, bool enable); void transformUint64(rapidjson::Document &doc, int key, uint64_t arg); + bool m_opencl = false; int64_t m_affinity = -1; uint64_t m_intensity = 1; uint64_t m_threads = 0; diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index d4a0a5b8..fcad8bc5 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -91,6 +91,9 @@ static const option options[] = { # ifdef XMRIG_ALGO_RANDOMX { "randomx-init", 1, nullptr, IConfig::RandomXInitKey }, { "randomx-no-numa", 0, nullptr, IConfig::RandomXNumaKey }, +# endif +# ifdef XMRIG_FEATURE_OPENCL + { "opencl", 0, nullptr, IConfig::OclKey }, # endif { nullptr, 0, nullptr, 0 } }; diff --git a/src/core/config/usage.h b/src/core/config/usage.h index f64842ae..60225d0b 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -71,7 +71,7 @@ static inline const std::string &usage() u += "\nCPU backend:\n"; - u += " --no-cpu disable CPU backend\n"; + u += " --no-cpu disable CPU mining backend\n"; u += " -t, --threads=N number of CPU threads\n"; u += " -v, --av=N algorithm variation, 0 auto select\n"; u += " --cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n"; @@ -94,6 +94,11 @@ static inline const std::string &usage() u += " --http-no-restricted enable full remote access to HTTP API (only if access token set)\n"; # endif +# ifdef XMRIG_FEATURE_OPENCL + u += "\nOpenCL backend:\n"; + u += " --opencl enable OpenCL mining backend\n"; +# endif + u += "\nLogging:\n"; # ifdef HAVE_SYSLOG_H