Run MATLAB Functions with Automatic Parallel Support

Several MATLAB and Simulink products 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 need Parallel 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 need MATLAB Parallel Server.

  • Some functions run automatically in parallel by default. For example, parfor, parsim, and tall.

  • 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 is local. Control parallel behavior with the parallel preferences, including scaling up to a cluster, automatic pool creation, and preferred number of workers.

Find Automatic Parallel Support

  • On function pages, find information under Extended Capabilities.

  • To browse supported functions by product, click the Functions tab, select a product, and select the check box Automatic Parallel Support. For example, for a filtered list of all Statistics and Machine Learning Toolbox™ functions with automatic parallel support, see Function List (Automatic Parallel Support). If you select a product that does not have functions with automatic parallel support, then the Automatic Parallel Support filter 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. See Run 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. See parfor.

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

Related Examples

More About