3 different kinds of
functions
in a CUDA program
- There are
3 different kinds of
functions
in a CUDA program:
-
__host__
specified function
(this is the default)
-
__global__
specified function
-
__device__
specified function
|
|
If you do not provide
any specification, the
CUDA compiler will
assume:
__host__
speficied
__host__ specified functions
__global__
specified functions
- The
__global__
execution space specifier
declares a function that is:
- Executed on the
device (= GPU),
- Callable
from the host.
- Callable
from the device
(with compute capacability ≥ 3.2).
|
-
Usage of
__global__
specified functions:
- The __global__ specified
functions are
called (launched) by C function(s)
in the main program
to perform a task
using the GPU
|
|
__device__
specified functions
- The
__device__
execution space specifier
declares a function that is:
- Executed on the
device (= GPU),
- Callable
from the device (GPU)
only !!!
|
-
Usage of
__device__
specified functions:
- The __device__ specified
functions are
GPU help functions
used by __global__
speficied function
|
|
❮
❯