Main Content

Parallel Computing with MultiStart and GlobalSearch

R2026b

MultiStart

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. fmincon cannot estimate gradients in parallel when used with parallel MultiStart. This is because parfor does not work in parallel when called from within another parfor loop.

  • Serial parfor overhead. When executing serially, parfor loops can run slower than for loops. Therefore, for best performance, set your local solver UseParallel option to "off" when the MultiStart UseParallel property 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.

See Also

Topics