Guide example of RPC "forwarding"

Issue #614 new
Dan Bonachea created an issue

One of the attendees of our tutorial this week started a very interesting discussion thread in #cuf23-upcxx about composing RPC with itself : specifically invoking RPC from within an RPC callback to forward work along to other processes, and dealing with the acknowledgments.

I don't think we have any current coverage of this idiom in the guide, but it seems worth a subsection in a later chapter (maybe Ch 11?).

I'd like to see the example include sub-examples that demonstrate each of the following use cases (probably in this order):

  1. Simple round-trip RPC that sends another round-trip RPC, and acks flow back up the chain to the root process.
  2. Adding some generality to allow the "chain" of RPCs to stretch across N processes, where N is provided as an input parameter (e.g. recursive
  3. Convert round-trip RPC to one-way rpc_ff and show the "leaf" of the chain sending an explicit acknowledgment directly back to the root process to perform promise fulfillment.
  4. Expanding the linear chain of round-trip RPC to a DAG and adding some .then() continuations along the ack chain that transform the results coming back - one possible example that comes to mind here would be a recursive fibonacci that executes each step via RPC and conjoins to sum the results coming back (although we'd need to explain this example is pedagogical and a very inefficient algorithm for this computation).

Comments (2)

  1. Paul Hargrove

    Having read the Slack thread, I agree that adding all or some of the listed use cases has value.

    Currently #2 in the list appears truncated, ending "(e.g. recursive"

    As an alternative to recursive fibonacci in #4, perhaps a "reduction like" operation to concatenate strings to generate a string at the root which is the in-order traversal of a distributed tree? To me that doesn't sound significantly harder to write or understand than the proposed fibonacci computation, but is possibly less artificial.

  2. Log in to comment