MATLAB Quick Start THPC Version - Deprecated

Note

This page contains a quick start guide for earlier version(s) of Matlab that are still available but no longer directly supported. Please refer to the latest version for direct support.

Compute Resources

Docker Usage

Setting up the MATLAB License

  • The prerequisite for using MATLAB is to setup the MATLAB license. Shown below are the steps that must be taken to setup the license for MATLAB. You only need to set it up one time.
    • Login to the client host with your WUSTL Key username.

    ssh wustlkey@compute1-client-1.ris.wustl.edu
    
    • Add the following code to the end of your ~/.bashrc file.

    export LSF_DOCKER_VOLUMES=/path/to/licenses/MATLAB/R2019b_licenses:$HOME/.matlab/R2019b_licenses
    
    • This example is for version 2019b, where /path/to/licenses/R2019b_licenses is a directory that contains the file with the license information in it.

    • Add the following code to the end of your ~/.bashrc file to make sure you have /usr/local/bin in your PATH.

    export PATH=$PATH:/usr/local/bin
    

Using an Interactive Terminal

  • Login to the client host with your WUSTL Key username.

ssh wustlkey@compute1-client-1.ris.wustl.edu
  • Get a compute exec node terminal.

compute1-terminal /bin/bash

Note

  • If you are a member of more than one compute group, you will be prompted to specify an LSF User Group with -G group_name or by setting the LSB_SUB_USER_GROUP variable.

  • You can specify -n option to request N number of processes. For example, to request for 16 CPU, compute1-terminal -n 16 /bin/bash

  • You can specify -M and -R option to request N GB of memory. For example, to request for 64GB, compute1-terminal -M 64GB -R 'rusage[mem=64GB]' /bin/bash

  • Use software modules to load the environment for running MATLAB.

[wustlkey@compute1-exec-N ~]$ module avail matlab
--------------   /act/modulefiles -------------------------------
matlab matlab_R2019b
  • The MATLAB module is a short-cut to the latest version. If you wanted to use a specific version, you’ll do:

[wustlkey@compute1-exec-123 ~]$ module load matlab_R2019b
  • You can then run the MATLAB command directly:

[wustlkey@compute1-exec-123 ~]$ matlab
MATLAB is selecting SOFTWARE OPENGL rendering.

Using an Interactive GUI

  • Login to the client host with your WUSTL Key username.

ssh wustlkey@compute1-client-1.ris.wustl.edu
  • Get a noVNC session. You will get the output similar to the following if this is your first time using noVNC. It will generate a random password for you indicated by line with “Your password for noVNC is:”.

[wustlkey@compute1-client-1 ~]$ compute1-gui-desktop
Created password for your noVNC web login.
Your password for noVNC is: PRhtO6O2PwM=

Please use the password below to login to the noVNC session.
If you want to pick your own password, you can simply set the
environment variable VNC_PW with you own password.

Job <627984> is submitted to queue <general-interactive>.
You can access your compute1 desktop with the URL https://compute1-exec-N.compute.ris.wustl.edu:8901/vnc.html?resize=remote

Note

  • If you are a member of more than one compute group, you will be prompted to specify an LSF User Group with -G group_name or by setting the LSB_SUB_USER_GROUP variable.

  • You can specify -n option to request N number of processes. For example, to request for 16 CPU, compute1-gui-desktop -n 16 /bin/bash

  • You can specify -M and -R option to request N GB of memory. For example, to request for 64GB, compute1-gui-desktop -M 64GB -R 'rusage[mem=64GB]' /bin/bash

  • The password and URL above are only for illustration only. You might get different password and URL.

  • You can prepend to the command compute-gui-desktop with VNC_PW=password to set your own password for noVNC. Please replace “password” with your custom password.

  • Open a browser and copy-and-paste the URL from step #2 above. The URL is at the line with the wording “You can access your compute1 desktop with the URL”.

Note

There might be some delay in starting the noVNC session at the compute execution node. Normally, it will take less than 30 seconds. If it is not presenting the noVNC session page after a minute, please put in a ticket to RIS service desk https://jira.ris.wustl.edu/servicedesk/customer/portal/1.

  • Login to the noVNC session from the noVNC session page. Please click on the “Connect” button indicated by the red arrow. Then, please put in the password from step #2.

../../../../../_images/noVNC_opening_screen.png
  • Get a noVNC session terminal by clicking on the terminal icon as indicated by the red arrow as shown below.

../../../../../_images/noVNC_select_terminal.png
  • Use software modules to load the environment for running MATLAB.

[wustlkey@compute1-exec-123 ~]$ module avail matlab
--------------   /act/modulefiles -------------------------------
matlab matlab_R2019b
  • The MATLAB module is a short-cut to the latest version. If you wanted to use a specific version, you’ll do:

[wustlkey@compute1-exec-123 ~]$ module load matlab_R2019b
  • You can then run the MATLAB command directly.

[wustlkey@compute1-exec-123 ~]$ matlab
MATLAB is selecting SOFTWARE OPENGL rendering.

Submitting a Non-Interactive Batch Job

This section will demo the submission of a non-interactive MATLAB batch job.

  • Generate a sample Hello World script and save it as hello.m.

echo "'Hello World'" >> $HOME/hello.m
  • Generate a MATLAB bsub job file. More information on bsub job files can be found here.

#!/bin/bash
#BSUB -q general
#BSUB -J matlab
#BSUB -W 7200
#BSUB -N
#BSUB -u WUSTLKEY@wustl.edu
#BSUB -oo $HOME/matlab-test.log

. /etc/bashrc # this step is required to load the MATLAB module
module load matlab

matlab -nodisplay -nodesktop -r "run('/path/to/hello');"

Note

Omit the .m extension of the hello.m script or the job submission will fail.

  • Designate the $HOME filesystem location and pass it to Docker using LSF_DOCKER_VOLUMES.
    • Documentation on this command can be found here.

export LSF_DOCKER_VOLUMES="$HOME:$HOME"
  • Batch submit the MATLAB job.

/scratch1/fs1/ris/application/bin/compute1-batch < matlab.bsub
  • You will receive an email once your job has finished running.

  • You can check the output of your job in the matlab-test.log file.

cat $HOME/matlab-test.log
  • Towards the end of the matlab-test.log file you will see the MATLAB output from our script.

                            < M A T L A B (R) >
              Copyright 1984-2019 The MathWorks, Inc.
          R2019b Update 1 (9.7.0.1216025) 64-bit (glnxa64)
                         September 26, 2019


To get started, type doc.
For product information, visit www.mathworks.com.


ans =

    'Hello World'