Code laboratory

Reproduce the programs already developed in the chapters: system calls and processes, file permissions, shell scripts, memory-hierarchy and bandwidth probes, races and locks, the Jacobi solver, and OpenMP work distribution.

This laboratory is a directory and command-line launcher for the existing chapter programs. Read each chapter for its assumptions, model definitions, units, and worked interpretation.

Download the Python launcher with the rest of the repository. The programs are C, Python 3 and Bash, and run in a Linux shell: natively on Linux, or through WSL 2 on Windows. They need gcc with OpenMP support, and the Python programs of chapters 1, 4 and 9 also need NumPy. From the repository root:

python code_lab.py
python code_lab.py --chapter 9
python tools/check_chapter_code.py

The first command lists the programs of each chapter. The second builds and runs every program of one chapter in a temporary directory. The verification tool runs all programs and compares their output with the printed output in the book: byte for byte where a listing is marked data-check="exact", and successful exit only where it is marked data-check="returncode" (timings and thread interleaving differ from run to run). The execution record reports actual results on the verification machine.

ChapterProgram contextProgramsFiles
01What high performance scientific computing is for9poisson_check.py, flopcount.c, matmul_bench.c, solve_bench.py, iterations.py, budget.py, growth.py, frontier.py, cg_spectrum.py
02Operating systems and the Linux kernel13privileged.c, launch.c, launch_cost.c, syscall_cost.c, chunks.c, sched_sim.py, fairshare.c, ctxswitch.c, pagetable.py, ptes.c, pagefault.c, fdtypes.c, forkcost.c
03The Linux file system: names, inodes, permission bits and ownership14free_used.py, nav_session.sh, names_inodes.py, files_session.sh, redirect_session.sh, owner_class.sh, mode_decode.py, access_predicate.py, chmod_session.sh, chmod_model.py, umask_check.py, group_session.sh, shared_dir_model.py, modestr.c
04Processes, text processing, memory and networking from the command line17jacobi_log.c, machine.sh, jobs_demo.sh, states.c, regex_derivative.py, blowup.py, lecture_files.sh, pipes.sh, logsummary.sh, rate_check.sh, modal_check.py, end_prediction.py, modal_big.py, memory_model.c, meminfo_check.py, loopback.sh, ssh_tools.sh
05Shell scripting: processes, input, and control flow12exec_modes.sh, interp_line.sh, arith.sh, env_demo.sh, path_demo.sh, status_demo.sh, read_demo.sh, loops_demo.sh, functions_demo.sh, fork_cost.sh, monitor.sh, sweep.sh
06The components of an HPC system and the architecture of a compute node8top500_arith.py, stripe.py, workspan.py, fma_scalar.c, fma_vector.c, variants.py, node_scaling.c, pingpong.c
07Hierarchical memory and scalable architectures9interleave.py, reuse.py, chase.c, stride.c, cachesim.py, sumcg.c, rowcol.c, coherence.py, topology.py
08Concurrency and synchronization: races, locks, atomic instructions and barriers10interleave.py, counter.c, lock_model.py, sb.c, peterson.c, locks.c, cas_pi.c, barrier.c, deadlock.c, omp_counter.c
09Why parallel computing: numerical models and their cost12moore_fit.py, bag_of_integers.py, error_balance.c, order_check.py, canonical_check.py, jacobi.c, jacobi_error.c, jacobi_time.c, cost_model.py, band_solve.c, autopar.c, gauss_seidel.c
10Memory bottlenecks, the organization of large HPC systems and the Grace Hopper superchip10hierarchy.c, faults.c, amat.py, stream_mini.c, fill_mini.c, peak_fma.c, jacobi_bench.c, roofline.py, jacobi_check.c, systems.py
11OpenMP I: shared-memory threads and the distribution of work11hello.c, interleavings.py, team.c, race.c, pi_error.c, pi_spmd.c, triangle.c, amdahl.py, fork_cost.c, falseshare.c, pi_scaling.c