OpenMP: An API for Writing Portable SMP Application Software

SC’99 Tutorial: Agenda

Parallel Computing
What is it?

Parallel Computing:
Writing a parallel application.

Parallel Computing:
The Hardware is in great shape.

Parallel Computing:
… but where is the software?

Solution: Effective Standards for parallel programming

SC’99 Tutorial: Agenda

OpenMP: Introduction

OpenMP: Supporters*

OpenMP: Programming Model

OpenMP:
How is OpenMP typically used?

OpenMP:
How do threads interact?

SC’99 Tutorial: Agenda

OpenMP:
Some syntax details to get us started

OpenMP:
Structured blocks

OpenMP: Contents

OpenMP: Parallel Regions

OpenMP: Parallel Regions

Exercise 1:
A multi-threaded “Hello world” program

OpenMP: Some subtle details (don’t worry about these at first)

OpenMP: Contents

OpenMP: Work-Sharing Constructs

Work Sharing Constructs
A motivating example

OpenMP For constuct:
The schedule clause

OpenMP: Work-Sharing Constructs

OpenMP: Combined Parallel Work-Sharing Constructs

Exercise 2:
A multi-threaded “pi” program

PI Program:
The sequential program

OpenMP:
More details: Scope of OpenMP constructs

OpenMP: Contents

Data Environment:
Default storage attributes

Data Environment:
Example storage attributes

Data Environment:
Changing storage attributes

Private Clause

Firstprivate Clause

Lastprivate Clause

OpenMP:
Another data environment example

OpenMP:
Default Clause

OpenMP:
Default Clause Example

Threadprivate

A threadprivate example

OpenMP: Reduction

OpenMP: 
Reduction example

Exercise 3:
A multi-threaded “pi” program

OpenMP: Some subtle details (don’t worry about these at first)

OpenMP: More subtle details (don’t worry about these at first)

OpenMP: Contents

OpenMP: Synchronization

OpenMP: Synchronization

OpenMP: Synchronization

OpenMP: Synchronization

OpenMP: Synchronization

OpenMP: Synchronization

OpenMP: Synchronization

OpenMP: Synchronization

OpenMP:
A flush example

OpenMP:
Implicit synchronization

OpenMP: Some subtle details on directive nesting

OpenMP: Contents

OpenMP: Library routines

OpenMP: Library Routines

OpenMP: Library Routines

OpenMP: Environment Variables

SC’99 Tutorial: Agenda

Generating OpenMP Programs Automatically

The Basics About
Parallelizing Compilers

Basic Compiler Transformations

Basic Compiler Transformations

Basic Compiler Transformations

Compiler Options

More About Compiler Options

Inspecting the Translated Program

Compiler Listing

Slide 75

Tuning Automatically-
Parallelized Code

Why Tuning Automatically-Parallelized Code?

SC’99 Tutorial: Agenda

Performance Tuning and Case Studies with Realistic Applications

Performance Tuning
Example 1: MDG

MDG: Tuning Steps

MDG Code Sample

Performance Tuning
Example 2: ARC2D

ARC2D: Tuning Steps

ARC2D: Code  Samples

ARC2D: Code  Samples

ARC2D: Code  Samples

Performance Tuning Example 3: TOMCATV

TOMCATV: Tuning Steps

TOMCATV Code Samples

TOMCATV Code Samples

What Tools Did We Use for Performance Analysis and Tuning?

Guidelines for Fixing “Performance Bugs”

Performance Tuning

Performance Tuning

Case Study of a Large-Scale Application

Overview of Seismic

Seismic:
Basic Characteristics

Basic OpenMP Use:
Parallelization Scheme

Basic OpenMP Use:
Data Privatization

Basic OpenMP Use:
Synchronization and Communication

OpenMP Issues:
Mixing Fortran and C

OpenMP Issues:
Broadcast Common Blocks

OpenMP Issues:
Multithreading IO and malloc

OpenMP Issues:
Processor Affinity

Performance Results

SC’99 Tutorial: Agenda

SMP Programming errors

2 major SMP errors

Race Conditions

Race Conditions:
A complicated solution

Race Conditions

Race Conditions

Exercise 4:
Race conditions and the “pi” program

Deadlock

Deadlock

OpenMP death-traps

Navigating through the Danger Zones

Navigating through the Danger Zones

Portable Sequential Equivalence

Portable Sequential Equivalence

2 Forms of Sequential Equivalence

Strong Sequential Equivalence: rules

Strong Sequential Equivalence: example

Weak Sequential equivalence

Weak equivalence: example

Sequential Equivalence isn’t a Silver Bullet

Conclusion

SC’99 Tutorial: Agenda

OpenMP Futures: The ARB

ARB: What do we do

Goals of the ARB: Part 1

Goals of the ARB: Part 2.

The Future of OpenMP

OpenMP version 2.0:
Time line.

OpenMP 2.0: Goals*

OpenMP 2.0:
Some key items on “the list”

OpenMP 2.0:
Some key items dropped from “the list”

Summary: OpenMP Benefits*

Extra Slides
A series of parallel pi programs

PI Program: an example

Parallel Pi Program

Solution: Win32 API, PI

Solution: Keep it simple

OpenMP PI Program: 
Parallel Region example (SPMD Program)

OpenMP PI Program: 
Work sharing construct

OpenMP PI Program: 
private clause and a critical section

OpenMP PI Program : 
Parallel for with a reduction

Reference Material on OpenMP