OpenMP Andrew Williams References Chandra et al, Parallel Programming in OpenMP, Morgan Kaufmann Publishers 1999 OpenMP home:

Slides:



Advertisements
Similar presentations
Implementing Domain Decompositions Intel Software College Introduction to Parallel Programming – Part 3.
Advertisements

OpenMP.
Parallel Processing with OpenMP
Introduction to Openmp & openACC
NewsFlash!! Earth Simulator no longer #1. In slightly less earthshaking news… Homework #1 due date postponed to 10/11.
1 OpenMP—An API for Shared Memory Programming Slides are based on:
1 Tuesday, November 07, 2006 “If anything can go wrong, it will.” -Murphy’s Law.
Computer Architecture II 1 Computer architecture II Programming: POSIX Threads OpenMP.
OpenMP 3.0 Feature: Error Detection Capability Kang Su Gatlin Visual C++ Program Manager.
Games at Bolton OpenMP Techniques Andrew Williams
1 ITCS4145/5145, Parallel Programming B. Wilkinson Feb 21, 2012 Programming with Shared Memory Introduction to OpenMP.
SW Architecture Review Steven Anastos Jose De Jesus Sean Stevenson.
CSCI-6964: High Performance Parallel & Distributed Computing (HPDC) AE 216, Mon/Thurs 2-3:20 p.m. Pthreads (reading Chp 7.10) Prof. Chris Carothers Computer.
A Very Short Introduction to OpenMP Basile Schaeli EPFL – I&C – LSP Vincent Keller EPFL – STI – LIN.
INTEL CONFIDENTIAL OpenMP for Domain Decomposition Introduction to Parallel Programming – Part 5.
CS 470/570 Lecture 7 Dot Product Examples Odd-even transposition sort More OpenMP Directives.
Games at Bolton Parallel Sections Andrew Williams.
INTEL CONFIDENTIAL Reducing Parallel Overhead Introduction to Parallel Programming – Part 12.
Programming with Shared Memory Introduction to OpenMP
CS470/570 Lecture 5 Introduction to OpenMP Compute Pi example OpenMP directives and options.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Chapter 5 Shared Memory Programming with OpenMP An Introduction to Parallel Programming Peter Pacheco.
CC02 – Parallel Programming Using OpenMP 1 of 25 PhUSE 2011 Aniruddha Deshmukh Cytel Inc.
Lecture 5: Shared-memory Computing with Open MP. Shared Memory Computing.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
OpenMP - Introduction Süha TUNA Bilişim Enstitüsü UHeM Yaz Çalıştayı
1 OpenMP Writing programs that use OpenMP. Using OpenMP to parallelize many serial for loops with only small changes to the source code. Task parallelism.
OpenMP Blue Waters Undergraduate Petascale Education Program May 29 – June
OpenMP – Introduction* *UHEM yaz çalıştayı notlarından derlenmiştir. (uhem.itu.edu.tr)
Computer Organization David Monismith CS345 Notes to help with the in class assignment.
CS 838: Pervasive Parallelism Introduction to OpenMP Copyright 2005 Mark D. Hill University of Wisconsin-Madison Slides are derived from online references.
Work Replication with Parallel Region #pragma omp parallel { for ( j=0; j
OpenMP fundamentials Nikita Panov
High-Performance Parallel Scientific Computing 2008 Purdue University OpenMP Tutorial Seung-Jai Min School of Electrical and Computer.
Introduction to OpenMP
Introduction to OpenMP Eric Aubanel Advanced Computational Research Laboratory Faculty of Computer Science, UNB Fredericton, New Brunswick.
Shared Memory Parallelism - OpenMP Sathish Vadhiyar Credits/Sources: OpenMP C/C++ standard (openmp.org) OpenMP tutorial (
Threaded Programming Lecture 2: Introduction to OpenMP.
CS/EE 217 GPU Architecture and Parallel Programming Lecture 23: Introduction to OpenACC.
Single Node Optimization Computational Astrophysics.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
10/05/2010CS4961 CS4961 Parallel Programming Lecture 13: Task Parallelism in OpenMP Mary Hall October 5,
Special Topics in Computer Engineering OpenMP* Essentials * Open Multi-Processing.
CPE779: More on OpenMP Based on slides by Laxmikant V. Kale and David Padua of the University of Illinois.
Heterogeneous Computing using openMP lecture 2 F21DP Distributed and Parallel Technology Sven-Bodo Scholz.
CPE779: Shared Memory and OpenMP Based on slides by Laxmikant V. Kale and David Padua of the University of Illinois.
Heterogeneous Computing using openMP lecture 1 F21DP Distributed and Parallel Technology Sven-Bodo Scholz.
OpenMP – Part 2 * *UHEM yaz çalıştayı notlarından derlenmiştir. (uhem.itu.edu.tr)
Embedded Systems MPSoC Architectures OpenMP: Exercises Alberto Bosio
Introduction to OpenMP
SHARED MEMORY PROGRAMMING WITH OpenMP
Lecture 5: Shared-memory Computing with Open MP
SHARED MEMORY PROGRAMMING WITH OpenMP
CS427 Multicore Architecture and Parallel Computing
Loop Parallelism and OpenMP CS433 Spring 2001
Computer Engg, IIT(BHU)
Introduction to OpenMP
SHARED MEMORY PROGRAMMING WITH OpenMP
Computer Science Department
OpenMP Quiz B. Wilkinson January 22, 2016.
OpenMP 3.0 Feature: Error Detection Capability
Multi-core CPU Computing Straightforward with OpenMP
September 4, 1997 Parallel Processing (CS 730) Lecture 5: Shared Memory Parallel Programming with OpenMP* Jeremy R. Johnson Wed. Jan. 31, 2001 *Parts.
September 4, 1997 Parallel Processing (CS 730) Lecture 5: Shared Memory Parallel Programming with OpenMP* Jeremy R. Johnson *Parts of this lecture.
Introduction to High Performance Computing Lecture 20
Programming with Shared Memory Introduction to OpenMP
Introduction to OpenMP
Multithreading Why & How.
OpenMP Quiz.
OpenMP on HiHAT James Beyer, 18 Sep 2017.
OpenMP Parallel Programming
Presentation transcript:

OpenMP Andrew Williams

References Chandra et al, Parallel Programming in OpenMP, Morgan Kaufmann Publishers 1999 OpenMP home: Intel has superb resources, including some podcasts: –Have a look round their site

OpenMP Development MS Visual Studio 2005 Professional has support for OpenMP –Not available in Express or Standard editions –You have to set a flag in your Project Settings It is under Code Gen / C++ / Language The Intel C++ compilers have OpenMP support (version 10.0 onwards) –Free for non-commercial use –Not free for us to install here

OpenMP Development Omni OpenMP compiler –More of a command-line facility –Drives gcc / g++ I’ve tried it on Linux (Ubuntu Dapper) but it wouldn’t install properly –Will try to sort that out when I have time

Parallel Regions Fundamental to understanding OpenMP In a parallel region, every thread executes every instruction See “hello world” example later –For non-trivial problems, this takes some thinking about –It’s actually easier to understand with for- loops

Parallel Regions Regions where the work is shared between many threads #pragma omp parallel #pragma omp barrier Single thread Multiple threads Single thread

OpenMP Syntax OpenMP is implemented as a set of directives which are implemented using #pragma in C or C++ –Also available for Fortran A #pragma is used to give some information to the compiler Used to implement extra features which are not defined as part of a language –Ideal for OpenMP

OpenMP Syntax Examples: #pragma omp parallel Splits thread of execution (see later) #pragma omp parallel for for(i=0; i < 1000; i++) { do_something_or_other(); } This divides the iterations of the loop among the available threads –Note there are severe restrictions on the for() loop

OpenMP Syntax A #pragma is divided into a directive and clauses –There may be no clauses #pragma omp parallel num_threads(6)

OpenMP Syntax A #pragma is divided into a directive and clauses –There may be no clauses #pragma omp parallel num_threads(6) Directive

OpenMP Syntax A #pragma is divided into a directive and clauses –There may be no clauses #pragma omp parallel num_threads(6) Clause

OpenMP Syntax #pragma omp parallel for private(temp)

OpenMP Syntax #pragma omp parallel for private(temp) Directive

OpenMP Syntax #pragma omp parallel for private(temp) Directive Clause

Task or Data Parallelism? Last week we contrasted task parallelism and data parallelism –Which one do we have here? #pragma omp parallel for for(i=0; i < 1000; i++) { do_something_or_other(); }

Parallel Sections We will look at this in more detail later #pragma omp parallel sections { #pragma omp section { do_AI(); } #pragma omp section { do_physics(); }

Shared Data Everything we have discussed ignores the problem of data which is being shared between threads We’ll not bother with that too much this week But you must understand that having two threads write to the same data in an uncontrolled manner must result in disaster