send a message from one node to another
Send( node, msg )
integer, identifying the node to send the message to
arbitrary Maple expression, message to send
The Send command is for use within the Maple code executed as part of a parallel computation.
When a parallel job is started on a specified number of servers, say N, each server will be given an integer identifier between 0 and N-1 for the duration of this computation. The node parameter specifies the integer identifier of the node to send a message to.
The msg parameter can be an arbitrary Maple expression including NULL and expression sequences. Nested structures that contain expressions with last name evaluation rules, like modules, will not send the fully evaluated sub-expression.
The receive buffer of an Grid server is only limited by available memory, which means that the Send command will only block for the duration of transferring the data over the network.
The Send command will return before the message was accepted using a Receive command on the destination node. The return value is always NULL.
Note that you can create deadlock situations when all nodes are either done with their computation or still waiting to receive a message. Such deadlocks will be detected and the job will be automatically aborted.
In this example node 0 passes a message along to node 1, who adds to the message and sends it to node 2, etc. When all nodes have seen the message, the final result is sent back to node 0.
circ := proc()
local r, me := MyNode(), n := NumNodes();
if me = 0 then
r := Receive(n-1);
r := Receive(me-1);
Send(me+1 mod n, r, me);
circ ≔ proclocalr,me,n;me ≔ Grid:-MyNode⁡;n ≔ Grid:-NumNodes⁡;ifme=0thenGrid:-Send⁡1,0;r ≔ Grid:-Receive⁡n − 1elser ≔ Grid:-Receive⁡me − 1;Grid:-Send⁡me+1modn,r,meend ifend proc
The Grid[Send] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
Download Help Document
What kind of issue would you like to report? (Optional)