HPC / CFD Final Exam Revision Guide¶
One-page summary per chapter. Use this on the morning of the exam.
Top Strategy¶
- Read each one-pager once.
- Read
HPC_Final_Cheat_Sheets.pdfonce. - Walk through the four practice sets in
HPC_Written_Exam_Preparation.pdfsolving by hand. - Drink water. Sleep 8 hours.
In the exam:
- Read every question fully before starting.
- Allocate time = (marks/total marks) × duration.
- Start with the biggest question you know best — quick wins build confidence.
- For commands always quote the variable:
"${VAR}". - For diagrams use a small text Venn / arrow diagram even if hand-drawn.
- For C++ remember the compile command at the top.
Chapter 1 — Course Introduction & HPC Overview¶
- HPC = aggregating many cores so calculations finish in hours not years.
- CFD discretises Navier–Stokes on \(10^{9}\) cells × \(10^{5}\) steps → \(10^{15}\)+ ops → needs HPC.
- Top500 = LINPACK-ranked list; #1 El Capitan (1.7 EF), #2 Frontier, #3 Aurora.
- All Top500 run Linux.
- Why Linux? open, stable, scriptable, POSIX, modular.
- Key term: SAF (Sustainable Aviation Fuel), Cluster of Excellence SE²A (Hannover/Braunschweig).
- Likely question: Why HPC for CFD? Define + 1 example + 1 limitation.
Chapter 2 — Unix / Linux Basics¶
- Unix = 1970 AT&T proprietary OS family.
- POSIX = IEEE standard for portability.
- GNU = free Unix-like userland (bash, gcc, coreutils).
- Linux = the kernel; "GNU/Linux" = the OS.
- Distributions = kernel + userland + init + package mgr (Ubuntu, Rocky, SLES).
- User vs kernel mode → system calls (
syscallinstr). - Likely question: Define Unix/POSIX/GNU/Linux + Venn.
Chapter 3 — Linux Commands & File Permissions¶
ls -lh,cd,mkdir -p,cp -r,rm -rf,mv,touch,wc -l,cat/less/head/tail,chmod,chown.- Permissions:
r=4 w=2 x=1.755=rwxr-xr-x,644=rw-r--r--,600=rw-------. - Special: setuid 4, setgid 2, sticky 1 →
chmod 4755,chmod 1777 /tmp. - Redirection:
> >> 2> 2>&1 < <<EOF. Pipe:|. - FHS:
/,/home,/etc,/var,/usr,/tmp,/dev,/proc. - Likely question: Translate
ls -lto chmod numeric. Explain>vs>>vs2>&1.
Chapter 4 — bashrc, SSH, Remote Workflows¶
.bashrcfor aliases/functions/prompt..bash_profilefor login.- Env:
export VAR=value. PATH/HOME/USER/SHELL/EDITOR/LD_LIBRARY_PATH. - Symmetric (AES) one key fast; asymmetric (Ed25519/RSA) pub+priv slow.
- SSH: 1) ECDH key exchange, 2) AES session, 3) public-key auth.
- Passwordless:
ssh-keygen -t ed25519 -b 4096 -f ~/.ssh/k,ssh-copy-id,~/.ssh/config, chmod 600/700. - Compare:
scp(one-shot) /rsync -avzP --delete(incremental) /sftp(interactive) /sshfs(mount). nohup ./run > log 2>&1 &; disown.tmux new -s sim; detachCtrl-b d.ssh -L 8080:host:80local fwd;-Rreverse;-DSOCKS.- Likely question: passwordless setup steps; scp vs rsync.
Chapter 5 — Vim & Command-Line Editing¶
- Modes: Normal, Insert (
i a o I A O), Visual (v V Ctrl-v), Cmd-line (:). - Grammar:
[count][verb][motion]. Verbs:d c y > gU. Motions:w b e 0 $ gg G %. dd 5dd yy y2j p P u Ctrl-r .. Search/pat n N *.- Replace:
:%s/old/new/gc. Whole-word\<word\>. Multifile:bufdo … | update. - Macros:
qa…q,@a,5@a,:reg a. - Buffers/windows/tabs:
:e :sp :vsp :tabnew gt :ls. .vimrc:set number expandtab hlsearch incsearch.- Lecture macro (Task 3):
qa /[<Enter> v /]<Enter> d 0 /><Enter> p 0 qthen@a. - Likely question: keystrokes to transform "before" into "after"; record macro.
Chapter 6 — Regex & Globbing¶
- Glob:
* ? [abc] {a,b}. Brace expansion{a..e},dir-{1,3}/*[0-9].h. - Regex flavours: BRE (grep, sed default), ERE (
-E), PCRE (-P). - Atoms:
. *(0+) +(1+) ?(0/1) {n,m}(in ERE). Anchors^ $ \< \> \b. - Char class:
[abc],[^abc],[[:alpha:]],[[:digit:]]. Backref\1. - E04 solutions:
- Phone:
\+[0-9]+ [0-9]{3}-[0-9]{3}-[0-9]{4} - Email:
^[[:alnum:]_.]+@[[:alpha:]]+\.[[:alpha:]]{2,}$ - Glob
dir-{1,3}/*[0-9].h,dir-3/*[A-Z]*.h - Likely question: Phone/email/IP regex; predict matches.
Chapter 7 — Linux Text Tools¶
find <path> -name -type f -size +N -mtime -N -exec cmd {} +grep -EinrlA 2 -B 1flags.sed -E -i.bak 's/pat/repl/g'. Print only matchingsed -n '/p/p'.awk 'BEGIN{FS=",";OFS="\t"} /pat/ {print $1,$3}' file.column -t -s ':' /etc/passwd.- E05 solutions: find -regex -exec chmod, awk salary filter, sed grouping
\1-\5. - Likely question: write awk/sed/grep for CSV; predict output.
Chapter 8 — Shell Scripting¶
- Shebang
#!/bin/bash; strictset -euo pipefail. - Vars
$1 $# $@ $? $$ $!. Quote"${VAR}". - Tests
[ -f f ],[[ "$x" =~ pat ]],(( a+b )). - if/elif/else, case (
pat) cmds ;;), for/while/until. - Arrays
A=(a b c); "${A[@]}"; ${#A[@]}. - getopts:
OPTSTRING=":a:b:v", while-getopts case +shift $((OPTIND-1)). - Function
fn(){ local x=$1; ... }. Capturer=$(fn). - backup-data.sh: getopts -v / extended -s for rsync.
- Likely question: walk through backup-data.sh; write parameter-sweep script.
Chapter 9 — Gnuplot Postprocessing¶
- Plot
plot 'd' using 1:2 with linespoints lt 1 lw 2 pt 7 lc rgb "red" title 'X'. - Customisations:
set title/xlabel/ylabel/grid/xrange/yrange/logscale y/key/xtics. - Linestyle:
set style line N lt 1 lw 2 pt 7 ps 1.5 lc rgb "...". - Multiplot:
set multiplot layout R,C ... unset multiplot. - Fit:
f(x)=a*x**2+b*x+c; fit f(x) 'd' via a,b,c. - Errorbars:
using 1:2:3 with yerrorbars. - PNG:
set terminal png; set output 'x.png'; replot. Heredoc:gnuplot <<EOF…EOF. - Bash automation:
for f in *.txt; do gnuplot <<EOF...EOF; done. - Likely question: customise plot; fit quadratic; multiplot 2×2; PNG export.
Chapter 10 — Git Version Control¶
- Zones: working dir → staging (index) → local repo → remote.
- Setup:
git config --global user.{name,email}. - Cycle:
status add commit log diff. Modify+stage+commit pattern. - Branch:
switch -c x,merge x,branch -d x. - Remote:
remote add origin url,push -u origin main,pull --rebase. - GitLab TU-BS: PAT (api/read/write scopes) or SSH key.
- Conflicts: edit markers, add, commit.
- Likely question: setup + first commit + branch + merge; PAT setup.
Chapter 11 — C++ Basics¶
- Compile
g++ -O2 -std=c++17 -Wall src.cpp -o exe. - Types int 4B, char 1B, float 4B, double 8B, bool 1B.
- Pointer
int *p=&a; *p=7;. Referenceint& r=a; r=7;. - Pass by value (copy) / pointer (
int*) / reference (int&). - Class:
class C{private:…;public:…;};+C::methodoutside. - Complex class with
add (a+c)+(b+d)i,multiply (ac-bd)+(ad+bc)i,modulus sqrt(a²+b²). - Likely question: predict
example10.cppoutput; complete Complex; swap by pointer.
Chapter 12 — Build Process¶
- Stages:
.cpp→-E→.i→-S→.s→-c→.o→link→.exe. - Header guard
#ifndef X #define X #endif. - Static lib
ar rcs lib.a *.o. Shared libg++ -fPIC -shared -o lib.so *.cpp. - Link
-L path -l name. Run-timeLD_LIBRARY_PATH. - Make rule:
target: deps\n\trecipe. Auto vars$@ $< $^..PHONY: clean. - CMake:
cmake_minimum_required, project, add_library, add_executable, target_link_libraries; cmake -B build. - Likely question: pipeline diagram; write Makefile splitting Complex; CMake equivalent.
Chapter 13 — Debugging¶
- Build for debug:
g++ -O0 -g. - gdb:
break run next step print backtrace watch continue list quit. - Watchpoint:
watch i. - Common bugs: off-by-one (
i<=5), NULL deref, infinite loop, leak (debug06), logical (debug05). - valgrind:
valgrind --leak-check=full --track-origins=yes ./prog. - Sanitizers:
-fsanitize=address,undefined(~2× slower). - Mapper2D bug:
xyToPosshould bex + sx*y(lecture's(sx-1)*yis wrong). - Likely question: find bug with gdb step-by-step; explain leak detection.
Chapter 14 — Parallelization¶
- Shared memory ↔ OpenMP. Distributed memory ↔ MPI. Hybrid common.
- Amdahl
S(N)=1/(f+(1-f)/N). Strong vs weak scaling. - OpenMP:
#pragma omp parallel for reduction(+:sum) schedule(dynamic,k). - MPI 6 calls:
Init / Comm_rank / Comm_size / Send / Recv / Finalize. - Send args: buf, count, type, dest, tag, comm.
- Domain decomposition + halo cells for CFD.
- Compile
mpic++ -O2. Runmpirun -n N. - Likely question: OpenMP vs MPI; MPI hello; race condition fix.
Chapter 15 — HPC Cluster Usage¶
- Nodes: login (don't compute) / compute / GPU / fat / vis / storage / managing.
- Modules:
module purge,module load gcc/12 openmpi/4.1,module list,module spider. - SLURM:
sbatch run.sbatch,squeue -u $USER,scancel ID,sinfo,srun --pty bash,salloc. - Job script:
#SBATCH --nodes=N --ntasks-per-node=M --cpus-per-task=K --time=HH:MM:SS --partition=name --output=... - Env vars in script:
$SLURM_NTASKS, $SLURM_CPUS_PER_TASK, $SLURM_NODELIST, $SLURM_JOB_ID, $SLURM_SUBMIT_DIR. OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK; mpirun -n $SLURM_NTASKS ./solver.- Storage:
$HOMEslow /$WORKfast /$ARCHIVEtape. - Likely question: write a SBATCH script; explain
sbatchvssrunvssalloc.
Last-Minute Checklist¶
- [ ] I can convert
-rwxr-xr--↔ 754. - [ ] I can write a regex for email + IP + phone.
- [ ] I can write
awk -F, 'NR>1 && $4>1000'. - [ ] I can sketch the SSH passwordless flow.
- [ ] I can record + apply a Vim macro.
- [ ] I can write
backup-data.sh(verbose + sync). - [ ] I can write a multi-curve gnuplot with PNG export.
- [ ] I can
git init→ branch → merge → push. - [ ] I can compile and run a C++ program with pointers.
- [ ] I can explain pipeline
.cpp → .i → .s → .o → exewith flags. - [ ] I can run
gdbto find a NULL deref. - [ ] I can write MPI hello and an OpenMP reduction.
- [ ] I can write a SBATCH file for an MPI job.
High-Probability Long-Answer Topics¶
- "Discuss why HPC clusters use Linux."
- "Compare experiments and CFD simulations in research."
- "Walk through SSH passwordless authentication step by step."
- "Explain the build pipeline of a C++ program with all four stages."
- "Compare OpenMP and MPI; explain hybrid parallelism for CFD."
- "Describe the architecture of an HPC cluster and how a job traverses it."
Common Traps¶
| Trap | Fix |
|---|---|
chmode typo |
chmod |
[ $a==$b ] (no spaces) |
[ "$a" = "$b" ] |
forgot git add before commit |
git add first |
* in regex vs glob |
different meaning |
forgot -E for ERE |
grep -E, sed -E |
Missing $ brace in ${VAR} |
always ${...} |
| TAB vs spaces in Makefile | always TAB |
Forgot nohup + disown |
job dies on logout |
Permission 644 on private SSH key |
must be 600 |
Forgot MPI_Finalize |
always close |
Good luck — viel Erfolg!
End of revision guide.