spmdSendReceive
Description
sends data B
= spmdSendReceive(destination
,source
,A
)A
from the current worker in an spmd
block or communicating job to the destination
, and
receives data from the source
. The array A
is sent
from the current worker to the worker whose index is equal to
destination
. The current worker receives data B
sent to the current worker from the worker whose index is equal to
source
.
When you use this syntax, the computation is equivalent to the worker sending and receiving data by running these lines of code simultaneously:
spmdSend(A,destination); B = spmdReceive(source);
sends and receives data with the tag B
= spmdSendReceive(___,tag
)tag
. When you use
spmdSendReceive
to send data between workers, multiple items of data
can wait to be collected. When you send multiple items of data to a worker, add a tag to
each item to distinguish between the items.
Examples
Input Arguments
Tips
Tags have many uses, for example:
Use tags to save memory by only loading arrays on workers when you need the data.
Use tags to create code that does not depend on the index of the sending worker.
Extended Capabilities
Version History
Introduced in R2022b
See Also
spmdBarrier
| spmdIndex
| spmdProbe
| spmdReceive
| spmdSend
| spmdSize