Explain the difference between CUDA cores and Tensor cores. How do you optimize C++ code for parallel execution on a GPU?
Last updated
CUDA cores are general-purpose scalar ALUs running threads in 32-thread warps (SIMT). Tensor cores perform whole small matrix multiply-accumulates per instruction in mixed precision (FP16/BF16/TF32).
Tensor cores are used via cuBLAS/cuDNN or the
wmmaAPI, so prefer library kernels for matrix-heavy work.Optimize by coalescing memory access, minimizing warp divergence, using
__shared__memory, tuning block/grid sizes for occupancy, and overlapping compute with transfers via streams.
- https://www.techinterview.net/questions/cuda-gpu-computing-interview-questions
- https://www.aleksagordic.com/blog/matmul
- https://docs.nvidia.com/cuda/archive/9.0/cuda-c-programming-guide/
- https://docs.nvidia.com/cuda/archive/12.9.2/cuda-c-best-practices-guide/contents.html
- https://julianroth.org/documentation/cuda/
- https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html
- https://www.techinterview.net/blog/gpu-memory-architecture-interview