Program Structure of CUDA
Program Structure of CUDA
CPU
cannot directly access GPU memory, and vice versa. In CUDA terminology, CPU
memory is called host memory and GPU memory is called device memory. Pointers to
CPU and GPU memory are called host pointer and device pointer, respectively.
For data to be accessible by GPU, it must be presented in the device memory. CUDA
provides APIs for allocating device memory and data transfer between host and device
memory. Following is the common workflow of CUDA programs.
So far, we have done step 1 and 4. We will add step 2, 3, and 5 to our vector addition
program and finish this exercise.