CS475 Lab 2: Scheduling of Parallel Mandelbrot

In Lab 1 you probably did not get perfect speedup, not even linear speedup! Convince yourself that even though the outer loops of Mandelbrot are very nice and regular, the inner loop IS NOT! Study the mandelbrot image.

  1. What does a certain pixel value tell you about the number of iterations in the inner loop?
  2. What does that say about the amount of work the various threads have to do? (hint: Think about 2 vs 3 threads.)
  3. Find a better scheduling strategy, and plot your new results. These are your input for Discussion 2. Use the state capital machines for your experiments.

In discussion 2 you will report your results and discuss your observations with your group.

Additional thought:

What if neither hint nor the use of scheduling strategy is specified? What will be a systematic way to analyze?
In the attached tar file Mand_Profiling, you have the following files.

  1. makefile
  2. mandelbrot.c
  3. timer.h
  4. timer.c
  5. mand_prof.c
The first four files are the same from your Lab-1 (Makefile modified to compile mand_prof.c). In mand_prof.c , there are counters to count the number of iterations each thread does. When you compile it, you can find the following object files.
  1. mandSEQ
  2. mandSEQ_prof
  3. mandOMP
  4. mandOMP_prof
mandSEQ_prof and mandOMP_prof are the versions with the counter. Below is an example of running them.
$mandSEQ_prof 1000
Elapsed time: 6.258007 sec
op_count_sequential=1404437847

$mandOMP_prof 1000 3
Elapsed time: 2.413585 sec
op_count[0]=354968274
op_count[1]=699245587
op_count[2]=468106879
op_count_parallel=1404437847
The third argument in the mandOMP_prof is the number of threads. You can specify it here instead of using "export OMP_NUM_THREADS". As you can see the op_count_sequential and op_count_parallel should be the same. But the op_count[i] varies for each thread. By this way, even if you cannot understand the code at first glace, you can systematically see how the parallelization is working and how the work/iterations are distribuited among the threads. You can play with the code and see how the count value varies with different scheduling strategies. This is not a part of your Lab exercise. This is an illustration to understand the code better.