diff --git a/src/vt/runtime/runtime.cc b/src/vt/runtime/runtime.cc index f8ad7f36d1..d62b1f9a07 100644 --- a/src/vt/runtime/runtime.cc +++ b/src/vt/runtime/runtime.cc @@ -424,9 +424,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; diff --git a/src/vt/vrt/collection/balance/read_lb.cc b/src/vt/vrt/collection/balance/read_lb.cc index f2aa22d20d..a32e99e45b 100644 --- a/src/vt/vrt/collection/balance/read_lb.cc +++ b/src/vt/vrt/collection/balance/read_lb.cc @@ -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 diff --git a/src/vt/vrt/collection/balance/read_lb.h b/src/vt/vrt/collection/balance/read_lb.h index a1fbb6998a..60f4c88dd0 100644 --- a/src/vt/vrt/collection/balance/read_lb.h +++ b/src/vt/vrt/collection/balance/read_lb.h @@ -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 params);