Commit fcbf3818 authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

added busy spin option

parent 659f100d
...@@ -45,12 +45,17 @@ void hepnos_run_service(MPI_Comm comm, const char* config_file, const char* conn ...@@ -45,12 +45,17 @@ void hepnos_run_service(MPI_Comm comm, const char* config_file, const char* conn
return; return;
} }
std::unique_ptr<tl::engine> engine; tl::engine engine;
try { try {
engine = std::make_unique<tl::engine>( hg_init_info hg_opt;
memset(&hg_opt, 0, sizeof(hg_opt));
if(config->busySpin)
hg_opt.na_init_info.progress_mode = NA_NO_BLOCK;
engine = tl::engine(
config->address, config->address,
THALLIUM_SERVER_MODE, THALLIUM_SERVER_MODE,
false, config->numThreads-1); false, config->numThreads-1,
&hg_opt);
} catch(std::exception& ex) { } catch(std::exception& ex) {
std::cerr << "Error: unable to initialize thallium" << std::endl; std::cerr << "Error: unable to initialize thallium" << std::endl;
...@@ -59,25 +64,25 @@ void hepnos_run_service(MPI_Comm comm, const char* config_file, const char* conn ...@@ -59,25 +64,25 @@ void hepnos_run_service(MPI_Comm comm, const char* config_file, const char* conn
MPI_Abort(MPI_COMM_WORLD, -1); MPI_Abort(MPI_COMM_WORLD, -1);
return; return;
} }
engine->enable_remote_shutdown(); engine.enable_remote_shutdown();
auto self_addr_str = static_cast<std::string>(engine->self()); auto self_addr_str = static_cast<std::string>(engine.self());
/* SDSKV providers initialization */ /* SDSKV providers initialization */
for(auto& provider_config : config->datasetProviders) for(auto& provider_config : config->datasetProviders)
createProviderAndDatabases(*engine, provider_config); createProviderAndDatabases(engine, provider_config);
for(auto& provider_config : config->runProviders) for(auto& provider_config : config->runProviders)
createProviderAndDatabases(*engine, provider_config, hepnosItemDescriptorCompare); createProviderAndDatabases(engine, provider_config, hepnosItemDescriptorCompare);
for(auto& provider_config : config->subrunProviders) for(auto& provider_config : config->subrunProviders)
createProviderAndDatabases(*engine, provider_config, hepnosItemDescriptorCompare); createProviderAndDatabases(engine, provider_config, hepnosItemDescriptorCompare);
for(auto& provider_config : config->eventProviders) for(auto& provider_config : config->eventProviders)
createProviderAndDatabases(*engine, provider_config, hepnosItemDescriptorCompare); createProviderAndDatabases(engine, provider_config, hepnosItemDescriptorCompare);
for(auto& provider_config : config->productProviders) for(auto& provider_config : config->productProviders)
createProviderAndDatabases(*engine, provider_config); createProviderAndDatabases(engine, provider_config);
hepnos::ConnectionInfoGenerator fileGen(self_addr_str, *config); hepnos::ConnectionInfoGenerator fileGen(self_addr_str, *config);
fileGen.generateFile(MPI_COMM_WORLD, connection_file); fileGen.generateFile(MPI_COMM_WORLD, connection_file);
engine->wait_for_finalize(); engine.wait_for_finalize();
} }
static void createProviderAndDatabases(tl::engine& engine, hepnos::ProviderConfig& provider_config, sdskv_compare_fn comp) { static void createProviderAndDatabases(tl::engine& engine, hepnos::ProviderConfig& provider_config, sdskv_compare_fn comp) {
......
...@@ -28,6 +28,8 @@ ServiceConfig::ServiceConfig(const std::string& filename, int rank, int numRanks ...@@ -28,6 +28,8 @@ ServiceConfig::ServiceConfig(const std::string& filename, int rank, int numRanks
YAML::Node address = config["address"]; YAML::Node address = config["address"];
YAML::Node threads = config["threads"]; YAML::Node threads = config["threads"];
YAML::Node databases = config["databases"]; YAML::Node databases = config["databases"];
YAML::Node busySpin = config["busy-spin"];
if(busySpin) this->busySpin = busySpin.as<bool>();
if(threads) this->numThreads = threads.as<uint32_t>(); if(threads) this->numThreads = threads.as<uint32_t>();
this->address = address.as<std::string>(); this->address = address.as<std::string>();
// Count the total number of providers and targets // Count the total number of providers and targets
......
...@@ -27,6 +27,7 @@ public: ...@@ -27,6 +27,7 @@ public:
std::string address; std::string address;
uint32_t numRanks = 1; uint32_t numRanks = 1;
uint32_t numThreads = 1; uint32_t numThreads = 1;
bool busySpin = false;
std::vector<ProviderConfig> datasetProviders; std::vector<ProviderConfig> datasetProviders;
std::vector<ProviderConfig> runProviders; std::vector<ProviderConfig> runProviders;
std::vector<ProviderConfig> subrunProviders; std::vector<ProviderConfig> subrunProviders;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment