Working alongside GPU libraries

Questions

  • My code needs to use a library, how should they work together?

  • How to use OpenMP mapped variables?

  • How to use CUDA or HIP device variables into OpenMP?

Objectives

  • Understand TODO

  • Understand TODO

  • Understand

  • Understand

Prerequisites

  1. TODO

  2. TODO

First heading

OpenMP interoperability with CUDA C/C++ and CUDA Fortran.

  • You can call kernels written in CUDA C/C++ or CUDA Fortran in your OpenMP programs from the host.

  • You can use the OpenMP USE_DEVICE_PTR clause to pass OpenMP mapped variables to CUDA kernels that are launched from the host.

  • You can use the OpenMP IS_DEVICE_PTR clause to access CUDA device attribute variables or to pass device addresses directly to target regions.

Second heading

Some more text, with a figure

../_images/stencil.svg

This is a sample image

Exercise

TODO get the students to think about the content and answer a Zoom quiz

Some source code

Sometimes we need to look at code, which can be in the webpage and optionally you can pull out only some lines, or highlight others. Make sure both C++ and Fortran examples exist and work.

Building the code

If there’s terminal output to discuss, show something like:

nvc++ -g -O3 -fopenmp -Wall -I../common -c main.cpp -o main.o
nvc++ -g -O3 -fopenmp -Wall -I../common -c core.cpp -o core.o
nvc++ -g -O3 -fopenmp -Wall -I../common -c setup.cpp -o setup.o
nvc++ -g -O3 -fopenmp -Wall -I../common -c utilities.cpp -o utilities.o
nvc++ -g -O3 -fopenmp -Wall -I../common -c io.cpp -o io.o
nvc++ -g -O3 -fopenmp -Wall -I../common main.o core.o setup.o utilities.o io.o ../common/pngwriter.o -o heat_serial  -lpng

Running the code

To show a sample command line, use this approach

./heat_serial 800 800 1000

Keypoints

  • TODO summarize the learning outcome

  • TODO