Skip to content

Commit

Permalink
#708: Carry subphase timings into ProcStats
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Miller committed Jun 8, 2020
1 parent bfbbac9 commit 2b78eec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/vt/vrt/collection/balance/elm_stats.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ template <typename ColT>
auto const& proxy = col->getCollectionProxy();
auto const& untyped_proxy = col->getProxy();
auto const& total_load = stats.getLoad(cur_phase, getFocusedSubPhase(untyped_proxy));
auto const& subphase_loads = stats.subphase_timings_.at(cur_phase);
auto const& comm = stats.getComm(cur_phase);
auto const& idx = col->getIndex();
auto const& elm_proxy = proxy[idx];

theProcStats()->addProcStats<ColT>(elm_proxy, col, cur_phase, total_load, comm);
theProcStats()->addProcStats<ColT>(elm_proxy, col, cur_phase, total_load, subphase_loads, comm);

auto const before_ready = theCollection()->numReadyCollections();
theCollection()->makeCollectionReady(untyped_proxy);
Expand Down
10 changes: 7 additions & 3 deletions src/vt/vrt/collection/balance/proc_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
namespace vt { namespace vrt { namespace collection { namespace balance {

struct ProcStats : runtime::component::Component<ProcStats> {
using MigrateFnType = std::function<void(NodeType)>;
using LoadMapType = std::unordered_map<ElementIDType,TimeType>;
using MigrateFnType = std::function<void(NodeType)>;
using LoadMapType = std::unordered_map<ElementIDType,TimeType>;
using SubphaseLoadMapType = std::unordered_map<ElementIDType, std::vector<TimeType>>;

ProcStats() = default;

Expand Down Expand Up @@ -98,7 +99,8 @@ struct ProcStats : runtime::component::Component<ProcStats> {
template <typename ColT>
ElementIDType addProcStats(
VirtualElmProxyType<ColT> const& elm_proxy, ColT* col_elm,
PhaseType const& phase, TimeType const& time, CommMapType const& comm
PhaseType const& phase, TimeType const& time,
std::vector<TimeType> const& subphase_time, CommMapType const& comm
);

/**
Expand Down Expand Up @@ -198,6 +200,8 @@ struct ProcStats : runtime::component::Component<ProcStats> {
objgroup::proxy::Proxy<ProcStats> proxy_;
/// Processor timings for each local object
std::vector<LoadMapType> proc_data_;
/// Processor subphase timings for each local object
std::vector<SubphaseLoadMapType> proc_subphase_data_;
/// Local migration type-free lambdas for each object
std::unordered_map<ElementIDType,MigrateFnType> proc_migrate_;
/// Map of temporary ID to permanent ID
Expand Down
16 changes: 13 additions & 3 deletions src/vt/vrt/collection/balance/proc_stats.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ namespace vt { namespace vrt { namespace collection { namespace balance {
template <typename ColT>
ElementIDType ProcStats::addProcStats(
VirtualElmProxyType<ColT> const& elm_proxy, ColT* col_elm,
PhaseType const& phase, TimeType const& time, CommMapType const& comm
PhaseType const& phase, TimeType const& time,
std::vector<TimeType> const& subphase_time, CommMapType const& comm
) {
// A new temp ID gets assigned when a object is migrated into a node

Expand All @@ -68,8 +69,8 @@ ElementIDType ProcStats::addProcStats(

debug_print(
lb, node,
"ProcStats::addProcStats: temp_id={}, perm_id={}, phase={}, load={}\n",
temp_id, perm_id, phase, time
"ProcStats::addProcStats: temp_id={}, perm_id={}, phase={}, subphases={}, load={}\n",
temp_id, perm_id, phase, subphase_time.size(), time
);

proc_data_.resize(phase + 1);
Expand All @@ -81,6 +82,15 @@ ElementIDType ProcStats::addProcStats(
std::forward_as_tuple(time)
);

proc_subphase_data_.resize(phase + 1);
auto elm_subphase_iter = proc_subphase_data_.at(phase).find(temp_id);
vtAssert(elm_subphase_iter == proc_subphase_data_.at(phase).end(), "Must not exist");
proc_subphase_data_.at(phase).emplace(
std::piecewise_construct,
std::forward_as_tuple(temp_id),
std::forward_as_tuple(subphase_time)
);

proc_comm_.resize(phase + 1);
for (auto&& c : comm) {
proc_comm_.at(phase)[c.first] += c.second;
Expand Down

0 comments on commit 2b78eec

Please sign in to comment.