Matlab

From UFRC
Revision as of 01:04, 15 January 2023 by Israel.herrera (talk | contribs)
Jump to navigation Jump to search

Description

matlab 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.

Environment Modules

Run module spider matlab or module spider mcr to find out what environment modules are available for the MatLab GUI and for the Matlab Compiler Runtime. Use matlab for compiling your code and mcr for running it. The mcr does not consume matlab licenses.

Restrictions

MatLab install on HiPerGator is restricted to the toolboxes available under the UF license. The full list of ineligible toolboxes is on the MATLAB website: MATLAB Add-On Availability

Run matlab_show_license_use after loading a matlab module to see what licenses are available and how many are in use.

System Variables

  • HPC_MATLAB_DIR - installation directory



Policies

  1. You may not run MatLab nor compiled MatLab executables interactively on the login servers.
  2. Long running (more than 30 minutes) MatLab jobs need to be in compiled form and must be submitted to the batch system.
  3. UF Research Computing has no budget for application software and licensing. All MatLab licenses (including the compiler) come from, and are shared with, all of UF campus. For this reason it is sometimes difficult to obtain a license or MatLab may take a long time to start. 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.

Available components

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

Compiling MatLab Programs

MatLab programs must be compiled via the MatLab compiler before they can be run in batch mode on HiPerGator.

In order to compile MatLab programs you should

  1. See Development and Testing page to learn how to get an interactive developmental session on HiPerGator under SLURM.
  2. Set up your environment so that the libraries needed by the compiler can be found.
    • module load matlab
    • Note: The module load command should be included in your batch submission script as well since your compiled matlab executable will also need to find the appropriate dynamically loaded libraries.
  3. Compile your matlab program (.m) files using the MatLab compiler (mcc).
    • mcc -R -singleCompThread -m some_prog.m

Example

Expand this section to view Matlab example.

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.


MatLab Compiler Documentation can be found on the MatLab Website.

MATLAB GUI use on HiPerGator

If you must use the Graphical User Interface for MatLab follow the Matlab GUI Example documentation, or options in GUI Programs

MATLAB online training

Please see the Pre-recorded MATLAB on HiPerGator Training session for information on using MATLAB on HiPerGator.

Mathworks also has a number of free online training resources.


Compiled DLL

If you have compiled a MatLab 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 Command Path

To set a command path in your MatLab program, should add the following code.

path(path, '/path/to/matlab/binaries')

This will add the specified directory to the matlab search path. For more information see the Matlab web site.

Known Issues

Expand this section to view common troubleshooting steps.