HPC Concepts
High-performance computing (HPC) clusters share a common anatomy regardless of which scheduler they run: you connect to a login node, describe your work in a job script, and submit it to a scheduler that queues it and runs it on one or more compute nodes.
Never run heavy computation on the login node. It is shared by everyone; use it only to edit files, submit jobs, and inspect results. Anything CPU- or memory-intensive belongs in a job (or an interactive session on a compute node).
Cluster anatomy
- Login (head) nodes — where you land after
ssh. Shared, lightly provisioned; for editing, compiling small things, and job submission. - Compute nodes — where jobs actually run. Grouped into partitions/queues with different limits (walltime, memory, GPUs).
- Scheduler — Slurm, SGE, PBS, LSF, etc. Decides when and where each job runs, typically using fair-share policies: heavy recent usage lowers your priority, so queue wait times vary.
- Shared filesystem — your home directory and a scratch area are usually visible from every node. Scratch is faster and larger but often purged on a schedule; keep code and final results in home or project space, and run I/O-heavy work in scratch.
Job scripts
A job script is a shell script with scheduler directives in comment lines at the top
(#SBATCH for Slurm, #$ for SGE, #PBS for PBS). The directives request resources
(cores, memory, walltime); the body is what runs on the compute node.
#!/bin/bash
# --- scheduler directives go here (see per-scheduler pages) ---
module load python/3.12
python analyze.py input.csvRequest resources honestly: ask for too little and the job is killed; ask for far too much and it queues longer and wastes your fair-share priority.
Environment modules
Most clusters manage software with Environment Modules or
Lmod. Loading a module edits your PATH and related
variables for the current shell — load the same modules inside your job script.
module avail # list available software
module spider python # search (Lmod)
module load gcc/13.2 python/3.12
module list # what's loaded now
module purge # unload everythingJob arrays
To run the same script over many inputs (samples, seeds, parameter sets), submit one
array job instead of hundreds of individual jobs. The scheduler runs N copies, each
with an index in an environment variable (SLURM_ARRAY_TASK_ID, SGE_TASK_ID,
PBS_ARRAY_INDEX) that you use to pick the input.
Interactive sessions
For debugging, testing, or exploratory work, request an interactive shell on a compute node
(srun --pty bash in Slurm, qrsh in SGE, qsub -I in PBS) rather than running on the
login node.
Scheduler cheat-sheet
| Task | Slurm | SGE | PBS |
|---|---|---|---|
| Submit a job | sbatch job.sh | qsub job.sh | qsub job.sh |
| Submit interactive | srun --pty bash | qrsh | qsub -I |
| List your jobs | squeue --me | qstat | qstat -u $USER |
| Job details | scontrol show job ID | qstat -j ID | qstat -f ID |
| Cancel a job | scancel ID | qdel ID | qdel ID |
| Cluster/queue state | sinfo | qhost / qstat -g c | pbsnodes -a |
| Past job accounting | sacct -j ID | qacct -j ID | qstat -x ID |
| Directive prefix | #SBATCH | #$ | #PBS |
| Array job flag | --array=1-100 | -t 1-100 | -J 1-100 |
| Array index variable | $SLURM_ARRAY_TASK_ID | $SGE_TASK_ID | $PBS_ARRAY_INDEX |
| Job ID variable | $SLURM_JOB_ID | $JOB_ID | $PBS_JOBID |
See the per-scheduler pages for full details: Slurm, SGE, PBS.