Skip to content

Commit

Permalink
fixup: Do inline entry methods manually
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsdeppe committed Dec 2, 2018
1 parent f69b37c commit 931d593
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/GroupDefs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,16 @@ The `receive_data` function always takes a `ReceiveTag`, which is set in the
actions `inbox_tags` type alias as described above. The first argument is the
temporal identifier, and the second is the data to be sent.
Normally when remote functions are invoked they go through the Charm++ runtime
system, which adds some overhead. The `receive_data` function elides the call to
the Charm++ RTS for calls into array components. Charm++ refers to
these types of remote calls as "inline entry methods". With the Charm++ method
of eliding the RTS the code becomes susceptible to stack overflows because
of infinite recursion. The `receive_data` function is limited to at most 64 RTS
elided calls, though in practice reaching this limit is rare. When the limit is
reached the remote method invocation is done through the RTS instead of being
elided.
#### 3. Reduction %Actions
Finally, there are reduction actions which are used when reducing data over an
Expand Down
4 changes: 4 additions & 0 deletions src/Parallel/Invoke.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void receive_data(Proxy&& proxy, typename ReceiveTag::temporal_id temporal_id,
ReceiveDataType&& receive_data,
const bool enable_if_disabled) noexcept {
auto* obj = proxy.ckLocal();
// Only elide the Charm++ RTS if the object is local and if we won't blow the
// stack by having too many recursive function calls.
if (obj != nullptr and not detail::max_inline_entry_methods_reached()) {
obj->template receive_data<ReceiveTag>(
std::move(temporal_id), std::forward<ReceiveDataType>(receive_data),
Expand All @@ -69,6 +71,8 @@ template <
void receive_data(Proxy&& proxy, typename ReceiveTag::temporal_id temporal_id,
ReceiveDataType&& receive_data) noexcept {
auto* obj = proxy.ckLocal();
// Only elide the Charm++ RTS if the object is local and if we won't blow the
// stack by having too many recursive function calls.
if (obj != nullptr and not detail::max_inline_entry_methods_reached()) {
obj->template receive_data<ReceiveTag>(
std::move(temporal_id), std::forward<ReceiveDataType>(receive_data));
Expand Down

0 comments on commit 931d593

Please sign in to comment.