PX457 · Course contents

Introduction to High Performance Computing

A simulation takes a month on one processor. If we buy a thousand processors, should it finish in forty-three minutes? Only if the work can be divided, the data can reach each processor, and the processors spend almost no time waiting. Even then, the answer must retain the accuracy the scientist needs.

This is the organising problem of high-performance computing (HPC): obtain useful scientific results within limits on time, memory, energy and cost. Supercomputers and clusters provide resources; algorithms and implementations determine how effectively those resources are used. This first week establishes two contracts that we will keep returning to: what numerical answer is acceptable, and what counts as improved performance.

In this chapter: numbers, rates, hardware scaling, energy, and the course ahead.

1. Before computing faster, decide what a number means

Integers have a range

The unsigned eight-bit pattern 01111001 represents

121=64+32+16+8+1.121=64+32+16+8+1.

Integers in range are represented exactly. Arithmetic is exact only when its result is representable. In C, unsigned arithmetic wraps modulo a power of two; signed integer overflow is undefined behaviour. An iteration count, allocation size or array index can therefore fail before any floating-point operation occurs.

Real arithmetic becomes rounded arithmetic

Decimal scientific notation separates scale from significant digits: 123456=1.23456×105123456=1.23456\times10^5. A normal binary floating-point number similarly has the form

x=(−1)s(1.f)2 2e.x=(-1)^s(1.f)_2\,2^e.

IEEE binary32 stores one sign bit, eight exponent bits and twenty-three fraction bits. The implicit leading one gives twenty-four significant binary digits for normal numbers. Zero, subnormal numbers, infinities and NaNs require separate encodings.

For example, 123456123456 is exactly representable in binary32:

sign     exponent       fraction
 0       10001111       11100010010000000000000

Here the stored exponent is 143143, so e=143−127=16e=143-127=16. But a finite binary fraction cannot represent every decimal fraction: 0.90.9 has a repeating binary expansion. A calculation starts from a nearby representable number and rounds again after arithmetic operations.

Consider adding 10−810^{-8} to 11 in binary32, using round-to-nearest. The next representable number above 11 is 1+2−231+2^{-23}. Since 10−8<2−2410^{-8}<2^{-24}, the exact sum is nearer to 11 and rounds back to it.

A small increment can disappear
1midpoint1 + 2⁻²³1 + 10⁻⁸
Near 1, adjacent binary32 values are separated by 2⁻²³. The increment 10⁻⁸ lies before the midpoint, so round-to-nearest returns 1. Distances are schematic; the labelled order is exact. ↗

For a normal result away from overflow and underflow, a standard rounding model is

fl⁡(a∘b)=(a∘b)(1+δ),∣δ∣≤u,u=2−24for binary32,\operatorname{fl}(a\circ b)=(a\circ b)(1+\delta),\qquad |\delta|\le u, \qquad u=2^{-24}\quad\text{for binary32},

where ∘\circ is a basic arithmetic operation and rounding is to nearest. This is a local error model, not a bound on an entire simulation. Cancellation can make a small absolute error large relative to the final result. Later, parallel reductions will change the order of additions; a different final bit pattern need not mean a race, but it must still satisfy the application's error tolerance.

Rounding is a map onto a discrete set of values. Follow an exact sum as it crosses a rounding boundary; then change the scale of the number.

When a number falls between the marks

Move an exact increment across the rounding midpoint. Which representable value keeps it?

Play, pause, or scrub to inspect a moment.

rounding midpointexact increment: 0 spacing11 + 2⁻²³exact value → representable neighbour

Paused. The exact increment is 0 of a spacing. It rounds to the lower neighbour.

The increment sweeps across one binary32 spacing. The moving dot is the exact sum; the outlined dot is its rounded representation. Ties use round-to-nearest, ties-to-even. ↗

2. A rate is not a time to solution

A FLOP is a floating-point arithmetic operation; FLOP/s is a rate. If a calculation performs WW operations at sustained rate RR, then its arithmetic time is W/RW/R. This estimate excludes waiting for memory, communication, storage and other work.

A fused multiply-add, ab+cab+c, is conventionally counted as two FLOPs even though it can be one instruction. Peak rates must state precision and counting convention. A GPU's low-precision tensor rate cannot be compared directly with a CPU's binary64 rate.

As a dated example, the November 2024 TOP500 list reports El Capitan with 11,039,616 listed cores, an HPL result of 1.742 exaFLOP/s, theoretical peak 2.74638 exaFLOP/s and listed power 29.581 MW. These are different quantities; neither rate predicts the speed of an arbitrary application. The original lecture's rounded “2.8 exaFLOPS” should be read as a peak-scale figure, not an HPL measurement or a current ranking.

The Apollo guidance computer provides the opposite historical scale: tiny memory and a tightly constrained mission. Its integer-oriented instruction set makes an unqualified FLOP/s comparison misleading; see NASA's hardware history. The useful lesson is that a constrained machine can accomplish a carefully designed computation. Likewise, a smartphone's advertised teraFLOP/s says little without the precision, workload and power envelope.

A cluster contains racks of nodes connected by a network. A node may contain several CPU sockets, multiple cores per socket, and accelerators. Three capacities now matter separately: arithmetic throughput, the rate at which data reaches that arithmetic, and the amount of data that fits in memory. More of one cannot always compensate for too little of another.

3. Why transistor growth led to parallelism

A MOSFET uses gate voltage to control conduction between source and drain. CMOS combines complementary transistor types to implement logic such as NOT and NAND: NAND outputs zero only when both inputs are one. Ideal static CMOS draws negligible steady current, but real devices also dissipate leakage and short-circuit power.

Moore's law describes the historical growth of transistor counts, often summarised as a doubling roughly every two years. It is an observation about integration, not a theorem guaranteeing faster programs or an expiry date. Modern process-node names are technology labels, not direct measurements of a single transistor dimension.

Dennard scaling supplied a different argument: under ideal proportional scaling of dimensions and voltage, faster and more numerous transistors could operate at approximately constant power density. A simplified dynamic-power relation explains the attraction:

Wdynamic≈aCV2ν,W_{\mathrm{dynamic}}\approx aCV^2\nu,

where aa is switching activity, CC switched capacitance, VV supply voltage and ν\nu clock frequency. Voltage reduction is particularly valuable because it appears squared. Leakage and limits to voltage scaling undermined this trajectory around the mid-2000s. Raising frequency indefinitely became thermally expensive.

Manufacturers could still add transistors, but increasingly used them for more cores, SIMD units, caches and specialised accelerators. Single-thread performance has continued to improve through architectural changes; the lost expectation is that clock-frequency growth alone will rescue an unchanged program.

Industry demand has moved through scientific and military computing, personal computers, graphics and gaming, mobile/cloud services, cryptocurrency and machine learning. These overlapping drivers explain why hardware can favour a particular arithmetic precision or data pattern. A scientist must check whether that specialisation matches the problem.

4. The fastest configuration need not use the least energy

At constant power WW, energy is E=WTE=WT. If reducing frequency changes runtime by a factor tt and power by a factor ww, energy changes by wtwt. A 10% slower calculation at 20% lower power uses 1.1×0.8=0.881.1\times0.8=0.88 times the energy. It saves 12% while occupying the machine longer.

ARCHER2's frequency study compared 2.25 and 2.0 GHz. Three of four benchmarks showed 13–20% energy reductions with 1–5% performance reductions. That is workload-specific evidence, not a promise for every program. Memory-bound code can be relatively insensitive to core frequency; compute-bound code may react differently.

The source also used ARCHER2 to discuss capital cost, electricity and embodied carbon. Those remain distinct accounting questions: manufacturing emissions occur even before the first job; operational emissions depend on energy use and the electricity-accounting method. The service's sustainability information explains its reporting approach. Undated lecture cost/carbon estimates are recorded as unverified historical figures in the editorial ledger rather than treated as current measurements.

Zettascale means 102110^{21} FLOP/s. For an illustrative efficiency of 47.647.6 GFLOP/s/W, arithmetic at that rate would require about 2121 GW. This is a proportional extrapolation with fixed efficiency, not a prediction of a future installation. Improving useful work per joule matters as much as increasing nominal peak throughput.

The energy calculation can be read geometrically as an area under a power curve. Let the two runs unfold on the same axes.

Watch power become energy

The lower-power run takes longer. Predict whether the shaded area will still be smaller when it finishes.

Play, pause, or scrub to inspect a moment.

power (normalised)time (normalised)10.8011.1energy so far = 0

Paused. Elapsed time 0; power 1; accumulated energy 0.

Power is normalised to 1. The alternative uses power 0.8 for time 1.1. Areas use the same scales; the growing area is accumulated energy, not a measured machine trace. ↗

5. Follow both instructions and data

CPUs emphasise flexible control, low latency and complex instruction streams. GPUs devote more resources to throughput across many threads. Discrete GPUs typically have their own high-bandwidth memory, although integrated and unified-memory systems complicate that simple split. Neither processor is universally faster.

Language choice is similarly incomplete as an explanation. A Python loop may pay substantial interpreter overhead, while a NumPy operation can call highly tuned compiled kernels. C and Fortran offer detailed control, but handwritten low-level code does not automatically beat a numerical library.

The course first improves instruction flow, then data flow. OpenMP distributes work within shared memory; MPI makes ownership and communication explicit across processes; CUDA exposes GPU execution. Finally, performance models help interpret measurements, and automatic differentiation shows how a high-level mathematical operation can expose efficient parallel structure.

Exercises

  1. Explain why an integer overflow, a floating-point rounding difference and a data race require different remedies.
  2. A kernel performs 2N2N FLOPs and transfers 24N24N bytes. What information besides peak FLOP/s is needed to estimate its runtime?
  3. Derive the energy break-even condition wt<1wt<1. Why can an energy-saving configuration still be unattractive to a user facing a deadline?