GPU Computing

TP 0.2 - Host view of kernel computations

E. Carlinet

J. Chazalon

Sept. 2020

Objective(s)

Duration

You should complete this part within 30 minutes.

Exercise 1: Launch 1D kernels

Instructions

In this exercise your will have to prepare a device buffer and launch some kernels to change its content. Then, you will copy the device buffer to the host for inspection.

Code template

Read and edit the file 1-1d_kernel_calls.cu from the student resources archive student_resources.tar.gz.

You have to write the code for the kernel in the main() function. You are expected to insert your code in the sections demarcated with //@@. You should not have to make any change in other code sections. In particular, you do not have to write kernels yet: we already coded them and they are available in the kernels.o object file. The documentation / API of the kernels in provided in the kernel.h header.

Validation

Running make test-1-1d_kernel_calls should build and run your program. The integrated test should succeed.

Relevant documentation

Exercise 2: Launch 2D kernels

Instructions

In this exercise your will have to prepare a device buffer and launch some kernels to change its content. Then, you will copy the device buffer to the host for inspection.

Code template

Read and edit the file 2-2d_kernel_calls.cu from the student resources archive student_resources.tar.gz.

You have to write the code for the kernel in the main() function. You are expected to insert your code in the sections demarcated with //@@. You should not have to make any change in other code sections. In particular, you do not have to write kernels yet: we already coded them and they are available in the kernels.o object file. The documentation / API of the kernels in provided in the kernel.h header.

Validation

Running make test-2-2d_kernel_calls should build and run your program. The integrated test should succeed.

Relevant documentation