Remote procedure call

The Function Offload or Remote Procedure Call (RPC) Model is implemented using stubs as proxies.

A method stub , or simply stub , is a small piece of code used to stand in for some other code. The stub or proxy acts as a local surrogate for the remote procedure, hiding the details of server communication. The main code on the PPE contains a stub for each remote procedure on the SPEs. Each procedure on an SPE has a stub that takes care of running the procedure and communicating with the PPE.

When the program on the PPE calls a remote procedure, it actually calls that procedure's stub located on the PPE. The stub code initializes the SPE with the necessary data and code, packs the procedure's parameters, and sends a mailbox message to the SPE to start its stub procedure.

The SPE stub retrieves the parameters and executes the procedure locally on the SPE. The PPE program then retrieves the output parameters. Figure 1 shows an example of a program using this method.
Figure 1. Example of the Function-Offload (or RPC) Modelexample of the function-offload model