How-to: Use Matlab on the cluster
Action
A site-wide license for Matlab is administered by the University at Albany. Matlab can be run on the cluster with the GUI via X11 forwarding.
Â
Be sure to use Matlab on a full stomach. Neither Matlab nor SUNY at Albany are responsible for any side effects of prolonged usage.
Instructions
Interactive Matlab
Running Matlab interactively requires a connection via SSH with X-forwarding. In the below examples, an Interactive Matlab session running on the cluster is demonstrated here with a macOS.
For more information on connecting to the cluster via SSH, please see How-to: Connect via SSH (PuTTY, macOS terminal)
Â
Connect to head-01.arcc.albany.edu with X-forwarding. Instruction on doing so, depending on your operating system can be found here.
Â
Next, launch an interactive job using a command similar to the one below:
srun --pty --time=01:00:00 --cpus-per-task=2 --mem-per-cpu=2000 bash -i |
GPU
If you need access to batch-gpu for your lab group, please submit a ticket to askIT@albany.edu requesting access.
Note: You can request access to the GPUs on --partition=batch-gpu by adding the following flag above:
--gres=gpu:1Â # For one GPU
Â
Now, we'll use the matlab module file to load matlab 2023a, via "module load matlab/2023a"
module load matlab/2023a |
Finally, type "matlab" and the GUI will spawn:
Â
Once your job is complete and you exit the MATLAB GUI, be sure to cancel your job:
squeue -u your_netid              JOBID PARTITION    NAME    USER ST      TIME NODES NODELIST(REASON)            5385415    batch mrun your_netid  R 6-06:44:30     1 uagc20-11  scancel 5385415 |
Â
Example SLURM Script for a non-interactive job:
#!/bin/bash #SBATCH -p batch #batch partition #SBATCH --cpus-per-task=2 # 2 cores #SBATCH --mem-per-cpu=2000 # 2GB memory #SBATCH --mail-type=ALL #SBATCH --mail-user=%u@albany.edu #email address #SBATCH -o /network/rit/home/%u/example-slurm-%j.out #log file #SBATCH --time=1-0:1 # Estimating the job will take 1 day, 0 hours, 1 minute   # source matlab module module load matlab/2023a   #Run the script matlab -nodesktop -nosplash -batch [your_script].m |
Â
Need more help? Contact the ITS Service Desk.
Â
Â
Â