omp-hands-on-SC08

omp-hands-on-SC08 - A Hands-on Introduction to OpenMP* Tim...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 A “Hands-on” Introduction to OpenMP * Tim Mattson Principal Engineer Intel Corporation timothy.g.mattson@intel.com * The name “OpenMP” is the property of the OpenMP Architecture Review Board. Larry Meadows Principal Engineer Intel Corporation lawrence.f.meadows@intel.com
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
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.
Background image of page 2
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.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Our Plan for the day Tasks and other OpenMP 3 features Linked list IX OpenMP 3 and tasks Point to point synch with flush Producer consumer VIII. Memory model For, schedules, sections Linked list, matmul VII. Worksharing and schedule Data environment details, modular software, threadprivate Pi_mc VI. Data Environment Single, master, runtime libraries, environment variables, synchronization, etc. No exercise V. Odds and ends For, reduction Pi_loop IV. Parallel loops False sharing, critical, atomic Pi_spmd_final III. Synchronization Parallel, default data environment, runtime library calls Pi_spmd_simple II. Creating threads Parallel regions Install sw, hello_world I. OMP Intro concepts Exercise Topic Break Break lunch
Background image of page 4
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
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 OpenMP * Overview: omp_set_lock(lck) #pragma omp parallel for private(A, B) #pragma omp critical C$OMP parallel do shared(a, b, c) C$OMP PARALLEL REDUCTION (+: A, B) call OMP_INIT_LOCK (ilok) call omp_test_lock(jlok) setenv OMP_SCHEDULE “dynamic” CALL OMP_SET_NUM_THREADS(10) C$OMP DO lastprivate(XX) C$OMP ORDERED C$OMP SINGLE PRIVATE(X) C$OMP SECTIONS C$OMP MASTER C$OMP ATOMIC C$OMP FLUSH C$OMP PARALLEL DO ORDERED PRIVATE (A, B, C) C$OMP THREADPRIVATE(/ABC/) C$OMP PARALLEL COPYIN(/blk/) Nthrds = OMP_GET_NUM_PROCS() !$OMP BARRIER OpenMP: An API for Writing Multithreaded Applications ± A set of compiler directives and library routines for parallel application programmers ± Greatly simplifies writing multi-threaded (MT) programs in Fortran, C and C++ ± Standardizes last 20 years of SMP practice * The name “OpenMP” is the property of the OpenMP Architecture Review Board.
Background image of page 6
7 OpenMP Basic Defs: Solution Stack OpenMP Runtime library OS/system support for shared memory and threading S y s t e m l a r
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/17/2011 for the course CS 33 taught by Professor Rohr during the Spring '08 term at UCLA.

Page1 / 153

omp-hands-on-SC08 - A Hands-on Introduction to OpenMP* Tim...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online