Best Practices for Using HPC
Scaling Up to Cluster-Native Workflows
Bridging the gap between personal laptops and large-scale, hardware-accelerated supercomputing.
About the Presenter
Computational Scientist for AI at Rice University Center for Research Computing
Recep Erol, PhD
ποΈ Center for Research Computing | Rice University
Best Practices for Using HPC
We Are Your Partners in Research
An HPC cluster is not just a larger laptopβit is a shared community ecosystem.
Cutting-Edge Science
You push domain boundaries in molecular dynamics, AI/LLMs, genomics, and simulations.
New Paradigms
Cluster computing introduces batch queues, parallel storage, and hardware accelerators.
Active Collaboration
CRC engineers co-design pipelines with you before runs happen, turning queue delays into speedups.
Guiding Philosophy: Everyone needs help scaling up. Our goal is empowering you to write cluster-native code that runs faster, costs less in wait time, and reproduces seamlessly.
Best Practices for Using HPC
The 5 Pillars of Cluster Efficiency
Core competencies covered in this workshop
The Mindset Shift
Shared resource ethics, interactive vs. batch paradigms, and login node etiquette.
Data Logistics & Storage
High-speed VAST scratch vs. archives; migrating multi-TB datasets via Globus & rsync.
Reproducible Environments
Containerizing workloads with Apptainer (Singularity) and automating with Makefiles.
Slurm & The 3 Traps
Memory over-allocation, sequential job loops, and single-GPU lockups on multi-GPU nodes.
Observability & CRC Support
Auditing jobs with seff, monitoring live GPUs with nvtop, and collaborating
during office hours.
Best Practices for Using HPC
Laptop vs. Supercomputer
Moving from synchronous execution to orchestrated batch scheduling
π» Personal Laptop / Workstation
- Dedicated Resources: 100% of CPU and RAM belongs to your single user session.
- Synchronous Execution: You click "Run" in VS Code or Jupyter and inspect output immediately.
- Volatile: Closing lid, system updates, or WiFi drop terminates execution.
- Bottlenecks: Bound to 16β64 GB RAM and local battery / thermal constraints.
β‘ Shared HPC Cluster
- Shared Community: Hundreds of researchers share multi-node interconnects.
- Asynchronous Batch Queues: Workloads are packaged as Slurm batch scripts and submitted to a scheduler.
- Persistent & Robust: Runs complete independently of your laptop's connection state.
- Massive Scale: Access to TBs of distributed memory and multi-node GPU clusters.
Best Practices for Using HPC
Accessing HPC: The Golden Rule
Never execute computational workloads on login nodes!
π« Login Nodes (Gateway Only)
[β DON'T COMPUTE HERE]Strictly intended for:
- Submitting Slurm jobs (
sbatch,squeue). - Editing code, text configs, and reviewing logs.
- Transferring files, basic git commits.
python train.py or compiling heavy C++ on login nodes freezes the terminal for everyone on the cluster!
β Compute Nodes (The Workhorses)
[β RECOMMENDED]Two sanctioned access methods:
πΉ Interactive Debugging:
# Request 1 GPU for 1 hour of interactive testing
salloc --partition=gpu --gres=gpu:1 --time=01:00:00 --mem=32G
πΉ Batch Production:
# Submit batch script to background queue
sbatch run_experiment.slurm
Best Practices for Using HPC
Moving Data at Scale
Choose the right vehicle for your data payload
π Small to Medium (< 100 GB)
TerminalTool: rsync or scp
# Efficient incremental synchronization
rsync -avzP --exclude '*.tmp' ./my_dataset/ \
re51@range.rice.edu:/scratch/re51/data/
- Resumes interrupted transfers (
-P). - Preserves timestamps and permissions (
-a). - Ideal for code, configs, and preprocessed subsets.
π Massive Payloads (Multi-TB)
High ThroughputTool: Globus Transfer
- GridFTP Engine: Maxes out campus 100GbE science DMZ.
- Auto-Healing: Checksums every chunk and retries on dropped connections.
- Background Execution: Does not require your laptop to remain open.
- Direct endpoint-to-endpoint between Rice, TACC, AWS, and external universities.
Best Practices for Using HPC
Storage Hygiene: Scratch vs. Archive
HPC storage is partitioned for specific I/O profiles
π Home (~/home)
For dotfiles, SSH keys, virtual environment definitions, and Git repositories. Never write simulation checkpoints here.
β‘ Scratch (/scratch)
For active compute runs, checkpointing, and uncompressed datasets. Purge policy appliesβclean intermediate files!
π¦ Project / Archive
For published benchmark data and final analysis results. Not for hundreds of thousands of tiny temp cache files.
β οΈ The Million Tiny Files Trap: Storing 1,000,000 loose 10KB images degrades
metadata servers. Always archive or bundle datasets (e.g. tar, HDF5, WebDataset).
Best Practices for Using HPC
Eliminate "Works on My Machine"
Package once with Apptainer (Singularity) β’ Run anywhere identically
π¦ Why Containers on HPC?
- No Root Needed: Apptainer executes in unprivileged user space.
- Direct Hardware Binding:
--nvautomatically passes NVIDIA driver & CUDA libraries into container. - Host Filesystem Mounting: Access
/scratchand/homeseamlessly inside. - Reproducibility: One
.siffile encapsulates Python 3.13, PyTorch, C libraries, and CUDA.
π Example Slurm Execution
# Run PyTorch GPU script inside container
apptainer exec --nv \
--bind /scratch/re51:/scratch \
/scratch/re51/containers/pytorch_2.4.sif \
python3 /scratch/re51/code/train.py \
--data-dir /scratch/re51/dataset
Pair with a project Makefile so that make train executes the identical recipe
locally and on RANGE.
Best Practices for Using HPC
Trap 1: The Memory Overallocation Trap
Requesting 128 GB "just to be safe" inflates queue wait times for days
β over_allocation_bad_example.sh
#!/bin/bash
#SBATCH --job-name=mem_hog
#SBATCH --mem=128G
# Job stays pending in queue for days for
# resources it doesn't actually need.
python data_process.py
- Slurm scheduler must drain nodes to carve out 128GB RAM.
- Actual script memory peak: only 12.4 GB.
- Wasted: 115.6 GB RAM locked away from peers.
β enough_amount_allocation.sh
#!/bin/bash
#SBATCH --job-name=mem_smart
#SBATCH --mem=16G
# Job starts quickly. Validated using `seff`
# from a previous run.
python data_process.py
- Slurm instantly fits this job into available node fragments.
- Queue wait drops from 48 hours to 3 minutes.
- Verified with:
seff <jobid>(85% memory efficiency).
Best Practices for Using HPC
Trap 2: The Sequential Loop Trap
Running 100 independent simulations sequentially inside a huge multi-core allocation
β single_core_job_full_allocate.sh
#!/bin/bash
#SBATCH --job-name=bad_seq
#SBATCH --nodes=1
#SBATCH --ntasks=64
#SBATCH --time=48:00:00
# Wastes 63 cores while 1 task runs at a time!
for i in {1..100}; do
python simulate.py --seed $i
done
- CPU efficiency measured by
seff: 1.5%! - If the node restarts at hour 47, all progress is lost.
β single_core_job_slurm_jobarray.sh
#!/bin/bash
#SBATCH --job-name=smart_array
#SBATCH --array=1-100%20
#SBATCH --ntasks=1
#SBATCH --time=00:30:00
# Slurm executes tasks concurrently!
python simulate.py --seed $SLURM_ARRAY_TASK_ID
- Slurm launches independent sub-jobs across available nodes.
- Individual tasks retry automatically on transient failures.
Best Practices for Using HPC
Trap 3: The Multi-GPU Hoarding Trap
Requesting 4 H100 GPUs for a script that only addresses cuda:0
β wasting_gpu_resource.sh
#!/bin/bash
#SBATCH --job-name=gpu_hoard
#SBATCH --partition=gpu
#SBATCH --gres=gpu:4
# Script only uses single GPU cuda:0!
python single_gpu_train.py
- GPUs 1, 2, and 3 sit completely idle ($90k+ of hardware locked).
- Slurm fairshare score severely drops due to unused GPU billing.
β correct_gpu_reseource_allocation.sh
#!/bin/bash
#SBATCH --job-name=gpu_right
#SBATCH --partition=gpu
#SBATCH --gres=gpu:1
# Perfectly matched allocation
python single_gpu_train.py
- Immediate dispatch from the queue.
- If multi-GPU is needed, implement PyTorch DDP /
torchrun.
Best Practices for Using HPC
Know Your Hardware Utilization
Audit running and finished jobs with native diagnostics
π Post-Mortem Audit: seff
Immediately after your job finishes, check actual resource usage:
$ seff 4819204
Job ID: 4819204
Cluster: range
State: COMPLETED (exit code 0)
Cores: 8
CPU Utilized: 03:42:10
CPU Efficiency: 88.5% of 04:12:00 core-walltime
Memory Utilized: 14.21 GB
Memory Efficiency: 88.8% of 16.00 GB
If CPU or Memory efficiency is < 40%, tune your Slurm directive on the next run!
π Live Monitoring During salloc
While testing interactively inside an allocation:
- CPU & RAM: Run
htopto inspect multi-threading and core load. - GPU Load & VRAM: Run
nvtoporwatch -n 1 nvidia-smi. - Disk I/O Wait: Watch if compute cores are starved waiting on slow disk reads.
Best Practices for Using HPC
Folder Structure & Slurm Hygiene
Pair submitted job scripts with their output logs
π Recommended Project Blueprint
my_project/
βββ data/ # Symbolic link to /scratch/
βββ containers/ # Apptainer .sif images
βββ src/ # Pure Python / C++ source
βββ slurm_jobs/ # All .slurm batch scripts
βββ logs/ # Slurm stdout & stderr logs
β βββ %x_%j.out
β βββ %x_%j.err
βββ Makefile # One-command orchestration
βββ README.md # Execution recipes
π― Best Practices for Slurm Directives
- Name your logs cleanly:
#SBATCH --output=logs/%x_%j.out(%x=job name,%j=job ID). - Set realistic walltimes: Requesting 2 hours gets scheduled 10x faster than 24 hours.
- Use email alerts for failures only:
#SBATCH --mail-type=FAIL(avoid inbox spam). - Document software dependencies: Record git commit hash inside every batch log.
Best Practices for Using HPC
Let's Collaborate: We Are Here to Help!
Engage with CRC engineers during experimental design, not just when jobs fail
Open Office Hours
Every Tuesday & Thursday:
10:00 AM β 12:00 PM
1:00 PM β 3:00 PM
Drop in with code, Slurm scripts, or architecture questions.
CRC Support Tickets
Submit questions anytime:
helpdesk@rice.edu
or Service Now portal
Tag CRC for cluster, GPU, and software support.
1-on-1 Consultations
Scaling up a grant or pipeline?
Dedicated Engineering
We help optimize MPI, PyTorch DDP, and Slurm arrays.
Portal: researchcomputing.rice.edu β’ Cluster Docs: kb.rice.edu
Best Practices for Using HPC
Thank You!
Let's build scalable, reproducible, cluster-native science together.
Recep Erol, PhD
ποΈ Center for Research Computing | Rice University
Best Practices for Using HPC