Steve Lantz
Cornell Center for Advanced Computing

6/2025 (original)

We examine the characteristics of computational tasks that are suitable for porting to GPUs, then we explore some basic ways of moving the work and the associated data from CPUs to GPUs. After describing the host-device execution model, in which GPU tasks are always managed by the CPU, we highlight a couple of methods by which the CPU can offload work to the GPU. Specifically, we take a brief look at CUDA and OpenMP through C++ code examples, a comparison of their capabilities, and basic compilation instructions.

Objectives

After you complete this topic, you should be able to:

  • Describe the kinds of computing tasks that ought to work well on GPUs vs. CPUs
  • Explain how GPU computing is orchestrated by the CPU in the host-device model
  • Identify the roles of the CPU and GPU in kernel execution, memory allocation, and data transfers
  • Write and execute simple C++ programs that offload computations to the GPU using CUDA and OpenMP
  • Evaluate the performance and portability trade-offs between these two approaches
Prerequisites
 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Access Statement
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)