CUDA: A Comprehensive Guide and Cheat sheet.

Pau Santana
3 min readApr 21, 2024
A picture of CUDA’s processing workflow in a Geforce 8800 GTX

CUDA, short for Compute Unified Device Architecture, is a parallel computing platform and programming model developed by NVIDIA. It enables developers to harness the power of NVIDIA GPUs for accelerating general-purpose computations. Whether you’re a beginner diving into CUDA programming or an experienced developer looking for a quick reference, this guide and cheat sheet will help you navigate the CUDA ecosystem with ease.

1. Checking CUDA Compiler Version

Before diving into CUDA development, it’s essential to ensure that you have the correct CUDA toolkit installed on your system. You can check the CUDA compiler version using the following command:

nvcc --version

This command will display the version of the NVIDIA CUDA Compiler along with other relevant information.

2. Obtaining CUDA Architecture Values

Understanding the CUDA architecture targeted by your code is crucial for optimizing performance and compatibility. You can obtain the CUDA architecture values using the following code snippet:

#include <cstdio>
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
__global__ void example() {
const char my_compile_time_arch[] = STR(__CUDA_ARCH__)…

--

--