send a message from one node to another - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Toolboxes : Grid Computing : Grid/Send

Grid[Send] - send a message from one node to another

Calling Sequence

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()
   uses Grid;
   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);
   end if;

circ:=proclocalr,me,n;me:=Grid:-MyNode;n:=Grid:-NumNodes;ifme=0thenGrid:-Send1,0;r:=Grid:-Receiven1elser:=Grid:-Receiveme1;Grid:-Sendme+1modn,r,meend ifend proc





See Also

Grid, Grid[Receive]

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam