CS475 Lab 1: Parallel Performance of Mandelbrot

This lab session is intended to show you how run an OMP code and to analyze and graph the speedup of parallel code. We will be using Mandelbrot code, which produces a fractal.

1. Retrieve source code and verify that you can compile, run, and control the number of threads.

A quick note for Mac users: OpenMP
If you want work on a Mac at home, you need a version of gcc compiled with openMP support: You can go to hpc.sourceforge.net and download gcc 4.7 4.8 4.9 depending on your OS version. You will have to extract the archive and update the PATH variable to include the new gcc. You still have to report the results for a state capital machine in 120-unix-lab at the cs department!
  1. Log into one of the state capital machines.
    1. Choose a machine from the list of capital machines:( machines list ).
    2. Secure shell (ssh) into a capital machine (e.g.
      ssh <yourname>@denver.cs.colostate.edu
      ).
    3. Check to see how busy the machine is. You want to run on a quiet machine. These machines have one CPU with eight hyperthreaded cores. Use
      who
      to find out whether there are other users, or
      top
      to find out what the processor is doing.
  2. Download and untar the provided mand.tar file.
  3. Study the makefile and the
    mandelbrot.c
    code. Study the way it times the program. This is an OpenMP program; study the parallelized for loop.
  4. Compile (using the makefile) and run
    mandSEQ 1000

    mandOMP 1000
  5. Vary the number of threads being used: for p = 1, 2, 3, 4, 5, 6, 7, and 8.
    csh:
    setenv OMP_NUM_THREADS p

    bash:
    export OMP_NUM_THREADS=p

2. Collect Parallel Performance Data

  1. Run each case 5 times.
  2. Record execution itmes in a file: "resultsMachinename.txt"
  3. Analyze your data and prepare for discussion:
    1. Contrast the execution times for mandSEQ and mandOMP for OMP_NUM_THREADS=1. Write down an explaination of what you see and why you think it is happening.
    2. Make observations about the collected data including:
      How many decimal digits are significant?
      How variable are the execution times?
    3. Summarize your data using the median.
    4. Build a table with a row for each p containing the speedups you see for p=1, 2, ... , 8?
    5. Plot the number of threads, time, speedup and efficiency. You can use any plotting tool, or plot by hand. What do you observe? Can you explain your observations?

3. Scheduling of Parallel Mandelbrot

In section 2 above 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. Look at the fractal image; where is most of the work done?
  3. What does that say about the amount of work the various threads have to do? (hint: Think about 2 vs 3 threads.)
  4. Find a better scheduling strategy, (check out dynamic scheduling) and plot your new results.
In discussion 1 you will report your results and discuss your observations with your group in Piazza.