Parallel Computing with MultiStart and GlobalSearch
R2026bMultiStart
MultiStart distributes start points to
multiple processors. From these points, local solvers run to completion independently,
and MultiStart combines the distinct local minima
into a vector of GlobalOptimSolution objects.
To run MultiStart in parallel, set the
UseParallel property:
ms = MultiStart(UseParallel="auto");When UseParallel is "auto",
MultiStart uses parallel
computing if a parallel pool is open or automatic pool creation is
enabled. When UseParallel is
"on", MultiStart starts a parallel pool using your default
cluster profile if no pool is open.
If the MultiStart
Display property is 'iter', then MultiStart displays:
Running the local solvers in parallel.
For an example of parallel MultiStart, see
Parallel MultiStart.
Parallel Processing and Random Number Streams
MultiStart generates pseudorandom
start points locally, and then distributes the start points to parallel
processors. Because the parallel processors do not use random numbers to
generate start points, parallel MultiStart
runs are reproducible. This is in contrast to other
solvers, where parallel random number sequences are not necessarily
controllable or reproducible.
GlobalSearch
GlobalSearch does not distribute start points
to multiple processors. However, when GlobalSearch
runs the fmincon local solver, fmincon
can estimate gradients by parallel finite differences.
To enable parallel gradient estimation within GlobalSearch, set the UseParallel option in the
problem structure:
opts = optimoptions(@fmincon,UseParallel="auto",Algorithm="sqp"); problem = createOptimProblem("fmincon",objective=@myobj,... x0=startpt,options=opts);
For more details on parallel gradient estimation, see Parallel Computing in Optimization Toolbox.
Limitations
No parallel gradient estimation with parallel MultiStart.
fminconcannot estimate gradients in parallel when used with parallelMultiStart. This is becauseparfordoes not work in parallel when called from within anotherparforloop.Serial parfor overhead. When executing serially,
parforloops can run slower thanforloops. Therefore, for best performance, set your local solverUseParalleloption to"off"when theMultiStartUseParallelproperty is"auto"or"on".Occasional serial evaluation. Even when running in parallel, a solver occasionally calls the objective and nonlinear constraint functions serially on the host machine. Therefore, ensure that your functions have no assumptions about whether they are evaluated in serial or parallel.
For information on factors that affect the speed and results of parallel computations, see Improving Performance with Parallel Computing.