CS 333: Assignment #8

Parallel Programming

This project explores parallel programming across different languages.


The end result of this project should be a set of programs that compare the performance of parallel v. non-parallel code to do the same task. For each task, write the programs in two different languages, one of which must be C. The other language can be one of your chosen languages, or one of {Python, Java}.

  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?

    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. In your other language, use whatever package you like to read in an image (or write your own PPM reader, using the C code as an example). If reading an image doesn't make sense in either of your chosen languages, use Python or Java.

    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.

  3. 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.



Overall, make a wiki page that shows the results of your experiments. You should have tables/graphs showing computation time per number of threads, and computation time per size of the task. Each graph should have at least four data points on it.

In addition, discuss how parallelism is supported, or not, in each of your chosen languages.

When you have finished your writeup, please put the following label on the wiki page.