Due: Friday, December 08 2017, 11:59 pm

Part I: Parallel Programming in C

This part explores parallel programming in the C language.

Tasks

The end result of this part should be a set of programs that compare the performance of parallel v. non-parallel code to do the same task.

  1. Write a function that sorts an array. Use parallelism to reduce the computation time. You can use sort functions from the standard library, like qsort in C, or write your own from scratch. Divide the task into N parts for N threads.

    Your function does not need to be generic, but why not make it so?

    As part of your experimentation, determine how computation time changes with both the number of threads and the size of the problem. Is using two threads twice as fast? Is using four threads four times as fast? What is the improvement in speed with additional threads?

  2. Write a program that reads an image and applies a pixel-wise operator to it. Use parallelism to reduce the computation time. You can use this C-kit as the basis for your C example.

    To compile the files, use the following.

    gcc -o colorize -I. colorize.c ppmIO.c -lm

    Compare computation times for the serial and parallel versions. You may need to process the image some number of times in order to make it slow enough to measure accurately.

    As above, you should also compare how computation time depends upon the number of threads.

Part II: Parallel Programming in Selected Languages

This part explores parallel programming in the selected languages.

Tasks

  1. For each of your chosen languages, discuss on a wiki page how parallelism is supported in the language, either implicitly or explicitly. This does not need to be a long description, but you may need to do a little research on this in order to be accurate.

  2. Choose a language from the two you selected (or you can choose Python or Java) to do the task 1 and 2 of part I.

Extensions

  1. Write some other useful routine that would be good to parallelize, such as matrix multiplication or an image filter.
  2. Do one or both tasks of part I in another language.
  3. Do task 1 of part II in another language.
  4. Demonstrate the use of a semaphore or mutex lock to control access to a critical section.
  5. Poetry.

Submission

The submission of this project has three components:

  1. Codes: The source codes for part I and task 2 of part II should be submitted to the fileserver. Please make the filename of your source codes reflect the tasks or extensions.Note that the quality of your comments counts toward your grade.
  2. README: In this project, you need to submit a README file for your source codes of part I and task 2 of part II. The README file can be a .txt file. It should be well-organized in a way that readers can easily know the usage and the outputs of every source files. Please explain the timing results of your experiments in part I and task 2 of part II. In addition, the known bugs of your codes should also be indicated in the README file. Please also indicate the version of your C complier, your operationg system, and its version in the README file.
  3. Wiki write-up: The write-up of this project should have the following elements.
    • Title of the project and your name
    • The tutorials on parallelism in the selected languages (task 1 of part II)
    • Please include necessary code snapshots in your tutorials.

Please note that it is your responsibility to explicitly indicate the extensions you have taken. If your extensions have source codes, please indicate explicitly in the codes and README file. If you take the extensions in the selected languages that do not have source codes, please indicate explicitly in your wiki write-up.

© 2017 Ying Li. Page last modified: .