You are here

MATLAB, Simulink and MATLAB Distributed Compute Server

Both the MATLAB client and the MATLAB Distributed Compute Server (MDCS) products from Mathworks are available on Minerva.The current version for both is R2014b.


Accessing the MATLAB and SIMULINK client on Minerva

Users can use the MATLAB client on Minerva as part of the MATLAB Total Academic Headcount license administered by Academic IT. Users are required to purchase an activation for Minerva just as they must for a local desktop copy. This is done by filling out the Mathworks Software Distribution Form found here and checking the "Minerva" box. Once the Scientific Computing staff is notified by Academic IT, the user will be given permission to use MATLAB on Minerva.

The license on Minerva is a Network floating license and allows a user to run on any node in the Minerva complex but only on one node at a time. One can have multiple instatiations of MATLAB on the same node just as they can on a local installation. Access to the MATLAB program on Minerva is by way of the module system so the user does not download a personal copy:

> module load matlab
> matlab

The MATLAB client can be run in either graphics mode or command line mode. If one wants to run in graphics mode, you must use X-forwarding when you log in:

> ssh -X <userid>@mothra.hpc.mssm.edu
Because one should never use the login node for computing, you will need to ssh to an interactive node:

> ssh -X interactive1

or submit a batch interactive job to a compute node:

> bsub -q low -Ip -XF -W 2:00 /bin/bash

The -Ip option will create an interactive job with a pseudo-terminal; the -XF will allow X-forwarding. The command above starts the interactive session with only one cpu. The Parallel Toolkit(PTK) of MATLAB allows the user to start up 12 additional workers for parallel work. If you plan on using the PTK, then you should also use the -n option to specify that additional cores need to be allocated to your job.

> bsub -q low -n 4 -Ip -XF -W 2:00 /bin/bash
or however many cpu's you will be using


MATLAB Distributed Compute Server (MDCS)

Minerva also supports the MATLAB Distributed Compute Server. The MDCS allows for large scale Matlab scripts to be run in batch mode and supports both serial and parallel calculations. Jobs can be submited from MATLAB clients running on Minerva or on remote workstations. The MDCS can also execute parallel Matlab code snippets in real time from scripts being run on a Minerva MATLAB instance by using the matlabpool and the parfor constructs. Unfortunately, because we use two-factor authentication, using this real-time feature from a remote MATLAB instance will not work. The MATLAB batch command, however, will work. For more information about the MDCS see the MathWorks MDCS web page.


Communication with the MDCS

Communicating with the MDCS from a MATLAB client application is essentially the same whether the application is running on Minerva or on a user's workstation.

  • Both the MATLAB client and the MDCS must be the same version. Currently: R2014b.
  • The Parallel Computing Toolkit (PCT) must be available on the MATLAB client ( If MATLAB is downloaded using the Mount Sinai TAH license, it is there by default )
  • A set of helper scripts must be downloaded. There are 2 versions: one for Minerva clients; another for remote workstation clients.
  • A bit of configuration needs to be done.
  • A validation needs to be run.


Remote Client Setup

Preliminaries:

  1. Make sure your version of MATLAB is R2014b.
  2. Make sure you have a Minerva account. If you do not have one, you can apply for one here.
  3. Once you have a Minerva userid, log on and create a folder named MdcsDataLocation. This is where MATLAB will be putting files needed for communications between the MDCS and the MATLAB client and can be anywhere.
  4. You will need to know the fully qualified domain name (FQDN) of your machine.
    • If your local machine is a linux or Mac machine, type "hostname -f" in a window and note the response. It should look something like mymachine.1425mad.mssm.edu.
    • If your local machine is a PC, click Start > All programs > Command Prompt. Then enter "ipconfig /all" in the window that just opened. You will want to concatenate the "Host Name" and the "Connection-specific DNS name" with a dot in between.

    You will need this name each time you want to use the MDCS.

  5. Download the mdcslsf_remote.zip file to your local workstation and unzip it in a convenient and save location. It will create a directory/folder called mdcslsf and contain various MATLAB scripts needed for communication.

Configuration

  1. Start up MATLAB.
  2. BEFORE YOU DO ANYTHING ELSE AND EACH TIME YOU START UP MATLAB enter:

    pctconfig('hostname','The FQDN you looked up when you started'

    A convenient way to do this is to edit or create a startup.m script in a folder that is in the MATLAB path, e.g, $MATLABROOT/toolkit/local.

  3. Click on Set Path and add the mdcslsf folder to the path.
  4. Click on Parallel > Manage Cluster Profiles
  5. Click on Import and navigate to the mdcslsf folder. From there, import minerva_r2014b.settings
  6. In the Cluster Profile frame, select the minerva_r2014b profile.
  7. Click Edit and make the following edits to the profile:
  • Folder where cluster stores job data: Change to the name of a folder on your workstation to be used for communication.



  • SUBMIT FUNCTIONS: For both IndependetSubmitFcn and CommunicatingSubmitFCN, change third element of the triplet to the name of a folder you created on Minerva to be used for communication.




  • Click Done
  • Click the big Validate button to begin validation of your setup. Validations require batch jobs being submitted to Minerva. Based on job load, this could take some time. You should see a window open for you to enter your Minerva userid.





    Followed by one that requests your password. Remember to append your 6-digit token to your password.



  • MATLAB will submit jobs to Minerva to test various aspects of parallel computing. The Parallel pool test will fail because the MDCS does not support re-authentication with 2-factor signon.


  • You are now set to submit batch jobs or batch snippets to Minerva. You do not need to run the validation again unless you think something is wrong.


    Minerva Client Setup

    Make sure you have purchased a license from Academic IT. The form is here.

    1. Logon to Minerva.:
      • If using ssh, use the -X option to forward X-windows:

        ssh -X <username%#62;@minerva.hpc.mssm.edu
      • If using puTTY, make sure the Enable X11 forwarding button is checked:

        catagory -> connection -> SSH -> X11 -> ☑ Enable X11 forwarding
    2. Create a folder to be used for MDCS-MATLAB communication. Default is $HOME/MdcsDataLocation.
    3. Download the mdcslsf_minerva.tar file to your HOME directory on Minerva and untar it. This will create a directory/folder called mdcslsf and contain various MATLAB scripts needed for communication.
    4. Start up MATLAB:.


      > module load matlab

      > matlab
    5. Click on Set Path and add the mdcslsf folder to the path.
    6. Click on Parallel > Manage Cluster Profiles
    7. Click on Import and navigate to the mdcslsf folder. From there, import minerva_r2014b.settings
    8. In the Cluster Profile frame, select the minerva_r2014b profile.
    9. If you are using the default communication folder, no edits are necessary. If you created a different communication folder click Edit and change the name in the profile.
    10. Click on the Validate button
    11. Everything should work.



    ClusterInfo

    The ClusterInfo command is a local command that gets and sets parameters that control the running of MDCS jobs on the Minerva Cluster. It consists of several methods that set the parameters. There are, of course, corresponding get methods. You will most certainly need to modify some of these values to successfully run jobs on Minerva.


    ClusterInfo.state()

    The ClusterInfo.state() function will display the values of all the configurable parameters:



    ClusterInfo.setArch(string)
    ClusterInfo.getArch()

    This command will set the value for the -m option to the bsub which designates which architecture to use. Valid arguments are:

    • manda - Dispatch only to AMD nodes
    • mothra - Dispatch only to Intel nodes.

    Not specifying either will allow dispatch of the job to first available node.


    ClusterInfo.setClusterHost(string)
    ClusterInfo.getClusterHost()

    Not implemented. For future development.


    ClusterInfo.setEmailAddress(string
    ClusterInfo.getEmailAddress()

    This command sets/gets the user's email address for LSF to use.


    ClusterInfo.setUseGpu(boolean)
    ClusterInfo.getEmailAddress()

    This command sets/gets the UseGpu flag. If set, the submitted script will specify that a GPU node should be used. Arguments for the setUseGpu function is a boolean: true or false.


    ClusterInfo.setGpusPerNode(integer)
    ClusterInfo.getGpusPerNode()

    This command specifies the number of GPU's per node to allocate. Currently, the value can be only 1 or 2.


    ClusterInfo.setMemUsage(integer)
    ClusterInfo.getMemUsage()

    Set/get memory usage per core. Memory is specified in Megabytes and is the input to the -R rusage[mem=xxx] option to the bsub command.


    ClusterInfo.setProcsPerNode(integer
    ClusterInfo.getProcsPerNode()

    Set/get number of processors to use per node. This is the value used for the -R span[ptile=nprocs] option to the bsub command.


    ClusterInfo.setQueueName(string)
    ClusterInfo.getQueueName()

    Set/get the submission queue name. Value of the -q option to bsub.


    ClusterInfo.setProjectName(string)
    ClusterInfo.getProjectName()

    Set/get the project(account) name for this calculation. This is the value of the -P option to the bsub command.


    ClusterInfo.setUserDefinedOptions(string)
    ClusterInfo.getUserDefinedOptions()

    Set/get any valid string of LSF bsub options. This string is inserted directly as part of the bsub command.


    ClusterInfo.setUserNameOnCluster(string)
    ClusterInfo.getUserNameOnCluster()

    Set/get username to use when authenticating to the Minerva cluster.


    ClusterInfo.setWallTime(string)
    ClusterInfo.getWallTime()

    Set/get wall time for the remote job. This is a string in the standard LSF time format of HH:MM and will be the value of the -W option of bsub command.

    Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer