CUDA turns a graphics accelerator into a general-purpose processor: neural networks are trained and run on NVIDIA GPUs, physics is simulated and data is processed. NVIDIA released the platform in 2007. CUDA is proprietary — programs written for it run only on NVIDIA GPUs; OpenCL, by contrast, is an open cross-platform standard.
What it consists of
| Component | What it provides |
|---|---|
| Driver | links the program to the GPU, manages memory and task launching; the driver version determines which CUDA Toolkit versions the application works with |
| CUDA Toolkit | the nvcc compiler, a debugger, a profiler and libraries, such as cuBLAS for matrix operations; cuDNN for neural networks and NCCL for communication between GPUs are installed separately |
| Language and extensions | a C/C++ extension for writing kernels, plus running code in Python, Julia and Fortran through bindings |
How a kernel works
The programmer writes a kernel — code that runs on the GPU in parallel across thousands of threads. Threads are grouped into blocks, blocks into a grid, and the same operation is applied to thousands of data elements at once.
__global__ void add(const float* x, const float* y, float* z, int n) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < n) z[i] = x[i] + y[i]; } add<<<256, 256>>>(x, y, z, n); Compatibility
Each GPU generation has a compute capability number, for example 8.9 for Ada Lovelace and 9.0 for Hopper. Binary code built for a given version runs on GPUs of the same generation with a higher second digit; for a new generation it is rebuilt, or intermediate PTX bytecode is kept, which the driver compiles for the specific GPU on the fly. Since CUDA 11, minor version compatibility applies: applications from one major Toolkit family run on a sufficiently new driver without updating it.
Sources
the term is written from these pagesVerified 9 Nov