1. Introduction
  2. Versions
  3. Adding MATLAB to Your Environment
  4. Running MATLAB Batch Jobs
  5. Parallel MATLAB
  6. MATLAB matlabpool is no longer available
  7. MATLAB Errors

Introduction

MATLAB (matrix laboratory) is a high-level language and interactive environment for numerical computation, visualization, and programming. Developed by MathWorks, MATLAB allows you to analyze data, develop algorithms, and create models and applications.

MATLAB is available on the campus cluster along with a collection of toolboxes all of which are covered by a campus concurrent license.

Versions

The table below list the versions of MATLAB installed on the campus cluster.

 

Version Release Name
MATLAB 9.7 2019b
MATLAB 9.5 2018b
MATLAB 9.4 2018a

Adding MATLAB to Your Environment

Each MATLAB installation on the campus cluster has a module that you can use to load a specific version of MATLAB into your user environment. You can see the available versions of MATLAB by typing module avail matlab on the command line. The the latest version of MATLAB can be loaded into your environment by typing module load matlab. To load a specific version you will need to load the corresponding module. See the section Managing Your Environment in the User Guide for more information about modules.

The MATLAB modules make the coresponding MATLAB product as well as all the installed toolboxes available to the user environment. To verify which toolboxes are available (and the MATLAB version), type ver at the prompt of an interactive MATLAB session.

Running MATLAB Batch Jobs

Execution of MATLAB should be restricted to compute nodes that are part of a batch job. For detailed information about running jobs on the campus cluster, see the section Running Jobs in the User Guide.

Standard batch job

A sample batch script that runs a single MATLAB task with a single m-file is available in /projects/consult/slurm/matlab.sbatch that you can copy and modify for your own use. Submit the job with:

    [cc-login1 ~]$ sbatch matlab.sbatch

Interactive batch job

  • For the GUI (which will display on your local machine), use the -x11 option with the srun command:
        srun --x11 --export=All --time=00:30:00 --nodes=1 --cpus-per-task=16 --partition=secondary --pty /bin/bash

    Once the batch job starts, you will have an interactive shell prompt on a compute node. Then type:

        module load matlab
        matlab

    Note: An X-Server must be running on your local machine with X11 forwarding enabled within your ssh connection in order to display X-Apps, GUIs, etc … back on your local machine. Generally users on Linux based machines only have to enable X11 forwarding by passing an option (-X or -Y) to the ssh command. While users on Windows machines will need to ensure that their ssh client has X11 forwarding enabled and have an X-Server is running. A list of ssh clients (which includes a combo packaged ssh client and X-Server) can be found in the ssh section of the campus cluster User Guide. Additional information about running X applications can be found on the Using the X Window System page.
     

  • For the command line interface:
        srun --export=All --time=00:30:00 --nodes=1 --cpus-per-task=16 --partition=secondary --pty /bin/bash

    Once the batch job starts, you will have an interactive shell prompt on a compute node. Then type:

        module load matlab
        matlab -nodisplay

Parallel MATLAB

The Parallel Computing Toolbox (PCT) lets you solve computationally and data-intensive problems using multicore processors. High level constructs, parallel for loops, special array types, and parallelized numerical algorithms let you parallelize MATLAB applications without MPI programming. Under MATLAB vesrions 8.4 and earlier, this toolbox provides 12 workers (MATLAB computational engines) to execute applications locally on a single multicore node of the campus cluster. Under MATLAB version 8.5 the number of workers available is equal to the number of cores on a single node (up to a maximum of 512). See MATLAB Errors for error messages generated when violating this limit.

When submitting multiple parallel MATLAB jobs on the campus cluster a race condition to write temporary MATLAB job information to the same location can occur if two or more jobs start at the same time. This race condition can cause one or more of the parallel MATLAB jobs fail to use the parallel functionality of the toolbox. See MATLAB Errors for error messages generated when this occurs. (Note that non-parallel MATLAB jobs do not suffer from this race condition.)

To avoid this behavior, the start times of the parallel MATLAB jobs can be staggered by submitting each subsequent job to the batch system with the -W depend=after:JobID option (see the section Job Dependencies in the User Guide for more information about this option).

    • Example:
      
      sbatch parallel.ML-job.sbatch
      sbatch --dependency=after:JobID.01 parallel.ML-job.sbatch
      sbatch --dependency=after:JobID.02 parallel.ML-job.sbatch
      ...
      sbatch --dependency=after:JobID.NN parallel.ML-job.sbatch

Note: The MATLAB Distributed Computing Server (MDCS) is not installed on the campus cluster because the latest versions of MDCS are not covered under the campus concurrent license. Therefore MATLAB jobs are restricted to the parallel computing functionality of MATLAB’s Parallel Computing Toolbox.

The UI WebStore offers MDCS for release 2010b – you can contact them directly at webstore@illinois.edu for information and download instructions (for use with release 2010b only – it is not compatible for use with other versions).

MATLAB matlabpool is no longer available

The matlabpool function is not available in MATLAB version 8.5(R2015a). The parpool function should be used instead. Additional information can be found in the Parallel Computing Toolbox release notes.

MATLAB Errors

The following are some errors encountered when running MATLAB on the campus cluster.

MATLAB version <= 8.4
MATLAB version >= 8.5
Error message generated when trying to start
matlabpool with more than 12 workers:
Error message generated when trying to start
parpool with more than 12 workers:
   matlabpool('open', 24)

>> Starting matlabpool using the 'local' profile ... stopped.

Error using matlabpool (line 144)
Failed to open matlabpool. (For information in addition to the causing error,
validate the profile 'local' in the Cluster Profile Manager.)

Caused by:
     Error using distcomp.interactiveclient/start (line 88)
     Failed to start matlabpool.
     This is caused by:
     You requested a minimum of 24 workers, but only 12 workers are allowed
     with the Local cluster.

   parpool('local', 24)

>> Starting parallel pool (parpool) using the 'local' profile ... 

Error using parpool (line 103)
You requested a minimum of 24 workers, but the cluster "local" has the
NumWorkers property set to allow a maximum of 12 workers. To run a
communicating job on more workers than this (up to a maximum of 512 for the
Local cluster), increase the value of the NumWorkers property for the cluster.
The default value of NumWorkers for a Local cluster is the number of cores on
the local machine.

Error message generated when trying to start a matlabpool
with 12 workers using 2 nodes and 6 ppn/node:
Error message generated when trying to start a parpool
with 12 workers using 2 nodes and 6 ppn/node:
   matlabpool('open', 12)

>> Starting matlabpool using the 'local' profile ... 
Error using matlabpool (line 148)
Failed to start a parallel pool. (For information in addition to the causing
error, validate the profile 'local' in the Cluster Profile Manager.)

Caused by:
    Error using parallel.internal.pool.InteractiveClient/start (line 326)
    Failed to start pool.
        Error using parallel.Job/submit (line 304)
        You requested a minimum of 12 workers, but the cluster "local" has the
        NumWorkers property set to allow a maximum of 6 workers. To run a
        communicating job on more workers than this (up to a maximum of 12 for
        the Local cluster), increase the value of the NumWorkers property for
        the cluster. The default value of NumWorkers for a Local cluster is the
        number of cores on the local machine.































   parpool('local', 12)

>> Starting parallel pool (parpool) using the 'local' profile ... 

Error using parpool (line 103)
You requested a minimum of 12 workers, but the cluster "local" has the
NumWorkers property set to allow a maximum of 6 workers. To run a communicating
job on more workers than this (up to a maximum of 512 for the Local cluster),
increase the value of the NumWorkers property for the cluster. The default
value of NumWorkers for a Local cluster is the number of cores on the local
machine.

Example error messages generated when 2 or more parallel MATLAB jobs start at the same time (see the Parallel MATLAB section for details):
Example 1.

  Error using matlabpool (line 144)
  Failed to open matlabpool. (For information in addition to the causing error,
  validate the profile 'local' in the Cluster Profile Manager.)

  Caused by:
      Error using distcomp.interactiveclient/start (line 88)
      Failed to start matlabpool.
      This is caused by:
      A communicating job must have a single task defined before submission.


Example 2.

  Error using matlabpool (line 144)
  Failed to open matlabpool. (For information in addition to the causing error,
  validate the profile 'local' in the Cluster Profile Manager.)

  Caused by:
      Error using distcomp.interactiveclient/start (line 88)
      Failed to start matlabpool.
      This is caused by:
      Can't write file
      /home//.matlab/local_cluster_jobs/R2012a/Job2.in.mat.

Example 1.

  >> Starting parallel pool (parpool) using the 'local' profile ...
  Error using parpool (line 103)
  Failed to start a parallel pool. (For information in addition to the causing
  error, validate the profile 'local' in the Cluster Profile Manager.)

  Caused by:
      Error using parallel.internal.pool.InteractiveClient>iThrowWithCause (line
      667)
      Failed to start pool.
          Error using parallel.Job/createTask (line 277)
          Only one task may be created on a communicating Job.

		
Example 2.

  >> Starting parallel pool (parpool) using the 'local' profile ...
  Error using parpool (line 103)
  Failed to start a parallel pool. (For information in addition to the causing
  error, validate the profile 'local' in the Cluster Profile Manager.)

  Caused by:
      Error using parallel.internal.pool.InteractiveClient>iThrowWithCause (line
      667)
      Failed to start pool.
          Error using parallel.Cluster/createCommunicatingJob (line 92)
          The storage metadata file is corrupt. Please delete all files in the
          JobStorageLocation and try again.

When all of the MATLAB licenses are unavailable (in use)
      >> Starting [matlabpool]/[parallel pool (parpool)] using the 'local' profile ... License checkout failed.
      License Manager Error -4
      Maximum number of users for Distrib_Computing_Toolbox reached.
      Try again later.
      To see a list of current users use the lmstat utility or contact your License Administrator.

      Troubleshoot this issue by visiting:
      http://www.mathworks.com/support/lme/R####x/4
 
      Diagnostic Information:
      Feature: Distrib_Computing_Toolbox
      License path: /home//.matlab/R####x_licenses:/usr/local/MATLAB/R####x/licenses/license.dat:/usr/local/MATLAB/R####x/licenses/network.lic
      Licensing error: -4,132.
      Error using gcp (line 45)
      Unable to checkout a license for the Parallel Computing Toolbox.

Note: R####x corresponds to the MATLAB release name associated with the version (i.e. ver 8.5 = R2015a)