iwomp2005_tutorial_openmp_rvdp

iwomp2005_tutorial_openmp_rvdp - IWOMP 2005 1 An...

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

View Full Document Right Arrow Icon
1 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 An Introduction Into OpenMP Ruud van der Pas Senior Staff Engineer Scalable Systems Group Sun Microsystems IWOMP 2005 University of Oregon Eugene, Oregon, USA June 1-4, 2005
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 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 Outline The OpenMP Programming Model OpenMP Guided Tour OpenMP Overview Clauses Worksharing constructs Synchronization constructs Environment variables Global Data Runtime functions Wrap-up
Background image of page 2
3 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 The OpenMP Programming Model
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 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 0 1 P Memory
Background image of page 4
5 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 Shared Memory Model T private T private T private T private T private Programming Model Shared Memory All threads have access to the same, globally shared , memory Data can be shared or private Shared data is accessible by all threads Private data can be accessed only by the threads that owns it Data transfer is transparent to the programmer Synchronization takes place, but it is mostly implicit
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 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 About Data In a shared memory parallel program variables have a "label" attached to them: Labelled "Private" Visible to one thread only Change made in local data, is not seen by others Example - Local variables in a function that is executed in parallel Labelled "Shared" Visible to all threads Change made in global data, is seen by all others Example - Global data
Background image of page 6
7 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 The OpenMP execution model Fork and Join Model Master Thread Worker Threads Parallel region Parallel region Synchronization "threads"
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 TID = 0 for (i=0,1,2,3,4) TID = 1 for (i=5,6,7,8,9) Example - Matrix times vector i = 0 i = 5 i = 1 i = 6 a[ 1 ] = sum a[ 6 ] = sum sum = b[ i=1] [j]*c[j] sum = b[ i=6] [j]*c[j] ... etc . .. for (i=0; i<m; i++) { sum = 0.0; for (j=0; j<n; j++) sum += b[i][j]*c[j]; a[i] = sum; } #pragma omp parallel for default(none) \ private(i,j,sum) shared(m,n,a,b,c) = * j i a[ 0 ] = sum a[ 5 ] = sum sum = b[ i=0] [j]*c[j] sum = b[ i=5] [j]*c[j]
Background image of page 8
9 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 OpenMP Guided Tour
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 http://www.openmp.org http://www.compunity.org
Background image of page 10
11 RvdP/V1.1 An Introduction Into OpenMP Copyright©2005 Sun Microsystems IWOMP 2005 When to consider using OpenMP? The compiler may not be able to do the parallelization in the way you like to see it: A loop is not parallelized The data dependency analysis is not able to determine whether it is safe to parallelize or not The granularity is not high enough The compiler lacks information to parallelize at the highest possible level This is when explicit parallelization through OpenMP directives and functions comes into the picture
Background image of page 11

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

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

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

Page1 / 82

iwomp2005_tutorial_openmp_rvdp - IWOMP 2005 1 An...

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

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