Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback from hwloc autoconf to basic autoconf #2430

Merged
merged 1 commit into from May 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions xmrstak/backend/cpu/autoAdjustHwloc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ namespace xmrstak
namespace cpu
{

class autoAdjust
class autoAdjustHwloc
{
public:
autoAdjust()
public:
autoAdjustHwloc()
{
auto neededAlgorithms = ::jconf::inst()->GetCurrentCoinSelection().GetAllAlgorithms();

Expand Down Expand Up @@ -60,6 +60,7 @@ class autoAdjust
conf += "/*\n//CPU config is disabled by default because cryptonight_gpu is not suitable for CPU mining.\n";
}

bool is_successful = true;
try
{
std::vector<hwloc_obj_t> tlcs;
Expand All @@ -86,10 +87,8 @@ class autoAdjust
}
catch(const std::runtime_error& err)
{
// \todo add fallback to default auto adjust
conf += std::string(" { \"low_power_mode\" : false");
conf += std::string(", \"no_prefetch\" : true, \"asm\" : \"off\", \"affine_to_cpu\" : false },\n");
printer::inst()->print_msg(L0, "Autoconf FAILED: %s. Create config for a single thread.", err.what());
is_successful = false;
printer::inst()->print_msg(L0, "Autoconf with hwloc FAILED: %s. Trying basic autoconf.", err.what());
}

if(useCryptonight_gpu)
Expand All @@ -101,7 +100,7 @@ class autoAdjust
/* Destroy topology object. */
hwloc_topology_destroy(topology);

return true;
return is_successful;
}

private:
Expand Down
15 changes: 15 additions & 0 deletions xmrstak/backend/cpu/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#ifndef CONF_NO_HWLOC
#include "autoAdjustHwloc.hpp"
#include "autoAdjust.hpp"
#else
#include "autoAdjust.hpp"
#endif
Expand Down Expand Up @@ -515,9 +516,23 @@ std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work

if(!configEditor::file_exist(params::inst().configFileCPU))
{
#ifndef CONF_NO_HWLOC
autoAdjustHwloc adjustHwloc;
if(!adjustHwloc.printConfig())
{
autoAdjust adjust;
if(!adjust.printConfig())
{
return pvThreads;
}
}
#else
autoAdjust adjust;
if(!adjust.printConfig())
{
return pvThreads;
}
#endif
}

if(!jconf::inst()->parse_config())
Expand Down