Main Content

RunMATLABFunctions with Automatic Parallel Support

SeveralMATLABand金宝appproducts have a growing number of functions and features that help you take advantage of parallel computing resources without requiring any extra coding. You can enable this support by simply setting a flag or preference.

To take advantage of this functionality on your desktop, you needParallel Computing Toolbox. Run calculations in parallel using local workers to speed up large calculations. To scale the parallel computing to larger resources such as computer clusters, you also needMATLABParallel Server.

  • Some functions run automatically in parallel by default. For example,parfor,parsim(Simulink), andtall.

  • Many other functions run automatically in parallel if you set an option to use parallel.

When you run a function with parallel enabled, MATLAB®automatically opens a parallel pool of workers. MATLAB runs the computation across the available workers.

Automatic parallel support starts a parallel pool of workers using the default cluster profile. If you have not touched your parallel preferences, the default profile isProcesses. Control parallel behavior with the parallel preferences, including scaling up to a cluster and automatic pool creation.

Find Automatic Parallel Support

  • On function pages, find information underExtended Capabilities.

  • You can browse supported functions from all MathWorks®products at the following link:All Functions List (Automatic Parallel Support). Alternatively, you can filter by product. On theHelpbar, click theFunctionstab, select a product, and select the check boxAutomatic Parallel Support. For example, for a filtered list of all Statistics and Machine Learning Toolbox™ functions with automatic parallel support, seeFunction List (Automatic Parallel Support)(Statistics and Machine Learning Toolbox). If you select a product that does not have functions with automatic parallel support, then theAutomatic Parallel Supportfilter is not available.

If a function you are interested in does not include automatic parallel support, there are the alternatives:

  • If you have a GPU, many MATLAB functions run automatically on a GPU. SeeRun MATLAB Functions on a GPU.

  • Any MATLAB code inside a for-loop can be made into a parallel for loop, provided the iterations are independent. Seeparfor.

  • If you are you looking for other ways to speed up your processing or to scale up your big data calculation, seeChoose a Parallel Computing Solution.

Related Examples

More About