New THOTH website available here

`/home/clear/lear/matlab`

.
This will use licenses from the LJK Laboratory, and run the latest MATLAB installed.
LJK licenses are reserved for teaching and pure research: they MUST NOT BE USED for deliverables
(European projects, etc) or commercial developments.
You can also run
`/softs/stow/matlab-*/bin/matlab`

, this way you will use INRIA licenses,
of which there are only few since they are very expensive as INRIA does not get the educational discount.

Please exit MATLAB as soon as you have finished using it (add ` exit`

at the end of your scripts),
otherwise you are waisting licenses=money.
Or, consider using octave instead (=free).
Use:

`/home/clear/lear/matlab -nodesktop -nojvm -r \"cd my_dir;my_script_to_run('\$BASH_VAR'); exit\"`

if you want to run a script from the command line use.
Note that you can pass shell variables to MATLAB (it can be very handy!).

` addpath('/home/clear/paulin/src/Libs/mosek/7/toolbox/r2012b') `

`setenv('MOSEKLM_LICENSE_FILE','/home/clear/paulin/src/Libs/mosek/mosek.lic').`

To find which lincences are cheked out run the
following command:

/softs/stow/matlab-2014b/etc/glnxa64/lmutil lmstat
-a

You may have to add a `-c licensefile`

option to set the
relevant license file, which is referenced in
`/home/clear/lear/matlab`

script.

Toolbox license keys only get checked back in when the main MATLAB session is ended regardless of whether the toolbox is still being used. So if you do not want to quit, to release the key:

/softs/stow/matlab-2014b/etc/glnxa64/lmutil lmremove TOOLBOXNAME USERNAME COMPUTERNAME
DISPLAYNAME

Just to illustrate with an example:

/softs/stow/matlab-2014b/etc/glnxa64/lmutil lmremove Image_Toolbox dorko
kent.inrialpes.fr /dev/pts/15

All required information can be found in the output of lmutil lmstat -a

IMPORTANT: ONLY REMOVE YOURSELF, or ask holder of the licence first!

- Matlab licenses are allocated per user-machine pair. Running 10 matlab sessions on one machine costs only one matlab license, instead of 10 licenses when you run one session on 10 different machines. Group all your matlab sessions on one machine whenever possible.
- Make sure your matlab jobs quit matlab automatically when they are done, so as to free-up immediately your license. Use 'exit' at the end of your script, or start functions from the command line (possibly using bash scripts).
- Use functions instead of scripts where possible, so that memory is free-ed up as soon as possible and does not remain allocated in the environment. The Matlab machines have a lot of RAM, but this is shared for all users, and still have 'only' 2 to 2.7 GB per core (just like the latest desktop machines).
- use Matlab's 'profile' tools to analyze and optimize your code. If you spend 90% of run time in Matlab for-loops it's probably time to write some MEX functions (possibly using multithreaded code, see here). This may take a few hours to code, but can speed up your code by orders of magnitude (typically between 1 to 3 orders).
- If your code is stable enough and if you want to run it on the cluster, consider compiling it to avoid using licenses.

You can use Octave instead, which is mostly compatible with Matlab. Strong points of Octave:

- the syntax is the same as Matlab's,
- the data types (including cells and structs) are the same as Matlab's,
- the basic functions are there (linear algebra, i/o, etc.),
- it is able to read .mat files and compile mex files
- startup is much faster (it makes sense to embed octave scripts in shell scripts).

The main drawbacks are:

- porting from Matlab requires some effort,
- the graphic output (based on gnuplot and ImageMagick) is not as flexible as Matlab's. It is impossible to combine images and vector graphics,
- Matlab toolbox functions are often not available.
- it is sometimes slower than matlab (especially the basic matrix algebra).

In any case, it is good discipline to validate that the Matlab code that you write also runs on Octave.

Another free Matlab wana-be is Scilab, but its syntax is quite different and tends to segfault too often.

Finally, another nice and open source alternative to Matlab can be obtained via the Python language and its Numpy and Scipy libraries, but the syntax is completely different.function [] = main(seed) if isdeployed % true only in compiled mode seed=str2num(seed); % in compiled mode, arguments are only strings end rand('seed',seed); fprintf('random number: %f\n',rand(1));You can compile this function by using the command:

/softs/bin/mcc -m test_mcc.m -R -singleCompThread -R -nodisplay

-R allows you to pass different matlab options.

Then, to run the function, without using any licence,

sh run_test_mcc.sh /scratch2/clear/mairal/MCR_matlab2013a/v81/ 9

9 is the argument ``seed'' in test_mcc.m

You have to use at least Matlab version 2013a (installed in

`/softs/stow/matlab-2013a/bin`

).
` /home/lear/douze/.matlab/R2012b/mexopts.sh `

into: ` ~/.matlab/R2012b `

.