Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Industries Academia Support User Community Company

 

Choosing Hardware for Use with MATLAB®

Although many MATLAB® users would like to know which computer is "best suited" for MATLAB, it is impossible to predict precisely how well MATLAB will perform on a given computer, due to the many factors that affect MATLAB performance:

  • The computer's RAM, processors, and other architectural details
  • The exact code being executed (Different functions require different types of calculations, and efficient code can accelerate MATLAB execution.)
  • The resources given to MATLAB by the operating system (Some calculations can be RAM- or processor-intensive.) 
  • Other processes running on the computer

The minimum system requirements provide guidance for baseline hardware needs for MATLAB. Following is more detail on the variables that affect MATLAB performance.


Contents


Computer Hardware Configuration


Memory

Many computations in MATLAB (especially those that involve large matrices and other objects containing thousands of elements) require repeated access to memory for reading and writing data.  The random access memory (RAM) of a computer allows for the fastest access to such working memory.  Installing more RAM than what is listed in the system requirements may improve MATLAB performance, although other factors such as memory access speed should be considered.

See the amount of memory available for different types of data using 32-bit and 64-bit MATLAB in Technical Note 1110: Maximum Matrix Size by Platform.

For a general introduction to 32-bit and 64-bit computing, including the salient characteristics of each, see Technical Note 1106: Memory Management Guide.  

Note that changing from 32-bit to 64-bit MATLAB only allows for the creation and manipulation of larger variables but does not imply a boost in execution speed.

Processors

A processor with a high clock speed can perform calculations faster than those with lower clock speeds, so processor speed will affect MATLAB performance. However, users should be aware of several limitations:

  • You can not, in general, compare the clock speeds of different microprocessor families. 
  • The speed of many MATLAB programs is not limited by processor speed but rather by other factors such as access to memory and bus speed.  Thus, doubling the clock speed of your processor will not necessarily cause a doubling in execution speed.
Cache Memory

The cache memory in modern processors represents a fast but expensive location for data storage.  The less expensive but slower RAM becomes active whenever the cache memory is exhausted.

The effect of increasing the cache memory on MATLAB performance is difficult to assess without careful benchmarking.  Unless special needs are identified, systems generally come with enough cache memory for most common applications.

Multiple Cores

As of MATLAB 7.4 (R2007a), it is possible to enable MATLAB to use the multithreading capabilities of your multicore computer for functions that include operations in the Basic Linear Algebra Subprograms (BLAS) Library (e.g., matrix multiplication and QR decomposition) and element-wise numerical operations (e.g., trigonometric and logarithmic functions). 

MATLAB is not multithreaded for other functions, notably those in the C and C++ Math Libraries.  Hence, even when a standalone executable is generated using MATLAB Compiler and the C or C++ Math Libraries, it will not be able to take advantage of the multiple processors on a given machine.

If many users of MATLAB are sharing the same machine, then having multiple processors can greatly improve the throughput of the system and the response time of each individual user of MATLAB.

See more information about multithreading capabilities in the multiprocessing section of the MATLAB documentation.

Other Hardware

MATLAB can only run as fast as its slowest hardware component.  Thus, a slower data acquisition card can limit MATLAB performance during real-time simulations, and a slower graphics adapter can delay the display of results.  To obtain the maximum performance with MATLAB graphics, use the fastest adapter you can afford and one that implements as much of the Open Graphics Library (OpenGL) in its hardware as possible.

Using the MATLAB Benchmark Function

You can benchmark MATLAB performance on your computer by typing BENCH at the MATLAB command prompt.  Before you buy a computer, we recommend that you download a trial version of MATLAB and run BENCH on that configuration.  Although you should not exclusively rely on BENCH to evaluate a computer's performance, it is helpful as an estimate of MATLAB performance on several common tasks.

The BENCH function times six different MATLAB tasks on your computer and compares the execution speed with the speed of several other computers.  The six tasks are:

  • LU (LAPACK: Floating point, regular memory access)
  • FFT (Fast Fourier transform: Floating point, irregular memory access)
  • ODE (Ordinary differential equations: Data structures, M-files)
  • Sparse (Solve sparse system: Mixed integer and floating point)
  • 2-D (plot(fft(eye)): 2-D line drawing graphics)
  • 3-D (MathWorks logo: 3-D animated OpenGL graphics)

A final bar chart shows speed, which is inversely proportional to time.  The longer bars represent faster machines, and the shorter bars represent slower ones.

  • BENCH runs each of the six tasks once.
  • BENCH(N) runs each of the six tasks N times.
  • BENCH(0) just displays the results from other machines.
  • T = BENCH(N) returns an N-by-6 array with the execution times of each task, measured in seconds.

The comparison data for other computers is stored in a text file: $MATLABROOT/toolbox/matlab/demos/bench.dat, where $MATLABROOT is the directory in which MATLAB is installed. Updated versions of this file are available from MATLAB Central.

Fluctuations of five or ten percent in the measured times of repeated runs on a single machine are not uncommon.

BENCH is intended to compare performance of one particular version of MATLAB on different machines.  It does not offer direct comparisons between different versions of MATLAB.  The tasks and problem sizes change from version to version.

Optimized Programming Style

Optimizing your code will help MATLAB run faster on any computer.  You can learn more about writing MATLAB code for performance in Solution 1-15NM7: How do I increase the speed or performance of MATLAB?

Contact sales
Free technical kit
Trial software
E-mail this page