OpenMP - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

OpenMP

Description:

... language (FORTRAN, C) for parallel programming on a shred memory machine. ... Used on shared memory machines as opposed to distributed memory machines. ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 15
Provided by: CCS373
Category:
Tags: openmp | shred

less

Transcript and Presenter's Notes

Title: OpenMP


1
OpenMP
  • An API for shared memory multiprocessing.

2
What is OpenMP?
  • OpenMP is a portable, shared memory,
    multiprocessing API.
  • Not a new language.
  • Specifies a set of subroutines in an existing
    language (FORTRAN, C) for parallel programming on
    a shred memory machine.

3
  • Where is OpenMP used?
  • Used on shared memory machines as opposed to
    distributed memory machines.
  • Shared memory vs. distributed memory.
  • Why is OpenMP popular?
  • Vendor involvement
  • Allows us to use existing code
  • Incremental parallelization

4
OpenMP Architecture
OpenMP is made up of the following components
  • Directives and Pragmas
  • Runtime Library Routines
  • Environment variables

5
OpenMP Execution Model
fork
Slave threads / processes
synchronize
6
OpenMP Directives
  • Control Structures
  • Work Sharing
  • Synchronization
  • Data Scope Attributes
  • Orphaning

7
Parallel Region
  • !OMP PARALLEL Clause
  • code block
  • !OMP END PARALLEL
  • The block of code between the PARALLEL and END
    PARALLEL directives is xecuted by multiple
    threads, in parallel.

8
Work Sharing Constructs
  • A work sharing construct divides the execution of
    enclosed code region among participating
    processes
  • The DO directive
  • The SECTIONS directive
  • The SINGLE directive

9
Synchronization
Synchronization directives provide for process
synchronization and mutual exclusion
  • The MASTER directive
  • The BARRIER directive
  • The CRITICAL directive
  • The ORDERED directive
  • The ATOMIC directive

10
Data Scoping Directives
Clauses qualify and scope the variables in a
block of code
  • PRIVATE
  • SHARED
  • DEFAULT (PRIVATE SHARED NONE)
  • FIRSTPRIVATE
  • LASTPRIVATE
  • COPYIN
  • REDUCTION

11
Orphaning
  • Directives that do not appear in the lexical
    extent of the parallel construct, but lie in the
    dynamic extent are called orphaned directives.
  • Directives in routines called from within
    parallel constructs.

12
Runtime Library Routines
  • OMP_SET_NUM_THREADS (int)
  • OMP_GET_NUM_THREADS( )
  • OMP_GET_MAX_THREADS( )
  • OMP_GET_THREAD( )
  • OMP_GET_NUM_PROCS( )
  • OMP_IN_PARALLEL( )
  • OMP_SET_DYNAMIC(bool)

13
Lock Routines
  • OMP_INIT_LOCK(var)
  • OMP_DESTROY_LOCK(var)
  • OMP_SET_LOCK(var)
  • OMP_UNSET_LOCK(var)
  • OMP_TEST_LOCK(var)

14
Environment Variables
  • OMP_SCHEDULE
  • OMP_NUM_THREADS
  • OMP_DYNAMIC
  • OMP_NESTED
Write a Comment
User Comments (0)
About PowerShow.com