Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

MATLAB Multiprocessing

Overview

The MATLAB software supports two types of multiprocessing: implicit and explicit.

Implicit Multiprocessing

Characteristics of implicit multiprocessing:

MATLAB enables multithreaded computation by default. You can disable it by specifying the singleCompThread option when starting MATLAB.

Explicit Multiprocessing

Characteristics of explicit multiprocessing:

Enable explicit multiprocessing by installing Parallel Computing Toolbox.

Implicit Multiprocessing

Multithreaded computation runs in a single instance of MATLAB and generates simultaneous instruction streams on a multiple CPU (multiprocessor or multicore) system. The multiple processors share the memory of a single computer. The work to be processed is implicitly partitioned for execution on multiple threads. Multithreaded computation in MATLAB speeds up elementwise computations such as those done by the sin and log functions, and computations that use the Basic Linear Algebra Subroutines (BLAS) library, such as matrix multiply.

Enabling Multithreaded Computation

Multithreaded computation in MATLAB is enabled by default. When enabled, MATLAB automatically detects the number of CPUs on your system and recommends the number of threads based on that. To disable multithreaded computation, start MATLAB using the singleCompThread option.

To set or retrieve the maximum number of computational threads from the command line or from within an M-file program, use the maxNumCompThreads function. You can either set the maximum number of computational threads to a specific number, or indicate that you want the setting to be done automatically by MATLAB.

To set the maximum number of computational threads to a specific number N, use

maxNumCompThreads(N) 

To have MATLAB set the maximum number of threads, use:

maxNumCompThreads('automatic')

maxNumCompThreads also returns the current maximum number of threads if you call it with an output value:

oldN = MaxNumCompThreads(newN)

Explicit Multiprocessing

See the Parallel Computing Toolbox documentation for information regarding explicit multiprocessing in MATLAB.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS