Parallel Computing: Lecture 5
Learning objectives
After this class, you should be able to:
- Explain the following: (i) fork-join model used in OpenMP, (ii) shared variable, and (iii) private variable.
- Given a sequential loop, parallelize it with OpenMP using the following: (i)
parallel for
, (ii)firstprivate
, (iii)lastprivate
, (iv)private
, (v)omp_get_num_procs
, (vi)omp_set_num_threads
, (vii)omp_get_max_threads
.- Given a code that is incorrectly parallelized using OpenMP, point out the errors.
- Given code that is parallelized using OpenMP, give the output produced by it.
Reading assignment
- Chapter 17, up to (and including) section 17.4, note on using p690 at NCSA.
- Chapter 17, section 17.6.
Exercises and review questions
- Questions on current lecture's material
- (Programming) Exercise 17.2.
- Questions on next lecture's material
- Parallelize the following loop using OpenMP.
a = 0;
for (i=0; i < n; i++)- a += b[i];