Chapter 22: Intro to CUDA

David L. Chopp · Society for Industrial and Applied Mathematics eBooks · 2019

When programming in CUDA, we must be careful to distinguish between operations being done by the CPU and those on the GPU. In keeping with the CUDA terminology, operations performed in main memory or by the CPU will be said to be on the host. Those operations or memory addresses located on the GPU are designated as being on the device. This chapter covers the first steps toward computing on the device. Using printf from within a kernel function is possible, but it should be done only for debugging purposes. Because of that, the introductory program will be a simple addition of two numbers. We will see how to compile the program using the CUDA compiler nvcc and how to select a particular device when given multiple choices.

Read the paper · More papers on PaperTik