01 — Build & Run the Ladder¶
Goal: get a feel for the whole project by building and running every optimization level and watching the performance evolve.
Build everything¶
This produces, in build/:
matvec0…matvec14— the 15 matrix-vector levelsmatmat0…matmat10— the portable matrix-matrix levelsref_matmul,ref_matvec— reference drivers
Why only matmat0–10?
matmat/optim11–14 use x86 SSE intrinsics and a sse_compat.h that isn't
provided, so they're excluded by default. See
Writing a new level for how a portable
sse_compat.h would enable them.
Run every level¶
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
printf "matvec%-2s " $i; ./build/matvec$i
done
for i in 0 1 2 3 4 5 6 7 8 9 10; do
printf "matmat%-2s " $i; ./build/matmat$i
done
Each program allocates random data, times the kernel, and prints something like:
What to watch for¶
- GFLOPS generally climbs as the kernel matures (unrolling → registers → vectorization → blocking → packing).
- Some levels dip — those are the "structure-first" steps (e.g.
optim6builds a tile from many dot products before re-fusing). That's expected and instructive. - The times and GFLOPS depend heavily on your CPU, cache sizes, and compiler.
Manual build (for one level)¶
Next
Now that you can run the ladder, learn to interpret the numbers in 02 — Reading GFLOPS & Roofline.