Parallel Computing: Lecture 6
Learning objectives
After this class, you should be able to:
- Explain the purpose of the following clauses: (i)
critical
, (ii)reduction
, and (iii)schedule
.- Given sequential code, use the above clauses and other OpenMP directives to parallelize the code.
- Given sequential or parallel code, use OpenMP directives and clauses to get good performance. You may reorder loops, if necessary.
Reading assignment
- Chapter 17, sections 17.5 - 17.7.
- Chapter 17, pages 427.
Exercises and review questions
- Questions on current lecture's material
- Run the code examples of sections 17.5.1 and 17.6, and compare their performance. Please bring your timing results, for different values of
n
and number of threads.- Compare the performance of the OpenMP example in section 17.7.1 with a code that parallelizes the inner loop of the sequential code at the top of page 417. Please bring your timing results, for different values of
m
,n
, and number of threads.- (Post your solution on the discussion board) Write code similar to the example at the bottom of page 420, and present the timing results with different scheduling policies. Explain the reasons for the differences in times with different policies.
- Questions on next lecture's material
- Give an example to demonstrate the utility of the
single
pragma.