Distributed-memory parallelism. These are C + MPI programs plus one browser demo.
MPI runs many separate processes that cooperate by passing messages — it
cannot run inside a browser. Open the .c files to view the
code, then run them with mpicc + mpirun or an online MPI
playground (see "How to run" below).
Watch Broadcast, Scatter, Gather, and Reduce move data between rank 0 and its workers. The mental model behind every collective call. Runs in-browser — show it live.
Your first MPI program. Each process prints its rank out of size. Run order is non-deterministic — the first "aha".
Two processes bounce a number with MPI_Send / MPI_Recv. Includes the deadlock trap and why send/recv ordering matters.
The workhorse pattern: broadcast a size, scatter an array, sum locally, reduce to a grand total. Fan-out then fan-in (map-reduce).
Scatter chunks → each process sorts its chunk locally → gather → k-way merge on rank 0. A distributed sort, end to end.
The .c files need an MPI implementation (Open MPI or MPICH). Compile with mpicc file.c -o out and launch N processes with mpirun -np 4 ./out.
No MPI installed? Use mpitutorial.com, an online MPI playground, or any Linux box (sudo apt install mpich). MPI cannot run in a browser. Full instructions and the install notes are in README.md.
Unit IV: OpenMP (Session 10, shared memory) · MPI (this session, distributed memory) · CUDA (Session 12, GPU).