CSCE569

Assignment 2 – CSCE569, Spring 2018

Due: 11:55PM March 2nd, Friday 2018


In this assignment, you will parallelize three programs using OpenMP, Jacobi iterative method, image Histogram and Filtering. For Jacobi, the sequential version and the program skeleton are given as jacobi.c file. For image Histogram and Filtering (convolution), you can start with the sequential implementation you finished in Assignment 1, or using the files provided in this assignment. For Filtering, your implementation provides OpenMP parallelization of processing a single image. You have option to enhance your filtering implementation to support processing multiple images in pipeline (see below description), which would earn you bonus point. Please check course lecture Dense Matrices and Decomposition for the description of the parallelization algorithms.

Jacobi Iterative Method

OpenMP omp parallel should be applied to the outer while loop and omp for to the two inner for loops of the jacobi_omp function. reduction and single may be needed to make sure output and error are computed correctly.

Image Histogram

OpenMP parallel for should be used for parallelizing the loop for computing the histogram. The difficult part is for storing the histogram since data racing may be introduced for updating histogram by multiple threads. We talked about two options of parallelization during the class and you only need to implement one of them.

Image Filtering

Your implementation provides OpenMP parallelization of processing a single image by using OpenMP parallel for for the filtering loop.

You have option to enhance your program for supporting processing multiple images using the pipeline algorithm to overlap I/O and computations as we discussed during the class (slide #86 of OpenMP). The algorithm is also shown in the following picture. Please refer to OpenCV for reading and writing images. You program should also be enhanced to take as arguments the name of a folder that contains the images and the number of images to be processed. To simplify reading and writing images, all input images are named sequentially as 1.jpg, 2.jpg, 3.jpg, …, and out images should be named as 1out.jpg, 2out.jpg, 3out.jpg, …. Image files are provided in data folder (about 50 images). You will earn bonus point by doing this.

Source Code to Start

You can start your implementation with your codes from Assignment 1. For Jacobi, copy jacobi.c file to the folder and add two lines add_executable( jacobi jacobi.c ) and target_link_libraries( jacobi m ) in the CMakeLists.txt file so you will build jacobi using the same instruction as in the README.md file. A sample CMakeLists.txt is given for your reference if you need. For image Histogram and Filtering (convolution), you can also start with the implementation in Histogram.cpp and Filtering.cpp if you do not want to use yours.

Machines for Development and for Collecting Results

Your development can be done in any machine that has the necessnary tools and environment setup (mainly make, cmake, gcc compiler, CUDA for GPU, and OpenCV), including those in Swearingen 1D39 and 3D22 for OpenMP and MPI development. In this assingment, you are encouraged to report your results using Bridges supercomputer from PSC, which will earn you 10 points as bonus. In the future, reporting results using Bridges is required. Please check Access to XSEDE PSC Bridges Supercomputer section for details. Each node of Bridges has 16 cores supporting up to 32 hardware threads. You can use export OMP_NUM_THREADS=8 to set the number of threads for your OpenMP program execution.

Submission

Your submission should be a single zipped file named LastNameFirstName.zip that includes ONLY the following: three source code files (jacobi.c, Histogram.cpp, Filtering.cpp), a CMakeLists.txt file for how to build sources to executables, one PDF file for your report. Please remove all other files, including the executables, Excel sheet, etc. The source files contain your implementations, and each file should be invidually compiled to generate executables. The report is max 3-page report that includes:

  1. Short description on how you parallelize Jacobi, Histogram and Filtering. Please mention specifically whether you implement the pipelined filtering algorithm.
  2. Performance report using two figures (execution time and speedup) for the three applications. An excel sheet is provided for creating those figures after you input the execution times you will collect (The numbers in the current sheet are dummy numbers). Seedup, which is the ratio of the execution time using 1 thread to the execution time using x threads, will be automatically calculated based on the numbers in executime time table. The two figures will be automatically populated and generated by Excel as well. Please include those figures in your report.
  3. Please indicate in your report, which machine you use and the CPU and memory information of your machine. You can find those information by using cat /proc/cpuinfo command.
  4. Explanation of the performance results shown in your figures and draw meaningful conclusions.

Grading:

  1. Function implementation: 80 points (20 for Jacobi, 30 for Histogram and 30 for Fitering of single image algorithm). For source file that cannot be compiled, you only receive max 60% of function implementation points. For compliable, but with execution errors or incorrectness, you receive max 80% of function implementation points.
  2. Bonus point: 40 (30 for pipeline filtering implementation and 10 for reporting results using XSEDE resources.)
  3. Report: 20 points.

Assignment Policy

  1. Programming assignments are to be done individually. You may discuss assignments with others, but you must code your own solutions and submit them with a write-up in your own words. Indicate clearly the name(s) of student(s) you collaborated with, if any.
  2. Although homework assignments will not be pledged, per se, the submitted solutions must be your work and not copied from other students’ assignments or other sources.
  3. You may not transmit or receive code from anyone in the class in any way–visually (by showing someone your code), electronically (by emailing, posting, or otherwise sending someone your code), verbally (by reading your code to someone), or in any other way.
  4. You may not collaborate with people who are not your classmates, TAs, or instructor in any way. For example, you may not post questions to programming forums.
  5. Any violations of these rules will be reported to the honor council. Check the syllabus for the late policy and academic conduct.