diff options
-rw-r--r-- | xmrstak/backend/amd/autoAdjust.hpp | 1 | ||||
-rw-r--r-- | xmrstak/backend/amd/config.tpl | 6 | ||||
-rw-r--r-- | xmrstak/backend/amd/minethd.cpp | 2 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/minethd.cpp | 2 | ||||
-rw-r--r-- | xmrstak/misc/environment.hpp | 45 |
5 files changed, 22 insertions, 34 deletions
diff --git a/xmrstak/backend/amd/autoAdjust.hpp b/xmrstak/backend/amd/autoAdjust.hpp index ebe59df..2a22a08 100644 --- a/xmrstak/backend/amd/autoAdjust.hpp +++ b/xmrstak/backend/amd/autoAdjust.hpp @@ -105,7 +105,6 @@ private: } configTpl.replace("PLATFORMINDEX",std::to_string(platformIndex)); - configTpl.replace("NUMGPUS",std::to_string(devVec.size())); configTpl.replace("GPUCONFIG",conf); configTpl.write(params::inst().configFileAMD); printer::inst()->print_msg(L0, "AMD: GPU configuration stored in file '%s'", params::inst().configFileAMD.c_str()); diff --git a/xmrstak/backend/amd/config.tpl b/xmrstak/backend/amd/config.tpl index b8b6dc4..a93859c 100644 --- a/xmrstak/backend/amd/config.tpl +++ b/xmrstak/backend/amd/config.tpl @@ -1,10 +1,4 @@ R"===( - -/* - * Number of GPUs that you have in your system. Each GPU will get its own CPU thread. - */ -"gpu_thread_num" : NUMGPUS, - /* * GPU configuration. You should play around with intensity and worksize as the fastest settings will vary. * index - GPU index number usually starts from 0 diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index 84f0055..5ca10d3 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -65,7 +65,7 @@ __declspec(dllexport) #endif std::vector<iBackend*>* xmrstak_start_backend(uint32_t threadOffset, miner_work& pWork, environment& env) { - environment::inst() = env; + environment::inst(&env); return amd::minethd::thread_starter(threadOffset, pWork); } } // extern "C" diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp index a4aa519..fcd01cd 100644 --- a/xmrstak/backend/nvidia/minethd.cpp +++ b/xmrstak/backend/nvidia/minethd.cpp @@ -112,7 +112,7 @@ __declspec(dllexport) #endif std::vector<iBackend*>* xmrstak_start_backend(uint32_t threadOffset, miner_work& pWork, environment& env) { - environment::inst() = env; + environment::inst(&env); return nvidia::minethd::thread_starter(threadOffset, pWork); } } // extern "C" diff --git a/xmrstak/misc/environment.hpp b/xmrstak/misc/environment.hpp index 6140d7d..99c2db8 100644 --- a/xmrstak/misc/environment.hpp +++ b/xmrstak/misc/environment.hpp @@ -7,40 +7,35 @@ class executor; namespace xmrstak { -class globalStates; -class params; +struct globalStates; +struct params; struct environment { - - static environment& inst() - { - static environment env; - return env; - } - - environment& operator=(const environment& env) + static inline environment& inst(environment* init = nullptr) { - this->pPrinter = env.pPrinter; - this->pglobalStates = env.pglobalStates; - this->pJconfConfig = env.pJconfConfig; - this->pExecutor = env.pExecutor; - this->pParams = env.pParams; - return *this; - } + static environment* env = nullptr; + if(env == nullptr) + { + if(init == nullptr) + env = new environment; + else + env = init; + } - environment() : pPrinter(nullptr), pglobalStates(nullptr) - { + return *env; } + environment() + { + } - printer* pPrinter; - globalStates* pglobalStates; - jconf* pJconfConfig; - executor* pExecutor; - params* pParams; - + printer* pPrinter = nullptr; + globalStates* pglobalStates = nullptr; + jconf* pJconfConfig = nullptr; + executor* pExecutor = nullptr; + params* pParams = nullptr; }; } // namepsace xmrstak |