CSI 702 Assignment 2: Threaded Mandelbrot Program - Prof. John Wallin, Assignments of Computer Science

In this document, students are provided with instructions for assignment 2 in csi 702, fall 2008. The assignment requires modifying an existing code to use pthreads to reduce computational time. Students must compile and run the code on linux workstations, add thread-related modifications, and compare the results with the original unthreaded code. The final project should be packaged as a tar file and submitted online.

Typology: Assignments

Pre 2010

Uploaded on 02/10/2009

koofers-user-mst-1
koofers-user-mst-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Threads
CSI 702- Fall 2008 - Assignment 2 Due: October 1, 2008
In this assignment, you will modify an existing code to use pthreads to reduce the computa-
tional time. The final assignment will be submitted by the beginning of class on Monday October
1. The code must compile and run on the linux workstations in room Research I, room 249 (aka
wkxx.cos.gmu.edu). The final project must be packaged according to the specifications below so I
can easily grade it.
Late assignments will not receive full credit.
1. Download and compile the mandel.c code from the course website. The compilation can be
down using
gcc -o mandel -lpthread mandel.c
2. Modify the code to run with threads. You will need to follow several steps to do these changes-
(a) Modify the mandel subroutine so that the input value will set the limits of the outer loop.
You will need to modify the variables istart and iend to change so that it represents a
unique and equal share of the work based on the thread id and the total number of threads
in the system.
(b) Add an appropriate offset so that the correct region of the img array is updated.
(c) Change the mandel routine to record the the time spent in executing each thread.
(d) Add the pthread calls to create and join threads for these routines.
(e) Add appropriate output routines to print the time spent in each thread along with the
total execution time in the code.
3. Show that the output of the threaded mandelbrot program is the same as the output of the
original unthreaded code.
4. Using the system “time” command, tabulate the real and system times for 2-16 processors
using a dual core or greater machine. Compare the results to what you found from the internal
time routine.
At the end of the project, you will create a “tar” file that contains the code, instructions, plots,
and analysis. The code should be put into your public html directory on access.cos.gmu.edu and
named ”c702f08-hw1.tar”. If you have placed it in the directory correctly, I will be able to access the
file using a web browser using the URL
http://www.cos.gmu.edu/~accountname/c702f08-hw1.tar
The tar file “c702f08-hw1.tar” will contain.
your program
a README file with instructions on how to compile and run the program on the linux work-
stations
Any scripts you created
A write up of the project including
1
pf2

Partial preview of the text

Download CSI 702 Assignment 2: Threaded Mandelbrot Program - Prof. John Wallin and more Assignments Computer Science in PDF only on Docsity!

Threads

CSI 702- Fall 2008 - Assignment 2 Due: October 1, 2008

In this assignment, you will modify an existing code to use pthreads to reduce the computa- tional time. The final assignment will be submitted by the beginning of class on Monday October

  1. The code must compile and run on the linux workstations in room Research I, room 249 (aka wkxx.cos.gmu.edu). The final project must be packaged according to the specifications below so I can easily grade it. Late assignments will not receive full credit.
  2. Download and compile the mandel.c code from the course website. The compilation can be down using

gcc -o mandel -lpthread mandel.c

  1. Modify the code to run with threads. You will need to follow several steps to do these changes-

(a) Modify the mandel subroutine so that the input value will set the limits of the outer loop. You will need to modify the variables istart and iend to change so that it represents a unique and equal share of the work based on the thread id and the total number of threads in the system. (b) Add an appropriate offset so that the correct region of the img array is updated. (c) Change the mandel routine to record the the time spent in executing each thread. (d) Add the pthread calls to create and join threads for these routines. (e) Add appropriate output routines to print the time spent in each thread along with the total execution time in the code.

  1. Show that the output of the threaded mandelbrot program is the same as the output of the original unthreaded code.
  2. Using the system “time” command, tabulate the real and system times for 2-16 processors using a dual core or greater machine. Compare the results to what you found from the internal time routine.

At the end of the project, you will create a “tar” file that contains the code, instructions, plots, and analysis. The code should be put into your public html directory on access.cos.gmu.edu and named ”c702f08-hw1.tar”. If you have placed it in the directory correctly, I will be able to access the file using a web browser using the URL

http://www.cos.gmu.edu/~accountname/c702f08-hw1.tar

The tar file “c702f08-hw1.tar” will contain.

  • your program
  • a README file with instructions on how to compile and run the program on the linux work- stations
  • Any scripts you created
  • A write up of the project including
  • A description of the modifications you added to the code to make it run using threads
  • A short description of the problems you had implementing the code
  • An overview of the results from the exercise
  • A graph of how the program scales with more threads
  • Conclusions and analysis of the timing results