Master the fundamental concepts of cache optimization through this focused micro-challenge.
Cache-oblivious algorithms use recursive divide-and-conquer so subproblems eventually fit in L1, L2, or L3 without hard-coded tile sizes. Matrix transpose is the textbook demo: naive a[j][i]=b[i][j] scans one matrix with huge stride.
Split the matrix into quadrants. Transpose each quadrant recursively until the base case fits in cache. Combine with a simple in-register transpose at the leaf.
cLoading…
Keep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will implement a recursive cache-oblivious transpose and compare against naive code. This exercise requires reporting both runtime and cache-miss counters.
Implement cache-oblivious matrix transpose using recursive divide-and-conquer.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github