Skip to content

Commit

Permalink
#2074: Create LBDataRestartReader when there is OfflineLB in the conf…
Browse files Browse the repository at this point in the history
…ig file
  • Loading branch information
thearusable committed May 16, 2023
1 parent ca02e10 commit 5b75e31
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/vt/runtime/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,18 @@ bool Runtime::tryFinalize(bool const disable_sig) {
}

bool Runtime::needLBDataRestartReader() {
using vrt::collection::balance::ReadLBConfig;

#if vt_check_enabled(lblite)
if (true) {
return arg_config_->config_.vt_lb_data_in;
if (arg_config_->config_.vt_lb_data_in) {
auto& config_file = arg_config_->config_.vt_lb_file_name;
if (config_file != "") {
bool const has_spec = ReadLBConfig::openConfig(config_file);
if (has_spec) {
return ReadLBConfig::hasOfflineLB();
}
}
return false;
} else
#endif
return false;
Expand Down
9 changes: 9 additions & 0 deletions src/vt/vrt/collection/balance/read_lb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ namespace vt { namespace vrt { namespace collection { namespace balance {
}
}

/*static*/ bool ReadLBConfig::hasOfflineLB() {
for(auto&& ele : config_exact_) {
if(getLB(ele.first) == LBType::OfflineLB) {
return true;
}
}
return false;
}

/*static*/ ConfigEntry* ReadLBConfig::entry(ConfigIndex const& idx) {
// First, search the exact iter config for this iteration: it has the highest
// precedence
Expand Down
1 change: 1 addition & 0 deletions src/vt/vrt/collection/balance/read_lb.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ struct ReadLBConfig {
static ConfigIndex numEntries() { return config_mod_.size() + config_exact_.size(); }
static ConfigEntry* entry(ConfigIndex const& idx);
static LBType getLB(ConfigIndex const& idx);
static bool hasOfflineLB();
static ConfigMapType getModEntries() { return config_mod_; };
static ConfigMapType getExactEntries() {return config_exact_; };
static ParamMapType parseParams(std::vector<std::string> params);
Expand Down

0 comments on commit 5b75e31

Please sign in to comment.