Skip to content

Commit

Permalink
Changing HPX tasks from actions to regular hpx::async calls
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Apr 22, 2020
1 parent 6bc59ae commit 7fca918
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
27 changes: 0 additions & 27 deletions src/apex/apex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@
#include <hpx/include/util.hpp>
#include <hpx/local_lcos/composable_guard.hpp>
#include "global_constructor_destructor.h"
#ifdef APEX_HAVE_HPX_disabled
static void apex_schedule_shutdown(void);
#endif // APEX_HAVE_HPX_disabled
#endif // APEX_HAVE_HPX

#if APEX_DEBUG
Expand Down Expand Up @@ -165,8 +162,6 @@ static void finalize_hpx_runtime(void) {
instance->query_runtime_counters();
}
}
// Tell other localities to shutdown APEX
apex_schedule_shutdown();
// Shutdown APEX
finalize();
hpx_finalized = true;
Expand Down Expand Up @@ -2100,26 +2095,4 @@ static void apex_register_with_hpx(void) {
}
#endif

#ifdef APEX_HAVE_HPX_disabled
HPX_DECLARE_ACTION(APEX_TOP_LEVEL_PACKAGE::finalize,
apex_internal_shutdown_action);
HPX_ACTION_HAS_CRITICAL_PRIORITY(apex_internal_shutdown_action);
HPX_PLAIN_ACTION(APEX_TOP_LEVEL_PACKAGE::finalize,
apex_internal_shutdown_action);

void apex_schedule_shutdown() {
if(get_hpx_runtime_ptr() == nullptr) return;
return;
//if(!thread_instance::is_worker()) return;
apex_internal_shutdown_action act;
try {
for(auto locality : hpx::find_all_localities()) {
hpx::apply(act, locality);
}
} catch(...) {
// what to do?
}
}
#endif


11 changes: 1 addition & 10 deletions src/apex/profiler_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,24 +1726,15 @@ if (rc != 0) cout << "PAPI error! " << name << ": " << PAPI_strerror(rc) << endl
}

#ifdef APEX_HAVE_HPX
HPX_DECLARE_ACTION(
APEX_TOP_LEVEL_PACKAGE::profiler_listener::process_profiles_wrapper,
apex_internal_process_profiles_action);
HPX_ACTION_HAS_CRITICAL_PRIORITY(apex_internal_process_profiles_action);
HPX_PLAIN_ACTION(
APEX_TOP_LEVEL_PACKAGE::profiler_listener::process_profiles_wrapper,
apex_internal_process_profiles_action);

void apex_schedule_process_profiles() {
if(get_hpx_runtime_ptr() == nullptr) return;
if(!thread_instance::is_worker()) return;
if(hpx_shutdown) {
APEX_TOP_LEVEL_PACKAGE::profiler_listener::process_profiles_wrapper();
} else {
if(!consumer_task_running.test_and_set(memory_order_acq_rel)) {
apex_internal_process_profiles_action act;
try {
hpx::apply(act, hpx::find_here());
hpx::async(&profiler_listener::process_profiles_wrapper);
} catch(...) {
// During shutdown, we can't schedule a new task,
// so we process profiles ourselves.
Expand Down

0 comments on commit 7fca918

Please sign in to comment.