Week 15 — Coding Projects

Core

Implement bitonic sorting network.

  • NumPy: Simulate comparator stages explicitly. Print intermediate arrays for small n.
  • Metal: Bitonic sort compute kernel with barrier placement between stages. · Reading: MBT — compute passes over buffers, synchronization, staged algorithms.
  • Vulkan: Bitonic sort in compute shaders with barrier placement and staged compare-exchange kernels. · Reading: Vulkan Book — repeated compute dispatches, barrier placement, staged compare-exchange kernels.
  • CUDA: Bitonic sort kernel with branch-friendly compare-exchange structure. · Reading: CUDA Book — sorting kernels, compare-exchange structure, branch behavior.
  • Stretch: Sort key-value pairs. Benchmark against a CPU baseline.
  • Verify: Correctness on random arrays and duplicates · Stage ordering is right · Bitonic constraints are understood.