Skip to content

Commit

Permalink
#1983: location: bypass complex logic when entity is local
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Sep 28, 2022
1 parent 452df8a commit 4c4bb4a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/vt/topos/location/location.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ struct EntityLocationCoord : LocationCoord {
MsgSharedPtr<MessageT> const& msg
);

/**
* \brief Route a message with a custom handler where the element is local
*
* \param[in] m message shared pointer
*/
template <typename MessageT>
void routeMsgHandlerLocal(MsgSharedPtr<MessageT> const& msg);

/**
* \brief Route a message to the default handler
*
Expand Down
17 changes: 16 additions & 1 deletion src/vt/topos/location/location.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,22 @@ void EntityLocationCoord<EntityID>::routeMsgHandler(
# endif

msg->setHandler(handler);
return routeMsg<MessageT>(id,home_node,msg);

if (local_registered_.find(id) == local_registered_.end()) {
return routeMsg<MessageT>(id,home_node,msg);
} else {
return routeMsgHandlerLocal(msg);
}
}

template <typename EntityID>
template <typename MessageT>
void EntityLocationCoord<EntityID>::routeMsgHandlerLocal(
MsgSharedPtr<MessageT> const& msg
) {
runnable::makeRunnable(msg, true, msg->getHandler(), theContext()->getNode())
.withTDEpochFromMsg()
.run();
}

template <typename EntityID>
Expand Down

0 comments on commit 4c4bb4a

Please sign in to comment.