HPC/Applications/matlab: Difference between revisions

From CNM Wiki
Jump to navigation Jump to search
Line 104: Line 104:
The run_''myname''.sh script will be generated by the compiler. It expects as its first argument a path to a MATLAB runtime. On Carbon, the main MATLAB installation directory can be used, whose path is provided by the matlab module file in the environment variable shown, following [[HPC/Module_Setup#Module_Conventions_on_Carbon|local conventions]].
The run_''myname''.sh script will be generated by the compiler. It expects as its first argument a path to a MATLAB runtime. On Carbon, the main MATLAB installation directory can be used, whose path is provided by the matlab module file in the environment variable shown, following [[HPC/Module_Setup#Module_Conventions_on_Carbon|local conventions]].


=== Running in parallel ===
=== Parallel toolkit===
* http://www.mathworks.com/help/distcomp/
* or http://www.mathworks.com/help/releases/R2013a/distcomp/
* http://www.mathworks.com/help/distcomp/release-notes.html?searchHighlight=matlabpool
*: parpool: New command-line interface (replaces matlabpool)
* http://www.mathworks.com/help/mdce/release-notes.html?searchHighlight=matlabpool
*: Same, plus: Discontinued Support for parallel.cluster.Mpiexec
*: Automatic start of a parallel pool when executing code that uses parfor or spmd
 
  An error has occurred processing your job, see below.
  An error has occurred processing your job, see below.
  Post job file processing error; job 435379.sched1.carboncluster on host n189/7+n189/6+…+n187/0
  Post job file processing error; job 435379.sched1.carboncluster on host n189/7+n189/6+…+n187/0

Revision as of 18:03, February 18, 2014

Alternatives

MATLAB is vendor-specific, and comparably expensive licensed software and thus not generally available. Consider using an unencumbered alternative solution.

Octave

If you have existing MATLAB code, try running in using GNU Octave instead of MATLAB for all but the most demanding or vendor-specific tasks:

  • To start octave:
octave

Python or Perl

For more flexibility, use a general-purpose scripting language.

NLopt – Nonlinear optimization

For users wishing to solve nonlinear optimization problems, the nlopt module is a fairly general-purpose optimization library with interfaces in C, C++ and Fortran.

Licensing

MATLAB is available on Carbon on request, and is subject to strictly limited license terms. Running MATLAB is restricted to:

  • Argonne employees (including consultants and students),
  • by one user at a time.

Toolboxes

We have the following toolboxes installed:

  • Curve Fitting Toolbox
  • Image Processing Toolbox
  • Optimization Toolbox
  • Parallel Computing Toolbox
  • Statistics Toolbox


Running MATLAB

  • To get started, load the "matlab" module as described at HPC/Module Setup.
  • Then choose how to run the application:
GUI
matlab
Command line
For basic calculations, you could save some startup time by simply using the text interface.
matlab -nojvm
Does not load the Java VM and toolboxes requiring any java.

or

matlab -nodisplay
Suppresses X11.

Running the MATLAB compiler

As of 2013, we have available a MATLAB compiler on Carbon. This compiler allows you to create standalone Linux binaries that do not need a MATLAB license token in order to run. It is therefore highly recommended to use this tool to enable your MATLAB scripts to run when you need them, regardless of other users' demands on our MATLAB license.

Note that the compiler is, unfortunatley, rather slow and unwieldy to use and leaves much to be desired. Compilation of a simple "hello world" script takes several minutes.

Documentation

Consult the vendor site for full documentation. Useful starting points:

Quickstart

  • Connect to clogin5 .
  • Locate your toplevel file and function, say file myfunc.m.
  • Create a target directory, deploydir.
mkdir deploydir

Basic compiler options

mcc -v \
	-o myname \
	-W main \
	-T link:exe \
	-d deploydir \
	myfunc.m
  • You must use a separate deploydir, and it must be a directory other than $PWD or "." Attempting to deploy into the current directory leads to an obscure runtime error "Compiled parallel application fails: distcompdeserialize".
  • -v is optional but useful to get progress info during the lengthy compile process.

Additional options

You can include the following lines, before naming your own .m file:

  • To always write a log file upon execution:
	-R '-logfile,myfile.log' \
  • The compilation is very slow, but may be sped up by removing toolboxes that are not used, and only adding those that are:
 	-N -p distcomp -p images \
    • The toolboxes that can be given for the -p option are:
$ ls /opt/soft/matlab-R2013a-8/toolbox/
compiler  curvefit  distcomp  images  local  matlab  optim  shared  stats

Running the executable

cd deploydir
./run_myname.sh $MATLAB_HOME args-for-your-program

The run_myname.sh script will be generated by the compiler. It expects as its first argument a path to a MATLAB runtime. On Carbon, the main MATLAB installation directory can be used, whose path is provided by the matlab module file in the environment variable shown, following local conventions.

Parallel toolkit

An error has occurred processing your job, see below.
Post job file processing error; job 435379.sched1.carboncluster on host n189/7+n189/6+…+n187/0

Unable to copy file /var/spool/torque/spool/435379.sched1.carboncluster.OU to /home/stern/somedir/Job1/Job1.log
*** error from copy
/bin/cp: cannot create regular file `/home/stern/somedir/Job1/Job1.log': No such file or directory
*** end error output
Output retained on that host in: /var/spool/torque/undelivered/435379.sched1.carboncluster.OU

Troubleshooting

Access

To run MATLAB on Carbon, you must be a member of the "employees" group. You could still load the "matlab" module if you are not, but it will not enable anything.

  • To inspect your current group membership, run:
groups
The word "employees" must show.


License in use

License checkout failed.
License Manager Error -9
This error may occur when:
-The hostid of this computer does not match the hostid in the license file.
-A Designated Computer installation is in use by another user.
If no other user is currently running MATLAB, you may need to activate.

Solution:

  • Wait a few minutes or hours.
  • For urgent request, to locate and possibly terminate an existing session, Send a support request.