Send - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Grid

  

Send

  

send a message from one node to another

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Send( node, msg )

Parameters

node

-

integer, identifying the node to send the message to

msg

-

arbitrary Maple expression, message to send

Description

• 

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.

Examples

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
       Send(1,0);
       r := Receive(n-1);  
   else
       r := Receive(me-1);
       Send(me+1 mod n, r, me);
   end if;
end;

circproclocalr,me,n;meGrid:-MyNode;nGrid:-NumNodes;ifme=0thenGrid:-Send1,0;rGrid:-Receiven1elserGrid:-Receiveme1;Grid:-Sendme+1modn,r,meend ifend proc

(1)

Grid:-Launchcirc,numnodes=4

0,1,2,3

(2)

Compatibility

• 

The Grid[Send] command was introduced in Maple 15.

• 

For more information on Maple 15 changes, see Updates in Maple 15.

See Also

Grid

Grid[Receive]