Matlab
Installation
Currently matlab is located here:
/apps/matlab/bin
Policy
Please remember that the HPC Center resources are not to be used interactively! Matlab jobs should be submitted via Torque submission scripts with no user interaction.
Compiler
In order to compile matlab programs on the HPC cluster so that they will be usable by the batch system, you need to do a couple of things.
First, you need to setup your environment so that the proper libraries are available for use by Matlab:
$ export LD_LIBRARY_PATH=/apps/matlab/bin/glnxa64:/apps/matlab/sys/os/glnxa64 $ export PATH=${PATH}:/apps/matlab/bin
Once your environment is ready, you can compile your matlab .m files so that they will be usable as binaries. We use the mcc command for this.
Example
Let us say that we have a program called houdin.m, which looks like this:
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.
$ mkdir tmp $ cd tmp $ cp ../houdini.m . $ ls houdini.m $ export LD_LIBRARY_PATH=/apps/matlab/bin/glnxa64:/apps/matlab/sys/os/glnxa64 $ export PATH=${PATH}:/apps/matlab/bin $ mcc -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. $ 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
So there we have it. A binary executable houdini has been produced.
For more information, documentation for the Matlab Compiler can be viewed at the Matlab Website.
Frequently Asked Questions
Dear Sirs,
I have a basic question about what can be run on the cluster. I have a standalone C application file generated by the Matlab compiler. Is it possible to run it (after porting/copying the required libraries) as an external application on a particular node of the cluster. This is because it is not possible for me to compile the C source files on the cluster itself?
OK... from what I gather here, I think you have the following:
- A compiled executable, most likely in linux x86 format.
- This executable obviously requires specific libraries to run, and if we don't have them installed they won't work. From what I remember of the matlab compiler suite, it is possible for the matlab compiler to actually generate a full set of files that include your executable and the libraries it needs to support it such that the whole suite is portable. This is what you really want to look for, and I know it has been done before.
- Possibly the source code.
- If you have the C source code, you should be able to compile that source code on our systems with out any trouble, unless it requires some sort of library provided by matlab. If this is the case, then option 1 above is your best bet.
Where is the Distributed Computing Toolbox?
It hasn't been added because we do not have a license for the distributed computing toolbox. The University of Florida has not opted for that particular option, and our group does not have the money to purchase this particular license, as it is very expensive.