06-openmp - Announcements Classschedule TA...

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

View Full Document Right Arrow Icon
Announcements Class schedule Feedback on your Homework #2 (thoughts on term project) coming soon CoC accounts coming real soon now (this week) TA Jonathan Brownsworth [email protected] Action Items Finalize term project proposals and collaborators Recommended books list on Amazon http://amzn.com/l/R11Z 4Q3BVWKKM7 Computational Science and Engineering Division 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS6230–HPC Tools and Applications Shared Memory Parallelism w/ OpenMP Jeffrey S. Vetter Computational Science and Engineering College of Computing Georgia Institute of Technology http://ft.ornl.gov/~vetter [email protected]
Background image of page 2
OpenMP Specification and Functionality
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS6230 / Vetter 3 OpenMP Basics Compiler directives for parallel regions (PARALLEL) parallel loops (PARALLEL DO) parallel sections (PARALLEL SECTION) sections to be done by only one processor (SINGLE) synchronization (BARRIER, CRITICAL, ATOMIC, locks, etc.) data structures (PRIVATE, SHARED, REDUCTION) Run time library routines like OMP_SET_NUM_THREADS, OMP_GET_NUM_THREADS, etc. UNIX environment variables like OMP_NUM_THREADS, etc.
Background image of page 4
CS6230 / Vetter 4 Basic Fork Join Model Fork Join Parallel Region Master Thread Parallel Region
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS6230 / Vetter 5 Fork Join Model Master thread executes sequentially Fork Master thread creates a thread team which is executed in parallel Join When team threads terminate, they synchronize, and rejoin the Master Number of threads is independent of the number of processors
Background image of page 6
CS6230 / Vetter 6 Work sharing Constructs Do/For loops Data parallelism Sections Function or task parallelism Single Serializes a section of the code Useful for code that is not thread safe
Background image of page 7

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

View Full DocumentRight Arrow Icon
CS6230 / Vetter 7 Parallel Regions do/for Each thread executes a part of the loop By default, the work is evenly and continuously divided among the threads e.g. 2 threads: thread 1 works on 1…n/2 thread 2 works on (n/2)+1 … n The work is statically assigned to the threads !$OMP PARALLEL DO DO i = 1, n a(i) = b(i) + c(i) END DO !$OMP END PARALLEL DO
Background image of page 8
CS6230 / Vetter 8 OpenMP–Example–jacobi Courtesy of OpenMP.org
Background image of page 9

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

View Full DocumentRight Arrow Icon
CS6230 / Vetter 9 OpenMP can’t be used on every FOR/DO loop Control clause of the for loop mush have canonical shape For (index=start; index REL end; INC) REL <, <=, >=, > INC {++,--}Index{++,--} Index {+-}= inc This rules OUT a lot of interesting loops … Index == end Inc += a[index]
Background image of page 10
CS6230 / Vetter 10 Scope of Variables Shared memory programming model Most variables are shared by default Global variables are SHARED among threads Fortran COMMON blocks C: File scope variables Some are PRIVATE Stack variables in sub programs called from parallel regions Automatic variables w/i a statement block
Background image of page 11

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

View Full DocumentRight Arrow Icon
CS6230 / Vetter 11 Parallel Regions Sections The two independent sections can be executed concurrently by two threads If `NOWAIT' option specified at end of parallel DO or SECTIONS then threads will not be synchronized !$OMP PARALLEL SECTIONS
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/04/2010 for the course CSE 6530 taught by Professor Jeffreyvetter during the Fall '10 term at Georgia Tech.

Page1 / 44

06-openmp - Announcements Classschedule TA...

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

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