diff --git a/allscale/components/monitor.hpp b/allscale/components/monitor.hpp index 322eafe..df21ffe 100644 --- a/allscale/components/monitor.hpp +++ b/allscale/components/monitor.hpp @@ -338,6 +338,7 @@ namespace allscale { namespace components { private: + typedef hpx::lcos::local::spinlock mutex_type; // MONITOR MANAGEMENT // Measuring total execution time @@ -347,6 +348,8 @@ namespace allscale { namespace components { std::uint64_t rank_, execution_init; std::uint64_t num_localities_; + mutex_type init_mutex; + bool initialized = false; bool enable_monitor; // System parameters @@ -361,7 +364,6 @@ namespace allscale { namespace components { // hpx::id_type left_; // hpx::id_type right_; - typedef hpx::lcos::local::spinlock mutex_type; mutex_type work_map_mutex; // Performance profiles per work item ID diff --git a/hpx b/hpx index b90ec00..0c6fdba 160000 --- a/hpx +++ b/hpx @@ -1 +1 @@ -Subproject commit b90ec0016fb5624e51a4e58b91ecedc3b841016e +Subproject commit 0c6fdbaa8770ce7aa46b3c715748098983d449ec diff --git a/src/components/monitor_component.cpp b/src/components/monitor_component.cpp index 36bae65..69745e6 100644 --- a/src/components/monitor_component.cpp +++ b/src/components/monitor_component.cpp @@ -1852,6 +1852,10 @@ namespace allscale { namespace components { } void monitor::init() { + std::unique_lock l(init_mutex); + if (initialized) return; + hpx::util::ignore_while_checking> il(&l); + // bool enable_signals = true; if(const char* env_p = std::getenv("ALLSCALE_MONITOR")) { @@ -1861,8 +1865,8 @@ namespace allscale { namespace components { if(!enable_monitor) { - std::cout << "Monitor component disabled!\n"; - return; + std::cout << "Monitor component disabled!\n"; + return; } num_localities_ = allscale::get_num_localities(); @@ -2155,6 +2159,10 @@ namespace allscale { namespace components { // Init historical data history = std::make_shared(); + hpx::register_with_basename("allscale/monitor", this->get_id(), rank_).get(); + + + initialized = true; std::cerr << "Monitor component with rank " diff --git a/src/components/scheduler_component.cpp b/src/components/scheduler_component.cpp index b13d1d8..8c534a7 100644 --- a/src/components/scheduler_component.cpp +++ b/src/components/scheduler_component.cpp @@ -848,18 +848,41 @@ std::pair> } reqs->add_allowance(addr); + bool async = work.id().depth() < 2;//addr.getParent().getNumaNode() != numa_node; + hpx::future acquired = reqs->acquire_split(addr); + typename hpx::traits::detail::shared_state_ptr_for< hpx::future>::type const &state = hpx::traits::future_access>::get_shared_state( acquired); - - state->set_on_completed( - [state, this, numa_node, work = std::move(work), reqs = std::move(reqs)]() mutable + auto f_split = [async, state, this, numa_node, work = std::move(work), reqs = std::move(reqs)]() mutable { auto &exec = executors_[numa_node]; - work.split(exec, std::move(reqs)); - }); + if (async) + { + hpx::parallel::execution::post( + exec, hpx::util::annotated_function( + hpx::util::deferred_call([work = std::move(work), reqs = std::move(reqs), &exec]() mutable + { + work.split(exec, std::move(reqs)); + + }), + "allscale::work_item::split")); + } + else + { + work.split(exec, std::move(reqs)); + } + }; + + if (acquired.is_ready()) + { + f_split(); + return std::make_pair(work_item(), std::unique_ptr()); + } + + state->set_on_completed(std::move(f_split)); return std::make_pair(work_item(), std::unique_ptr()); } else diff --git a/src/dashboard.cpp b/src/dashboard.cpp index 1397c33..02f830d 100644 --- a/src/dashboard.cpp +++ b/src/dashboard.cpp @@ -26,8 +26,8 @@ namespace allscale { namespace dashboard node_state get_state() { node_state state; - static allscale::components::monitor *monitor_c = &allscale::monitor::get(); - + allscale::components::monitor *monitor_c = &allscale::monitor::get(); +// state.rank = hpx::get_locality_id(); state.online = true; state.active = true; diff --git a/src/monitor.cpp b/src/monitor.cpp index 6bd158a..b5b4e2a 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -67,6 +67,7 @@ namespace allscale { hpx::util::detail::yield_k(k, "get component..."); res = m.component_.get(); } + res->init(); return res; } @@ -75,17 +76,15 @@ namespace allscale { hpx::id_type gid = hpx::new_(hpx::find_here(), rank).get(); - component_ = hpx::get_ptr(gid).get(); - component_->init(); - - char *env = std::getenv("ALLSCALE_MONITOR"); - if(env && env[0] == '0') - { - return; - } - - hpx::register_with_basename("allscale/monitor", gid, rank).get(); +// component_->init(); +// +// char *env = std::getenv("ALLSCALE_MONITOR"); +// if(env && env[0] == '0') +// { +// return; +// } +// } } diff --git a/src/scheduler.cpp b/src/scheduler.cpp index 8a05edf..a526aaf 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -267,6 +267,11 @@ namespace allscale void schedule(work_item work) { + { + int i = 0; + unsigned j =0; + if (i < j) { return; } + } if (policy_.value_ == replacable_policy::dynamic && work.id().is_root() && work.id().id > 0 && (work.id().id % 10 == 0)) {