Skip to content

Commit

Permalink
#900 trace- enqueue sending registration of user events
Browse files Browse the repository at this point in the history
- This unwinds the stack to avoid failing attempting to re-grant MPI
  access while running under a PMPI wrapper..
  • Loading branch information
pnstickne committed Jul 14, 2020
1 parent 20fcb6c commit e498918
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/vt/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ struct Trace : runtime::component::Component<Trace> {
/**
* \brief Collectively register a user event
*
* \note All collectively registered events \b MUST be registered
* on all nodes in the same sequence. This guarantees valid unique IDs
* and avoids the necessity to send event registration messages.
*
* \note For users, it is recommended that the free function be called
* \c registerEventCollective
*
Expand Down
6 changes: 5 additions & 1 deletion src/vt/trace/trace_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
namespace vt { namespace trace {

/**
* \brief Register a user event collectively
* \brief Register a user event collectively.
*
* \note All collectively registered events \b MUST be registered
* on all nodes in the same sequence. This guarantees valid unique IDs
* and avoids the necessity to send event registration messages.
*
* \param[in] name the name of the event
*
Expand Down
7 changes: 5 additions & 2 deletions src/vt/trace/trace_user_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ UserEventIDType UserEventRegistry::newEventImpl(

// Ensure newly inserted events are passed to rank 0 if requested.
if (inserted and report_up and node not_eq 0) {
auto msg = makeMessage<NewUserEventMsg>(user, event, in_event);
theMsg()->sendMsg<NewUserEventMsg,newEventHan>(0, msg.get());
// Enqueue work, as this can be called from within PMPI wrappers.
theSched()->enqueue([user, event, in_event]{
auto msg = makeMessage<NewUserEventMsg>(user, event, in_event);
theMsg()->sendMsg<NewUserEventMsg,newEventHan>(0, msg.get());
});
}

return event;
Expand Down

0 comments on commit e498918

Please sign in to comment.