Lecture 3

Learning objectives

After this class, you should be able to:

  1. Explain the following: (i) fork-join model used in OpenMP, (ii) shared variable, and (iii) private variable.
  2. Explain the purpose of the following directives, clauses, and functions: (i) parallel, (ii) omp_get_thread_num, (iii) for, (iv) single, (v) nowait, (vi) sections, (vii) section, (viii) omp_get_wtime, (ix) omp_get_wtick, (x) parallel for, (xi) firstprivate, (xii) lastprivate, (xiii) private, (xiv) omp_get_num_procs, (xv) omp_set_num_threads, (xvi) omp_get_max_threads, (xvii) critical, (xviii) reduction, and (xix) schedule.
  3. Given sequential code, use the above features to parallelize the code.
  4. Given a code that is incorrectly parallelized using OpenMP, point out the errors.

Reading assignment

  1. OpenMP tutorial at: http://www.llnl.gov/computing/tutorials/openMP.
  2. Reference -- OpenMP 2 C/C++ specifications: http://www.openmp.org/mp-documents/cspec20.pdf.

Exercises and review questions


Last modified: 13 Jan 2010