CS475 Fall 2011 - Homework 1
OpenMP Programming
Objectives
The objective of this homework is to write four OpenMP programs,
to debug and test them, and to experimentally determine the gains you
get in running it in parallel on up to 8 (or possibly 16) processors
on carver. The parallelizations are relatively simple, and the
results should be pleasing in terms of performance/speedups.
As always, you should measure the performance of your
parallelization as a function of the number of processors and the
problem size, and analyze, plot and discuss your observations. For
these programs, you may use the department machines for debugging and
program development, but use carver for the final tests and data
collection. Remember the environment/compiler options and/or commands
may be different for each setup. However, it must be possible to
switch back and forth simply by selecting an option to
make.
1. Mandelbrot
You have already worked with this program
in Lab 3, and have been able to set it op so that the program executes
on carver. It returns a .pgm file for the Mandelbrot set. Using this
as a starting point, develop and debug an OpenMP parallelization.
Analyze this program for your report.
2. Jacobi Stencil 1D
Parallelize the Jacobi stencil computation from the provided
sequential code (see below). You should make sure this runs on carver
and that you are getting good speed up as the number of processors
increases, but you do not need to analyze this program for the report.
3. Jacobi Stencil 2D
Extension of the previous
problem, but the data is now a 2-D array that is updated using the
values of four neighboring elements. Please, analyze the ruining
time as a function of the number of processors and the problem size,
plot and discuss your observations.
4. Matrix-vector Product
The objective of is to write an OpenMP program for the
matrix-vector product. The sequential program for the Matrix-vector
Product algorithm is provided below. You do not need to analyze this
program for your report.
Provided Code
Jacobi 1D
Jacobi 2D
Mandelbrot
Matrix-vector Product
timer.c
timer.h
Makefile
Compile OpenMP Program
We are using gcc on both lab machine and carver. On the department
lab machines, OpenMP is part of gcc, but you need to enable the OpenMP
flag to compile, the flag for OpenMP is "fopenmp".
Questions to discuss in your report
The main question we want you to address in the report is how the
performance (execution time) changes as a function o the number of
processors. More specific details (e.g., input parameters and program
size values to be used for the data) will be provided soon.
What/When:
- We should be able to compile your programs by simply typing make with the makefile you provided. It should produce executables jacobi_1D, jacobi_2D, mandelbrot, and mat_vec respectively.
- Please specify your thread number in the environment instead of inside the program. The input usage for each program should be
- Jacobi_1D: jacobi_1D < size > < iteration >
- Jacobi_2D: jacobi_2D < size > < iteration >
- Mandelbrot: mandelbrot < iteration >
- mat_vec: mat_vec < N > < M >
- The default output should be the same as the output for the sequential
code when not in debug mode.
- In the report you need to include your performance for mandelbrot and jacobi_2D. You should test the thread number from 1 to 8 for each program, we also provide the test size as below:
- Mandelbrot: ./madelbrot 10000
- Jacobi_2D: ./jacobi_2D 3000 2000
If you got some problem size gave you better performance, please use your problem size and declare it in your report.
- 11:59 pm, Saturday, Sep 10. OpenMP source files and Makefiles to be
submitted. A detailed description is given above. Please read carefully
and make sure that your programs match the description.
- 11:59 pm, Sunday, Sep 11. Lab report to be checked in, as well as
data and scripts. You only need to report on Jacobi 2D and Mandelbrot.
How to Submit:
- You must submit the file from one of the Linux machines, such as
crestone or dmx.
-
All assignments are submitted electronically via the
~cs475/bin/checkin program.
-
You must submit a single tar file containg all of your source code and
your Makefile.
- You may name the file anything you wish.
- You may resubmit the file as many times as you like. Subsequent
submissions will not overwrite previous submissions.
-
If you have more than one file for your program, then you should provide a makefile that will compile all executables. Any
assignment submitted that contains code that will not compile will receive a 0%.
-
The checkin program should be used as follows:
~cs475/bin/checkin
HW1 filename.tar
How to tar files:
Good luck and have fun!