HPC/Applications/matlab: Difference between revisions

From CNM Wiki
Jump to navigation Jump to search
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== 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 [http://www.gnu.org/software/octave/ '''GNU Octave'''] instead of MATLAB for all but the most demanding or vendor-specific tasks:
* To start octave:
octave
* [http://www.gnu.org/software/octave/doc/interpreter/index.html GNU Octave Documentation]
* [http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB Differences between Octave and MATLAB] in the WikiBook ''MATLAB Programming'' (slightly out of date).
* [http://stackoverflow.com/questions/3534867/why-when-should-i-prefer-matlab-over-octave Why/when should I prefer MATLAB over Octave?] – Discussion at [http://stackoverflow.com/ stackoverflow.com].
=== Python or Perl ===
For more flexibility, use a general-purpose scripting language.
* Most users may want to look at [http://www.python.org/ Python] with [http://www.numpy.org/ NumPy], available as module "numpy" on Carbon. See also:
** [http://matplotlib.org/api/mlab_api.html Numerical python functions written for compatability with MATLAB]
** [http://www.scipy.org/NumPy_for_Matlab_Users NumPy for Matlab Users]
* Users who like a stonger Unix flavor should look at [http://www.perl.org/ Perl].
=== NLopt – Nonlinear optimization ===
For users wishing to solve nonlinear optimization problems, the [[HPC/Applications#nlopt | nlopt module]] is a fairly general-purpose optimization library with interfaces in C, C++ and Fortran.
== Licensing ==
== Licensing ==
[http://www.mathworks.com/ MATLAB] is available on Carbon on request, and is subject to strictly limited license terms.
[http://www.mathworks.com/ MATLAB] is available on Carbon on request, and is subject to strictly limited license terms.
Line 46: Line 24:
To request access to MATLAB on Carbon, [mailto:[email protected]?subject=MATLAB%20on%20Carbon send an email].
To request access to MATLAB on Carbon, [mailto:[email protected]?subject=MATLAB%20on%20Carbon send an email].
-->
-->
== Alternatives ==
Given licensing and availability limitations of MATLAB you may wish to consider using alternative solutions, especially for new projects.
=== Octave ===
If you have existing MATLAB code, try running in using [http://www.gnu.org/software/octave/ '''GNU Octave'''] instead of MATLAB for all but the most demanding or vendor-specific tasks:
* To start octave:
octave
* [http://www.gnu.org/software/octave/doc/interpreter/index.html GNU Octave Documentation]
* [http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB Differences between Octave and MATLAB] in the WikiBook ''MATLAB Programming'' (slightly out of date).
* [http://stackoverflow.com/questions/3534867/why-when-should-i-prefer-matlab-over-octave Why/when should I prefer MATLAB over Octave?] – Discussion at [http://stackoverflow.com/ stackoverflow.com].
=== Python or Perl ===
For more flexibility, use a general-purpose scripting language.
* Most users may want to look at [http://www.python.org/ Python] with [http://www.numpy.org/ NumPy], available as module "numpy" on Carbon. See also:
** [http://matplotlib.org/api/mlab_api.html Numerical python functions written for compatability with MATLAB]
** [http://www.scipy.org/NumPy_for_Matlab_Users NumPy for Matlab Users]
* Users who like a stonger Unix flavor should look at [http://www.perl.org/ Perl].
=== NLopt – Nonlinear optimization ===
For users wishing to solve nonlinear optimization problems, the [[HPC/Applications#nlopt | nlopt module]] is a fairly general-purpose optimization library with interfaces in C, C++ and Fortran.


== Running MATLAB ==
== Running MATLAB ==
Line 59: Line 58:
: Suppresses X11.
: Suppresses X11.


== Running the MATLAB compiler ==
== Documentation ==
As of 2013, we have available a MATLAB compiler. Consult the vendor site for full documentation:
Consult the vendor's documentation:
* http://www.mathworks.com/help/compiler/
* http://www.mathworks.com/help/matlab/index.html
 
: '''Caution:''' This page presents the vendor's current release (R2014b at time of writing). To see documentation specific to the release installed on Carbon (R2013a), whose behavior could differ from the current release, see the tab "Other Releases". You will need an existing or new user-specific site login.
; Quickstart:
* http://www.mathworks.com/help/matlab/getting-started-with-matlab.html .
* Connect to clogin5 .
* Locate the toplevel function, say file ''myfunc.m''.
* Create a target directory, ''deploydir''.
mkdir ''deploydir''


=== Minimal compiler options ===
== Using the MATLAB compiler ==
mkdir ''deploydir''
The MATLAB compiler, available on Carbon, allows you to create standalone Linux binaries that ''do not need a MATLAB license token'' to run.
mcc -v \
-o ''myname'' \
-W main:''myfunc'' \
-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".


=== Additional options ===
For documentation, see [[HPC/Applications/matlab/Compiler]].
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 <code>-p</code> option are:
$ ls /opt/soft/matlab-R2013a-8/toolbox/
compiler  '''curvefit  distcomp  images'''  local  matlab  '''optim'''  shared  '''stats'''


=== Running the executable ===
== Parallel toolkit==
cd ''deploydir''
See [[HPC/Applications/matlab/Parallel]].
./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 [[HPC/Module_Setup#Module_Conventions_on_Carbon|local conventions]].


== Troubleshooting ==
== Troubleshooting ==

Latest revision as of 18:00, November 24, 2014

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


Alternatives

Given licensing and availability limitations of MATLAB you may wish to consider using alternative solutions, especially for new projects.

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.

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.

Documentation

Consult the vendor's documentation:

Caution: This page presents the vendor's current release (R2014b at time of writing). To see documentation specific to the release installed on Carbon (R2013a), whose behavior could differ from the current release, see the tab "Other Releases". You will need an existing or new user-specific site login.

Using the MATLAB compiler

The MATLAB compiler, available on Carbon, allows you to create standalone Linux binaries that do not need a MATLAB license token to run.

For documentation, see HPC/Applications/matlab/Compiler.

Parallel toolkit

See HPC/Applications/matlab/Parallel.

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.