CUDA


CUDA is a parallel computing platform and application programming interface model created by Nvidia. It allows software developers and software engineers to use a CUDA-enabled graphics processing unit for general purpose processing an approach termed GPGPU. The CUDA platform is a software layer that gives direct access to the GPU's virtual instruction set and parallel computational elements, for the execution of compute kernels.
The CUDA platform is designed to work with programming languages such as C, C++, and Fortran. This accessibility makes it easier for specialists in parallel programming to use GPU resources, in contrast to prior APIs like Direct3D and OpenGL, which required advanced skills in graphics programming. CUDA-powered GPUs also support programming frameworks such as OpenACC and OpenCL; and HIP by compiling such code to CUDA. When CUDA was first introduced by Nvidia, the name was an acronym for Compute Unified Device Architecture, but Nvidia subsequently dropped the common use of the acronym.

Background

The graphics processing unit, as a specialized computer processor, addresses the demands of real-time high-resolution 3D graphics compute-intensive tasks. By 2012, GPUs had evolved into highly parallel multi-core systems allowing very efficient manipulation of large blocks of data. This design is more effective than general-purpose central processing unit for algorithms in situations where processing large blocks of data is done in parallel, such as:
The CUDA platform is accessible to software developers through CUDA-accelerated libraries, compiler directives such as OpenACC, and extensions to industry-standard programming languages including C, C++ and Fortran. C/C++ programmers can use 'CUDA C/C++', compiled with nvcc, Nvidia's LLVM-based C/C++ compiler. Fortran programmers can use 'CUDA Fortran', compiled with the PGI CUDA Fortran compiler from The Portland Group.
In addition to libraries, compiler directives, CUDA C/C++ and CUDA Fortran, the CUDA platform supports other computational interfaces, including the Khronos Group's OpenCL, Microsoft's DirectCompute, and C++ AMP. Third party wrappers are also available for Python, Perl, Fortran, Java, Ruby, Lua, Common Lisp, Haskell, R, MATLAB, IDL, Julia, and native support in Mathematica.
In the computer game industry, GPUs are used for graphics rendering, and for game physics calculations ; examples include PhysX and Bullet. CUDA has also been used to accelerate non-graphical applications in computational biology, cryptography and other fields by an order of magnitude or more.
CUDA provides both a low level API and a higher level API. The initial CUDA SDK was made public on 15 February 2007, for Microsoft Windows and Linux. Mac OS X support was later added in version 2.0, which supersedes the beta released February 14, 2008. CUDA works with all Nvidia GPUs from the G8x series onwards, including GeForce, Quadro and the Tesla line. CUDA is compatible with most standard operating systems. Nvidia states that programs developed for the G8x series will also work without modification on all future Nvidia video cards, due to binary compatibility.
CUDA 8.0 comes with the following libraries :
CUDA 8.0 comes with these other software components:
CUDA 9.0-9.2 comes with these other components:
CUDA 10 comes with these other components:
CUDA has several advantages over traditional general-purpose computation on GPUs using graphics APIs:
Supported CUDA level of GPU and card. See also at :
Compute
capability
Micro-
architecture
GPUsGeForceQuadro, NVSTeslaTegra,
Jetson,
DRIVE
1.0TeslaG80GeForce 8800 Ultra, GeForce 8800 GTX, GeForce 8800 GTSQuadro FX 5600, Quadro FX 4600, Quadro Plex 2100 S4Tesla C870, Tesla D870, Tesla S870
1.1TeslaG92, G94, G96, G98, G84, G86GeForce GTS 250, GeForce 9800 GX2, GeForce 9800 GTX, GeForce 9800 GT, GeForce 8800 GTS, GeForce 8800 GT, GeForce 9600 GT, GeForce 9500 GT, GeForce 9400 GT, GeForce 8600 GTS, GeForce 8600 GT, GeForce 8500 GT,
GeForce G110M, GeForce 9300M GS, GeForce 9200M GS, GeForce 9100M G, GeForce 8400M GT, GeForce G105M
Quadro FX 4700 X2, Quadro FX 3700, Quadro FX 1800, Quadro FX 1700, Quadro FX 580, Quadro FX 570, Quadro FX 470, Quadro FX 380, Quadro FX 370, Quadro FX 370 Low Profile, Quadro NVS 450, Quadro NVS 420, Quadro NVS 290, Quadro NVS 295, Quadro Plex 2100 D4,
Quadro FX 3800M, Quadro FX 3700M, Quadro FX 3600M, Quadro FX 2800M, Quadro FX 2700M, Quadro FX 1700M, Quadro FX 1600M, Quadro FX 770M, Quadro FX 570M, Quadro FX 370M, Quadro FX 360M, Quadro NVS 320M, Quadro NVS 160M, Quadro NVS 150M, Quadro NVS 140M, Quadro NVS 135M, Quadro NVS 130M, Quadro NVS 450, Quadro NVS 420, Quadro NVS 295
1.2TeslaGT218, GT216, GT215GeForce GT 340*, GeForce GT 330*, GeForce GT 320*, GeForce 315*, GeForce 310*, GeForce GT 240, GeForce GT 220, GeForce 210,
GeForce GTS 360M, GeForce GTS 350M, GeForce GT 335M, GeForce GT 330M, GeForce GT 325M, GeForce GT 240M, GeForce G210M, GeForce 310M, GeForce 305M
Quadro FX 380 Low Profile, Quadro FX 1800M, Quadro FX 880M, Quadro FX 380M,
Nvidia NVS 300, NVS 5100M, NVS 3100M, NVS 2100M, ION
1.3TeslaGT200, GT200bGeForce GTX 295, GTX 285, GTX 280, GeForce GTX 275, GeForce GTX 260Quadro FX 5800, Quadro FX 4800, Quadro FX 4800 for Mac, Quadro FX 3800, Quadro CX, Quadro Plex 2200 D2Tesla C1060, Tesla S1070, Tesla M1060
2.0FermiGF100, GF110GeForce GTX 590, GeForce GTX 580, GeForce GTX 570, GeForce GTX 480, GeForce GTX 470, GeForce GTX 465,
GeForce GTX 480M
Quadro 6000, Quadro 5000, Quadro 4000, Quadro 4000 for Mac, Quadro Plex 7000,
Quadro 5010M, Quadro 5000M
Tesla C2075, Tesla C2050/C2070, Tesla M2050/M2070/M2075/M2090
2.1FermiGF104, GF106 GF108, GF114, GF116, GF117, GF119GeForce GTX 560 Ti, GeForce GTX 550 Ti, GeForce GTX 460, GeForce GTS 450, GeForce GTS 450*, GeForce GT 640, GeForce GT 630, GeForce GT 620, GeForce GT 610, GeForce GT 520, GeForce GT 440, GeForce GT 440*, GeForce GT 430, GeForce GT 430*, GeForce GT 420*,
GeForce GTX 675M, GeForce GTX 670M, GeForce GT 635M, GeForce GT 630M, GeForce GT 625M, GeForce GT 720M, GeForce GT 620M, GeForce 710M, GeForce 610M, GeForce 820M, GeForce GTX 580M, GeForce GTX 570M, GeForce GTX 560M, GeForce GT 555M, GeForce GT 550M, GeForce GT 540M, GeForce GT 525M, GeForce GT 520MX, GeForce GT 520M, GeForce GTX 485M, GeForce GTX 470M, GeForce GTX 460M, GeForce GT 445M, GeForce GT 435M, GeForce GT 420M, GeForce GT 415M, GeForce 710M, GeForce 410M
Quadro 2000, Quadro 2000D, Quadro 600,
Quadro 4000M, Quadro 3000M, Quadro 2000M, Quadro 1000M,
NVS 310, NVS 315, NVS 5400M, NVS 5200M, NVS 4200M
3.0KeplerGK104, GK106, GK107GeForce GTX 770, GeForce GTX 760, GeForce GT 740, GeForce GTX 690, GeForce GTX 680, GeForce GTX 670, GeForce GTX 660 Ti, GeForce GTX 660, GeForce GTX 650 Ti BOOST, GeForce GTX 650 Ti, GeForce GTX 650,
GeForce GTX 880M, GeForce GTX 780M, GeForce GTX 770M, GeForce GTX 765M, GeForce GTX 760M, GeForce GTX 680MX, GeForce GTX 680M, GeForce GTX 675MX, GeForce GTX 670MX, GeForce GTX 660M, GeForce GT 750M, GeForce GT 650M, GeForce GT 745M, GeForce GT 645M, GeForce GT 740M, GeForce GT 730M, GeForce GT 640M, GeForce GT 640M LE, GeForce GT 735M, GeForce GT 730M
Quadro K5000, Quadro K4200, Quadro K4000, Quadro K2000, Quadro K2000D, Quadro K600, Quadro K420,
Quadro K500M, Quadro K510M, Quadro K610M, Quadro K1000M, Quadro K2000M, Quadro K1100M, Quadro K2100M, Quadro K3000M, Quadro K3100M, Quadro K4000M, Quadro K5000M, Quadro K4100M, Quadro K5100M,
NVS 510, Quadro 410
Tesla K10, GRID K340, GRID K520
3.2KeplerGK20ATegra K1,
Jetson TK1
3.5KeplerGK110, GK208GeForce GTX Titan Z, GeForce GTX Titan Black, GeForce GTX Titan, GeForce GTX 780 Ti, GeForce GTX 780, GeForce GT 640, GeForce GT 630 v2, GeForce GT 730, GeForce GT 720, GeForce GT 710, GeForce GT 740M, GeForce GT 920MQuadro K6000, Quadro K5200Tesla K40, Tesla K20x, Tesla K20
3.7KeplerGK210Tesla K80
5.0MaxwellGM107, GM108GeForce GTX 750 Ti, GeForce GTX 750, GeForce GTX 960M, GeForce GTX 950M, GeForce 940M, GeForce 930M, GeForce GTX 860M, GeForce GTX 850M, GeForce 845M, GeForce 840M, GeForce 830M, GeForce GTX 870MQuadro K1200, Quadro K2200, Quadro K620, Quadro M2000M, Quadro M1000M, Quadro M600M, Quadro K620M, NVS 810Tesla M10
5.2MaxwellGM200, GM204, GM206GeForce GTX Titan X, GeForce GTX 980 Ti, GeForce GTX 980, GeForce GTX 970, GeForce GTX 960, GeForce GTX 950, GeForce GTX 750 SE,
GeForce GTX 980M, GeForce GTX 970M, GeForce GTX 965M
Quadro M6000 24GB, Quadro M6000, Quadro M5000, Quadro M4000, Quadro M2000, Quadro M5500,
Quadro M5000M, Quadro M4000M, Quadro M3000M
Tesla M4, Tesla M40, Tesla M6, Tesla M60
5.3MaxwellGM20BTegra X1,
Jetson TX1,
Jetson Nano,
DRIVE CX,
DRIVE PX
6.0PascalGP100Quadro GP100Tesla P100
6.1PascalGP102, GP104, GP106, GP107, GP108Nvidia TITAN Xp, Titan X,
GeForce GTX 1080 Ti, GTX 1080, GTX 1070 Ti, GTX 1070, GTX 1060, GTX 1050 Ti, GTX 1050,
GT 1030, MX350, MX330, MX250, MX230, MX150
Quadro P6000, Quadro P5000, Quadro P4000, Quadro P2200, Quadro P2000, Quadro P1000, Quadro P400, Quadro P500, Quadro P520, Quadro P600,
Quadro P5000, Quadro P4000, Quadro P3000
Tesla P40, Tesla P6, Tesla P4
6.2PascalGP10BTegra X2, Jetson TX2, DRIVE PX 2
7.0VoltaGV100NVIDIA TITAN VQuadro GV100Tesla V100, Tesla V100S
7.2VoltaGV10BTegra Xavier,
Jetson Xavier NX,
Jetson AGX Xavier, DRIVE AGX Xavier, DRIVE AGX Pegasus
7.5TuringTU102, TU104, TU106, TU116, TU117NVIDIA TITAN RTX,
GeForce RTX 2080 Ti, RTX 2080 Super, RTX 2080, RTX 2070 Super, RTX 2070, RTX 2060 Super, RTX 2060,
GeForce GTX 1660 Ti, GTX 1660 Super, GTX 1660, GTX 1650 Super, GTX 1650
Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Quadro RTX 4000,
Quadro T2000, Quadro T1000
Tesla T4
8.0AmpereGA100A100

'*' – OEM-only products

Version features and specifications

Data TypeOperationSupported sinceSupported since
for global memory
Supported since
for shared memory
16-bit integergeneral operations
32-bit integeratomic functions1.11.2
64-bit integeratomic functions1.22.0
16-bit floating pointaddition, subtraction,
multiplication, comparison,
warp shuffle functions, conversion
5.3
32-bit floating pointatomicExch1.11.2
32-bit floating pointatomic addition2.02.0
64-bit floating pointgeneral operations1.3
64-bit floating pointatomic addition6.06.0
tensor core7.0

Note: Any missing lines or empty entries do reflect some lack of information on that exact item.
For more information see the article: and read Nvidia CUDA programming guide.

Example

This example code in C++ loads a texture from an image into an array on the GPU:

texture tex;
void foo
//end foo
__global__ void kernel

Below is an example given in Python that computes the product of two arrays on the GPU. The unofficial Python language bindings can be obtained from PyCUDA.

import pycuda.compiler as comp
import pycuda.driver as drv
import numpy
import pycuda.autoinit
mod = comp.SourceModule
multiply_them = mod.get_function
a = numpy.random.randn.astype
b = numpy.random.randn.astype
dest = numpy.zeros_like
multiply_them, drv.In, drv.In,
block=)
print dest-a*b

Additional Python bindings to simplify matrix multiplication operations can be found in the program pycublas.

import numpy
from pycublas import CUBLASMatrix
A = CUBLASMatrix
B = CUBLASMatrix
C = A*B
print C.np_mat

while CuPy directly replaces NumPy:

import cupy
a = cupy.random.randn
b = cupy.random.randn
dest = cupy.zeros_like
print

Benchmarks

There are some open-source benchmarks containing CUDA codes