H.P.C.

HPC MATLAB

Step 1: Log in to the HPC cluster with your username (e.g., Mobaxter).

ssh -X username@10.3.0.4

Step 2: Submit a job using a script file (e.g., matlab-dgx.sh or matlab-gpu.sh) to the HPC cluster.
 qsub matlab-dgx.sh 
(or)
 qsub matlab-gpu.sh

Note: The script will specify the resource requirements and walltime. If you don't have a script file, you can create one following the example below.

Jupyter Script Demo
How to Create the Script:

1. Run the command to create a new script file (e.g., matlab-dgx.sh or matlab-gpu.sh).
 vim matlab-dgx.sh 
OR
 vim matlab-gpu.sh

2. Copy and paste the lines below into the script.

3. Adjust the required ncpus and ngpus.

Select the walltime to set a time limit for your work.

Save the script by typing :wq!.


Note – please user minimum ncpus and ngpus as requirement



Demo MATLAB Script (matlab-gpu.sh)
Copy and paste the following details into the matlab-gpu.sh file:
#!/bin/bash
#PBS -N matlab_task

#PBS -l select=1:ncpus=10:ngpus=1
#PBS -q dgx
#PBS -l walltime=12:00:00
#PBS -o $PBS_O_WORKDIR/matlab_task.log

# Change to the working directory where your MATLAB files are located
cd $PBS_O_WORKDIR

# Save output files (modify this as needed)
mv output_results.txt $PBS_O_WORKDIR/

Demo MATLAB Script (matlab-dgx.sh)
Copy and paste the following details into the matlab-dgx.sh file:
#!/bin/bash
#PBS -N matlab_task
#PBS -l select=1:host=dgx:ncpus=8:ngpus=1
#PBS -q dgx
#PBS -l walltime=12:00:00
#PBS -o $PBS_O_WORKDIR/matlab_task.log

#PBS -joe

# Change to the working directory where your MATLAB files are located
cd $PBS_O_WORKDIR
# Save output files (modify this as needed)
mv output_results.txt $PBS_O_WORKDIR/

Step 4: Save the script by typing .
    :wq!
    
Step 5: Check the status of your job using the following command:
 qstat -aw

This command will help you see where your job is running and verify your allocated node. If you submitted a GPU job, SSH into a GPU node. If you submitted a DGX job, SSH into a DGX node.


Step 6: SSH into the node where your job is running:
 ssh -X dgx
or
ssh -X <node name> (after verifying with "qstat -aw" command)
Step 7: After logging in, load the MATLAB module:
#module avl { to check modules }
# module load <module loacation Directory>
apps/matlab-R2017b
apps/matlab-R2022a
apps/matlab-R2022b
apps/matlab-runtime-R2018a

Step 8: Run MATLAB by typing:
 matlab

Step 9: When your work is done, kill the job:
 qdel -W force <job ID>

Note: If you want to check your job ID, use the following command:

 qstat -aw


Central Computting Facilities MANIT Bhopal