Frequently Asked Question

4.3 PBS Example Using GPUs (A100)
Last Updated 6 months ago

To utilize GPUs on the Aziz Supercomputer, specifically the A100 GPU nodes, you need to configure your PBS job script accordingly. Below is an example of a basic PBS script that requests A100 GPUs for your computation.

#!/bin/bash
#PBS -N gpu_job              # Job name
#PBS -q A100                 # Choose the compute node type A100 GPU
#PBS -l select=1:ncpus=32    # Request 1 A100 GPU
#PBS -l walltime=02:00:00    # Set maximum wall time of 2 hours
#PBS -o output.txt
#PBS -e error.txt

# Give the directory where your code is
cd /path/to/my_files/
# If your PBS script and code file are in the same directory, use the following instead
cd $PBS_O_WORKDIR

# Load necessary modules
module use /app/utils/modules && module load anaconda3-2024.02

# Activate your environment
source activate Your_Env_Name_here  

# Execute your script
python your_code_file_name.py

# or execute your script with time stamp 
time python your_code_file_name.py

# Deactivate your environment
conda deactivate

# unload modules after execution
module purge

Explanation:

  • #PBS -l l select=1:ncpus=32: This will request the reservation of one A100 GPU. If you need more than one GPU, please contact the support team through the ticketing system.
  • #PBS -l walltime=02:00:00: Allocates a maximum of 2 hours of runtime for the job and you may delete this line if you're certain that your experiment requires more time, but it is recommended to use the walltime directive.
  • module load: Loads the necessary modules for your job, including CUDA for GPU support.
  • python your_code_file_name.py: Runs the Python script using the allocated resources or use time python your_code_file_name.py: to have execution run time but not the both.

Example for Submitting a job:

Submit the PBS script using the following commands and the example we have 2 files: 

1. Code file named mycodePython.py

2- PBS script named Myjob.pbs

image


First Step: Modify the PBS script accordingly   

#!/bin/bash
#PBS -N gpu_job              
#PBS -q A100
#PBS -l select=1:ncpus=32    
#PBS -l walltime=02:00:00    
#PBS -o output.txt
#PBS -e error.txt
# Give the directory where your code is
cd /home/hpctech/myWork/
# Load necessary modules
module use /app/utils/modules && module load anaconda3-2024.02
# Activate your environment
source activate my_env_name
# Execute your script
time python mycodePython.py
# Deactivate your environment
conda deactivate
# unload modules after execution
module purge

Second Step: Submit the PBS file.

 qsub Myjob.pbs

image

3rd Step: View your results.

image

Please Wait!

Please wait... it will take a second!