parfevalOnAll
Run function on all workers in background
Description
schedules the function F
= parfevalOnAll(backgroundPool,fcn
,n
,X1,...,Xm
)fcn
to run on all workers in the background. You
can run other code while MATLAB® is running the function fcn
. For more information about
workers and the background, see Background Workers.
Note
The background has multiple workers only if you have Parallel Computing Toolbox™.
When you use backgroundPool
to run code in the background, you do
not need to use parfevalOnAll
to set up environment variables.
To run a function on all workers in a parallel pool, see parfevalOnAll
(Parallel Computing Toolbox).
MATLAB evaluates the function fcn
asynchronously on each worker
as [Y1,...,Yn] = fcn(X1,...,Xm)
, with m
inputs and
n
outputs.
MATLAB returns the Future
object F
before the
function fcn
finishes running on all of the background workers. You can
use fetchOutputs
to
retrieve the results [Y1,...,Yn]
from the future. To stop running the
function fcn
, use the cancel
function. For more information about futures, see Future
.
schedules the function F
= parfevalOnAll(fcn
,n
,X1,...,Xm
)fcn
to be run.
MATLAB returns the Future
object F
before the
function fcn
finishes running.
Use this syntax to run code designed for use with Parallel Computing Toolbox.
If you do not have Parallel Computing Toolbox, you do not use any parallel resources. The function runs in serial.
If you have Parallel Computing Toolbox,
parfevalOnAll
automatically uses parallel resources.
Input Arguments
Output Arguments
Extended Capabilities
See Also
parfevalOnAll
(Parallel Computing Toolbox) | cancel
| afterEach
| afterAll
| fetchNext
| fetchOutputs
| wait
| Future