spmdReceive
Syntax
Description
receives data
B
= spmdReceiveB
sent to the current worker from any worker in the current spmd
block or communicating job.
When you offload computations using parfor
and
parfeval
, only one worker at a time runs each computation. These
workers are independent and do not communicate with each other. If you apply
spmdReceive
to these workers, the function has no effect.
When a worker runs spmdReceive
, the function blocks the execution
of other commands until the worker receives the data.
To use spmdReceive
, the number of workers running the current spmd
block must be greater than 1
. To get the number of workers running the
current spmd block, use the spmdSize
function.
receives data from any
worker.B
= spmdReceive('any')
Examples
Input Arguments
Output 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
| spmdSendReceive
| spmdSend