Profiling code for GPUs
Questions
What tools can help me reason about the performance of my code?
TODO
Objectives
Understand TODO
Understand TODO
Understand
Understand
Prerequisites
TODO
TODO
First heading
Some text
Second heading
Some more text, with a figure
Exercise
TODO get the students to think about the content and answer a Zoom quiz
Solution
Hide the answer and reasoning in here
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.
The field data structure
struct field {
// nx and ny are the dimensions of the field. The array data
// contains also ghost layers, so it will have dimensions nx+2 x ny+2
int nx;
int ny;
// Size of the grid cells
double dx;
double dy;
// The temperature values in the 2D grid
std::vector<double> data;
};
type :: field
integer :: nx ! ldimension of the field
integer :: ny
real(dp) :: dx
real(dp) :: dy
real(dp), dimension(:,:), allocatable :: data
end type field
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