DTS202TC Foundation of Parallel Computing
Group Assignment 1
Overview
The purpose of this assignment is to gain experience in C programming and parallel algorithm design. You are expected to write a C serial program to convert a RBG image to a grey-scale image (no parallelism), and provide a parallel algorithm design that may speed up the serial implementation. Identity the bottlenecks in your serial implementation and provide an outline of how you plan to parallelise the serial implementation. Highlight the performance improvements you expect after parallelisation and potential challenges you may have to overcome. You may include pseudo-code or explain your approach in plain English.
Team policy You are tree to form your group up to 5 team members, one of the team member must send a document contains all team members’ intormation before 13th Nov, 23:59 via email to TA. Students who fail to do so will be randomly assigned to a team. Changes will not be allowed once the teams are confrmed.
Tasks Image gray-scaling is one of the most common image processing tasks. A simplest way to gray-scale an image is to set each pixel to the mean of the RGB channels. Gray D .R C G C B/ =3
Figure 1: Grayscaling example.
1 Serial Version (50 marks) PBM, PGM, and PPM fles are all image fle formats that hold data in regards to pixels of an image. Compared to formats like PNG, JPG, etc, these formats are very simplistic, offering no compression. These are simple formats that store the colours of pixels as bytes which can be read into your program. The below image.ppm is given as an example, more detail ppm specifcations can be found at http://web.eecs.utk.edu/ ~ssmit285/guide/img/index.html
P3 - Magic Number (Tells the program this is a PPM fle) 3 - Width 2 - Height 255 - Colour Range (0 = Black, This Number = White) Write a C program to read the given im.ppm image (you can fnd it on LMO along with this document), convert RGB to grayscale, then output the grayscale image to im-gray.ppm. Your program should be compiled and executed by: make ./ grayscale
2 Parallel Algorithm Design (50 marks)
Now that you have a complete understanding of the task, do the following: • Identity and analyse the bottlenecks of your serial implementation. (20 marks), and • provide a design of a solution to speed up using parallel programming (30 marks). You do not need to do the actual coding for the parallel implementation, but only provide the detailed design with maximum 500 words. You may include pseudo-code or explain your approach in plain English. Highlight the performance improvements you expect after parallelisation and potential challenges you may have to overcome.
3 Submission
One of the group members must submit the following fles: • Cover Page with the student ID of all group members (template can be found on LMO). • grayscale.c Your serial implementation. • A Makefle that will compile your code, make sure the output executable names are correct. • A pdf fle contains all the source code and the parallel design. Please note that quality of code, quality of writing and format/style of the report will also be considered in marking.