Table of Contents
Setting up the environment and invoking from a Research Computing server
Submitting Matlab jobs on a Research Computing server
Overview
Matlab is a high performance language for technical computing. Computation, visualization, and programming are integrated in an easy-to-use environment. Matlab can be used for mathematics, modeling, simulation, data analysis, visualization, scientific and engineering graphics.
| Default Version: | 2013a (Kure/Killdevil) |
| Installed Version(s): |
2012a, 2012b, 2013a (Kure/Killdevil) |
| Research Computing Servers: | Kure, Killdevil |
Research Computing purchases licenses (for university owned machines) for not only the basic Matlab but also for a number of toolboxes (6017 licenses are available for basic Matlab and for each of the toolboxes listed below):
Bioinformatics Toolbox
Communications Blockset
Communications Toolbox
Control System Toolbox
Curve Fitting Toolbox
Data Acquisition Toolbox
Database Toolbox
Filter Design Toolbox
Financial Derivatives Toolbox
Financial Toolbox
Fixed-Point Toolbox
Fuzzy Logic Toolbox
Genetic Algorithm & Direct Search Tlbx
Image Acquisition Toolbox
Image Processing Toolbox
Instrument Control Toolbox
MATLAB Builder EX
MATLAB Builder JA
MATLAB Builder NE
MATLAB Compiler
MATLAB Report Generator
Mapping Toolbox
Model Predictive Control Toolbox
Neural Network Toolbox
OPC Toolbox
Optimization Toolbox
Parallel Computing Toolbox
Partial Differential Equation Toolbox
Real-Time Workshop
Robust Control Toolbox
Signal Processing Blockset
Signal Processing Toolbox
SimBiology
SimMechanics
Simscape
Simulink
Simulink Control Design
Simulink Parameter Estimation
Simulink Report Generator
Simulink Verification and Validation
Spline Toolbox
Spreadsheet Link EX
Stateflow
Statistics Toolbox
Symbolic Math Toolbox
System Identification Toolbox
Video and Image Processing Blockset
Virtual Reality Toolbox
Wavelet Toolbox
xPC Target
You can choose to either install Matlab locally in your personal computer by ordering copy of Matlab from UNC’s Software Acquisition office or run Matlab on ITS lab computers, or the Research Computing server. Campus-wide licenses for the use of Matlab at UNC-CH are checking out from the UNC license server.
Installation
You can install Matlab locally in your computer but check out licenses from the UNC license server. Matlab is available to faculty/staff and students for various operating systems through UNC Software Acquisition Office. Please visit their webpage for more information.
Matlab will be started locally on your machine, but the application will look for the UNC license servers through the Internet and check out licenses when it starts. Therefore, a network connection for your machine is required for Matlab to run.
After you get the installation copy of Matlab, refer to these directions:
- You will need a license file in order to install Matlab. Refer to these instructions to obtain a license file (license.dat).
- Follow these installation instructions to install Matlab locally.
Setting up the environment and invoking from a Research Computing server
Matlab is available for use on the Research Computing Servers: Kure, and Killdevil. The following documents provide instructions for invoking Matlab and other high performance computing software. These documents include general instructions common to all applications, and specific instructions for each application.
- Invoking applications on a Research Computing Server from a UNIX/Linux desktop computer
- Invoking applications on a Research Computing Server from a Microsoft Windows computer
Submitting Matlab jobs on a Research Computing server
This section covers specific examples of how to submit various types of Matlab jobs on Research Computing’s two main compute clusters: Kure and KillDevil.
To start you will need to add Matlab to your cluster environment using the module commands:
module add matlab
module initadd matlab
All of the following examples assume you are in the directory where your Matlab script is located.
Serial job submission
The first examples cover submitting serial Matlab jobs. On Kure and KillDevil, the easiest way to submit a serial Matlab job is to use the bmatlab script:
bmatlab matlabjob.m
In the above example, “matlabjob.m” is the name of the Matlab script being submitted.
If you do not want to use the bmatlab script then you can use the following command instead and modify it as necessary to suit your job’s requirements:
bsub matlab -nodisplay -nosplash -singleCompThread -r matlabjob
-logfile matlabjob.out
The above command (which should all be on one line) submits the Matlab script “matlabjob.m” (yes, leave the .m off in the “-r” part of job submission command) and creates an output file called “matlabjob.out” in the current working directory.
Parallel job submission
The next example covers how to submit Matlab parallel jobs that use the Parallel Computing Toolbox. To begin with, in your Matlab script you should have the following Matlab code
where “m” is a number indicating the pool size. On Kure “m” has to be a positive integer less than or equal to 8 and on KillDevil “m” has to be a positive integer less than or equal to 12. Then to submit your job you can do the command:
bsub -n m -R “span[hosts=1]” matlab -nodisplay -nosplash -singleCompThread
-r matlabparjob -logfile matlabparjob.out
In the above bsub command “m” needs to be the same number as you specified in your matlab pool open statement. This command (which should all be on one line) submits a Matlab script called “matlabparjob.m” and creates an output file called “matlabparjob.out” in the current working directory.
Interactive job submission
Finally, to start a Matlab job on the compute cluster which gives you the Matlab GUI you can do the command
xmatlab
For the “xmatlab” command to work you need to have an X connection to the server.
Tutorials
- Introduction to Matlab is an online documentation written by the Research Computing group can help you start learning Matlab. It contains a number of examples.
- The Matlab Tutorial section of the Matlab online documentation provided by MathWorks is also useful for users new to this software.
FAQs
Useful links
References
- D. Redfern and C. Campbell, “The Matlab 5 Handbook”, Springer, New York, 1998.
- D. Hanselman and B. Littlefield, “Mastering Matlab 6 – A Comprehensive Tutorial and Reference”, Prentice Hall, New Jersey, 2001.
Additional help

