labSend
(Not recommended) Send data to another worker in an spmd
block
labSend
is not recommended. Use spmdSend
instead. For information on updating your code, see Version History.
Description
labSend(
sends data A
,destination
)A
from the current worker in an spmd
block or communicating job to another worker.
Tip
When you offload computations using parfor
and
parfeval
, each computation is run by only one worker at a time.
These workers are independent and do not communicate with each other. If you use
labSend
on these workers, the function has no effect.
The function labSend
sends data to the worker or workers specified
by destination
.
To use labSend
, numlabs
must be greater than
1
.
labSend(___,
sends data with
the tag tag
)tag
. When you use labSend
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
A worker that sends data using labSend
may return before the
receiving worker receives the data. When you need synchronized workers in an
spmd
block or communicating job, such as when you close a shared
resource, use labBarrier
after calling
labSend
and labReceive
.