Run MATLAB on multicore and multiprocessor machines
MATLAB® provides two main ways to take advantage of multicore and multiprocessor computers. By using the full computational power of your machine, you can run your MATLAB applications faster and more efficiently.
Built-in Multithreading
Linear algebra and numerical functions such as fft
, \
(mldivide
), eig
, svd
, and sort
are multithreaded in MATLAB. Multithreaded computations have been on by default in MATLAB since Release 2008a. These functions automatically execute on multiple computational threads in a single MATLAB session, allowing them to execute faster on multicore-enabled machines. Additionally, many functions in Image Processing Toolbox™ are multithreaded.
Parallelism Using MATLAB Workers
You can run multiple MATLAB workers (MATLAB computational engines) on a single machine to execute applications in parallel, with Parallel Computing Toolbox™. This approach allows you more control over the parallelism than with built-in multithreading, and is often used for coarser grained problems such as running parameter sweeps in parallel.
With programming constructs such as parallel for-loops (parfor
) and batch
, you can write parallel MATLAB programs with minimal programming effort. Several other products including Optimization Toolbox™, Statistics and Machine Learning Toolbox™, and Simulink Coder™ offer built-in parallel algorithms that work with Parallel Computing Toolbox. These algorithms let you distribute computations across available parallel computing resources without writing any parallel code.
Unlike with multithreaded computations, you can scale parallel applications that use MATLAB workers beyond a single machine to a computer cluster or grid using MATLAB Parallel Server™.
Examples and How To
Software Reference
See also: Parallel Computing Toolbox, MATLAB Parallel Server, MATLAB GPU computing, parallel computing, MATLAB acceleration, MATLAB multicore videos
Accelerating and Parallelizing MATLAB Code
In this course you’ll learn a variety of techniques to make your MATLAB® code run faster.