From f33dc9a314ddd16ce4074b5d02c9c959763bfbc5 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Thu, 13 Jan 2022 16:30:49 -0500 Subject: [PATCH] Minor changes to add annotations to clarify where the generic async time is being spent --- src/node_server.cpp | 21 +++++++++++---------- src/node_server_actions_2.cpp | 9 +++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/node_server.cpp b/src/node_server.cpp index 107e2dcc0..0b054bb0f 100644 --- a/src/node_server.cpp +++ b/src/node_server.cpp @@ -106,7 +106,7 @@ future node_server::exchange_flux_corrections() { if (this->nieces[f] == +1) { for (auto const &quadrant : geo::quadrant::full_set()) { futs[index++] = niece_hydro_channels[f][quadrant].get_future().then( - /*hpx::util::annotated_function(*/[this, f, quadrant](future > &&fdata) -> void { + hpx::util::annotated_function([this, f, quadrant](future > &&fdata) -> void { const auto face_dim = f.get_dimension(); std::array lb, ub; switch (face_dim) { @@ -136,16 +136,17 @@ future node_server::exchange_flux_corrections() { break; } grid_ptr->set_flux_restrict(GET(fdata), lb, ub, face_dim); - }/*, "node_server::exchange_flux_corrections::set_flux_restrict")*/); + }, "node_server::exchange_flux_corrections::set_flux_restrict")); } } } - return hpx::when_all(std::move(futs)).then([](future fout) { + return hpx::when_all(std::move(futs)).then( + hpx::util::annotated_function([](future fout) { auto fin = GET(fout); for (auto &f : fin) { GET(f); } - }); + }, "node_server::exchange_flux_corrections::sync")); } void node_server::all_hydro_bounds() { @@ -199,7 +200,7 @@ void node_server::collect_hydro_boundaries(bool energy_only) { for (auto const &dir : geo::direction::full_set()) { if (!(neighbors[dir].empty() && my_location.level() == 0)) { results[index++] = sibling_hydro_channels[dir].get_future(hcycle).then( - /*hpx::util::annotated_function(*/[this, energy_only, dir](future &&f) -> void { + hpx::util::annotated_function([this, energy_only, dir](future &&f) -> void { auto &&tmp = GET(f); if (!neighbors[dir].empty()) { grid_ptr->set_hydro_boundary(tmp.data, tmp.direction, energy_only); @@ -207,7 +208,7 @@ void node_server::collect_hydro_boundaries(bool energy_only) { grid_ptr->set_hydro_amr_boundary(tmp.data, tmp.direction, energy_only); } - }/*, "node_server::collect_hydro_boundaries::set_hydro_boundary")*/); + }, "node_server::collect_hydro_boundaries::set_hydro_boundary")); } } while (index < geo::direction::count()) { @@ -243,7 +244,7 @@ void node_server::collect_hydro_boundaries(bool energy_only) { grid_ptr->is_coarse, xmin, grid_ptr->U); } // None GPU build -> run on CPU -#else +#else #if defined __x86_64__ && defined OCTOTIGER_HAVE_VC complete_hydro_amr_boundary_vc(dx, energy_only, grid_ptr->Ushad, grid_ptr->is_coarse, xmin, grid_ptr->U); #else @@ -419,7 +420,7 @@ void node_server::compute_fmm(gsolve_type type, bool energy_account, bool aonly) for (auto &ci : geo::octant::full_set()) { future m_in_future = child_gravity_channels[ci].get_future(); - futs[index++] = m_in_future.then(/*hpx::util::annotated_function(*/[&m_out, ci](future &&fut) { + futs[index++] = m_in_future.then(hpx::util::annotated_function([&m_out, ci](future &&fut) { const integer x0 = ci.get_side(XDIM) * INX / 2; const integer y0 = ci.get_side(YDIM) * INX / 2; const integer z0 = ci.get_side(ZDIM) * INX / 2; @@ -434,7 +435,7 @@ void node_server::compute_fmm(gsolve_type type, bool energy_account, bool aonly) } } } - }/*, "node_server::compute_fmm::gather_from::child_gravity_channels")*/); + }, "node_server::compute_fmm::gather_from::child_gravity_channels")); } wait_all_and_propagate_exceptions(std::move(futs)); m_out = grid_ptr->compute_multipoles(type, &m_out); @@ -506,7 +507,7 @@ void node_server::compute_fmm(gsolve_type type, bool energy_account, bool aonly) // Check if we are a multipole if (!grid_ptr->get_leaf()) { // Input structure, needed for multipole-monopole interactions - std::array Xbase = { + std::array Xbase = { grid_ptr->get_X()[0][hindex(H_BW, H_BW, H_BW)], grid_ptr->get_X()[1][hindex(H_BW, H_BW, H_BW)], grid_ptr->get_X()[2][hindex(H_BW, H_BW, H_BW)] }; diff --git a/src/node_server_actions_2.cpp b/src/node_server_actions_2.cpp index 747ea695f..a4d21d79c 100644 --- a/src/node_server_actions_2.cpp +++ b/src/node_server_actions_2.cpp @@ -521,9 +521,10 @@ int node_server::form_tree(hpx::id_type self_gid, hpx::id_type parent_gid, std:: for (auto &f : geo::face::full_set()) { const auto &neighbor = neighbors[f.to_direction()]; if (!neighbor.empty()) { - nfuts.push_back(neighbor.set_child_aunt(me.get_gid(), f ^ 1).then([this, f](future &&n) { + nfuts.push_back(neighbor.set_child_aunt(me.get_gid(), f ^ 1).then( + hpx::util::annotated_function([this, f](future &&n) { nieces[f] = GET(n); - })); + }, "node_server::form_tree::sync"))); } else { nieces[f] = -2; } @@ -570,9 +571,9 @@ future node_client::get_child_client(const node_location &parent_l ++misses; } if (!found) { - rfut = hpx::async([=]() { + rfut = hpx::async(hpx::util::annotated_function([=]() { return sfut.get(); - }); + }), "return_future_get_child_client"); } #else rfut = hpx::async(get_unmanaged_gid(), ci);