Homework Three
Due : Tuesday April 1, 2008
Assignment:
Indicate which platform and compiler you used for compiling and running the programs.
For each of the programs indicate whether it compiled without errors, and whether there were warnings.
Also if it compiled succesfully, indicate any run time errors, such as segmentation errors, and
any pathological bahavior, such as freezing (deadlock) etc.
- Use OpenMP to parallelize the algorithm described in
Programming with OpenMP
for calculating pi by integration 4/1+x*x from 0 to 1.
-
Run the code sequentially
and using OpenMP on 1, 2, 3, 4, and 8
threads and time the results, on both dune.cs.kent.edu and strider.cs.kent.edu,
-
Modify the code to run similar tests using dynamic and guided scheduling.
-
List the various run times and comment on the results.
Note: when timing the output remember not to print anything while timing.
- Write code to use the Monte Carlo method to compute pi, and parallelize it using
OpenMP. Run it sequentially
and using OpenMP on 1, 2, 3, 4, and 8
threads and time the results, on dune.cs.kent.edu.
Comment on the results.
- Write a program to calculate the solution to
Poisson's equation using a
relaxation method.
This involves solving for the values on a two dimensional grid of points by averaging the
values of the four adjacent points two in the x direction and two in the y direction.
This link gives pseudo-code for the relaxation process.
Parallelize this using OpenMP and run it using 1, 2, 3, and 4 threads on dune and list and
comment on the results.
-
Integer sorting is a class of sorting where the keys are integers. The range of
key values is often smaller that the number of keys, and in this case the sorting can be
accomplished using an array of "buckets" in which to count keys.
This link gives pseudo-code for a bucket sort code
for sorting the array key into key2.
Implement it in C and parallelize the code using OpenMP regions.
This assignment is an individual assignment, to be done on your own without help from other
students in the class. However, you may use any
materials from any written resource, including web resources.