I was given to write a parallel computing problem in which a sequential c++ code is to be written and should be made to work as a parallel program by adding simple parallel computing constructs like "pragma omp parallel". it should be run on a ccr which I have access to and check the speed up of the parallelly running problem. All the skeleton of the program is given and I should complete the specific function.
Extracted text: Your task in this assignment is to implement and analyze efficient OMP program for fast application of 2D filters. 2D filters are frequently used in image and signal processing, and hence their efficient implementations are highly desired. Let us assume that our input image is represented by n x m array A, and let K be a kernel – a square matrix (for simplicity we will assume that K is always 3 x 3 matrix). In classic 2D filtering with kernel K, for each pixel A;j we compute convolution between K and submatrix of A centered around Aij. If you recall our lectures, this falls under the category of stencil pattern. In this assignment, we will consider a slightly modified version of the problem. Let A;-1:i+1,j–1:j+1 be submatrix of A centered at (i, j). Then our filter will be defined as follows. First, Z = A;-1;i+1,j–1:j+1 × K, then we obtain the filtered value A, = Eab Zab- In other words, first we compute matrix product between submatrix of A centered at (i, j) and kernel K, then we sum up all elements of the resulting matrix Z. Note that we do not apply the filter to the first and last row/column of A, i.e., A'; = Aij if i refers to the first/last row, or j refers to the first/last column. The assignment consists of two parts. In the first question (Q1), starting from the provided backbone (see below) you have to write a C++/OMP code implementing filter as explained above. In the second question (Q2), you have to analyze performance of your solution, generate a speedup plot showing scalability of your code, and then provide a brief discussion summarizing your findings (e.g., do you think your code is scalable, is it always scalable, if it is scalable in what sense, if it is not scalable what do you think is causing problems.).