Introduction to OpenMP

Size: px
Start display at page:

Download "Introduction to OpenMP"

Transcription

1 MPSoC Architectures OpenMP Aberto Bosio, Associate Professor UM Microeectronic Departement Introduction to OpenMP What is OpenMP? Open specification for Muti-Processing Standard API for defining muti-threaded sharedmemory programs Taks, exampes, forums, etc. High-eve API Preprocessor (compier) directives ( ~ 80% ) Library Cas ( ~ 19% ) Environment Variabes ( ~ 1% ) 1

2 A Programmer s View of OpenMP OpenMP is a portabe, threaded, shared-memory programming specification with ight syntax Exact behavior depends on OpenMP impementation! Requires compier support (C or Fortran) OpenMP wi: Aow a programmer to separate a program into seria regions and parae regions, rather than T concurrentyexecuting threads. Hide stack management Provide synchronization constructs OpenMP wi not: Paraeize (or detect!) dependencies Guarantee speedup Provide freedom from data races Introduction Outine Motivating exampe Parae Programming is Hard OpenMP Programming Mode Easier than PThreads Microbenchmark Performance Comparison vs. PThreads Discussion specomp 2

3 Current Parae Programming 1. Start with a parae agorithm 2. Impement, keeping in mind: Data races Synchronization Threading Syntax 3. Test & Debug 4. Debug 5. Debug Motivation Threading Library void* SayHeo(void *foo) printf( "Heo, word!\n" ); return NULL; int main() pthread_attr_t attr; pthread_t threads[16]; int tn; pthread_attr_init(&attr); pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); for(tn=0; tn<16; tn++) pthread_create(&threads[tn], &attr, SayHeo, NULL); for(tn=0; tn<16 ; tn++) pthread_join(threads[tn], NULL); return 0; 3

4 Motivation Thread ibraries are hard to use P-Threads/Soaris threads have many ibrary cas for initiaization, synchronization, thread creation, condition variabes, etc. Programmer must code with mutipe threads in mind Synchronization between threads introduces a new dimension of program correctness Motivation Woudn t it be nice to write seria programs and somehow paraeize them automaticay? OpenMP can paraeize many seria programs with reativey few annotations that specify paraeism and independence OpenMP is a sma API that hides cumbersome threading cas with simper directives 4

5 Better Parae Programming 1. Start with some agorithm Embarrassing paraeism is hepfu, but not necessary 2. Impement seriay, ignoring: Data Races Synchronization Threading Syntax 3. Test and Debug 4. Automaticay (magicay?) paraeize Expect inear speedup Motivation OpenMP int main() // Do this part in parae printf( "Heo, Word!\n" ); return 0; 5

6 Motivation OpenMP int main() omp_set_num_threads(16); // Do this part in parae #pragma omp parae printf( "Heo, Word!\n" ); return 0; OpenMP Parae Programming 1. Start with a paraeizabe agorithm Embarrassing paraeism is good, oop-eve paraeism is necessary 2. Impement seriay, mosty ignoring: Data Races Synchronization Threading Syntax 3. Test and Debug 4. Annotate the code with paraeization (and synchronization) directives Hope for inear speedup 5. Test and Debug 6

7 Programming Mode - Threading Seria regions by defaut, annotate to create parae regions Generic parae regions Paraeized oops Sectioned parae regions Fork Thread-ike Fork/Join mode Arbitrary number of ogica thread creation/ destruction events Join Programming Mode - Threading int main() // seria region printf( Heo ); // parae region #pragma omp parae printf( Word ); // seria again printf(! ); Fork Join Heo WordWordWordWord! 7

8 Programming Mode Nested Threading Fork/Join can be nested Nesting compication handed automagicay at compie-time Independent of the number of threads actuay running Fork Fork Join Join Programming Mode Thread Identification Master Thread Thread with ID=0 Ony thread that exists in sequentia regions Depending on impementation, may have specia purpose inside parae regions Some specia directives affect ony the master thread (ike master) 0 Fork Join 0 8

9 Exampe int main() int tid, nthreads; omp_set_num_threads(16); // Do this part in parae #pragma omp parae private(nthreads, tid) printf( "Heo, Word!\n" ); /* Obtain and print thread id */ tid = omp_get_thread_num(); if (tid == 0) nthreads = omp_get_num_threads(); printf("i'm the master, Number of threads = %d\n", nthreads); Programming Mode Data/Contro Paraeism Data paraeism Threads perform simiar functions, guided by thread identifier Fork Contro paraeism Threads perform differing functions - One thread for I/O, one for computation, etc Join 9

10 Programming mode: Summary Memory Mode Shared memory communication Threads cooperates by accessing shared variabes The sharing is defined syntacticay Any variabe that is seen by two or more threads is shared Any variabe that is seen by one thread ony is private Race conditions possibe Use synchronization to protect from conficts Change how data is stored to minimize the synchronization 10

11 Structure Programming Mode Concurrent Loops OpenMP easiy paraeizes oops No data dependencies between iterations! Preprocessor cacuates oop bounds for each thread directy from seria source #pragma omp parae for for( i=0; i < 25; i++ ) printf( Foo ); 11

12 The probem Executes the same code as many times as there are threads How many threads do we have? omp_set_num_threads(n) What is the use of repeating the same work n times in parae? Can use omp_thread_num() to distribute the work between threads. D is shared between the threads, i and sum are private Programming Mode Concurrent Loops 12

13 Programming Mode Concurrent Loops Programming Mode Concurrent Loops Load baancing If a the iterations execute at the same speed, the processors are used optimay If some iterations are faster than others, some processors may get ide, reducing the speedup We don't aways know the distribution of work, may need to re-distribute dynamicay Granuarity Thread creation and synchronization takes time Assigning work to threads on per-iteration resoution may take more time than the execution itsef! Need to coaesce the work to coarse chunks to overcome the threading overhead Trade-off between oad baancing and granuarity! 13

14 Controing Granuarity #pragma omp parae if (expression) Can be used to disabe paraeization in some cases (when the input is determined to be too sma to be beneficiay mutithreaded) #pragma omp num_threads (expression) Contro the number of threads used for this parae region Programming Mode Loop Scheduing schedue cause determines how oop iterations are divided among the thread team static([chunk]) divides iterations staticay between threads - Each thread receives [chunk] iterations, rounding as necessary to account for a iterations - Defaut [chunk] is cei( # iterations / # threads ) dynamic([chunk]) aocates [chunk] iterations per thread, aocating an additiona [chunk] iterations when a thread finishes - Forms a ogica work queue, consisting of a oop iterations - Defaut [chunk] is 1 guided([chunk]) aocates dynamicay, but [chunk] is exponentiay reduced with each aocation 14

15 Programming Mode Loop Scheduing Exampe The function TestForPrime (usuay) takes itte time But can take ong, if the number is a prime indeed Soution: use dynamic, but with chunks 15

16 Work sharing: Sections Sections The SECTIONS directive is a non-iterative work-sharing construct. It specifies that the encosed section(s) of code are to be divided among the threads in the team. Independent SECTION directives are nested within a SECTIONS directive. Each SECTION is executed once by a thread in the team. Different sections may be executed by different threads. It is possibe that for a thread to execute more than one section if it is quick enough and the impementation permits such. 16

17 Exampe #incude <omp.h> #define N 1000 main () int i; foat a[n], b[n], c[n], d[n]; /* Some initiaizations */ for (i=0; i < N; i++) a[i] = i * 1.5; b[i] = i ; Exampe #pragma omp parae shared(a,b,c,d) private(i) #pragma omp sections #pragma omp section for (i=0; i < N; i++) c[i] = a[i] + b[i]; #pragma omp section for (i=0; i < N; i++) d[i] = a[i] * b[i]; /* end of sections */ /* end of parae section */ 17

18 Data Sharing Shared Memory programming mode Most variabes are shared by defaut We can define a variabe as private // Do this part in parae #pragma omp parae private(nthreads, tid) printf( "Heo, Word!\n" ); if (tid == 0). Programming Mode Data Sharing Parae programs often empoy two types of data Shared data, visibe to a threads, simiary named Private data, visibe to a singe thread (often stack-aocated) PThreads: Goba-scoped variabes are shared Stack-aocated variabes are private int bigdata[1024]; void* foo(void* bar) int tid; #pragma omp parae \ shared ( bigdata ) \ private ( tid ) OpenMP: shared variabes are shared private variabes are private /* Cac. here */ 18

19 Programming Mode Data Sharing private: A copy of the variabe is created for each thread. No connection between the origina variabe and the private copies Can achieve the same using variabes inside Int i; #pragma omp parae for private(i) for (i=0; i<n; i++)... Programming Mode Data Sharing Firstprivate: Same, but the initia vaue is copied from the main copy Lastprivate: Same, but the ast vaue is copied to the main copy 19

20 Thread private Simiar to private, but defined per variabe Decaration immediatey after variabe definition. Must be visibe in a transation units. Persistent between parae sections Can be initiaized from the master's copy with #pragma omp copyin More efficient than private, but a goba variabe! Synchronization What shoud the resut be (assuming 2 threads)? X=0; #pragma omp parae X = X+1; 20

21 Synchronization 2 is the expected answer But can be 1 with unfortunate intereaving OpenMP assumes that the programmer knows what he is doing Regions of code that are marked to run in parae are independent If access coisions are possibe, it is the programmer's responsibiity to insert protection Synchronization Many of the existing mechanisms for shared programming OpenMP Synchronization Nowait (turn synchronization off!) Singe/Master execution Critica sections, Atomic updates Ordered Barriers Fush (memory subsystem synchronization) Reduction (specia case) 21

22 Singe/Master #pragma omp singe Ony one of the threads wi execute the foowing bock of code The rest wi wait for it to compete Good for non-thread-safe regions of code (such as I/O) Must be used in a parae region Appicabe to parae for sections Singe/Master #pragma omp master The foowing bock wi be executed by the master thread No synchronization invoved Appicabe ony to parae sections #pragma omp parae do_preprocessing () ; #pragma omp singe read_input () ; #pragma omp master notify_input_consumed () ; do_processing () ; 22

23 Critica Sections #pragma omp critica [name] Standard critica section functionaity Critica sections are goba in the program Can be used to protect a singe resource in different functions Critica sections are identified by the name A the unnamed critica sections are mutuay excusive throughout the program A the critica sections having the same name are mutuay excusive between themseves Critica Sections int x=0; #pragma omp parae shared(x) #pragma omp critica x++; 23

24 Ordered #pragma omp ordered statement Executes the statement in the sequentia order of iterations Exampe: #pragma omp parae for ordered for (j=0; j<n; j++) int resut = j*j; #pragma omp ordered printf ("computation(%d) = %d\n",j, resut ) ; Barrier synchronization #pragma omp barrier Performs a barrier synchronization between a the threads in a team at the given point. Exampe: #pragma omp parae int resut = heavy_computation_part1 () ; #pragma omp atomic sum += resut ; #pragma omp barrier heavy_computation_part2 (sum) ; 24

25 Expicit Locking Can be used to pass ock variabes around (unike critica sections!) Can be used to impement more invoved synchronization constructs Functions: omp_init_ock(), omp_destroy_ock(), omp_set_ock(), omp_unset_ock(), omp_test_ock() The usua semantics Use #pragma omp fush to synchronize memory Consistency Vioation? 25

26 Consistency Vioation? Reduction How to paraeize this code? for (j=0; j<n; j++) sum = sum+a[j] b[j]; sum is not private, but accessing it atomicay is too expensive Have a private copy of sum in each thread, then add them up Use the reduction cause! #pragma omp parae for reduction(+: sum) An operator must be used: +, -, *... 26

27 Synchronization Overhead Lost time waiting for ocks Prefer to use structures that are as ock-free as possibe! Summary OpenMP is a compier-based technique to create concurrent code from (mosty) seria code OpenMP can enabe (easy) paraeization of oopbased code Lightweight syntactic anguage extensions OpenMP performs comparaby to manuay-coded threading Scaabe Portabe Not a siver buet for a appications 27

28 More Information OpenMP officia site A handy OpenMP tutoria Another OpenMP tutoria and reference Backup Sides Syntax, etc 28

29 OpenMP Syntax Genera syntax for OpenMP directives #pragma omp directive [cause ] CR Directive specifies type of OpenMP operation Paraeization Synchronization Etc. Causes (optiona) modify semantics of Directive OpenMP Syntax PARALLEL syntax #pragma omp parae [cause ] CR structured_bock Ex: Output: Heo! (T=4) #pragma omp parae printf( Heo!\n ); // impicit barrier Heo! Heo! Heo! 29

30 OpenMP Syntax DO/for Syntax (DO-Fortran, for-c) #pragma omp for [cause ] CR for_oop Ex: #pragma omp parae #pragma omp for private(i) shared(x) \ schedue(static,x/n) for(i=0;i<x;i++) printf( Heo!\n ); // impicit barrier Note: Must reside inside a parae section OpenMP Syntax More on Causes private() A variabe in private ist is private to each thread shared() Variabes in shared ist are visibe to a threads Impies no synchronization, or even consistency! schedue() Determines how iterations wi be divided among threads schedue(static, C) Each thread wi be given C iterations - Usuay T*C = Number of tota iterations schedue(dynamic) Each thread wi be given additiona iterations as-needed - Often ess efficient than considered static aocation nowait Removes CS Architecture impicit Seminarbarrier from end of bock 30

31 OpenMP Syntax PARALLEL FOR (combines parae and for) #pragma omp parae for [cause ] CR for_oop Ex: #pragma omp parae for shared(x)\ private(i) \ schedue(dynamic) for(i=0;i<x;i++) printf( Heo!\n ); Exampe: AddMatrix // omp- Fies: (Makefie) addmatrix.c paraeized matrixmain.c printmatrix.c // non-omp // non-omp 31

32 OpenMP Syntax ATOMIC syntax #pragma omp atomic CR simpe_statement Ex: #pragma omp parae shared(x) #pragma omp atomic x++; // impicit barrier CRITICAL syntax OpenMP Syntax structured_bock Ex: #pragma omp parae shared(x) #pragma omp critica #pragma omp critica CR // ony one thread in here // impicit barrier 32

33 ATOMIC vs. CRITICAL OpenMP Syntax Use ATOMIC for simpe statements Can have ower overhead than CRITICAL if HW atomics are everaged (impementation dep.) Use CRITICAL for arger expressions May invove an unseen impicit ock OpenMP Syntax MASTER ony Thread 0 executes a bock #pragma omp master CR structured_bock SINGLE ony one thread executes a bock #pragma omp singe CR structured_bock No impied synchronization 33

34 OpenMP Syntax BARRIER #pragma omp barrier CR Locks Locks are provided through omp.h ibrary cas omp_init_ock() omp_destroy_ock() omp_test_ock() omp_set_ock() omp_unset_ock() OpenMP Syntax FLUSH #pragma omp fush CR Guarantees that threads views of memory is consistent Why? Reca OpenMP directives Code is generated by directives at compie-time - Variabes are not aways decared as voatie - Using variabes from registers instead of memory can seem ike a consistency vioation Synch. Often has an impicit fush - ATOMIC, CRITICAL 34

35 OpenMP Syntax Functions omp_set_num_threads() omp_get_num_threads() omp_get_max_threads() omp_get_num_procs() omp_get_thread_num() omp_set_dynamic() omp_[init destroy test set unset]_ock() Function for the environment omp_set_dynamic(int) omp_set_num_threads(int) omp_get_num_threads() omp_get_num_procs() omp_get_thread_num() omp_set_nested(int) omp_in_parae() omp_get_wtime() 35

An Introduction to OpenMP

An Introduction to OpenMP Dipartimento di Ingegneria Industriale e dell'informazione University of Pavia December 4, 2017 Recap Parallel machines are everywhere Many architectures, many programming model. Among them: multithreading.

More information

Introduction to OpenMP.

Introduction to OpenMP. Introduction to OpenMP www.openmp.org Motivation Parallelize the following code using threads: for (i=0; i

More information

Parallel Programming with OpenMP. CS240A, T. Yang, 2013 Modified from Demmel/Yelick s and Mary Hall s Slides

Parallel Programming with OpenMP. CS240A, T. Yang, 2013 Modified from Demmel/Yelick s and Mary Hall s Slides Parallel Programming with OpenMP CS240A, T. Yang, 203 Modified from Demmel/Yelick s and Mary Hall s Slides Introduction to OpenMP What is OpenMP? Open specification for Multi-Processing Standard API for

More information

Parallel Programming with OpenMP. CS240A, T. Yang

Parallel Programming with OpenMP. CS240A, T. Yang Parallel Programming with OpenMP CS240A, T. Yang 1 A Programmer s View of OpenMP What is OpenMP? Open specification for Multi-Processing Standard API for defining multi-threaded shared-memory programs

More information

Multithreading in C with OpenMP

Multithreading in C with OpenMP Multithreading in C with OpenMP ICS432 - Spring 2017 Concurrent and High-Performance Programming Henri Casanova (henric@hawaii.edu) Pthreads are good and bad! Multi-threaded programming in C with Pthreads

More information

Shared Memory Parallelism - OpenMP

Shared Memory Parallelism - OpenMP Shared Memory Parallelism - OpenMP Sathish Vadhiyar Credits/Sources: OpenMP C/C++ standard (openmp.org) OpenMP tutorial (http://www.llnl.gov/computing/tutorials/openmp/#introduction) OpenMP sc99 tutorial

More information

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Lecture 4: Threads

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Lecture 4: Threads CSE120 Principes of Operating Systems Prof Yuanyuan (YY) Zhou Lecture 4: Threads Announcement Project 0 Due Project 1 out Homework 1 due on Thursday Submit it to Gradescope onine 2 Processes Reca that

More information

EPL372 Lab Exercise 5: Introduction to OpenMP

EPL372 Lab Exercise 5: Introduction to OpenMP EPL372 Lab Exercise 5: Introduction to OpenMP References: https://computing.llnl.gov/tutorials/openmp/ http://openmp.org/wp/openmp-specifications/ http://openmp.org/mp-documents/openmp-4.0-c.pdf http://openmp.org/mp-documents/openmp4.0.0.examples.pdf

More information

Shared Memory Parallelism using OpenMP

Shared Memory Parallelism using OpenMP Indian Institute of Science Bangalore, India भ रत य व ज ञ न स स थ न ब गल र, भ रत SE 292: High Performance Computing [3:0][Aug:2014] Shared Memory Parallelism using OpenMP Yogesh Simmhan Adapted from: o

More information

Concurrent Programming with OpenMP

Concurrent Programming with OpenMP Concurrent Programming with OpenMP Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico March 7, 2016 CPD (DEI / IST) Parallel and Distributed

More information

Functions. 6.1 Modular Programming. 6.2 Defining and Calling Functions. Gaddis: 6.1-5,7-10,13,15-16 and 7.7

Functions. 6.1 Modular Programming. 6.2 Defining and Calling Functions. Gaddis: 6.1-5,7-10,13,15-16 and 7.7 Functions Unit 6 Gaddis: 6.1-5,7-10,13,15-16 and 7.7 CS 1428 Spring 2018 Ji Seaman 6.1 Moduar Programming Moduar programming: breaking a program up into smaer, manageabe components (modues) Function: a

More information

ECE 574 Cluster Computing Lecture 10

ECE 574 Cluster Computing Lecture 10 ECE 574 Cluster Computing Lecture 10 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 1 October 2015 Announcements Homework #4 will be posted eventually 1 HW#4 Notes How granular

More information

OpenMP Algoritmi e Calcolo Parallelo. Daniele Loiacono

OpenMP Algoritmi e Calcolo Parallelo. Daniele Loiacono OpenMP Algoritmi e Calcolo Parallelo References Useful references Using OpenMP: Portable Shared Memory Parallel Programming, Barbara Chapman, Gabriele Jost and Ruud van der Pas OpenMP.org http://openmp.org/

More information

Lecture 4: OpenMP Open Multi-Processing

Lecture 4: OpenMP Open Multi-Processing CS 4230: Parallel Programming Lecture 4: OpenMP Open Multi-Processing January 23, 2017 01/23/2017 CS4230 1 Outline OpenMP another approach for thread parallel programming Fork-Join execution model OpenMP

More information

OpenMP. António Abreu. Instituto Politécnico de Setúbal. 1 de Março de 2013

OpenMP. António Abreu. Instituto Politécnico de Setúbal. 1 de Março de 2013 OpenMP António Abreu Instituto Politécnico de Setúbal 1 de Março de 2013 António Abreu (Instituto Politécnico de Setúbal) OpenMP 1 de Março de 2013 1 / 37 openmp what? It s an Application Program Interface

More information

Parallel and Distributed Computing

Parallel and Distributed Computing Concurrent Programming with OpenMP Rodrigo Miragaia Rodrigues MSc in Information Systems and Computer Engineering DEA in Computational Engineering CS Department (DEI) Instituto Superior Técnico October

More information

Shared Memory Programming: Threads and OpenMP. Lecture 6

Shared Memory Programming: Threads and OpenMP. Lecture 6 Shared Memory Programming: Threads and OpenMP Lecture 6 James Demmel www.cs.berkeley.edu/~demmel/cs267_spr16/ CS267 Lecture 6 1 Outline Parallel Programming with Threads Parallel Programming with OpenMP

More information

Parallel Computing Parallel Programming Languages Hwansoo Han

Parallel Computing Parallel Programming Languages Hwansoo Han Parallel Computing Parallel Programming Languages Hwansoo Han Parallel Programming Practice Current Start with a parallel algorithm Implement, keeping in mind Data races Synchronization Threading syntax

More information

Introduction to. Slides prepared by : Farzana Rahman 1

Introduction to. Slides prepared by : Farzana Rahman 1 Introduction to OpenMP Slides prepared by : Farzana Rahman 1 Definition of OpenMP Application Program Interface (API) for Shared Memory Parallel Programming Directive based approach with library support

More information

CMSC 714 Lecture 4 OpenMP and UPC. Chau-Wen Tseng (from A. Sussman)

CMSC 714 Lecture 4 OpenMP and UPC. Chau-Wen Tseng (from A. Sussman) CMSC 714 Lecture 4 OpenMP and UPC Chau-Wen Tseng (from A. Sussman) Programming Model Overview Message passing (MPI, PVM) Separate address spaces Explicit messages to access shared data Send / receive (MPI

More information

Multi-core Architecture and Programming

Multi-core Architecture and Programming Multi-core Architecture and Programming Yang Quansheng( 杨全胜 ) http://www.njyangqs.com School of Computer Science & Engineering 1 http://www.njyangqs.com Programming with OpenMP Content What is PpenMP Parallel

More information

Allows program to be incrementally parallelized

Allows program to be incrementally parallelized Basic OpenMP What is OpenMP An open standard for shared memory programming in C/C+ + and Fortran supported by Intel, Gnu, Microsoft, Apple, IBM, HP and others Compiler directives and library support OpenMP

More information

MCSE Training Guide: Windows Architecture and Memory

MCSE Training Guide: Windows Architecture and Memory MCSE Training Guide: Windows 95 -- Ch 2 -- Architecture and Memory Page 1 of 13 MCSE Training Guide: Windows 95-2 - Architecture and Memory This chapter wi hep you prepare for the exam by covering the

More information

Introduction to OpenMP

Introduction to OpenMP Introduction to OpenMP Ekpe Okorafor School of Parallel Programming & Parallel Architecture for HPC ICTP October, 2014 A little about me! PhD Computer Engineering Texas A&M University Computer Science

More information

Introduction to OpenMP

Introduction to OpenMP Introduction to OpenMP Ricardo Fonseca https://sites.google.com/view/rafonseca2017/ Outline Shared Memory Programming OpenMP Fork-Join Model Compiler Directives / Run time library routines Compiling and

More information

Session 4: Parallel Programming with OpenMP

Session 4: Parallel Programming with OpenMP Session 4: Parallel Programming with OpenMP Xavier Martorell Barcelona Supercomputing Center Agenda Agenda 10:00-11:00 OpenMP fundamentals, parallel regions 11:00-11:30 Worksharing constructs 11:30-12:00

More information

Module 10: Open Multi-Processing Lecture 19: What is Parallelization? The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program

Module 10: Open Multi-Processing Lecture 19: What is Parallelization? The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program Amdahl's Law About Data What is Data Race? Overview to OpenMP Components of OpenMP OpenMP Programming Model OpenMP Directives

More information

Advanced C Programming Winter Term 2008/09. Guest Lecture by Markus Thiele

Advanced C Programming Winter Term 2008/09. Guest Lecture by Markus Thiele Advanced C Programming Winter Term 2008/09 Guest Lecture by Markus Thiele Lecture 14: Parallel Programming with OpenMP Motivation: Why parallelize? The free lunch is over. Herb

More information

HPC Practical Course Part 3.1 Open Multi-Processing (OpenMP)

HPC Practical Course Part 3.1 Open Multi-Processing (OpenMP) HPC Practical Course Part 3.1 Open Multi-Processing (OpenMP) V. Akishina, I. Kisel, G. Kozlov, I. Kulakov, M. Pugach, M. Zyzak Goethe University of Frankfurt am Main 2015 Task Parallelism Parallelization

More information

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Synchronization: Semaphore

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Synchronization: Semaphore CSE120 Principes of Operating Systems Prof Yuanyuan (YY) Zhou Synchronization: Synchronization Needs Two synchronization needs Mutua excusion Whenever mutipe threads access a shared data, you need to worry

More information

DPHPC: Introduction to OpenMP Recitation session

DPHPC: Introduction to OpenMP Recitation session SALVATORE DI GIROLAMO DPHPC: Introduction to OpenMP Recitation session Based on http://openmp.org/mp-documents/intro_to_openmp_mattson.pdf OpenMP An Introduction What is it? A set of compiler directives

More information

Parallel programming using OpenMP

Parallel programming using OpenMP Parallel programming using OpenMP Computer Architecture J. Daniel García Sánchez (coordinator) David Expósito Singh Francisco Javier García Blas ARCOS Group Computer Science and Engineering Department

More information

OpenMP 2. CSCI 4850/5850 High-Performance Computing Spring 2018

OpenMP 2. CSCI 4850/5850 High-Performance Computing Spring 2018 OpenMP 2 CSCI 4850/5850 High-Performance Computing Spring 2018 Tae-Hyuk (Ted) Ahn Department of Computer Science Program of Bioinformatics and Computational Biology Saint Louis University Learning Objectives

More information

COMP4300/8300: The OpenMP Programming Model. Alistair Rendell. Specifications maintained by OpenMP Architecture Review Board (ARB)

COMP4300/8300: The OpenMP Programming Model. Alistair Rendell. Specifications maintained by OpenMP Architecture Review Board (ARB) COMP4300/8300: The OpenMP Programming Model Alistair Rendell See: www.openmp.org Introduction to High Performance Computing for Scientists and Engineers, Hager and Wellein, Chapter 6 & 7 High Performance

More information

COMP4300/8300: The OpenMP Programming Model. Alistair Rendell

COMP4300/8300: The OpenMP Programming Model. Alistair Rendell COMP4300/8300: The OpenMP Programming Model Alistair Rendell See: www.openmp.org Introduction to High Performance Computing for Scientists and Engineers, Hager and Wellein, Chapter 6 & 7 High Performance

More information

Programming Shared Address Space Platforms using OpenMP

Programming Shared Address Space Platforms using OpenMP Programming Shared Address Space Platforms using OpenMP Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Topic Overview Introduction to OpenMP OpenMP

More information

Parallel Programming in C with MPI and OpenMP

Parallel Programming in C with MPI and OpenMP Parallel Programming in C with MPI and OpenMP Michael J. Quinn Chapter 17 Shared-memory Programming 1 Outline n OpenMP n Shared-memory model n Parallel for loops n Declaring private variables n Critical

More information

Parallel and Distributed Programming. OpenMP

Parallel and Distributed Programming. OpenMP Parallel and Distributed Programming OpenMP OpenMP Portability of software SPMD model Detailed versions (bindings) for different programming languages Components: directives for compiler library functions

More information

Mango DSP Top manufacturer of multiprocessing video & imaging solutions.

Mango DSP Top manufacturer of multiprocessing video & imaging solutions. 1 of 11 3/3/2005 10:50 AM Linux Magazine February 2004 C++ Parallel Increase application performance without changing your source code. Mango DSP Top manufacturer of multiprocessing video & imaging solutions.

More information

https://www.youtube.com/playlist?list=pllx- Q6B8xqZ8n8bwjGdzBJ25X2utwnoEG

https://www.youtube.com/playlist?list=pllx- Q6B8xqZ8n8bwjGdzBJ25X2utwnoEG https://www.youtube.com/playlist?list=pllx- Q6B8xqZ8n8bwjGdzBJ25X2utwnoEG OpenMP Basic Defs: Solution Stack HW System layer Prog. User layer Layer Directives, Compiler End User Application OpenMP library

More information

Parallel Programming. OpenMP Parallel programming for multiprocessors for loops

Parallel Programming. OpenMP Parallel programming for multiprocessors for loops Parallel Programming OpenMP Parallel programming for multiprocessors for loops OpenMP OpenMP An application programming interface (API) for parallel programming on multiprocessors Assumes shared memory

More information

Parallel Programming in C with MPI and OpenMP

Parallel Programming in C with MPI and OpenMP Parallel Programming in C with MPI and OpenMP Michael J. Quinn Chapter 17 Shared-memory Programming 1 Outline n OpenMP n Shared-memory model n Parallel for loops n Declaring private variables n Critical

More information

Shared Memory Programming Model

Shared Memory Programming Model Shared Memory Programming Model Ahmed El-Mahdy and Waleed Lotfy What is a shared memory system? Activity! Consider the board as a shared memory Consider a sheet of paper in front of you as a local cache

More information

Introduction to OpenMP. Motivation

Introduction to OpenMP.  Motivation Introduction to OpenMP www.openmp.org Motivation Parallel machines are abundant Servers are 2-8 way SMPs and more Upcoming processors are multicore parallel programming is beneficial and actually necessary

More information

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program? Intro to Programming & C++ Unit 1 Sections 1.1-3 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Spring 2018 Ji Seaman 1.1 Why Program? Computer programmabe machine designed to foow instructions Program a set of

More information

OpenMP Tutorial. Seung-Jai Min. School of Electrical and Computer Engineering Purdue University, West Lafayette, IN

OpenMP Tutorial. Seung-Jai Min. School of Electrical and Computer Engineering Purdue University, West Lafayette, IN OpenMP Tutorial Seung-Jai Min (smin@purdue.edu) School of Electrical and Computer Engineering Purdue University, West Lafayette, IN 1 Parallel Programming Standards Thread Libraries - Win32 API / Posix

More information

Outline. Parallel Numerical Algorithms. Forward Substitution. Triangular Matrices. Solving Triangular Systems. Back Substitution. Parallel Algorithm

Outline. Parallel Numerical Algorithms. Forward Substitution. Triangular Matrices. Solving Triangular Systems. Back Substitution. Parallel Algorithm Outine Parae Numerica Agorithms Chapter 8 Prof. Michae T. Heath Department of Computer Science University of Iinois at Urbana-Champaign CS 554 / CSE 512 1 2 3 4 Trianguar Matrices Michae T. Heath Parae

More information

OpenMP: Open Multiprocessing

OpenMP: Open Multiprocessing OpenMP: Open Multiprocessing Erik Schnetter June 7, 2012, IHPC 2012, Iowa City Outline 1. Basic concepts, hardware architectures 2. OpenMP Programming 3. How to parallelise an existing code 4. Advanced

More information

1 of 6 Lecture 7: March 4. CISC 879 Software Support for Multicore Architectures Spring Lecture 7: March 4, 2008

1 of 6 Lecture 7: March 4. CISC 879 Software Support for Multicore Architectures Spring Lecture 7: March 4, 2008 1 of 6 Lecture 7: March 4 CISC 879 Software Support for Multicore Architectures Spring 2008 Lecture 7: March 4, 2008 Lecturer: Lori Pollock Scribe: Navreet Virk Open MP Programming Topics covered 1. Introduction

More information

Parallel Computing. Lecture 13: OpenMP - I

Parallel Computing. Lecture 13: OpenMP - I CSCI-UA.0480-003 Parallel Computing Lecture 13: OpenMP - I Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Small and Easy Motivation #include #include int main() {

More information

OpenMP. OpenMP. Portable programming of shared memory systems. It is a quasi-standard. OpenMP-Forum API for Fortran and C/C++

OpenMP. OpenMP. Portable programming of shared memory systems. It is a quasi-standard. OpenMP-Forum API for Fortran and C/C++ OpenMP OpenMP Portable programming of shared memory systems. It is a quasi-standard. OpenMP-Forum 1997-2002 API for Fortran and C/C++ directives runtime routines environment variables www.openmp.org 1

More information

Distributed Systems + Middleware Concurrent Programming with OpenMP

Distributed Systems + Middleware Concurrent Programming with OpenMP Distributed Systems + Middleware Concurrent Programming with OpenMP Gianpaolo Cugola Dipartimento di Elettronica e Informazione Politecnico, Italy cugola@elet.polimi.it http://home.dei.polimi.it/cugola

More information

15-418, Spring 2008 OpenMP: A Short Introduction

15-418, Spring 2008 OpenMP: A Short Introduction 15-418, Spring 2008 OpenMP: A Short Introduction This is a short introduction to OpenMP, an API (Application Program Interface) that supports multithreaded, shared address space (aka shared memory) parallelism.

More information

Concurrent programming: From theory to practice. Concurrent Algorithms 2016 Tudor David

Concurrent programming: From theory to practice. Concurrent Algorithms 2016 Tudor David oncurrent programming: From theory to practice oncurrent Agorithms 2016 Tudor David From theory to practice Theoretica (design) Practica (design) Practica (impementation) 2 From theory to practice Theoretica

More information

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components Illustrated

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components Illustrated Intro to Programming & C++ Unit 1 Sections 1.1-3 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Fa 2017 Ji Seaman 1.1 Why Program? Computer programmabe machine designed to foow instructions Program instructions

More information

CS4961 Parallel Programming. Lecture 5: More OpenMP, Introduction to Data Parallel Algorithms 9/5/12. Administrative. Mary Hall September 4, 2012

CS4961 Parallel Programming. Lecture 5: More OpenMP, Introduction to Data Parallel Algorithms 9/5/12. Administrative. Mary Hall September 4, 2012 CS4961 Parallel Programming Lecture 5: More OpenMP, Introduction to Data Parallel Algorithms Administrative Mailing list set up, everyone should be on it - You should have received a test mail last night

More information

by system default usually a thread per CPU or core using the environment variable OMP_NUM_THREADS from within the program by using function call

by system default usually a thread per CPU or core using the environment variable OMP_NUM_THREADS from within the program by using function call OpenMP Syntax The OpenMP Programming Model Number of threads are determined by system default usually a thread per CPU or core using the environment variable OMP_NUM_THREADS from within the program by

More information

CS 5220: Shared memory programming. David Bindel

CS 5220: Shared memory programming. David Bindel CS 5220: Shared memory programming David Bindel 2017-09-26 1 Message passing pain Common message passing pattern Logical global structure Local representation per processor Local data may have redundancy

More information

CS4961 Parallel Programming. Lecture 9: Task Parallelism in OpenMP 9/22/09. Administrative. Mary Hall September 22, 2009.

CS4961 Parallel Programming. Lecture 9: Task Parallelism in OpenMP 9/22/09. Administrative. Mary Hall September 22, 2009. Parallel Programming Lecture 9: Task Parallelism in OpenMP Administrative Programming assignment 1 is posted (after class) Due, Tuesday, September 22 before class - Use the handin program on the CADE machines

More information

Parallel Programming in C with MPI and OpenMP

Parallel Programming in C with MPI and OpenMP Parallel Programming in C with MPI and OpenMP Michael J. Quinn Chapter 17 Shared-memory Programming Outline OpenMP Shared-memory model Parallel for loops Declaring private variables Critical sections Reductions

More information

CS 470 Spring Mike Lam, Professor. OpenMP

CS 470 Spring Mike Lam, Professor. OpenMP CS 470 Spring 2018 Mike Lam, Professor OpenMP OpenMP Programming language extension Compiler support required "Open Multi-Processing" (open standard; latest version is 4.5) Automatic thread-level parallelism

More information

A METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS. A. C. Finch, K. J. Mackenzie, G. J. Balsdon, G. Symonds

A METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS. A. C. Finch, K. J. Mackenzie, G. J. Balsdon, G. Symonds A METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS A C Finch K J Mackenzie G J Basdon G Symonds Raca-Redac Ltd Newtown Tewkesbury Gos Engand ABSTRACT The introduction of fine-ine technoogies to printed

More information

DPHPC: Introduction to OpenMP Recitation session

DPHPC: Introduction to OpenMP Recitation session SALVATORE DI GIROLAMO DPHPC: Introduction to OpenMP Recitation session Based on http://openmp.org/mp-documents/intro_to_openmp_mattson.pdf OpenMP An Introduction What is it? A set

More information

OpenMP. A parallel language standard that support both data and functional Parallelism on a shared memory system

OpenMP. A parallel language standard that support both data and functional Parallelism on a shared memory system OpenMP A parallel language standard that support both data and functional Parallelism on a shared memory system Use by system programmers more than application programmers Considered a low level primitives

More information

OpenMP Overview. in 30 Minutes. Christian Terboven / Aachen, Germany Stand: Version 2.

OpenMP Overview. in 30 Minutes. Christian Terboven / Aachen, Germany Stand: Version 2. OpenMP Overview in 30 Minutes Christian Terboven 06.12.2010 / Aachen, Germany Stand: 03.12.2010 Version 2.3 Rechen- und Kommunikationszentrum (RZ) Agenda OpenMP: Parallel Regions,

More information

CS 470 Spring Mike Lam, Professor. OpenMP

CS 470 Spring Mike Lam, Professor. OpenMP CS 470 Spring 2017 Mike Lam, Professor OpenMP OpenMP Programming language extension Compiler support required "Open Multi-Processing" (open standard; latest version is 4.5) Automatic thread-level parallelism

More information

Introduction to OpenMP

Introduction to OpenMP Introduction to OpenMP Le Yan Scientific computing consultant User services group High Performance Computing @ LSU Goals Acquaint users with the concept of shared memory parallelism Acquaint users with

More information

Data Handling in OpenMP

Data Handling in OpenMP Data Handling in OpenMP Manipulate data by threads By private: a thread initializes and uses a variable alone Keep local copies, such as loop indices By firstprivate: a thread repeatedly reads a variable

More information

Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-4,6

Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-4,6 Arrays Unit 5 Gaddis: 7.1-4,6 CS 1428 Fa 2017 Ji Seaman Array Data Type Array: a variabe that contains mutipe vaues of the same type. Vaues are stored consecutivey in memory. An array variabe definition

More information

Overview: The OpenMP Programming Model

Overview: The OpenMP Programming Model Overview: The OpenMP Programming Model motivation and overview the parallel directive: clauses, equivalent pthread code, examples the for directive and scheduling of loop iterations Pi example in OpenMP

More information

Shared Memory Programming Paradigm!

Shared Memory Programming Paradigm! Shared Memory Programming Paradigm! Ivan Girotto igirotto@ictp.it Information & Communication Technology Section (ICTS) International Centre for Theoretical Physics (ICTP) 1 Multi-CPUs & Multi-cores NUMA

More information

OpenMP 4. CSCI 4850/5850 High-Performance Computing Spring 2018

OpenMP 4. CSCI 4850/5850 High-Performance Computing Spring 2018 OpenMP 4 CSCI 4850/5850 High-Performance Computing Spring 2018 Tae-Hyuk (Ted) Ahn Department of Computer Science Program of Bioinformatics and Computational Biology Saint Louis University Learning Objectives

More information

OpenMP: Open Multiprocessing

OpenMP: Open Multiprocessing OpenMP: Open Multiprocessing Erik Schnetter May 20-22, 2013, IHPC 2013, Iowa City 2,500 BC: Military Invents Parallelism Outline 1. Basic concepts, hardware architectures 2. OpenMP Programming 3. How to

More information

OpenMP on Ranger and Stampede (with Labs)

OpenMP on Ranger and Stampede (with Labs) OpenMP on Ranger and Stampede (with Labs) Steve Lantz Senior Research Associate Cornell CAC Parallel Computing at TACC: Ranger to Stampede Transition November 6, 2012 Based on materials developed by Kent

More information

Parallel Programming. Exploring local computational resources OpenMP Parallel programming for multiprocessors for loops

Parallel Programming. Exploring local computational resources OpenMP Parallel programming for multiprocessors for loops Parallel Programming Exploring local computational resources OpenMP Parallel programming for multiprocessors for loops Single computers nowadays Several CPUs (cores) 4 to 8 cores on a single chip Hyper-threading

More information

Professor: Alvin Chao

Professor: Alvin Chao Professor: Avin Chao Anatomy of a Java Program: Comments Javadoc comments: /** * Appication that converts inches to centimeters. * * @author Chris Mayfied * @version 01/21/2014 */ Everything between /**

More information

EE/CSCI 451 Introduction to Parallel and Distributed Computation. Discussion #4 2/3/2017 University of Southern California

EE/CSCI 451 Introduction to Parallel and Distributed Computation. Discussion #4 2/3/2017 University of Southern California EE/CSCI 451 Introduction to Parallel and Distributed Computation Discussion #4 2/3/2017 University of Southern California 1 USC HPCC Access Compile Submit job OpenMP Today s topic What is OpenMP OpenMP

More information

Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-3,5

Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-3,5 Arrays Unit 5 Gaddis: 7.1-3,5 CS 1428 Spring 2018 Ji Seaman Array Data Type Array: a variabe that contains mutipe vaues of the same type. Vaues are stored consecutivey in memory. An array variabe decaration

More information

UvA-SARA High Performance Computing Course June Clemens Grelck, University of Amsterdam. Parallel Programming with Compiler Directives: OpenMP

UvA-SARA High Performance Computing Course June Clemens Grelck, University of Amsterdam. Parallel Programming with Compiler Directives: OpenMP Parallel Programming with Compiler Directives OpenMP Clemens Grelck University of Amsterdam UvA-SARA High Performance Computing Course June 2013 OpenMP at a Glance Loop Parallelization Scheduling Parallel

More information

Programming Shared-memory Platforms with OpenMP. Xu Liu

Programming Shared-memory Platforms with OpenMP. Xu Liu Programming Shared-memory Platforms with OpenMP Xu Liu Introduction to OpenMP OpenMP directives concurrency directives parallel regions loops, sections, tasks Topics for Today synchronization directives

More information

OpenMP Fundamentals Fork-join model and data environment

OpenMP Fundamentals Fork-join model and data environment www.bsc.es OpenMP Fundamentals Fork-join model and data environment Xavier Teruel and Xavier Martorell Agenda: OpenMP Fundamentals OpenMP brief introduction The fork-join model Data environment OpenMP

More information

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling CSE120 Principes of Operating Systems Prof Yuanyuan (YY) Zhou Scheduing Announcement Homework 2 due on October 25th Project 1 due on October 26th 2 CSE 120 Scheduing and Deadock Scheduing Overview In discussing

More information

OpenMP threading: parallel regions. Paolo Burgio

OpenMP threading: parallel regions. Paolo Burgio OpenMP threading: parallel regions Paolo Burgio paolo.burgio@unimore.it Outline Expressing parallelism Understanding parallel threads Memory Data management Data clauses Synchronization Barriers, locks,

More information

Programming Shared Memory Systems with OpenMP Part I. Book

Programming Shared Memory Systems with OpenMP Part I. Book Programming Shared Memory Systems with OpenMP Part I Instructor Dr. Taufer Book Parallel Programming in OpenMP by Rohit Chandra, Leo Dagum, Dave Kohr, Dror Maydan, Jeff McDonald, Ramesh Menon 2 1 Machine

More information

HPC Workshop University of Kentucky May 9, 2007 May 10, 2007

HPC Workshop University of Kentucky May 9, 2007 May 10, 2007 HPC Workshop University of Kentucky May 9, 2007 May 10, 2007 Part 3 Parallel Programming Parallel Programming Concepts Amdahl s Law Parallel Programming Models Tools Compiler (Intel) Math Libraries (Intel)

More information

Load Balancing by MPLS in Differentiated Services Networks

Load Balancing by MPLS in Differentiated Services Networks Load Baancing by MPLS in Differentiated Services Networks Riikka Susitaiva, Jorma Virtamo, and Samui Aato Networking Laboratory, Hesinki University of Technoogy P.O.Box 3000, FIN-02015 HUT, Finand {riikka.susitaiva,

More information

OpenMP Programming. Prof. Thomas Sterling. High Performance Computing: Concepts, Methods & Means

OpenMP Programming. Prof. Thomas Sterling. High Performance Computing: Concepts, Methods & Means High Performance Computing: Concepts, Methods & Means OpenMP Programming Prof. Thomas Sterling Department of Computer Science Louisiana State University February 8 th, 2007 Topics Introduction Overview

More information

HPCSE - I. «OpenMP Programming Model - Part I» Panos Hadjidoukas

HPCSE - I. «OpenMP Programming Model - Part I» Panos Hadjidoukas HPCSE - I «OpenMP Programming Model - Part I» Panos Hadjidoukas 1 Schedule and Goals 13.10.2017: OpenMP - part 1 study the basic features of OpenMP able to understand and write OpenMP programs 20.10.2017:

More information

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Midterm Review

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Midterm Review CSE120 Principes of Operating Systems Prof Yuanyuan (YY) Zhou Midterm Review Overview The midterm Architectura support for OSes OS modues, interfaces, and structures Processes Threads Synchronization Scheduing

More information

Parallel Programming using OpenMP

Parallel Programming using OpenMP 1 OpenMP Multithreaded Programming 2 Parallel Programming using OpenMP OpenMP stands for Open Multi-Processing OpenMP is a multi-vendor (see next page) standard to perform shared-memory multithreading

More information

OpenMP examples. Sergeev Efim. Singularis Lab, Ltd. Senior software engineer

OpenMP examples. Sergeev Efim. Singularis Lab, Ltd. Senior software engineer OpenMP examples Sergeev Efim Senior software engineer Singularis Lab, Ltd. OpenMP Is: An Application Program Interface (API) that may be used to explicitly direct multi-threaded, shared memory parallelism.

More information

Parallel Programming using OpenMP

Parallel Programming using OpenMP 1 Parallel Programming using OpenMP Mike Bailey mjb@cs.oregonstate.edu openmp.pptx OpenMP Multithreaded Programming 2 OpenMP stands for Open Multi-Processing OpenMP is a multi-vendor (see next page) standard

More information

Introduction to OpenMP. OpenMP basics OpenMP directives, clauses, and library routines

Introduction to OpenMP. OpenMP basics OpenMP directives, clauses, and library routines Introduction to OpenMP Introduction OpenMP basics OpenMP directives, clauses, and library routines What is OpenMP? What does OpenMP stands for? What does OpenMP stands for? Open specifications for Multi

More information

Tutorial 3 Concepts for A1

Tutorial 3 Concepts for A1 CPSC 231 Introduction to Computer Science for Computer Science Majors I Tutoria 3 Concepts for A1 DANNY FISHER dgfisher@ucagary.ca September 23, 2014 Agenda script command more detais Submitting using

More information

Alfio Lazzaro: Introduction to OpenMP

Alfio Lazzaro: Introduction to OpenMP First INFN International School on Architectures, tools and methodologies for developing efficient large scale scientific computing applications Ce.U.B. Bertinoro Italy, 12 17 October 2009 Alfio Lazzaro:

More information

CS 470 Spring Mike Lam, Professor. Advanced OpenMP

CS 470 Spring Mike Lam, Professor. Advanced OpenMP CS 470 Spring 2018 Mike Lam, Professor Advanced OpenMP Atomics OpenMP provides access to highly-efficient hardware synchronization mechanisms Use the atomic pragma to annotate a single statement Statement

More information

OpenMP programming. Thomas Hauser Director Research Computing Research CU-Boulder

OpenMP programming. Thomas Hauser Director Research Computing Research CU-Boulder OpenMP programming Thomas Hauser Director Research Computing thomas.hauser@colorado.edu CU meetup 1 Outline OpenMP Shared-memory model Parallel for loops Declaring private variables Critical sections Reductions

More information

Programming with OpenMP*

Programming with OpenMP* Objectives At the completion of this module you will be able to Thread serial code with basic OpenMP pragmas Use OpenMP synchronization pragmas to coordinate thread execution and memory access 2 Agenda

More information

A Memory Grouping Method for Sharing Memory BIST Logic

A Memory Grouping Method for Sharing Memory BIST Logic A Memory Grouping Method for Sharing Memory BIST Logic Masahide Miyazai, Tomoazu Yoneda, and Hideo Fuiwara Graduate Schoo of Information Science, Nara Institute of Science and Technoogy (NAIST), 8916-5

More information

ME759 High Performance Computing for Engineering Applications

ME759 High Performance Computing for Engineering Applications ME759 High Performance Computing for Engineering Applications Parallel Computing on Multicore CPUs October 25, 2013 Dan Negrut, 2013 ME964 UW-Madison A programming language is low level when its programs

More information