labBarrier
(Not recommended) Synchronize workers in an spmd
block
labBarrier is not recommended. Use spmdBarrier
instead. For more information, see Version History.
Syntax
Description
labBarrier stops all workers in the current spmd
block or communicating job from executing code until every worker calls
labBarrier.
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
labBarrier on these workers, the function has no effect.
Use labBarrier when you need to synchronize workers, such as when
workers use shared resources such as a file handle.
If numlabs is equal to 1, execution continues
immediately. numlabs is equal to 1 outside of an
spmd block or communicating job.