- 0
- 0
- 约4.79千字
- 约 7页
- 2022-12-26 发布于广东
- 举报
Lab 4: Performance Lab
1 Introduction
The assembly language in Lab 3 is one of the most effective means for gaining an understanding how the code will run in high performance. In this lab, students should optimize the performance of an application kernel function such as convolution or matrix transposition. It provides a clear demonstration of the properties of cache memories and gives them experience with low-level program optimization.
2 Type
This is a team project (up to three students) which will be completed in two weeks.
3 Instructions
3.1 Image processing problem
This lab deals with optimizing memory intensive code. Image processing offers many examples of functions that can benefit from optimization. In this lab, we will consider two image processing operations: rotate, which rotates an image counter-clockwise by 90。, and smooth, which “smooths” or “blurs” an image.
For this lab, we will consider an image to be represented as a two-dimensional matrix M, where Mi,j denotes the value of (i, j)th pixel of M. Pixel values are triples of red, green, and blue (RGB) values. We will only consider square images. Let N denote the number of rows (or columns) of an image. Rows and columns are numbered, in C-style, from 0 to N-1.
Given this representation, the rotate operation can be implemented quite simply as the combination of the following two matrix operations:
? Transpose: For each (i, j) pair, Mi,j and Mj,i are interchanged.
? Exchange rows: Row i is exchanged with row N-1-i.
This combination is illustrated in Figure 1.
Figure 1 Rotation of an image by 90。counterclockwise
The smooth operation is implemented by replacing every pixel value with the average of all the pixels around it (in a maximum of 3×3 window centered at that pixel). Consider Figure 2. The values of pixels M2[1][1] and M2[N-1][N-1] are given below:
Figure 2 Smoothing an image
3.2 Source code
The only file you will be modifying is kernels.c. Looking at the file kernels.c, you’ll notice a C structu
您可能关注的文档
- 暨南大学计组实验报告.doc
- 暨南大学2021计组实验1.doc
- 暨南大学2021计组实验2.doc
- 暨南大学2021计组实验3.docx
- 暨南大学2021计组实验5.doc
- 暨南大学离散数学Chapter0.pptx
- GB/Z 112-2026中医药 中西医结合临床术语系统分类框架.pdf
- 《GB/Z 112-2026中医药 中西医结合临床术语系统分类框架》.pdf
- 中国国家标准 GB/Z 112-2026中医药 中西医结合临床术语系统分类框架.pdf
- 《GB/T 3215-2025石油、石化和天然气工业用离心泵》.pdf
- JJG 543-2026心电图机检定规程.pdf
- 《JJG 543-2026心电图机检定规程》.pdf
- GB/T 47045-2026乘用车车载信息优先级的确定方法.pdf
- 《GB/T 12668.2-2025调速电气传动系统 第2部分:一般要求 交流调速电气传动系统额定值的规定》.pdf
- 中国国家标准 GB/T 12668.2-2025调速电气传动系统 第2部分:一般要求 交流调速电气传动系统额定值的规定.pdf
- 中国国家标准 GB/T 31487.1-2025直流融冰装置 第1部分:系统设计.pdf
- GB/T 12668.2-2025调速电气传动系统 第2部分:一般要求 交流调速电气传动系统额定值的规定.pdf
- GB/T 31487.1-2025直流融冰装置 第1部分:系统设计.pdf
- 《GB/T 31487.1-2025直流融冰装置 第1部分:系统设计》.pdf
- 《GB/T 31418-2025道路交通信号控制系统术语》.pdf
原创力文档

文档评论(0)