ARCHIVED: Use MATLAB on Big Red II at IU
On this page:
Overview
On Big Red II at Indiana University, you can use MATLAB interactively from the command line or in batch mode using a TORQUE job script. If your interactive session will require more than 20 minutes of processor time, you must run it as an interactive job on one of Big Red II's compute nodes in the Cluster Compatibility Mode (CCM) execution environment.
Set up your user environment
On the research supercomputers at Indiana University, the Modules environment management system provides a convenient method for dynamically customizing your software environment.
To use MATLAB on Big Red II, you must first add the
matlab
module to your user environment. To run MATLAB jobs on Big Red II's compute nodes in the CCM execution environment, you also must add the ccm
module to your user environment. To make sure both modules are loaded every time you log into Big Red II, add the following lines to your
~/.modules
file:
module load matlab module load ccm
For more, see Use modules to manage your software environment on IU research supercomputers.
Submit a MATLAB batch job
To submit a MATLAB batch job that will run on Big Red II's compute nodes in the CCM execution environment:
- Create an m-file (for example,
matlab_input.m
) containing the commands MATLAB should run. - Create a job script (for example,
matlab_job
) for the TORQUE resource manager on Big Red II. Your job script must include theccmrun
command, which will launch MATLAB on a compute node in the CCM environment, and the-l gres=ccm
flag.For example (replace
username
with your IU username andusername@iu.edu
with your IU email address):#!/bin/bash #PBS -l nodes=1:ppn=32 #PBS -l walltime=00:10:00 #PBS -l gres=ccm #PBS -m ae #PBS -M username@iu.edu #PBS -N matlab_job_name #PBS -V cd /N/u/username/BigRed2/new_directory ccmrun matlab -r matlab_input
The above example job script will:
- Change the working directory to the directory where the
matlab_input.m
m-file is located. - Invoke
ccmrun
to launch MATLAB. - Have MATLAB run the commands in the m-file (with the
-r
option, you can leave off the m-file's.m
extension). - Have Big Red II email you when the job is complete.
- Change the working directory to the directory where the
- Submit the job script to the TORQUE resource manager; on the command prompt, enter:
qsub matlab_job
- To check the status of your job, use the
qstat
command (replaceusername
with your IU username):qstat -u username
Run MATLAB interactively
If your interactive session will require less than 20 minutes of processor time, you can load the matlab
module and launch the application from the Big Red II command line; for example:
jajbinks@login1:~> module load matlab jajbinks@login1:~> matlab
Interactive sessions requiring more than 20 minutes of processor time must be run as interactive jobs on a Big Red II compute nodes in the CCM execution environment. This method of interactive execution is strongly recommended, as the login nodes are not intended for computational work.
To run an interactive MATLAB job on Big Red II:
- Make sure your user environment is configured properly; see Setting up your user environment above.
- From the command line, enter the
qsub
command with the-I
(interactive),-l gres=ccm
, and-q cpu
(CPU queue) flags added; for example:jajbinks@login1:~> qsub -I -l walltime=01:00:00 -l nodes=1:ppn=32 -l gres=ccm -q cpu
When the resources needed to run your job are available, your job will start. Once the CCM execution environment is initialized, you'll be placed on one of Big Red II's
aprun
nodes:qsub: waiting for job 79064 to start qsub: job 79064 ready In CCM JOB: 79064 JID 79064 USER jajbinks GROUP uits Initializing CCM environment, Please Wait waiting for jid.... CCM Start success, 1 of 1 responses Directory: /N/u/jajbinks/BigRed2 Tue Sep 10 15:29:21 EDT 2013 jajbinks@aprun1:~>
- From the
aprun
command line, enter theccmlogin
command:jajbinks@aprun1:~> ccmlogin
This will place you on a Big Red II compute node (for example,
nid00885
):Warning: Permanently added '[nid00885]:203' (RSA) to the list of known hosts. jajbinks@nid00885:~>
- From the compute node command prompt, enter
matlab
to launch MATLAB:jajbinks@nid00885:~> matlab Warning: No display specified. You will not be able to display graphics on the screen. Warning: No window system found. Java option 'Desktop' ignored. < M A T L A B (R) > Copyright 1984-2013 The MathWorks, Inc. R2013a (8.1.0.604) 64-bit (glnxa64) February 15, 2013 No window system found. Java option 'Desktop' ignored. To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com. >>
To use the features of the MATLAB graphical user interface (GUI), you must SSH to Big Red II with X forwarding enabled, and then use qsub
with the -I
(interactive) and
-X
(X forwarding) switches, as well as the
-l gres=ccm
switch; for example:
jajbinks@login1:~> qsub -I -X -l walltime=00:02:00 -l nodes=1:ppn=32 -l gres=ccm -q cpu
For instructions on setting up and using X forwarding, see Use X forwarding on a personal computer to securely run graphical applications installed on IU's research supercomputers.
Get help
If you need help or have a question about using MATLAB on Big Red II, contact the UITS Research Applications and Deep Learning team.
Research computing support at IU is provided by the Research Technologies division of UITS. To ask a question or get help regarding Research Technologies services, including IU's research supercomputers and research storage systems, and the scientific, statistical, and mathematical applications available on those systems, contact UITS Research Technologies. For service-specific support contact information, see Research computing support at IU.
This is document bdns in the Knowledge Base.
Last modified on 2023-05-09 14:41:13.