1
A “Hands-on” Introduction to
OpenMP
*
Tim Mattson
Principal Engineer
Intel Corporation
* The name “OpenMP” is the property of the OpenMP Architecture Review Board.
Larry Meadows
Principal Engineer
Intel Corporation
2
Preliminaries: part 1
z Disclosures
The views expressed in this tutorial are those of the
people delivering the tutorial.
– We are not speaking for our employers.
– We are not speaking for the OpenMP ARB
z This is a new tutorial for us:
Help us improve … tell us how you would make this
tutorial better.
3
Preliminaries: Part 2
z Our plan for the day .. Active learning!
We will mix short lectures with short exercises.
You will use your laptop for the exercises … that
way you’ll have an OpenMP environment to take
home so you can keep learning on your own.
z Please follow these simple rules
Do the exercises we assign and then change things
around and experiment.
– Embrace active learning!
Don’t cheat: Do Not look at the solutions before
you complete an exercise … even if you get really
frustrated.
4
Our Plan for the day
Tasks and other OpenMP 3
features
Linked listIX OpenMP 3 and tasks
Point to point synch with flushProducer
consumer
VIII. Memory model
For, schedules, sectionsLinked list,
matmul
VII. Worksharing and
schedule
Data environment details,
modular software,
threadprivate
Pi_mcVI. Data Environment
Single, master, runtime
libraries, environment
variables, synchronization, etc.
No exerciseV. Odds and ends
For, reductionPi_loopIV. Parallel loops
False sharing, critical, atomicPi_spmd_finalIII. Synchronization
Parallel, default data
environment, runtime library
calls
Pi_spmd_simpleII. Creating threads
Parallel regionsInstall sw,
hello_world
I. OMP Intro
conceptsExerciseTopic
Break
Break
lunch
5
Outline
z Introduction to OpenMP
z Creating Threads
z Synchronization
z Parallel Loops
z Synchronize single masters and stuff
z Data environment
z Schedule your for and sections
z Memory model
z OpenMP 3.0 and Tasks