CSE-746 2024 Course Project
Your task is to write a CUDA version of the serial code ~syam/CSE746/Project/heat_cube_level?.c (available on both
graham and cedar clusters). This code solves a heated cube problem on a 128^3 mesh using a simple finite difference
method. Initially the cube's temperature is 0 everywhere, except for the central hot cell which is the heat source
(temperature is maintained at 1). The cube's boundaries are heat sinks (temperature is maintained at 0). 5000
iterations are performed, driving the system towards an asymptotic solution. At each iteration, two identical
finite difference steps are performed: first computing future array B from current array A, then vice versa. This
is done to improve the efficiency of the code (minimise the amount of data copying).
You have to choose one of the two available levels of difficulty.
Level 1. Maximum grade: 80%. No eps_max calculations (so no need to do a reduction). Use
~syam/CSE746/Project/heat_cube_level1.c as your initial file.
Level 2. Maximum grade: 100%. You have to compute and print eps_max at the end of each iteration.
Requires carrying out a "maximum" reduction for floating points, every iteration. Use
~syam/CSE746/Project/heat_cube_level2.c as your initial file.
Check the header of your initial file for additional instructions and tips.
Use explicit GPU <-> CPU memory copying commands (do not rely on Unified Virtual Memory).
Do not use C++ templates (like Thrust) or Dynamic Parallelism.
Make sure all host data copied to/from GPU is pinned.
Make sure the final eps_max value is identical to that from the serial code (Level 2 only).
The CUDA code has to write the file heat.dat at the end. Make sure the results are
identical to the serial version.
Compiling instructions
are given in the header of the serial code.
On P100 GPU (graham), you are expected to
achieve a timing of around 1.16 seconds (Level 1) and 1.44 seconds (Level 2).
You should put
comments inside your code explaining what you are doing.
Marks will be taken off for
code bugs (some or all the results are wrong), for insufficient
commenting in the code, for poor performance. It must be your own
work and you are responsible for adhering to the Senate Policy
Statement on Academic Ethics.
Due date: Monday April 22nd before midnight , send me
the solution through email, to syam@physics.mcmaster.ca
. Late submissions will
have their mark reduced by 10% every day. This assignment is worth 30
percent of the course grade.