diff --git a/docs/md/lb-manager.md b/docs/md/lb-manager.md index 2cc7597dc4..e9f25c0ee7 100644 --- a/docs/md/lb-manager.md +++ b/docs/md/lb-manager.md @@ -15,19 +15,19 @@ instrumentation of work and communication performed by collection elements. To run a load balancer at runtime: - Pass `--vt_lb --vt_lb_name=` as a command line argument -- Write a LB specification file `--vt_lb --vt_lb_file_name=` +- Write a LB config file `--vt_lb --vt_lb_file_name=` - One can also pass `--vt_lb_self_migration` as a command line argument to allow load balancer to migrate objects to the same node Note that one should use either `--vt_lb_name` or `--vt_lb_file_name` option, not both. -\section lb-specification-file LB Specification File +\section lb-config-file LB Config File -The LB specification file allows users to specify which load balancer along with +The LB config file allows users to specify which load balancer along with which LB-specific configuration parameters are passed to the load balancer instance for any given phase. The order of the LB phase specification lines in the file disambiguates lines---higher precedence for earlier lines. -The format of the LB specification file is: +The format of the LB config file is: \code [%] <$phase> <$lbname> [$LB-specific-arg-1] ... [$LB-specific-arg-N] @@ -42,7 +42,7 @@ balancer are allowed to customize how the load balancer is run with the format of `key=value`. These arguments are the equivalent of passing `--vt_lb_args="A=test B=test2"` on the command line. -The following is an example LB specification: +The following is an example LB config: \code %10 TemperedLB c=1 k=5 f=2 i=10 @@ -51,7 +51,7 @@ The following is an example LB specification: 120 GreedyLB c=0 k=2 f=3 i=3 \endcode -To print LB specification during startup, use `--vt_lb_show_spec` command line flag. +To print LB config during startup, use `--vt_lb_show_config` command line flag. \section load-balancers Load balancers diff --git a/docs/md/node-lb-data.md b/docs/md/node-lb-data.md index b598b7bcbd..d729a0bba5 100644 --- a/docs/md/node-lb-data.md +++ b/docs/md/node-lb-data.md @@ -203,4 +203,4 @@ In order to customize when LB output is enabled and disabled, a LB specification file can be passed to \vt via a command-line flag: `--vt_lb_spec --vt_lb_spec_file=filename.spec`. -For details about vt's Specification File see \subpage vt-spec-file \ No newline at end of file +For details about vt's Specification File see \ref spec-file \ No newline at end of file diff --git a/docs/md/trace.md b/docs/md/trace.md index 7e4eea4aba..0b3e0f0367 100644 --- a/docs/md/trace.md +++ b/docs/md/trace.md @@ -19,4 +19,4 @@ In order to customize when tracing is enabled and disabled, a trace specification file can be passed to \vt via a command-line flag: `--vt_trace_spec --vt_trace_spec_file=filename.spec`. -For details about vt's Specification File see \subpage vt-spec-file \ No newline at end of file +For details about vt's Specification File see \ref spec-file \ No newline at end of file diff --git a/src/vt/collective/collective_ops.cc b/src/vt/collective/collective_ops.cc index 9f392b93a1..d376da4337 100644 --- a/src/vt/collective/collective_ops.cc +++ b/src/vt/collective/collective_ops.cc @@ -125,7 +125,7 @@ void printOverwrittens( printIfOverwritten(vt_trace_event_polling); printIfOverwritten(vt_trace_irecv_polling); printIfOverwritten(vt_lb); - printIfOverwritten(vt_lb_show_spec); + printIfOverwritten(vt_lb_show_config); printIfOverwritten(vt_lb_quiet); printIfOverwritten(vt_lb_file_name); printIfOverwritten(vt_lb_name); diff --git a/src/vt/configs/arguments/app_config.h b/src/vt/configs/arguments/app_config.h index 10f30e370e..00224cbfe8 100644 --- a/src/vt/configs/arguments/app_config.h +++ b/src/vt/configs/arguments/app_config.h @@ -136,7 +136,7 @@ struct AppConfig { bool vt_trace_irecv_polling = false; bool vt_lb = false; - bool vt_lb_show_spec = false; + bool vt_lb_show_config = false; bool vt_lb_quiet = false; std::string vt_lb_file_name = ""; std::string vt_lb_name = "NoLB"; @@ -309,7 +309,7 @@ struct AppConfig { | vt_trace_irecv_polling | vt_lb - | vt_lb_show_spec + | vt_lb_show_config | vt_lb_quiet | vt_lb_file_name | vt_lb_name diff --git a/src/vt/configs/arguments/args.cc b/src/vt/configs/arguments/args.cc index 84f1896cb6..bc5d1e5825 100644 --- a/src/vt/configs/arguments/args.cc +++ b/src/vt/configs/arguments/args.cc @@ -459,11 +459,11 @@ void addLbArgs(CLI::App& app, AppConfig& appConfig) { /* * Flags for enabling load balancing and configuring it */ - auto lb = "Enable load balancing"; - auto lb_args = "Arguments pass to LB: \"x=0 y=1\"; try --vt_help_lb_args"; - auto lb_quiet = "Silence load balancing output"; - auto lb_file_name = "LB specification file to read"; - auto lb_show_spec = "Show LB specification during startup"; + auto lb = "Enable load balancing"; + auto lb_args = "Arguments pass to LB: \"x=0 y=1\"; try --vt_help_lb_args"; + auto lb_quiet = "Silence load balancing output"; + auto lb_file_name = "LB config file to read"; + auto lb_show_config = "Show LB config during startup"; auto lb_name = "Name of the load balancer to use"; auto lb_interval = "Load balancing interval"; auto lb_keep_last_elm = "Do not migrate last element in collection"; @@ -483,7 +483,7 @@ void addLbArgs(CLI::App& app, AppConfig& appConfig) { auto s = app.add_flag("--vt_lb", appConfig.vt_lb, lb); auto t1 = app.add_flag("--vt_lb_quiet", appConfig.vt_lb_quiet, lb_quiet); auto u = app.add_option("--vt_lb_file_name", appConfig.vt_lb_file_name, lb_file_name)->capture_default_str()->check(CLI::ExistingFile); - auto u1 = app.add_flag("--vt_lb_show_spec", appConfig.vt_lb_show_spec, lb_show_spec); + auto u1 = app.add_flag("--vt_lb_show_config", appConfig.vt_lb_show_config, lb_show_config); auto v = app.add_option("--vt_lb_name", appConfig.vt_lb_name, lb_name)->capture_default_str(); auto v1 = app.add_option("--vt_lb_args", appConfig.vt_lb_args, lb_args)->capture_default_str(); auto w = app.add_option("--vt_lb_interval", appConfig.vt_lb_interval, lb_interval)->capture_default_str(); diff --git a/src/vt/runtime/runtime_banner.cc b/src/vt/runtime/runtime_banner.cc index a1f6542b4d..c694f1c298 100644 --- a/src/vt/runtime/runtime_banner.cc +++ b/src/vt/runtime/runtime_banner.cc @@ -306,10 +306,10 @@ void Runtime::printStartupBanner() { auto f11 = opt_on("--vt_lb_file_name", f12); fmt::print("{}\t{}{}", vt_pre, f11, reset); - if (getAppConfig()->vt_lb_show_spec) { - auto s = opt_on("--vt_lb_show_spec", "Showing LB specification"); + if (getAppConfig()->vt_lb_show_config) { + auto s = opt_on("--vt_lb_show_config", "Showing LB specification"); fmt::print("{}\t{}", vt_pre, s); - fmt::print(vrt::collection::balance::ReadLBSpec::toString()); + fmt::print(vrt::collection::balance::ReadLBConfig::toString()); } } else { auto a3 = fmt::format("Load balancer name: \"{}\"", getAppConfig()->vt_lb_name); diff --git a/src/vt/vrt/collection/balance/baselb/baselb.cc b/src/vt/vrt/collection/balance/baselb/baselb.cc index bc0aebb334..ae35ce89b3 100644 --- a/src/vt/vrt/collection/balance/baselb/baselb.cc +++ b/src/vt/vrt/collection/balance/baselb/baselb.cc @@ -77,7 +77,7 @@ std::shared_ptr BaseLB::startLB( runInEpochCollective("BaseLB::startLB -> runLB", [this,total_load]{ getArgs(phase_); - inputParams(spec_entry_.get()); + inputParams(config_entry_.get()); runLB(total_load); }); @@ -106,18 +106,18 @@ void BaseLB::importProcessorData( void BaseLB::getArgs(PhaseType phase) { using namespace balance; - bool has_spec = ReadLBSpec::openSpec(theConfig()->vt_lb_file_name); - if (has_spec) { - auto spec = ReadLBSpec::entry(phase); - if (spec) { - spec_entry_ = std::make_unique(*spec); + bool has_config = ReadLBConfig::openConfig(theConfig()->vt_lb_file_name); + if (has_config) { + auto config = ReadLBConfig::entry(phase); + if (config) { + config_entry_ = std::make_unique(*config); } else { - vtAssert(false, "Error no spec found, which must exist"); + vtAssert(false, "Error no config found, which must exist"); } } else { auto const args = theConfig()->vt_lb_args; - spec_entry_ = std::make_unique( - ReadLBSpec::makeSpecFromParams(args) + config_entry_ = std::make_unique( + ReadLBConfig::makeConfigFromParams(args) ); } } diff --git a/src/vt/vrt/collection/balance/baselb/baselb.h b/src/vt/vrt/collection/balance/baselb/baselb.h index 277a8cd007..c878c0365a 100644 --- a/src/vt/vrt/collection/balance/baselb/baselb.h +++ b/src/vt/vrt/collection/balance/baselb/baselb.h @@ -136,7 +136,7 @@ struct BaseLB { void transferMigrations(TransferMsg* msg); void finalize(CountMsg* msg); - virtual void inputParams(balance::SpecEntry* spec) = 0; + virtual void inputParams(balance::ConfigEntry* config) = 0; virtual void runLB(TimeType total_load) = 0; StatisticMapType const* getStats() const { @@ -152,14 +152,14 @@ struct BaseLB { void getArgs(PhaseType phase); protected: - double start_time_ = 0.0f; - ElementCommType const* comm_data = nullptr; - objgroup::proxy::Proxy proxy_ = {}; - PhaseType phase_ = 0; - std::unique_ptr spec_entry_ = nullptr; + double start_time_ = 0.0f; + ElementCommType const* comm_data = nullptr; + objgroup::proxy::Proxy proxy_ = {}; + PhaseType phase_ = 0; + std::unique_ptr config_entry_ = nullptr; // Observer only - LBManager owns the instance - balance::LoadModel* load_model_ = nullptr; - bool comm_aware_ = false; + balance::LoadModel* load_model_ = nullptr; + bool comm_aware_ = false; protected: /** diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb.cc b/src/vt/vrt/collection/balance/greedylb/greedylb.cc index 423af76d85..3b8d06f25b 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb.cc +++ b/src/vt/vrt/collection/balance/greedylb/greedylb.cc @@ -121,17 +121,17 @@ Default: scatter return keys_help; } -void GreedyLB::inputParams(balance::SpecEntry* spec) { +void GreedyLB::inputParams(balance::ConfigEntry* config) { auto keys_help = getInputKeysWithHelp(); std::vector allowed; for (auto&& elm : keys_help) { allowed.push_back(elm.first); } - spec->checkAllowedKeys(allowed); - min_threshold = spec->getOrDefault("min", greedy_threshold_p); - max_threshold = spec->getOrDefault("max", greedy_max_threshold_p); - auto_threshold = spec->getOrDefault("auto", greedy_auto_threshold_p); + config->checkAllowedKeys(allowed); + min_threshold = config->getOrDefault("min", greedy_threshold_p); + max_threshold = config->getOrDefault("max", greedy_max_threshold_p); + auto_threshold = config->getOrDefault("auto", greedy_auto_threshold_p); balance::LBArgsEnumConverter strategy_converter_( "strategy", "DataDistStrategy", { @@ -140,7 +140,7 @@ void GreedyLB::inputParams(balance::SpecEntry* spec) { {DataDistStrategy::bcast, "bcast"} } ); - strat_ = strategy_converter_.getFromSpec(spec, strat_); + strat_ = strategy_converter_.getFromConfig(config, strat_); } void GreedyLB::runLB(TimeType total_load) { diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb.h b/src/vt/vrt/collection/balance/greedylb/greedylb.h index 3012c1ea05..47590627e8 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb.h +++ b/src/vt/vrt/collection/balance/greedylb/greedylb.h @@ -82,7 +82,7 @@ struct GreedyLB : LoadSamplerBaseLB { void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType total_load) override; - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; static std::unordered_map getInputKeysWithHelp(); diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc index 80d811375e..0d0fae47dc 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc @@ -125,19 +125,19 @@ Default: LoadOverLessThan return keys_help; } -void HierarchicalLB::inputParams(balance::SpecEntry* spec) { +void HierarchicalLB::inputParams(balance::ConfigEntry* config) { auto keys_help = getInputKeysWithHelp(); std::vector allowed; for (auto&& elm : keys_help) { allowed.push_back(elm.first); } - spec->checkAllowedKeys(allowed); - min_threshold = spec->getOrDefault("min", hierlb_threshold_p); - max_threshold = spec->getOrDefault("max", hierlb_max_threshold_p); - auto_threshold = spec->getOrDefault("auto", hierlb_auto_threshold_p); + config->checkAllowedKeys(allowed); + min_threshold = config->getOrDefault("min", hierlb_threshold_p); + max_threshold = config->getOrDefault("max", hierlb_max_threshold_p); + auto_threshold = config->getOrDefault("auto", hierlb_auto_threshold_p); - std::string extract = spec->getOrDefault( + std::string extract = config->getOrDefault( "strategy", "LoadOverLessThan" ); if (extract.compare("LoadOverLessThan") == 0) { diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h index 7c4b9880e6..e3f0dc82df 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h @@ -74,7 +74,7 @@ struct HierarchicalLB : LoadSamplerBaseLB { void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType total_load) override; - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; static std::unordered_map getInputKeysWithHelp(); diff --git a/src/vt/vrt/collection/balance/lb_args_enum_converter.h b/src/vt/vrt/collection/balance/lb_args_enum_converter.h index 9370f0f7c7..050adfeb86 100644 --- a/src/vt/vrt/collection/balance/lb_args_enum_converter.h +++ b/src/vt/vrt/collection/balance/lb_args_enum_converter.h @@ -57,7 +57,7 @@ namespace vt { namespace vrt { namespace collection { namespace balance { * * \brief A VT component that converts enumerated values to their * stringifications for the purposes of reading LB arguments from the LB - * spec file. + * config file. */ template struct LBArgsEnumConverter { @@ -67,7 +67,7 @@ struct LBArgsEnumConverter { /** * \brief Construct a converter for a specific enumerated type * - * \param[in] par_name name of the LB arg in the spec file + * \param[in] par_name name of the LB arg in the config file * \param[in] enum_type name of the enumerated type being converted * \param[in] enum_to_str unordered map of enumerated values to their strings */ @@ -129,22 +129,22 @@ struct LBArgsEnumConverter { } /** - * \brief Read string from the spec and convert to enum + * \brief Read string from the config and convert to enum * - * Read the string from the spec entry and convert it to an enumerated value + * Read the string from the config entry and convert it to an enumerated value * using the reverse of the mapping provided at construction. */ - T getFromSpec(balance::SpecEntry* spec, T def_value) const { - std::string spec_value = spec->getOrDefault( + T getFromConfig(balance::ConfigEntry* config, T def_value) const { + std::string config_value = config->getOrDefault( par_name_, getString(def_value) ); - return getEnum(spec_value); + return getEnum(config_value); } private: EnumToStrMap enum_to_str_; //< 1 to 1 mapping of enumerated values to strings StrToEnumMap str_to_enum_; //< 1 to 1 mapping of strings to enumerated values - std::string par_name_; //< parameter to look for in the spec file + std::string par_name_; //< parameter to look for in the config file std::string enum_type_; //< name of the enumerated type for error handling }; diff --git a/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc b/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc index 7eb446f79b..45a369f8c1 100644 --- a/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc +++ b/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc @@ -119,9 +119,9 @@ LBType LBManager::decideLBToRun(PhaseType phase, bool try_file) { auto& spec_file = theConfig()->vt_lb_file_name; if (spec_file != "" and try_file) { - bool const has_spec = ReadLBSpec::openSpec(spec_file); + bool const has_spec = ReadLBConfig::openConfig(spec_file); if (has_spec) { - the_lb = ReadLBSpec::getLB(phase); + the_lb = ReadLBConfig::getLB(phase); } } else { auto interval = theConfig()->vt_lb_interval; diff --git a/src/vt/vrt/collection/balance/offlinelb/offlinelb.h b/src/vt/vrt/collection/balance/offlinelb/offlinelb.h index e131711a4f..971745b92c 100644 --- a/src/vt/vrt/collection/balance/offlinelb/offlinelb.h +++ b/src/vt/vrt/collection/balance/offlinelb/offlinelb.h @@ -62,7 +62,7 @@ struct OfflineLB : BaseLB { void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType) override; - void inputParams(balance::SpecEntry* spec) override { } + void inputParams(balance::ConfigEntry* config) override { } static std::unordered_map getInputKeysWithHelp() { return std::unordered_map{}; diff --git a/src/vt/vrt/collection/balance/randomlb/randomlb.cc b/src/vt/vrt/collection/balance/randomlb/randomlb.cc index 7ef03ae42e..8607d2703d 100644 --- a/src/vt/vrt/collection/balance/randomlb/randomlb.cc +++ b/src/vt/vrt/collection/balance/randomlb/randomlb.cc @@ -83,16 +83,16 @@ Default: 123456789 return keys_help; } -void RandomLB::inputParams(balance::SpecEntry* spec) { +void RandomLB::inputParams(balance::ConfigEntry* config) { auto keys_help = getInputKeysWithHelp(); std::vector allowed; for (auto&& elm : keys_help) { allowed.push_back(elm.first); } - spec->checkAllowedKeys(allowed); - seed_ = spec->getOrDefault("seed", seed_); - randomize_seed_ = spec->getOrDefault("randomize_seed", randomize_seed_); + config->checkAllowedKeys(allowed); + seed_ = config->getOrDefault("seed", seed_); + randomize_seed_ = config->getOrDefault("randomize_seed", randomize_seed_); } void RandomLB::runLB(TimeType) { diff --git a/src/vt/vrt/collection/balance/randomlb/randomlb.h b/src/vt/vrt/collection/balance/randomlb/randomlb.h index 21fd9f85c7..e012b34601 100644 --- a/src/vt/vrt/collection/balance/randomlb/randomlb.h +++ b/src/vt/vrt/collection/balance/randomlb/randomlb.h @@ -56,7 +56,7 @@ struct RandomLB : BaseLB { void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType) override; - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; static std::unordered_map getInputKeysWithHelp(); diff --git a/src/vt/vrt/collection/balance/read_lb.cc b/src/vt/vrt/collection/balance/read_lb.cc index f61a88b2e0..f2aa22d20d 100644 --- a/src/vt/vrt/collection/balance/read_lb.cc +++ b/src/vt/vrt/collection/balance/read_lb.cc @@ -56,32 +56,32 @@ namespace vt { namespace vrt { namespace collection { namespace balance { -/*static*/ std::string ReadLBSpec::open_filename_ = {}; -/*static*/ typename ReadLBSpec::SpecMapType ReadLBSpec::spec_mod_ = {}; -/*static*/ typename ReadLBSpec::SpecMapType ReadLBSpec::spec_exact_ = {}; -/*static*/ std::vector ReadLBSpec::spec_prec_ = {}; -/*static*/ bool ReadLBSpec::read_complete_ = false; +/*static*/ std::string ReadLBConfig::open_filename_ = {}; +/*static*/ typename ReadLBConfig::ConfigMapType ReadLBConfig::config_mod_ = {}; +/*static*/ typename ReadLBConfig::ConfigMapType ReadLBConfig::config_exact_ = {}; +/*static*/ std::vector ReadLBConfig::config_prec_ = {}; +/*static*/ bool ReadLBConfig::read_complete_ = false; -/*static*/ bool ReadLBSpec::openSpec(std::string const& filename) { +/*static*/ bool ReadLBConfig::openConfig(std::string const& filename) { // No-op if no file specified. Can't be used to clear. if (filename.empty()) { return false; } - // Ignore attempt to open same spec. + // Ignore attempt to open same config. if (not open_filename_.empty() and open_filename_ == filename) { return true; } vtAssert( open_filename_.empty(), - "Spec already opened. Use clear first to load again." + "Config already opened. Use clear first to load again." ); // Ensure file can be opened. std::ifstream file(filename); if (not file.good()) { - auto str = fmt::format("Unable to open spec file: {}", filename); + auto str = fmt::format("Unable to open config file: {}", filename); vtAbort(str); } @@ -93,7 +93,7 @@ namespace vt { namespace vrt { namespace collection { namespace balance { return true; } -/*static*/ LBType ReadLBSpec::getLB(SpecIndex const& idx) { +/*static*/ LBType ReadLBConfig::getLB(ConfigIndex const& idx) { auto const lb = entry(idx); if (lb) { return lb->getLB(); @@ -102,22 +102,22 @@ namespace vt { namespace vrt { namespace collection { namespace balance { } } -/*static*/ SpecEntry* ReadLBSpec::entry(SpecIndex const& idx) { - // First, search the exact iter spec for this iteration: it has the highest +/*static*/ ConfigEntry* ReadLBConfig::entry(ConfigIndex const& idx) { + // First, search the exact iter config for this iteration: it has the highest // precedence - auto spec_iter = spec_exact_.find(idx); - if (spec_iter != spec_exact_.end()) { - return &spec_iter->second; + auto config_iter = config_exact_.find(idx); + if (config_iter != config_exact_.end()) { + return &config_iter->second; } - // Second, walk through the spec precedence map for the mod overloads - for (auto mod : spec_prec_) { - auto iter = spec_mod_.find(mod); - if (iter != spec_mod_.end()) { + // Second, walk through the config precedence map for the mod overloads + for (auto mod : config_prec_) { + auto iter = config_mod_.find(mod); + if (iter != config_mod_.end()) { // Check if this mod is applicable to the idx if (idx % mod == 0) { - auto iter_mod = spec_mod_.find(mod); - if (iter_mod != spec_mod_.end()) { + auto iter_mod = config_mod_.find(mod); + if (iter_mod != config_mod_.end()) { return &iter_mod->second; } } @@ -135,7 +135,7 @@ int eatWhitespace(std::ifstream& file) { return file.eof() ? 0 : file.peek(); } -/*static*/ void ReadLBSpec::readFile(std::string const& filename) { +/*static*/ void ReadLBConfig::readFile(std::string const& filename) { std::ifstream file(filename); vtAssert(file.good(), "must be valid"); @@ -213,15 +213,15 @@ int eatWhitespace(std::ifstream& file) { * If the line is specified as a mod '%' or not line is specified (assume * mod 1) */ - SpecMapType* map = nullptr; + ConfigMapType* map = nullptr; if (is_mod or mod == -1) { if (mod == -1) { mod = 1; } - spec_prec_.push_back(mod); - map = &spec_mod_; + config_prec_.push_back(mod); + map = &config_mod_; } else { - map = &spec_exact_; + map = &config_exact_; } if (map->find(mod) != map->end()) { @@ -234,23 +234,23 @@ int eatWhitespace(std::ifstream& file) { map->emplace( std::piecewise_construct, std::forward_as_tuple(mod), - std::forward_as_tuple(SpecEntry{mod, lb_name, param_map}) + std::forward_as_tuple(ConfigEntry{mod, lb_name, param_map}) ); } read_complete_ = true; } -/*static*/ void ReadLBSpec::clear() { +/*static*/ void ReadLBConfig::clear() { read_complete_ = false; open_filename_ = ""; - spec_mod_.clear(); - spec_exact_.clear(); - spec_prec_.clear(); + config_mod_.clear(); + config_exact_.clear(); + config_prec_.clear(); } -/*static*/ typename ReadLBSpec::ParamMapType -ReadLBSpec::parseParams(std::vector params) { +/*static*/ typename ReadLBConfig::ParamMapType +ReadLBConfig::parseParams(std::vector params) { ParamMapType param_map; /* @@ -279,7 +279,7 @@ ReadLBSpec::parseParams(std::vector params) { return param_map; } -/*static*/ SpecEntry ReadLBSpec::makeSpecFromParams(std::string param_str) { +/*static*/ ConfigEntry ReadLBConfig::makeConfigFromParams(std::string param_str) { std::istringstream stream(param_str); std::vector params; while (not stream.eof()) { @@ -290,7 +290,7 @@ ReadLBSpec::parseParams(std::vector params) { auto param_map = parseParams(params); - return SpecEntry{0, "", param_map}; + return ConfigEntry{0, "", param_map}; } auto param_str = []( @@ -312,13 +312,13 @@ auto param_str = []( return ss.str(); }; -auto excluded_str = [](SpecIndex idx) -> std::string { +auto excluded_str = [](ConfigIndex idx) -> std::string { std::stringstream ss; - auto exact_entries = ReadLBSpec::getExactEntries(); + auto exact_entries = ReadLBConfig::getExactEntries(); auto max_idx = exact_entries.empty() ? 0 : exact_entries.rbegin()->first; for (auto k = 1; k*idx <= max_idx; k++) { - auto next_entry = ReadLBSpec::entry(k*idx); + auto next_entry = ReadLBConfig::entry(k*idx); if (next_entry != nullptr and next_entry->getIdx() != idx) { ss << fmt::format("{}, ", debug::emph(std::to_string(k*idx))); } @@ -327,17 +327,17 @@ auto excluded_str = [](SpecIndex idx) -> std::string { return s.empty() ? s : s.substr(0, s.size() - 2); }; -/*static*/ std::string ReadLBSpec::toString() { +/*static*/ std::string ReadLBConfig::toString() { std::stringstream ss; if (open_filename_.empty()) { - return "[No LB Spec open]"; + return "[No LB Config open]"; } - if (not ReadLBSpec::getExactEntries().empty()) { - ss << fmt::format("{}\tExact specification lines:\n", vt::debug::vtPre()); + if (not ReadLBConfig::getExactEntries().empty()) { + ss << fmt::format("{}\tExact config lines:\n", vt::debug::vtPre()); } - for (auto const& exact_entry : ReadLBSpec::getExactEntries()) { + for (auto const& exact_entry : ReadLBConfig::getExactEntries()) { ss << fmt::format("{}\tRun `{}` on phase {}{}", vt::debug::vtPre(), vt::debug::emph(exact_entry.second.getName()), @@ -346,12 +346,12 @@ auto excluded_str = [](SpecIndex idx) -> std::string { ss << '\n'; } - if (not ReadLBSpec::getModEntries().empty()) { + if (not ReadLBConfig::getModEntries().empty()) { ss << fmt::format( - "{}\tMod (%) specification lines:\n", vt::debug::vtPre() + "{}\tMod (%) config lines:\n", vt::debug::vtPre() ); } - for (auto const& mod_entry : ReadLBSpec::getModEntries()) { + for (auto const& mod_entry : ReadLBConfig::getModEntries()) { ss << fmt::format("{}\tRun `{}` every {} phases{}", vt::debug::vtPre(), vt::debug::emph(mod_entry.second.getName()), diff --git a/src/vt/vrt/collection/balance/read_lb.h b/src/vt/vrt/collection/balance/read_lb.h index 79035e6f8a..a1fbb6998a 100644 --- a/src/vt/vrt/collection/balance/read_lb.h +++ b/src/vt/vrt/collection/balance/read_lb.h @@ -54,7 +54,7 @@ namespace vt { namespace vrt { namespace collection { namespace balance { -using SpecIndex = int64_t; +using ConfigIndex = int64_t; template struct Converter { @@ -107,16 +107,16 @@ struct Converter { } }; -struct SpecEntry { +struct ConfigEntry { using ParamMapType = std::map; - SpecEntry( - SpecIndex const in_idx, std::string const in_name, + ConfigEntry( + ConfigIndex const in_idx, std::string const in_name, ParamMapType in_params ) : idx_(in_idx), lb_name_(in_name), params_(in_params) {} - SpecIndex getIdx() const { return idx_; } + ConfigIndex getIdx() const { return idx_; } std::string getName() const { return lb_name_; } ParamMapType getParams() const { return params_; } LBType getLB() const { @@ -161,13 +161,13 @@ struct SpecEntry { } private: - SpecIndex idx_; + ConfigIndex idx_; std::string lb_name_; ParamMapType params_; }; /* - * Reads the following file format for LB spec---example: + * Reads the following file format for LB config---example: * * %10 TemperedLB c=1 k=5 f=2 i=10 * 0 HierarchicalLB min=0.9 max=1.1 auto=false @@ -176,31 +176,31 @@ struct SpecEntry { * */ -struct ReadLBSpec { - using SpecMapType = std::map; +struct ReadLBConfig { + using ConfigMapType = std::map; using ParamMapType = std::map; /** - * \brief Opens and reads the spec file, if it exists. + * \brief Opens and reads the config file, if it exists. * * This method MUST be called before the other access methods. * * \param[in] filename The path to the file to read. * - * \pre A different spec file is not currently open. - * \pre The filename refers to a valid spec file. + * \pre A different config file is not currently open. + * \pre The filename refers to a valid config file. * - * \return True if the spec was opened and can be used. + * \return True if the config was opened and can be used. */ - static bool openSpec(std::string const& filename); + static bool openConfig(std::string const& filename); - static SpecIndex numEntries() { return spec_mod_.size() + spec_exact_.size(); } - static SpecEntry* entry(SpecIndex const& idx); - static LBType getLB(SpecIndex const& idx); - static SpecMapType getModEntries() { return spec_mod_; }; - static SpecMapType getExactEntries() {return spec_exact_; }; + static ConfigIndex numEntries() { return config_mod_.size() + config_exact_.size(); } + static ConfigEntry* entry(ConfigIndex const& idx); + static LBType getLB(ConfigIndex const& idx); + static ConfigMapType getModEntries() { return config_mod_; }; + static ConfigMapType getExactEntries() {return config_exact_; }; static ParamMapType parseParams(std::vector params); - static SpecEntry makeSpecFromParams(std::string params); + static ConfigEntry makeConfigFromParams(std::string params); static std::string toString(); static void clear(); @@ -209,9 +209,9 @@ struct ReadLBSpec { static bool read_complete_; static std::string open_filename_; - static SpecMapType spec_mod_; - static SpecMapType spec_exact_; - static std::vector spec_prec_; + static ConfigMapType config_mod_; + static ConfigMapType config_exact_; + static std::vector config_prec_; }; }}}} /* end namespace vt::vrt::collection::balance */ diff --git a/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc b/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc index 1dea2f0994..ad96b90ca2 100644 --- a/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc +++ b/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc @@ -59,7 +59,7 @@ RotateLB::getInputKeysWithHelp() { return std::unordered_map{}; } -void RotateLB::inputParams(balance::SpecEntry* spec) { } +void RotateLB::inputParams(balance::ConfigEntry* config) { } void RotateLB::runLB(TimeType) { auto const& this_node = theContext()->getNode(); diff --git a/src/vt/vrt/collection/balance/rotatelb/rotatelb.h b/src/vt/vrt/collection/balance/rotatelb/rotatelb.h index eefd90e709..f04909aff8 100644 --- a/src/vt/vrt/collection/balance/rotatelb/rotatelb.h +++ b/src/vt/vrt/collection/balance/rotatelb/rotatelb.h @@ -67,7 +67,7 @@ struct RotateLB : BaseLB { void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType) override; - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; static std::unordered_map getInputKeysWithHelp(); diff --git a/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc b/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc index 6c9d6e4dd2..32af5af035 100644 --- a/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc +++ b/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc @@ -256,18 +256,18 @@ Default: false return keys_help; } -void TemperedLB::inputParams(balance::SpecEntry* spec) { +void TemperedLB::inputParams(balance::ConfigEntry* config) { auto keys_help = getInputKeysWithHelp(); std::vector allowed; for (auto&& elm : keys_help) { allowed.push_back(elm.first); } - spec->checkAllowedKeys(allowed); + config->checkAllowedKeys(allowed); // the following options interact with each other, so we need to know // which were defaulted and which were explicitly specified - auto params = spec->getParams(); + auto params = config->getParams(); bool specified_knowledge = params.find("knowledge") != params.end(); bool specified_fanout = params.find("fanout") != params.end(); bool specified_rounds = params.find("rounds") != params.end(); @@ -279,7 +279,7 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { {KnowledgeEnum::Log, "Log"} } ); - knowledge_ = knowledge_converter_.getFromSpec(spec, knowledge_); + knowledge_ = knowledge_converter_.getFromConfig(config, knowledge_); vtAbortIf( specified_knowledge && knowledge_ == KnowledgeEnum::Log && @@ -310,13 +310,13 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { if (knowledge_ == KnowledgeEnum::Log) { if (specified_fanout) { // set the rounds based on the chosen fanout: k=log_f(p) - f_ = spec->getOrDefault("fanout", f_); + f_ = config->getOrDefault("fanout", f_); k_max_ = static_cast( std::ceil(std::log(num_nodes)/std::log(f_)) ); } else if (specified_rounds) { // set the fanout based on the chosen rounds: f=p^(1/k) - k_max_ = spec->getOrDefault("rounds", k_max_); + k_max_ = config->getOrDefault("rounds", k_max_); f_ = static_cast(std::ceil(std::pow(num_nodes, 1.0/k_max_))); } else { // set both the fanout and the rounds @@ -331,8 +331,8 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { } else { // knowledge_ == KnowledgeEnum::UserDefined // if either of these was omitted, a default will be used, which probably // isn't desirable - f_ = spec->getOrDefault("fanout", f_); - k_max_ = spec->getOrDefault("rounds", k_max_); + f_ = config->getOrDefault("fanout", f_); + k_max_ = config->getOrDefault("rounds", k_max_); } if (f_ < 1) { @@ -350,12 +350,12 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { vtAbort(s); } - num_iters_ = spec->getOrDefault("iters", num_iters_); - num_trials_ = spec->getOrDefault("trials", num_trials_); + num_iters_ = config->getOrDefault("iters", num_iters_); + num_trials_ = config->getOrDefault("trials", num_trials_); - deterministic_ = spec->getOrDefault("deterministic", deterministic_); - rollback_ = spec->getOrDefault("rollback", rollback_); - target_pole_ = spec->getOrDefault("targetpole", target_pole_); + deterministic_ = config->getOrDefault("deterministic", deterministic_); + rollback_ = config->getOrDefault("rollback", rollback_); + target_pole_ = config->getOrDefault("targetpole", target_pole_); balance::LBArgsEnumConverter criterion_converter_( "criterion", "CriterionEnum", { @@ -363,7 +363,7 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { {CriterionEnum::ModifiedGrapevine, "ModifiedGrapevine"} } ); - criterion_ = criterion_converter_.getFromSpec(spec, criterion_); + criterion_ = criterion_converter_.getFromConfig(config, criterion_); balance::LBArgsEnumConverter inform_type_converter_( "inform", "InformTypeEnum", { @@ -371,7 +371,7 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { {InformTypeEnum::AsyncInform, "AsyncInform"} } ); - inform_type_ = inform_type_converter_.getFromSpec(spec, inform_type_); + inform_type_ = inform_type_converter_.getFromConfig(config, inform_type_); balance::LBArgsEnumConverter obj_ordering_converter_( "ordering", "ObjectOrderEnum", { @@ -382,7 +382,7 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { {ObjectOrderEnum::LargestObjects, "LargestObjects"} } ); - obj_ordering_ = obj_ordering_converter_.getFromSpec(spec, obj_ordering_); + obj_ordering_ = obj_ordering_converter_.getFromConfig(config, obj_ordering_); balance::LBArgsEnumConverter cmf_type_converter_( "cmf", "CMFTypeEnum", { @@ -392,7 +392,7 @@ void TemperedLB::inputParams(balance::SpecEntry* spec) { {CMFTypeEnum::NormByMaxExcludeIneligible, "NormByMaxExcludeIneligible"} } ); - cmf_type_ = cmf_type_converter_.getFromSpec(spec, cmf_type_); + cmf_type_ = cmf_type_converter_.getFromConfig(config, cmf_type_); vtAbortIf( inform_type_ == InformTypeEnum::AsyncInform && deterministic_, diff --git a/src/vt/vrt/collection/balance/temperedlb/temperedlb.h b/src/vt/vrt/collection/balance/temperedlb/temperedlb.h index d252ce1503..6839ae6eb7 100644 --- a/src/vt/vrt/collection/balance/temperedlb/temperedlb.h +++ b/src/vt/vrt/collection/balance/temperedlb/temperedlb.h @@ -78,7 +78,7 @@ struct TemperedLB : BaseLB { public: void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType total_load) override; - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; static std::unordered_map getInputKeysWithHelp(); diff --git a/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.cc b/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.cc index ce237742f1..36e954e605 100644 --- a/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.cc +++ b/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.cc @@ -84,12 +84,12 @@ Default: 0.0 return map; } -void TemperedWMin::inputParams(balance::SpecEntry* spec) { - TemperedLB::inputParams(spec); +void TemperedWMin::inputParams(balance::ConfigEntry* config) { + TemperedLB::inputParams(config); - alpha_ = spec->getOrDefault("alpha", alpha_); - beta_ = spec->getOrDefault("beta", beta_); - gamma_ = spec->getOrDefault("gamma", gamma_); + alpha_ = config->getOrDefault("alpha", alpha_); + beta_ = config->getOrDefault("beta", beta_); + gamma_ = config->getOrDefault("gamma", gamma_); vt_debug_print( normal, temperedwmin, diff --git a/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.h b/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.h index 2125e456e2..d6f61bbaa4 100644 --- a/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.h +++ b/src/vt/vrt/collection/balance/temperedwmin/temperedwmin.h @@ -61,7 +61,7 @@ struct TemperedWMin : TemperedLB { void init(objgroup::proxy::Proxy in_proxy); static std::unordered_map getInputKeysWithHelp(); - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; protected: TimeType getModeledValue(const elm::ElementIDStruct& obj) override; diff --git a/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.cc b/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.cc index 1b694987ea..59f8f3b0cd 100644 --- a/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.cc +++ b/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.cc @@ -58,7 +58,7 @@ void TestSerializationLB::init(objgroup::proxy::Proxy) { ); } -void TestSerializationLB::inputParams(balance::SpecEntry*) { } +void TestSerializationLB::inputParams(balance::ConfigEntry*) { } void TestSerializationLB::runLB(TimeType) { auto const this_node = theContext()->getNode(); diff --git a/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.h b/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.h index f8d216439f..9e83b0e50e 100644 --- a/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.h +++ b/src/vt/vrt/collection/balance/testserializationlb/testserializationlb.h @@ -61,7 +61,7 @@ struct TestSerializationLB : BaseLB { void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType) override; - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; static std::unordered_map getInputKeysWithHelp(); }; diff --git a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc index 9b10cc6fed..299c5d7321 100644 --- a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc +++ b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc @@ -92,7 +92,7 @@ ZoltanLB::getInputKeysWithHelp() { return keys_help; } -void ZoltanLB::inputParams(balance::SpecEntry* spec) { +void ZoltanLB::inputParams(balance::ConfigEntry* config) { zoltan_config_ = { {"LB_APPROACH", "REPARTITION" }, {"DEBUG_LEVEL", "0" }, @@ -120,12 +120,12 @@ void ZoltanLB::inputParams(balance::SpecEntry* spec) { for (auto& c : zoltan_config_) { allowed.push_back(c.first); } - spec->checkAllowedKeys(allowed); + config->checkAllowedKeys(allowed); - do_edges_ = spec->getOrDefault("edges", do_edges_); + do_edges_ = config->getOrDefault("edges", do_edges_); for (auto& c : zoltan_config_) { - c.second = spec->getOrDefault(c.first, c.second); + c.second = config->getOrDefault(c.first, c.second); } } diff --git a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.h b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.h index 34f5108e50..d64c0777ff 100644 --- a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.h +++ b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.h @@ -65,7 +65,7 @@ struct ZoltanLB : BaseLB { void init(objgroup::proxy::Proxy in_proxy); void runLB(TimeType total_load) override; - void inputParams(balance::SpecEntry* spec) override; + void inputParams(balance::ConfigEntry* config) override; static std::unordered_map getInputKeysWithHelp(); diff --git a/tests/unit/lb/test_lb_reader.nompi.cc b/tests/unit/lb/test_lb_reader.nompi.cc index 5f283bd774..3451bab7a7 100644 --- a/tests/unit/lb/test_lb_reader.nompi.cc +++ b/tests/unit/lb/test_lb_reader.nompi.cc @@ -59,47 +59,47 @@ TEST_F(TestLBReader, test_lb_read_1) { "%10 HierarchicalLB\n"; out.close(); - using Spec = vt::vrt::collection::balance::ReadLBSpec; - using SpecIdx = vt::vrt::collection::balance::SpecIndex; - using SpecLBType = vt::vrt::collection::balance::LBType; + using Config = vt::vrt::collection::balance::ReadLBConfig; + using ConfigIdx = vt::vrt::collection::balance::ConfigIndex; + using ConfigLBType = vt::vrt::collection::balance::LBType; - Spec::clear(); - Spec::openSpec(file_name); + Config::clear(); + Config::openConfig(file_name); - EXPECT_EQ(Spec::numEntries(), 3); - EXPECT_EQ(Spec::getExactEntries().size(), 2); - EXPECT_EQ(Spec::getModEntries().size(), 1); + EXPECT_EQ(Config::numEntries(), 3); + EXPECT_EQ(Config::getExactEntries().size(), 2); + EXPECT_EQ(Config::getModEntries().size(), 1); - for (SpecIdx i = 0; i < 21; i++) { - auto entry = Spec::entry(i); + for (ConfigIdx i = 0; i < 21; i++) { + auto entry = Config::entry(i); switch (i) { case 0: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::NoLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::NoLB); EXPECT_EQ(entry->getName(), "NoLB"); break; case 1: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::HierarchicalLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::HierarchicalLB); EXPECT_EQ(entry->getName(), "HierarchicalLB"); break; case 10: case 20: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::HierarchicalLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::HierarchicalLB); break; default: EXPECT_TRUE(entry == nullptr); } } - std::string expected_spec = - "vt: \tExact specification lines:\n" + std::string expected_config = + "vt: \tExact config lines:\n" "vt: \tRun `NoLB` on phase 0\n" "vt: \tRun `HierarchicalLB` on phase 1\n" - "vt: \tMod (%) specification lines:\n" + "vt: \tMod (%) config lines:\n" "vt: \tRun `HierarchicalLB` every 10 phases\n"; - EXPECT_EQ(Spec::toString(), expected_spec); + EXPECT_EQ(Config::toString(), expected_config); } TEST_F(TestLBReader, test_lb_read_2) { @@ -114,25 +114,25 @@ TEST_F(TestLBReader, test_lb_read_2) { "120 HierarchicalLB test_xyz=3\n"; out.close(); - using Spec = vt::vrt::collection::balance::ReadLBSpec; - using SpecIdx = vt::vrt::collection::balance::SpecIndex; - using SpecLBType = vt::vrt::collection::balance::LBType; - Spec::clear(); - Spec::openSpec(file_name); + using Config = vt::vrt::collection::balance::ReadLBConfig; + using ConfigIdx = vt::vrt::collection::balance::ConfigIndex; + using ConfigLBType = vt::vrt::collection::balance::LBType; + Config::clear(); + Config::openConfig(file_name); - EXPECT_EQ(Spec::numEntries(), 5); - for (SpecIdx i = 0; i < 121; i++) { - auto entry = Spec::entry(i); + EXPECT_EQ(Config::numEntries(), 5); + for (ConfigIdx i = 0; i < 121; i++) { + auto entry = Config::entry(i); switch (i) { case 0: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::NoLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::NoLB); EXPECT_TRUE(entry->getParams().empty()); EXPECT_EQ(entry->getIdx(), 0); break; case 1: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::HierarchicalLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::HierarchicalLB); EXPECT_TRUE(entry->getOrDefault("min", 0.) == 0.9); EXPECT_TRUE(entry->getOrDefault("max", 0.) == 1.1); EXPECT_TRUE(entry->getOrDefault("auto", true) == false); @@ -150,7 +150,7 @@ TEST_F(TestLBReader, test_lb_read_2) { case 100: case 110: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::TemperedLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::TemperedLB); EXPECT_TRUE(entry->getOrDefault("c", 0) == 1); EXPECT_TRUE(entry->getOrDefault("k", 0) == 5); EXPECT_TRUE(entry->getOrDefault("f", 0) == 2); @@ -170,13 +170,13 @@ TEST_F(TestLBReader, test_lb_read_2) { case 105: case 115: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::GreedyLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::GreedyLB); EXPECT_TRUE(entry->getOrDefault("min", 0.) == 1.0); EXPECT_EQ(entry->getParams().at("min"), "1.0"); break; case 120: EXPECT_TRUE(entry != nullptr); - EXPECT_TRUE(entry->getLB() == SpecLBType::HierarchicalLB); + EXPECT_TRUE(entry->getLB() == ConfigLBType::HierarchicalLB); EXPECT_TRUE(entry->getOrDefault("test_xyz", 0) == 3); break; default: @@ -184,15 +184,15 @@ TEST_F(TestLBReader, test_lb_read_2) { } } - std::string expected_spec = - "vt: \tExact specification lines:\n" + std::string expected_config = + "vt: \tExact config lines:\n" "vt: \tRun `NoLB` on phase 0\n" "vt: \tRun `HierarchicalLB` on phase 1 with arguments `auto=false max=1.1 min=0.9`\n" "vt: \tRun `HierarchicalLB` on phase 120 with arguments `test_xyz=3`\n" - "vt: \tMod (%) specification lines:\n" + "vt: \tMod (%) config lines:\n" "vt: \tRun `GreedyLB` every 5 phases with arguments `min=1.0` excluding phases 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120\n" "vt: \tRun `TemperedLB` every 10 phases with arguments `c=1 f=2 i=10 k=5` excluding phases 120\n"; - EXPECT_EQ(Spec::toString(), expected_spec); + EXPECT_EQ(Config::toString(), expected_config); } }}} // end namespace vt::tests::unit diff --git a/tests/unit/lb/test_lbargs_enum_conv.nompi.cc b/tests/unit/lb/test_lbargs_enum_conv.nompi.cc index 0bdf504cf3..44ad59e5a8 100644 --- a/tests/unit/lb/test_lbargs_enum_conv.nompi.cc +++ b/tests/unit/lb/test_lbargs_enum_conv.nompi.cc @@ -118,7 +118,7 @@ TEST_F(TestLBArgsEnumConverter, test_enum_converter_mapping) { ); } -TEST_F(TestLBArgsEnumConverter, test_enum_converter_spec) { +TEST_F(TestLBArgsEnumConverter, test_enum_converter_config) { vrt::collection::balance::LBArgsEnumConverter dummy_( "dummy", "DummyEnum", { {DummyEnum::One, "One"}, @@ -127,7 +127,7 @@ TEST_F(TestLBArgsEnumConverter, test_enum_converter_spec) { } ); // normally this wouldn't reuse the same enum, but we're just testing - // spec-related stuff here so it's fine + // config-related stuff here so it's fine vrt::collection::balance::LBArgsEnumConverter count_( "count", "DummyEnum", { {DummyEnum::One, "One"}, @@ -136,27 +136,27 @@ TEST_F(TestLBArgsEnumConverter, test_enum_converter_spec) { } ); - std::string spec_string("dummy=Two"); // deliberately omit 'count=' - auto spec = vrt::collection::balance::ReadLBSpec::makeSpecFromParams( - spec_string + std::string config_string("dummy=Two"); // deliberately omit 'count=' + auto config = vrt::collection::balance::ReadLBConfig::makeConfigFromParams( + config_string ); // explicitly specified should return specified value - EXPECT_EQ(dummy_.getFromSpec(&spec, DummyEnum::One), DummyEnum::Two); + EXPECT_EQ(dummy_.getFromConfig(&config, DummyEnum::One), DummyEnum::Two); // unspecified should return default value - EXPECT_EQ(count_.getFromSpec(&spec, DummyEnum::One), DummyEnum::One); + EXPECT_EQ(count_.getFromConfig(&config, DummyEnum::One), DummyEnum::One); - std::string bad_spec_string("dummy=Four"); - auto bad_spec = vrt::collection::balance::ReadLBSpec::makeSpecFromParams( - bad_spec_string + std::string bad_config_string("dummy=Four"); + auto bad_config = vrt::collection::balance::ReadLBConfig::makeConfigFromParams( + bad_config_string ); ASSERT_THROW( - dummy_.getFromSpec(&bad_spec, DummyEnum::One), + dummy_.getFromConfig(&bad_config, DummyEnum::One), std::runtime_error ); ASSERT_THROW( - dummy_.getFromSpec(&spec, static_cast(0)), + dummy_.getFromConfig(&config, static_cast(0)), std::runtime_error ); }