spmdBroadcast
Description
sends the data B
= spmdBroadcast(source
,A
)A
to every 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
spmdBroadcast
to these workers, the function has no effect.
The worker whose index in the current spmd block is equal to source broadcasts the data.
To get the worker index, use the spmdIndex
function.
If source
is equal to the worker index, B
is
equal to A
.
Examples
Input Arguments
Output Arguments
Tips
A worker that calls spmdBroadcast
might finish execution before other
workers. When you need synchronized workers in an spmd
block or
communicating job, such as when you close a shared resource, use spmdBarrier
after calling spmdBroadcast
.
Extended Capabilities
Version History
Introduced in R2022b