程序代写 XJCO3221 Coursework 3 1 School of Computing, University of Leeds

XJCO3221 Coursework 3 1 School of Computing, University of Leeds
Parallel computation
Coursework 3: General purpose GPU programming with OpenCL Deadline: 10am, Tuesday 3rd May 2022
If you have any queries about this coursework please visit the OpenCL Discussion Forum on Minerva (found in the Learning Resources folder for this module). If your query is not resolved by previous answers, post a new message.

Copyright By PowCoder代写 加微信 powcoder

This piece of work is worth 15% of the final module grade.
Learning objectives
• Implementation of a general purpose GPU program in OpenCL.
• Correctly implement a GPU kernel to perform a common numerical task.
For this coursework you are required to design an OpenCL application that applies a numerical operation, similar to something known as the heat equation, to a two–dimensional grid of size N × N. More precisely, suppose you are given the following grid of values, where each value might refer to e.g. a temperature (only top–left portion of grid shown for clarity),
0.000 0.000 0.000 0.000 0.900 0.710 0.000 0.211 0.942 0.000 0.348 0.179 . . .
0.000 . . . 0.843 . . . 0.120 . . . 0.572 . . . .
Given this initial grid, each value, apart from the boundaries, needs to be replaced with the average of its 4 surrounding values, i.e. a quarter of the sum of the grid values above, below, to the left, and to the right. For the above example, this is
0.000 0.000 0.000 0.000 0.230 0.672 0.000 0.548 0.305 0.000 0.120 0.682 . . .
0.000 . . . 0.330 . . . 0.759 . . . 0.525 . . . .

XJCO3221 Coursework 3 2 This ‘smoothing’ corresponds somewhat to (heat) diffusion, hence the name ‘heat equation.’
In serial, and supposing the grid values are stored in a one–dimensional array float *grid with row i and column j indexed as grid[i*N+j], the serial code for this operation in C is
for( i=0; iCS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com