A number of functions in this implementation of the toolbox have been
enhanced to allow them to exploit multiple cores. This should deliver
speed-ups for moderate or large datasets over the single-threaded
versions when run on a multicore system. Parallelism has been implemented
in many key functions in the areas of:
Other NAG functions may also benefit to some extent because they internally
call one or more of the parallelised functions. The complete list is
- Dense and Sparse Linear Algebra
- Random Number Generators
- Partial Differential Equations
- Curve and Surface Fitting
- Correlation and Regression Analysis
- Multivariate Methods
- Time Series Analysis
- Financial Option Pricing
The parallelism within the NAG Toolbox is implemented using OpenMP and so the environment
variable OMP_NUM_THREADS should be set to a number greater
than 1 to enable this. The number chosen will be the maximum number of
processor cores which the toolbox can use. As a rule of thumb this
should be the number of available (idle) processor cores on the computer
running MATLAB. However:
User are also advised to turn off any power saving OS features, such as
facilities that reduce the clock speed of idle cores, if they wish to achieve
the best performance.
- Performance improvements depend on many factors, including the nature of
each algorithm, the problem size(s) and other parameters, and the characteristics
of the computer running MATLAB. Users who frequently run very similar problems are
encouraged to experiment with different values of OMP_NUM_THREADS, to see
which value gives the best performance on their code and data.
- Some INTEL processors support hyper-threading, which allows each
physical core to appear to the operating system as two virtual cores. Thus it can be
advantageous when running parallelised NAG functions to try values of
OMP_NUM_THREADS up to twice the number of physical cores present.
Note that other applications use OpenMP so it is possible that the
OMP_NUM_THREADS environment variable has already been defined
on your system. To check this, type
in MATLAB. If the answer is an integer then the variable has been set.
If it is an empty string ('') then it has not.
To set an environment on Windows do the following:
- Click the Start button, go to the Settings menu,
and select Control Panel.
- On the Control Panel menu, select System.
- In the System Properties dialog box, click the
- On the Advanced panel, click the Environment
- In the Environment Variables dialog box, click the
New button in the User Variables section.
- In the New User Variable dialog box, enter the name of the
variable as OMP_NUM_THREADS and set the value of the variable as
On Linux the precise syntax for setting environment variables depends on
the user's shell.