A free hands-on GPGPU course built on gpu.js: write real kernels in your browser, run them on your own GPU, and learn ideas that transfer to CUDA and WebGPU.
GPGPU 101
From zero to your first thousand threads
Hello, Kernel — What a kernel is, what a thread is, and why this.thread.x replaces your for-loop. (5 tasks)
Data In, Data Out — Feeding arrays and images into kernels, shaping 1D/2D/3D output, and reading results back. (6 tasks)
Pipelines & Textures — Chaining kernels so data stays on the GPU — the single biggest real-world speedup. (5 tasks)
Measuring Speed Honestly — Warm-up, transfer costs, and precision — when the GPU wins, and when the CPU quietly beats it. (4 tasks)
Parallel Primitives
The handful of patterns everything else is built from
Thinking in Parallel — Map and gather patterns, why kernels write only their own cell, and how to design around it. (6 tasks)
Reductions — Sum, min, max and mean over millions of values — the ladder pattern every platform uses. (6 tasks)
Prefix Sums (Scan) — Running totals in parallel — the doubling ladder, exclusive scans, and the offsets every variable-sized output depends on. (6 tasks)
Stream Compaction — Filtering on a GPU: flag what survives, scan to find out where it lands, then gather it into a packed array. (5 tasks)
Histograms & Binning — Counting values into bins with no atomics — the scatter that has to become a gather. (5 tasks)
Top-K Selection — The ten largest of a million values: rank by counting, gather the winners, or bisect for a cutoff — and when each one wins. (5 tasks)
Jump Flooding: Voronoi in log n Passes — A Voronoi diagram and a signed distance field in log₂(n) passes — more total work than the CPU algorithm, and faster anyway. (6 tasks)
Bitonic Sort — More comparisons than quicksort, and far faster on a GPU — because the whole comparison schedule is fixed before the data arrives. (5 tasks)
Radix Sort — A histogram, a scan and a gather assembled into the sort production GPU libraries actually run. (6 tasks)
Math & Simulation
Heavy math, thousands of threads at once
Matrix Multiply — The canonical GPGPU workload: from naive triple loop to a kernel that scales. (5 tasks)
Monte Carlo Methods — Estimate π, price an option, integrate the un-integrable — with a million random samples. (4 tasks)
N-Body Gravity — Every particle pulls on every other: an O(n²) problem the GPU eats for breakfast. (5 tasks)
ODE Integrators — Euler, midpoint, RK4 and velocity Verlet — measured against a closed form, one thread per trajectory. (6 tasks)
Iterative Linear Solvers — Jacobi, Gauss-Seidel, and why colouring a grid like a chessboard turns a sequential algorithm parallel. (5 tasks)
The Heat Equation & Stability — Why a correct-looking simulation explodes — the step-size limit, and the implicit step that ignores it. (5 tasks)
Gradient Descent — Fit a line by walking downhill — the gradient as a reduction, the learning rate as a stability limit, and 1,024 searches in one launch. (5 tasks)
The Ising Model: Colour to Break the Race — Metropolis on a lattice of spins, the race that makes an all-at-once update silently wrong, and the checkerboard that repairs it — ending in a temperature slider you can drag through a phase transition. (6 tasks)
Computer Vision
Teaching a GPU to look at pictures, not just draw them
Colour Spaces — Leaving RGB: perceptual luminance, the hue wheel, and why a channel that wraps breaks ordinary arithmetic. (5 tasks)
Convolution & Filters — Sliding-window math on signals and images: blur, sharpen, edge detection. (5 tasks)
Thresholding & Morphology — Turning grey pixels into a clean binary mask: global and adaptive thresholds, then erosion and dilation as a neighbourhood min and max. (6 tasks)
The Canny Edge Pipeline — The edge detector every vision library ships, one kernel per stage — blur, gradient, thinning, thresholds, hysteresis — then chained with pipeline: true. (6 tasks)
Seam Carving: Content-Aware Resizing — Shrink a picture by deleting its most boring pixels — an energy map, a wavefront DP one launch per row, and a gather that reflows the image. (6 tasks)
Template Matching — Finding a patch in a picture — and why a raw difference score is fooled by a light switch. (5 tasks)
Optical Flow — Per-pixel motion between two frames: the aperture problem, a 2×2 least-squares solve per thread, and knowing when not to believe the answer. (5 tasks)
Video Filters — Sixteen milliseconds a frame, and state that survives between them: temporal filtering, motion masks and a background model. (6 tasks)
Signal Processing
Time in, frequency out — and the algorithm that made it practical
Sampling & Aliasing — One thread per sample: build a signal, watch a tone come back as the wrong one, and rebuild what fell between. (5 tasks)
The DFT, Honestly — One thread per frequency bin, each summing over every sample — the honest O(n²) transform, complex arithmetic and all. (5 tasks)
The FFT Butterfly — Split the sum by parity and the transform collapses from n² terms to log₂n passes of a two-line butterfly — the same multi-pass gather every ladder in this course uses. (6 tasks)
Windowing & Spectral Leakage — Why the same tone looks clean or filthy depending only on how many samples you took — and what a window costs to fix it. (5 tasks)
Filtering in the Frequency Domain — Convolution becomes multiplication — the trade that makes the FFT worth its complexity, plus the ringing, the wrap-around and the cross terms it hides. (5 tasks)
Spectrograms — Slide a window along a signal and transform every slice — a picture of frequency over time, one thread per (frame, bin). (5 tasks)
Autocorrelation & Pitch — Finding the note in a sound by asking how well it resembles itself, shifted — and the octave error that catches every naive detector once. (5 tasks)
Computational Graphics
Pictures computed, not drawn
Pixels from Scratch — Graphical kernels and this.color(): gradients, patterns and plots, one thread per pixel. (4 tasks)
Escape-Time Fractals — Mandelbrot and Julia sets with smooth coloring — infinite detail from a ten-line kernel. (5 tasks)
Cellular Automata — Conway's Life and friends: feed a kernel's output back in and watch worlds evolve. (5 tasks)
Reaction–Diffusion — Two chemicals, two equations, and suddenly: coral, fingerprints, leopard spots. (4 tasks)