Research notebook

CUDA Transpose: Coalescing and Bank Padding notebook

Edit a Python cell and run it here. Your code runs in this browser tab; the notebook runtime and packages are served by this site.

Python starts when you choose Run.

CUDA Transpose: Coalescing and Bank Padding

Rectangular indexing and a simple bank-address model separate two optimizations: contiguous global access and padded shared-memory layout.

CPU rectangular indexing and simplified shared-memory bank-address model; no GPU execution.

The code uses Python 3 and the standard library. Saved output is from the checked CPU run.

Python · cell 1
transpose 5x7 -> 7x5: correct
last output row: [6, 16, 26, 36, 46]
shared row stride=32: unique banks=1
shared row stride=33: unique banks=32
Bank-address model only; no hardware counters or timing.

Sources

  • NVIDIA efficient transpose tutorial: https://developer.nvidia.com/blog/efficient-matrix-transpose-cuda-cc/
  • Lei Mao CuTe transpose walkthrough: https://leimao.github.io/article/CuTe-Matrix-Transpose/

Python runs locally in this page. Saved results and figures are visible before execution.

Download full experiment notebook