# GPU.js > GPGPU in pure JavaScript: gpu.js compiles JavaScript functions into shader > code and runs them on the GPU, falling back to the CPU when there is no > GPU available. gpu.rocks also hosts a free, hands-on GPGPU course that runs > entirely in the browser. Every page below is also available as Markdown by appending `.md` to its URL. The whole course in one file: https://gpu.rocks/llms-full.txt ## Site - [GPU.js — GPU accelerated JavaScript](https://gpu.rocks/index.md): GPGPU operations using pure JavaScript. gpu.js compiles your JavaScript functions into shader code and runs them on your GPU — with a CPU fallback. - [Benchmark — GPU.js](https://gpu.rocks/benchmark.md): Thirty GPGPU workloads timed in your browser on every backend gpu.js can reach — WebGPU, WebGL2, WebGL, WebAssembly and CPU — against hand-written implementations with no gpu.js in them. Every answer is checked against a plain-JavaScript oracle before it is timed. - [Installation — GPU.js](https://gpu.rocks/install.md): Install GPU.js from npm, yarn, or a CDN script tag and write your first GPU-accelerated JavaScript kernel in the browser or Node.js. - [Examples — GPU.js](https://gpu.rocks/examples.md): GPU.js examples: matrix multiplication and more GPGPU snippets you can read, run, and benchmark on your own graphics card. - [Learn GPGPU in your browser — GPU.js Learn](https://gpu.rocks/learn.md): 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. ## Course — GPGPU 101 From zero to your first thousand threads - [Hello, Kernel](https://gpu.rocks/learn/hello-kernel-f1399353.md): What a kernel is, what a thread is, and why this.thread.x replaces your for-loop. - [Data In, Data Out](https://gpu.rocks/learn/data-in-data-out-42b68d01.md): Feeding arrays and images into kernels, shaping 1D/2D/3D output, and reading results back. - [Pipelines & Textures](https://gpu.rocks/learn/pipelines-and-textures-9f4aeaa5.md): Chaining kernels so data stays on the GPU — the single biggest real-world speedup. - [Measuring Speed Honestly](https://gpu.rocks/learn/measuring-speed-honestly-b9188894.md): Warm-up, transfer costs, and precision — when the GPU wins, and when the CPU quietly beats it. ## Course — Parallel Primitives The handful of patterns everything else is built from - [Thinking in Parallel](https://gpu.rocks/learn/thinking-in-parallel-c3876efb.md): Map and gather patterns, why kernels write only their own cell, and how to design around it. - [Reductions](https://gpu.rocks/learn/reductions-3dadc130.md): Sum, min, max and mean over millions of values — the ladder pattern every platform uses. - [Prefix Sums (Scan)](https://gpu.rocks/learn/prefix-sum-351cfa41.md): Running totals in parallel — the doubling ladder, exclusive scans, and the offsets every variable-sized output depends on. - [Stream Compaction](https://gpu.rocks/learn/stream-compaction-0aed2e43.md): Filtering on a GPU: flag what survives, scan to find out where it lands, then gather it into a packed array. - [Histograms & Binning](https://gpu.rocks/learn/histograms-and-binning-dfb254f4.md): Counting values into bins with no atomics — the scatter that has to become a gather. - [Top-K Selection](https://gpu.rocks/learn/top-k-selection-1ba56df3.md): The ten largest of a million values: rank by counting, gather the winners, or bisect for a cutoff — and when each one wins. - [Jump Flooding: Voronoi in log n Passes](https://gpu.rocks/learn/jump-flooding-a741a650.md): A Voronoi diagram and a signed distance field in log₂(n) passes — more total work than the CPU algorithm, and faster anyway. - [Bitonic Sort](https://gpu.rocks/learn/bitonic-sort-84e0728e.md): More comparisons than quicksort, and far faster on a GPU — because the whole comparison schedule is fixed before the data arrives. - [Radix Sort](https://gpu.rocks/learn/radix-sort-fd3ff796.md): A histogram, a scan and a gather assembled into the sort production GPU libraries actually run. ## Course — Math & Simulation Heavy math, thousands of threads at once - [Matrix Multiply](https://gpu.rocks/learn/matrix-multiply-972e080b.md): The canonical GPGPU workload: from naive triple loop to a kernel that scales. - [Monte Carlo Methods](https://gpu.rocks/learn/monte-carlo-methods-9ea19810.md): Estimate π, price an option, integrate the un-integrable — with a million random samples. - [N-Body Gravity](https://gpu.rocks/learn/n-body-gravity-5de47751.md): Every particle pulls on every other: an O(n²) problem the GPU eats for breakfast. - [ODE Integrators](https://gpu.rocks/learn/ode-integrators-62f4a3ff.md): Euler, midpoint, RK4 and velocity Verlet — measured against a closed form, one thread per trajectory. - [Iterative Linear Solvers](https://gpu.rocks/learn/iterative-solvers-e73b8e1f.md): Jacobi, Gauss-Seidel, and why colouring a grid like a chessboard turns a sequential algorithm parallel. - [The Heat Equation & Stability](https://gpu.rocks/learn/heat-and-stability-514063bb.md): Why a correct-looking simulation explodes — the step-size limit, and the implicit step that ignores it. - [Gradient Descent](https://gpu.rocks/learn/gradient-descent-c94c3f22.md): 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. - [The Ising Model: Colour to Break the Race](https://gpu.rocks/learn/ising-model-1f12d841.md): 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. ## Course — Computer Vision Teaching a GPU to look at pictures, not just draw them - [Colour Spaces](https://gpu.rocks/learn/colour-spaces-8d79c6af.md): Leaving RGB: perceptual luminance, the hue wheel, and why a channel that wraps breaks ordinary arithmetic. - [Convolution & Filters](https://gpu.rocks/learn/convolution-and-filters-66933805.md): Sliding-window math on signals and images: blur, sharpen, edge detection. - [Thresholding & Morphology](https://gpu.rocks/learn/thresholding-and-morphology-670eaafa.md): Turning grey pixels into a clean binary mask: global and adaptive thresholds, then erosion and dilation as a neighbourhood min and max. - [The Canny Edge Pipeline](https://gpu.rocks/learn/canny-edges-6901c51a.md): The edge detector every vision library ships, one kernel per stage — blur, gradient, thinning, thresholds, hysteresis — then chained with pipeline: true. - [Seam Carving: Content-Aware Resizing](https://gpu.rocks/learn/seam-carving-a23a0d9b.md): 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. - [Template Matching](https://gpu.rocks/learn/template-matching-f57b4bed.md): Finding a patch in a picture — and why a raw difference score is fooled by a light switch. - [Optical Flow](https://gpu.rocks/learn/optical-flow-e85c6dfa.md): 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. - [Video Filters](https://gpu.rocks/learn/video-filters-4d39e404.md): Sixteen milliseconds a frame, and state that survives between them: temporal filtering, motion masks and a background model. ## Course — Signal Processing Time in, frequency out — and the algorithm that made it practical - [Sampling & Aliasing](https://gpu.rocks/learn/sampling-and-aliasing-ad14836c.md): One thread per sample: build a signal, watch a tone come back as the wrong one, and rebuild what fell between. - [The DFT, Honestly](https://gpu.rocks/learn/the-dft-7b1e3f9b.md): One thread per frequency bin, each summing over every sample — the honest O(n²) transform, complex arithmetic and all. - [The FFT Butterfly](https://gpu.rocks/learn/fft-butterfly-d4375da7.md): 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. - [Windowing & Spectral Leakage](https://gpu.rocks/learn/windowing-f563138d.md): Why the same tone looks clean or filthy depending only on how many samples you took — and what a window costs to fix it. - [Filtering in the Frequency Domain](https://gpu.rocks/learn/frequency-filtering-8c225e10.md): Convolution becomes multiplication — the trade that makes the FFT worth its complexity, plus the ringing, the wrap-around and the cross terms it hides. - [Spectrograms](https://gpu.rocks/learn/spectrograms-9ecd2295.md): Slide a window along a signal and transform every slice — a picture of frequency over time, one thread per (frame, bin). - [Autocorrelation & Pitch](https://gpu.rocks/learn/autocorrelation-b159433f.md): Finding the note in a sound by asking how well it resembles itself, shifted — and the octave error that catches every naive detector once. ## Course — Computational Graphics Pictures computed, not drawn - [Pixels from Scratch](https://gpu.rocks/learn/pixels-from-scratch-d2869039.md): Graphical kernels and this.color(): gradients, patterns and plots, one thread per pixel. - [Escape-Time Fractals](https://gpu.rocks/learn/escape-time-fractals-0de4764c.md): Mandelbrot and Julia sets with smooth coloring — infinite detail from a ten-line kernel. - [Cellular Automata](https://gpu.rocks/learn/cellular-automata-407c2c34.md): Conway's Life and friends: feed a kernel's output back in and watch worlds evolve. - [Reaction–Diffusion](https://gpu.rocks/learn/reaction-diffusion-bc3d0b34.md): Two chemicals, two equations, and suddenly: coral, fingerprints, leopard spots. - [Hydraulic Erosion: Carving Terrain by Accumulation](https://gpu.rocks/learn/hydraulic-erosion-07165ca1.md): Rain on a fractal heightmap, one gather at a time — until the noise grows rivers. - [Ray-Marched Metaballs](https://gpu.rocks/learn/ray-marched-metaballs-8b1282bd.md): Signed distance fields and soft shadows — a real-time 3D scene with no triangles at all. - [Progressive Path Tracing: Noise Melting Into an Image](https://gpu.rocks/learn/path-tracing-c99efc67.md): Every pixel fires its own random rays; a buffer that outlives the frame turns the static into a picture. ## Course — Others - [Wavefronts: Aligning DNA on the Diagonal](https://gpu.rocks/learn/sequence-alignment-a85ca6d9.md): Smith-Waterman looks fatally serial — until you notice that every cell on an anti-diagonal is independent.