Difference between revisions of "Matlab"

From UFRC
Jump to navigation Jump to search
Line 1: Line 1:
==Installation==
+
__NOTOC__
<pre>
+
__NOEDITSECTION__
Version: 2009b
+
[[Category:Software]]
Location: /apps/matlab/2009b
+
<!-- ########  Template Configuration ######## -->
</pre>
+
<!--Edit definitions of the variables used in template calls
 +
Required variables:
 +
app - lowercase name of the application e.g. "amber"
 +
url - url of the software page (project, company product, etc) - e.g. "http://ambermd.org/"
 +
Optional variables:
 +
INTEL - Version of the Intel Compiler e.g. "11.1"
 +
MPI - MPI Implementation and version e.g. "openmpi/1.3.4"
 +
-->
 +
{|
 +
<!--Main settings - REQUIRED-->
 +
|{{#vardefine:app|matlab}}
 +
|{{#vardefine:url|http://www.mathworks.com/}}
 +
<!--Compiler and MPI settings - OPTIONAL -->
 +
|{{#vardefine:intel|}} <!-- E.g. "11.1" -->
 +
|{{#vardefine:mpi|}} <!-- E.g. "openmpi/1.3.4" -->
 +
<!--Choose sections to enable - OPTIONAL-->
 +
|{{#vardefine:mod|1}} <!--Present instructions for running the software with modules -->
 +
|{{#vardefine:exe|1}} <!--Present manual instructions for running the software -->
 +
|{{#vardefine:conf|}} <!--Enable config wiki page link - {{#vardefine:conf|1}} = ON/conf|}} = OFF-->
 +
|{{#vardefine:pbs|}} <!--Enable PBS script wiki page link-->
 +
|{{#vardefine:policy|}} <!--Enable policy section -->
 +
|{{#vardefine:testing|}} <!--Enable performance testing/profiling section -->
 +
|{{#vardefine:faq|}} <!--Enable FAQ section -->
 +
|{{#vardefine:citation|}} <!--Enable Reference/Citation section -->
 +
|}
 +
<!-- ########  Template Body ######## -->
 +
<!--Description-->
 +
{{#if: {{#var: url}}|
 +
{{App_Description|app={{#var:app}}|url={{#var:url}}}}|}}
 +
MATLAB is a programming environment for algorithm development, data analysis, visualization, and numerical computation. Using MATLAB, you can solve technical computing problems faster than with traditional programming languages, such as C, C++, and Fortran.
  
 +
You can use MATLAB in a wide range of applications, including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology. For a million engineers and scientists in industry and academia, MATLAB is the language of technical computing.
 +
<!--Location-->
 +
{{App_Location|app={{#var:app}}|{{#var:ver}}}}
 +
==Available Versions==
 +
* 2009b (EL5)
 +
* 2012a (EL6)
 +
{{#if: {{#var: mod}}|==Running the application using modules==
 +
{{App_Module|app={{#var:app}}|intel={{#var:intel}}|mpi={{#var:mpi}}}}|}}
 +
{{#if: {{#var: exe}}|==How To Run==
 +
|}}
 +
{{#if: {{#var: conf}}|==Configuration==
 +
See the [[{{PAGENAME}}_Configuration]] page for {{#var: app}} configuration details.
 +
|}}
 +
{{#if: {{#var: pbs}}|==PBS Script Examples==
 +
See the [[{{PAGENAME}}_PBS]] page for {{#var: app}} PBS script examples.|}}
 +
{{#if: {{#var: policy}}|==Usage policy==
 +
WRITE USAGE POLICY HERE (perhaps templates for a couple of main licensing schemes can be used)
 +
|}}
 +
{{#if: {{#var: testing}}|==Performance==
 +
WRITE PERFORMANCE TESTING RESULTS HERE|}}
 +
{{#if: {{#var: faq}}|==FAQ==
 +
*'''Q:''' **'''A:'''
 +
|}}
 +
{{#if: {{#var: citation}}|==Citation==
 +
If you publish research that uses {{#var: app}} you have to cite it as follows:
 +
X. Yang, K. Dorman and S. Aluru, “Reptile: Representative tiling for short read error correction”, Bioinformatics, 26(20), 2526-2533, 2010.
 +
|}}
 
==Policies==
 
==Policies==
 
# You may not run MatLab nor compiled MatLab executables interactively on submit1 or submit2.
 
# You may not run MatLab nor compiled MatLab executables interactively on submit1 or submit2.
Line 18: Line 74:
  
 
1. Once on submit1 or submit2, log into one of the test nodes (test01 - test05) via ssh.  Due to user memory constraints on submit1 and submit2, the MatLab compiler cannot be used on them.
 
1. Once on submit1 or submit2, log into one of the test nodes (test01 - test05) via ssh.  Due to user memory constraints on submit1 and submit2, the MatLab compiler cannot be used on them.
<pre>
+
submit1% ssh test05
submit1% ssh test05
 
</pre> 
 
 
2. Set up your environment so that the libraries needed by the compiler can be found.
 
2. Set up your environment so that the libraries needed by the compiler can be found.
<pre>
 
 
  test05% export LD_LIBRARY_PATH=/apps/matlab/2009b/bin/glnxa64:/apps/matlab/2009b/sys/os/glnxa64
 
  test05% export LD_LIBRARY_PATH=/apps/matlab/2009b/bin/glnxa64:/apps/matlab/2009b/sys/os/glnxa64
 
  test05% export PATH=${PATH}:/apps/matlab/2009b/bin
 
  test05% export PATH=${PATH}:/apps/matlab/2009b/bin
</pre>
 
 
 
'''Note:''' These environment settings should be included in your batch submission script since they will also be needed by the resulting MatLab executable.  
 
'''Note:''' These environment settings should be included in your batch submission script since they will also be needed by the resulting MatLab executable.  
  
 
3a. For batch jobs, you should also set the MCR_CACHE_ROOT environment variable in your PBS job script.
 
3a. For batch jobs, you should also set the MCR_CACHE_ROOT environment variable in your PBS job script.
<pre>
 
 
  test05% export MCR_CACHE_ROOT=${TMPDIR}
 
  test05% export MCR_CACHE_ROOT=${TMPDIR}
</pre>
 
 
 
Please see the [[PBS Sample Job Scripts]] for a sample MatLab submission script.
 
Please see the [[PBS Sample Job Scripts]] for a sample MatLab submission script.
  
 
3b. For an interactive run (only on the test nodes), you should set MCR_CACHE_ROOT to a directory /scratch/local.
 
3b. For an interactive run (only on the test nodes), you should set MCR_CACHE_ROOT to a directory /scratch/local.
 
<pre>
 
 
  test05% mkdir -p /scratch/local/$USER/mcr_cache
 
  test05% mkdir -p /scratch/local/$USER/mcr_cache
 
  test05% export MCR_CACHE_ROOT=/scratch/local/$USER/mcr_cache
 
  test05% export MCR_CACHE_ROOT=/scratch/local/$USER/mcr_cache
</pre>
 
  
 
4. Compile your matlab program (.m) files using the MatLab compiler ([[mcc]]).
 
4. Compile your matlab program (.m) files using the MatLab compiler ([[mcc]]).
<pre>
 
 
  test05% mcc -R -singleCompThread -m some_prog.m
 
  test05% mcc -R -singleCompThread -m some_prog.m
</pre>
 
 
 
===Example===
 
===Example===
 
Let us say that we have a program such as that below in a source file named houdini.m
 
Let us say that we have a program such as that below in a source file named houdini.m
Line 91: Line 133:
 
Documentation for the MatLab compiler can be viewed on the [http://www.mathworks.com/access/helpdesk/help/toolbox/compiler MatLab Website].
 
Documentation for the MatLab compiler can be viewed on the [http://www.mathworks.com/access/helpdesk/help/toolbox/compiler MatLab Website].
  
===Is the Distributed Computing Toolbox available?===
+
===Available components===
No, not at this time.  The University of Florida has not purchased a license for that product.   The HPC Center has no budget for application software or licensing.  Users and/or groups must purchase commercial software on their own.
+
See the [[Matlab add-ons]] for a full list of licensed Matlab components.
 
 
 
===Compiled DLL===
 
===Compiled DLL===
 
If you have compiled a DLL to use as an executable, it will not run on the cluster. DLL's are Microsoft Windows based dynamically linked libraries that will only work under the Windows operating system.
 
If you have compiled a DLL to use as an executable, it will not run on the cluster. DLL's are Microsoft Windows based dynamically linked libraries that will only work under the Windows operating system.
Line 121: Line 162:
 
  export MCR_CACHE_ROOT=$TMPDIR
 
  export MCR_CACHE_ROOT=$TMPDIR
 
</pre>
 
</pre>
 +
 +
 +
==Interactive Use==
 +
To connect to a test node, for example test01, where you can run the graphical MatLab interface use the following or a similar command on a linux or MacOS X system:
 +
ssh USER@test01.ufhpc -o ForwardX11=yes -o ForwardX11Trusted=yes -o ProxyCommand='ssh USER@submit.hpc.ufl.edu exec nc test01 %p'
 +
or add the following to your ~/.ssh/config file:
 +
Host test01
 +
    User USER
 +
    KeepAlive yes
 +
    ProxyCommand ssh USER@submit.hpc.ufl.edu exec nc test01 %p
 +
    ForwardX11 yes
 +
    ForwardX11Trusted yes
 +
where USER is your username. After editing ~/.ssh/config you can just run the following command to connect:
 +
ssh test01
 +
 +
Once connected run
 +
module load matlab
 +
matlab

Revision as of 01:37, 9 August 2012

Description

{{{name}}} website  
MATLAB is a programming environment for algorithm development, data analysis, visualization, and numerical computation. Using MATLAB, you can solve technical computing problems faster than with traditional programming languages, such as C, C++, and Fortran.

You can use MATLAB in a wide range of applications, including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology. For a million engineers and scientists in industry and academia, MATLAB is the language of technical computing. Template:App Location

Available Versions

  • 2009b (EL5)
  • 2012a (EL6)

Running the application using modules

To use matlab with the environment modules system at HPC the following commands are available:

Get module information for matlab:

$module spider matlab

Load the default application module:

$module load matlab

The modulefile for this software adds the directory with executable files to the shell execution PATH and sets the following environment variables:

  • HPC_MATLAB_DIR - directory where matlab is located.

How To Run

Policies

  1. You may not run MatLab nor compiled MatLab executables interactively on submit1 or submit2.
  2. You must use the test nodes (test01 - test05) to test and compile your MatLab programs.
  3. Long running (more than 30 minutes) MatLab jobs must be submitted to the batch system.
  4. Large numbers of jobs must not be run on the test nodes but must be submitted to the batch system.
  5. The UF HPC Center has no budget for application software and licensing. All MatLab licenses (including the compiler) come from, and are shared with, all of campus. For this reason it is sometimes difficult to obtain a license. If your research depends on MatLab and you do not want to be delayed by licensing issues, you should consider purchasing a MatLab license for your personal or group use.

Compiling MatLab Programs

MatLab programs must be compiled via the MatLab compiler before they can be run in batch mode on the HPC Center cluster. In order to compile MatLab programs you should

1. Once on submit1 or submit2, log into one of the test nodes (test01 - test05) via ssh. Due to user memory constraints on submit1 and submit2, the MatLab compiler cannot be used on them.

submit1% ssh test05

2. Set up your environment so that the libraries needed by the compiler can be found.

test05% export LD_LIBRARY_PATH=/apps/matlab/2009b/bin/glnxa64:/apps/matlab/2009b/sys/os/glnxa64
test05% export PATH=${PATH}:/apps/matlab/2009b/bin

Note: These environment settings should be included in your batch submission script since they will also be needed by the resulting MatLab executable.

3a. For batch jobs, you should also set the MCR_CACHE_ROOT environment variable in your PBS job script.

test05% export MCR_CACHE_ROOT=${TMPDIR}

Please see the PBS Sample Job Scripts for a sample MatLab submission script.

3b. For an interactive run (only on the test nodes), you should set MCR_CACHE_ROOT to a directory /scratch/local.

test05% mkdir -p /scratch/local/$USER/mcr_cache
test05% export MCR_CACHE_ROOT=/scratch/local/$USER/mcr_cache

4. Compile your matlab program (.m) files using the MatLab compiler (mcc).

test05% mcc -R -singleCompThread -m some_prog.m

Example

Let us say that we have a program such as that below in a source file named houdini.m

function [m,t] = houdini();
% Doc example, chapter 3.

% Copyright 1997 The MathWorks, Inc.
% $Revision: 1.1.6.1 $

m = magic(2); % Assign 2x2 matrix to m. 
t = m .^ 3;   % Cube each element of m. 
disp(t);      % Display the value of t.

Since we already have the environment setup, we can compile this program. It is recommended that this be done in a separate directory as a number of files are produced.

 test05% mkdir tmp
 test05% cd tmp
 test05% cp ../houdini.m .
 test05% ls
houdini.m
 test05% export LD_LIBRARY_PATH=/apps/matlab/2009b/bin/glnxa64:/apps/matlab/2009b/sys/os/glnxa64
 test05% export PATH=${PATH}:/apps/matlab/2009b/bin
 test05% mcc -R -singleCompThread -m houdini.m 
Warning: Unable to open display , MATLAB is starting without a display.
  You will not be able to display graphics on the screen.
 test05% ls -l
total 124
-rwxr-xr-x  1 root root 12299 Apr  3 10:08 houdini
-rw-r--r--  1 root root 63146 Apr  3 10:08 houdini.ctf
-rw-r--r--  1 root root   239 Apr  3 10:06 houdini.m
-rw-r--r--  1 root root  2900 Apr  3 10:08 houdini_main.c
-rw-r--r--  1 root root  6328 Apr  3 10:08 houdini_mcc_component_data.c
-rw-r--r--  1 root root  5461 Apr  3 10:08 houdini.prj
-rw-r--r--  1 root root  1010 Apr  3 10:08 mccExcludedFiles.log
-rw-r--r--  1 root root  6757 Apr  3 10:08 readme.txt
-rwxr--r--  1 root root  1446 Apr  3 10:08 run_houdini.sh

The MatLab executable houdini has been generated.

Note: The "-R -singleCompThread" options on the mcc command line will result in a single-threaded executable. By default, multi-threading is enabled in executables produced by mcc. The result is that one computational thread will be started for each processor in a machine that runs your executable. That's not usually what you want. Unless you know what you are doing and intend to take advantage of multithreading (including requesting the appropriate resources in your submission script) you should use these options and generate a single-threaded executable. Otherwise, your MatLab jobs will oversubscribe the compute nodes and interfere with other users' programs.


Documentation for the MatLab compiler can be viewed on the MatLab Website.

Available components

See the Matlab add-ons for a full list of licensed Matlab components.

Compiled DLL

If you have compiled a DLL to use as an executable, it will not run on the cluster. DLL's are Microsoft Windows based dynamically linked libraries that will only work under the Windows operating system.

Setting a Path

In order to set a path in your MatLab program should add the following code.

path(path, '/path/to/wherever/you/want')

This would add a search path to the MatLab system. For more information see the Matlab web site.

Known Issues

No Licenses Available

You may run into an error when using the MatLab compiler such as

Licensed number of users already reached.

If so, the number of licenses available for the MatLab compiler has been exceeded. There are only two shared among the entire university so you should expect to see this problem from time to time if you use the MatLab compiler frequently.

MCR_CACHE_ROOT Directory

Could not access the MCR component cache

This error message means that MatLab is not able to access the MCR cache directory which, by default, is created by MatLab in your home directory. If you are running a large number of MatLab jobs, the file locking used by MatLab to manage concurrent access to files in the MCR_CACHE_ROOT directory can generate a significant load on the file system on which these files reside. Thus, we ask that you use a local scratch directory for your MCR_CACHE_ROOT directory. To do so, set the value of MCR_CACHE_ROOT to $TMPDIR in your job submission script.

 export MCR_CACHE_ROOT=$TMPDIR


Interactive Use

To connect to a test node, for example test01, where you can run the graphical MatLab interface use the following or a similar command on a linux or MacOS X system:

ssh USER@test01.ufhpc -o ForwardX11=yes -o ForwardX11Trusted=yes -o ProxyCommand='ssh USER@submit.hpc.ufl.edu exec nc test01 %p'

or add the following to your ~/.ssh/config file:

Host test01
   User USER
   KeepAlive yes
   ProxyCommand ssh USER@submit.hpc.ufl.edu exec nc test01 %p
   ForwardX11 yes
   ForwardX11Trusted yes

where USER is your username. After editing ~/.ssh/config you can just run the following command to connect:

ssh test01

Once connected run

module load matlab
matlab