Skip to content

Commit

Permalink
Merge pull request #3250 from STEllAR-GROUP/apex_refactoring_with_guids
Browse files Browse the repository at this point in the history
Apex refactoring with guids
  • Loading branch information
msimberg committed Mar 23, 2018
2 parents 5d1fc10 + ff4f604 commit 7367cfd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -1520,6 +1520,8 @@ if(HPX_WITH_APEX_NO_UPDATE)
set(_hpx_apex_no_update NO_UPDATE)
endif()
if(HPX_WITH_APEX)
# We want to track parent dependencies
hpx_add_config_define(HPX_HAVE_THREAD_PARENT_REFERENCE)
# handle APEX library
include(GitExternal)
git_external(apex
Expand Down
8 changes: 7 additions & 1 deletion hpx/runtime/threads/thread_data.hpp
Expand Up @@ -604,7 +604,13 @@ namespace hpx { namespace threads
parent_locality_id_ = get_locality_id();
#endif
#if defined(HPX_HAVE_APEX)
set_apex_data(apex_new_task(get_description()));
if (parent_thread_id_) {
set_apex_data(apex_new_task(get_description(),
parent_thread_id_.get()->get_apex_data()));
} else {
set_apex_data(apex_new_task(get_description(),
nullptr));
}
#endif
HPX_ASSERT(init_data.stacksize != 0);
HPX_ASSERT(coroutine_.is_ready());
Expand Down
16 changes: 8 additions & 8 deletions hpx/util/apex.hpp
Expand Up @@ -36,21 +36,19 @@ namespace hpx { namespace util
}

inline void * apex_new_task(
thread_description const& description)
thread_description const& description,
void * parent_task)
{
if (description.kind() ==
thread_description::data_type_description) {
return (void*)apex::new_task(description.get_description());
return (void*)apex::new_task(description.get_description(),
UINTMAX_MAX, (apex::task_wrapper*)parent_task);
} else {
return (void*)apex::new_task(description.get_address());
return (void*)apex::new_task(description.get_address(),
UINTMAX_MAX, (apex::task_wrapper*)parent_task);
}
}

inline void * apex_new_task(char const* name)
{
return (void*)apex::new_task(name);
}

inline void * apex_update_task(void * wrapper,
thread_description const& description)
{
Expand All @@ -68,6 +66,8 @@ namespace hpx { namespace util
return (void*)apex::update_task((apex::task_wrapper*)wrapper, name);
}

/* This is a scoped object around task scheduling to measure the time
* spent executing hpx threads */
struct apex_wrapper
{
apex_wrapper(void* const data_ptr) : stopped(false), data_(nullptr)
Expand Down

0 comments on commit 7367cfd

Please sign in to comment.