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.
| Chapter | Program context | Programs | Files |
|---|---|---|---|
| 01 | What high performance scientific computing is for | 9 | poisson_check.py, flopcount.c, matmul_bench.c, solve_bench.py, iterations.py, budget.py, growth.py, frontier.py, cg_spectrum.py |
| 02 | Operating systems and the Linux kernel | 13 | privileged.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 |
| 03 | The Linux file system: names, inodes, permission bits and ownership | 14 | free_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 |
| 04 | Processes, text processing, memory and networking from the command line | 17 | jacobi_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 |
| 05 | Shell scripting: processes, input, and control flow | 12 | exec_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 |
| 06 | The components of an HPC system and the architecture of a compute node | 8 | top500_arith.py, stripe.py, workspan.py, fma_scalar.c, fma_vector.c, variants.py, node_scaling.c, pingpong.c |
| 07 | Hierarchical memory and scalable architectures | 9 | interleave.py, reuse.py, chase.c, stride.c, cachesim.py, sumcg.c, rowcol.c, coherence.py, topology.py |
| 08 | Concurrency and synchronization: races, locks, atomic instructions and barriers | 10 | interleave.py, counter.c, lock_model.py, sb.c, peterson.c, locks.c, cas_pi.c, barrier.c, deadlock.c, omp_counter.c |
| 09 | Why parallel computing: numerical models and their cost | 12 | moore_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 |
| 10 | Memory bottlenecks, the organization of large HPC systems and the Grace Hopper superchip | 10 | hierarchy.c, faults.c, amat.py, stream_mini.c, fill_mini.c, peak_fma.c, jacobi_bench.c, roofline.py, jacobi_check.c, systems.py |
| 11 | OpenMP I: shared-memory threads and the distribution of work | 11 | hello.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 |