How to run MATLAB on ScienceCloud¶
Step-by-Step Instructions¶
Create an Instance (one-time step)¶
Start by creating an instance using one of the latest images that includes Singularity. Ensure to select an image with the ***
prefix in its name, such as ***Singularity on Ubuntu 20.04 (2024-05-29)
.
After creating the instance, install the latest updates and reboot the system:
sudo apt update
sudo apt full-upgrade
sudo reboot
Load MATLAB Module¶
- Select the version you would like to run and load it with
module load matlab/2023b
The first time you load the module, the MATLAB container will be downloaded to your instance. Since MATLAB is quite large, it may take 15-20 minutes to complete. You will see no progress bar. Subsequently, the module will be loaded in less than a second.
module load matlab
Note
When you load a MATLAB module for the first time, the container will be downloaded to your instance. Due to MATLAB's size, this process may take approximately 15-20 minutes to complete. Please note that there won't be a progress bar during this process. Once installed, subsequent loading of the module will take less than a second.
Specific MATLAB Versions¶
If you need a specific version of MATLAB, list available modules:
- If you created an instance with a GPU, you might be able to use it with MATLAB if you also load the
gpu
module, e.g.
module load gpu matlab/2023b
From the list of available modules, load a specific version:
module load matlab/r2023a
Note
Loading multiple versions of MATLAB modules on a single instance may exhaust disk space due to their significant storage requirements.
Run MATLAB¶
Once the MATLAB module is loaded, you can run MATLAB commands as usual. Test MATLAB with a command like:
matlab -nodisplay -r 'disp(magic(5)*magic(5)); exit'
Hints and Suggestions¶
GUI Usage¶
To run MATLAB with a GUI, enable X forwarding when connecting to the instance via SSH:
ssh -XY ubuntu@<ip-address>
GPU Usage¶
If your instance has a GPU and was created from an image with CUDA drivers, load the GPU module along with MATLAB for GPU-accelerated computations:
module load gpu matlab
Error Handling¶
If you encounter the "Unrecognized function or variable 'Settings'" error, run settings
in MATLAB to initialize settings properly.