/host-software/cuda-c
CUDA C++ (programming language)
CUDA C++ is an implementation of the CUDA programming model as an extension of the C++ programming language.
CUDA C++ adds several features to C++ to implement the CUDA programming model , including:
- Kernel definition with
global
. CUDA kernels are implemented as C functions that take in pointers and have return typevoid
, annotated with this keyword. - Kernel launches with
<<<>>>
. Kernels are executed from the CPU host using a triple bracket syntax that sets the thread block grid dimensions. - Shared memory allocation
with the
shared
keyword, barrier synchronization with the__syncthreads()
intrinsic function, and thread block and thread indexing with theblockDim
andthreadIdx
built-in variables.
CUDA C++ programs are compiled by a combination of host C/C++ compiler drivers
like gcc
and the
NVIDIA CUDA Compiler Driver , nvcc
.
For information on how to use CUDA C++ on Modal, see this guide .