Getting the most out of your CPUs Parallel computing strategies in R

Size: px
Start display at page:

Download "Getting the most out of your CPUs Parallel computing strategies in R"

Transcription

1 Getting the most out of your CPUs Parallel computing strategies in R Stefan Theussl Department of Statistics and Mathematics Wirtschaftsuniversität Wien July 2, 2008

2 Outline Introduction Parallel Computing Strategies in R HPC WU Benchmarks Parallel Monte Carlo Simulation Conclusions

3 Introduction

4 Why Parallel Computing? Multi core CPUs already available for commodity PCs Demand for computing power steadily increases In statistical analysis data volumes are becoming larger Statistical techniques are becoming more computer intensive

5 Why Parallel Computing? Software for parallel computing is already available R, a language for statistical computing and graphics already offers extensions to use this software High performance computers available for a reasonable price Parallel programming models are getting easier to use

6 Parallel Execution of Tasks Table: Interleaved Concurrency Cycle Process Process 1 X X X Process 2 X X X Process 3 X X X Table: Parallelism Cycle Process Process 1 X X X X X X Process 2 X X X X X X X Process 3 X X X X X

7 Computer Architecture Shared memory platforms (SMPs) Many-core desktop computers or laptops High performance computing servers with lots of RAM Distributed memory platforms (DMPs) Beowulf clusters The grid

8 Shared Memory Platforms Multiple processors share one global memory Connected to global memory mostly via bus technology Communication via shared variables SMPs are now commonplace because of multi core CPUs Limited number of processors (up to 64 in one machine)

9 Shared Memory Platforms

10 Shared Memory Platforms

11 Shared Memory Platforms

12 Distributed Memory Platforms Provide access to cheap computational power Can easily scale up to several hundreds or thousands of processors Communication between the nodes is achieved through common network technology Typically we use message passing libraries like MPI or PVM

13 Distributed Memory Platforms

14 General Strategies R is capable to call routines implemented in C or FORTRAN, so we can achieve Implicit parallelism via parallelizing compilers Depends on a corresponding compiler Bad performance as they are in its infancy Explicit parallelism with implicit decomposition e.g., OpenMP Parallelism easy to achieve using compiler directives Incrementally parallelizing sequential code possible Depends on a corresponding compiler Explicit parallelism e.g., with message passing libraries Interfaces available in R Development of parallel programs is difficult Deliver good performance

15 Parallel Computing Strategies in R

16 Example: Matrix Multiplication We want to parallelize r C = AB c ij = a ik b kj k=1

17 Matrix Multiplication Algorithm Require: A R m r and B R r n. Ensure: C R m n 1: m nrow(a) 2: r ncol(a) 3: n nrow(b) 4: for i = 1 : m do 5: for j = 1 : n do 6: for k = 1 : r do 7: C(i, j) C(i, j) + A(i, k)b(k, j) 8: end for 9: end for 10: end for C code

18 Parallel Computing Strategies in R Threaded R with OpenMP on SMPs Parallel R using MPI on a cluster of workstations Parallel R using package snow

19 Parallel Computing Strategies in R A selection of R infrastructure packages for parallel computing: Rmpi 1 (version on CRAN) rpvm 2 (version on CRAN) snow 3 (version on CRAN) RScaLAPACK 4 (version on CRAN) parc 5 (under development on R-Forge) snow is used by 9, Rmpi by 7, and rpvm by 2 other CRAN packages 1 Hao Yu 2 Na Li and A.J. Rossini 3 Luke Tierney 4 Samatova et al 5 Stefan Theussl

20 Threaded R with OpenMP on SMPs

21 Threaded R with OpenMP on SMPs OpenMP Parallel Algorithm Require: A R m r and B R r n. Ensure: C R m n 1: m nrow(a) 2: r ncol(a) 3: n nrow(b) 4:!$omp parallel for shared(a, B, C, j, k) 5: for i = 1 : m do 6: for j = 1 : n do 7: for k = 1 : r do 8: C(i, j) C(i, j) + A(i, k)b(k, j) 9: end for 10: end for 11: end for C code

22 Parallel R Using MPI on a Cluster

23 Parallel R Using MPI on a Cluster A = A 1. A p A i is the ith block or sub matrix with dimensions m i by n of A where p i=1 m i = m. We say that A = A i is an m i by n block matrix. The workers calculate a block of matrix C C i = A i B The master combines the results to a single matrix.

24 Message Passing Algorithm Master Require: A R m r, B R r n and p. Ensure: C R m n 1: m nrow(a) 2: n worker m/p 3: n last m (p 1)n worker 4: decompose A to A i such that A 1...A p 1 R n worker r and A p R n last r 5: spawn p worker processes 6: for i = 1 : p do 7: send A i, B to process i; Start multiplication on process i 8: end for 9: for i = 1 : p do 10: receive local result C i from workers 11: end for 12: combine C i to C R code

25 Message Passing Algorithm Workers Require: A rank R n rank r, B R r n, p Ensure: C rank R n rank n 1: C rank A rank B 2: send local result C rank to master R code

26 Parallel R using package snow snow stands for simple network of workstations It is easy to create R worker processes library("snow") cl <- makecluster(10, type = "MPI") To carry out matrix multiplication in parallel simply use C <- parmm(cl, A, B) snow offers parallel versions of apply(), lapply(),...

27 HPC WU

28 bignode.q 4 nodes 2 Dual Core Intel XEON 2.33 GHz 16 GB RAM node.q 68 nodes 1 Intel Core 2 Duo 2.4 GHz 4 GB RAM This is a total of bit computation nodes and a total of 336 gigabytes of RAM.

29 Coming soon IBM System p core IBM 3.5 GHz 128 GB RAM This is a total of 8 64-bit computation nodes which have access to 128 gigabytes of shared memory.

30 Benchmarks

31 Results on an SMP Task: Matrix Multiplication execution time [s] normal MPI wb OpenMP PVM wb # of CPUs

32 Results on a DMP Task: Matrix Multiplication execution time [s] native BLAS MPI PVM snow MPI snow PVM # of CPUs

33 Parallel Monte Carlo Simulation

34 Pricing of Derivatives 1. Sample a random path for S in a risk neutral world 2. Calculate the expected payoff of the derivative 3. Repeat steps 1 and 2 to get many sample values of the payoff from the derivative in a risk neutral world. 4. Calculate the mean of the sample payoffs to get an estimate of the expected payoff in a risk neutral world 5. Discount the expected payoff at a risk free rate to get an estimate of the value of the derivative. Step 3 can be parallelized.

35 Conclusions OpenMP Parallelization of sequential (C or FORTRAN) code Performance is good on SMPs Message passing libraries MPI based code delivers better results in comparison to PVM (in combination with R) MPI routines have to be implemented by hand Routines of package snow are easy to handle Package Rmpi and snow allow interactive handling of R processes

36 Outlook and future work Implement high level R functions for existing parallel algorithms Finish package parc which will include OpenMP aware code Efficient parallel pseudo random number generation Interface to Google Map/Reduce

37 Thank you for your attention Further reading: Erricos Kontoghiorghes, editor. Handbook of Parallel Computing and Statistics. Chapman & Hall, Anthony Rossini, Luke Tierney, and Na Li. Simple Parallel Statistical Computing in R. UW Biostatistics Working Paper Series, (Working Paper 193), Stefan Theussl. Applied High Performance Computing Using R. Master s thesis, Wirtschaftsuniversität Wien, 2007.

38 Matrix Multiplication in C void Serial_matrix_mult( double *x, int *nrx, int *ncx, double *y, int *nry, int *ncy, double *z) { int i, j, k; double sum; } for(i = 0; i < *nrx; i++) for(j = 0; j < *ncy; j++){ sum = 0.0; for(k = 0; k < *ncx; k++) sum += x[i + k**nrx]*y[k + j**nry]; z[i + j**nrx] = sum; } Back

39 OpenMP: Algorithm void OMP_matrix_mult( double *x, int *nrx, int *ncx, double *y, int *nry, int *ncy, double *z) { int i, j, k; double tmp, sum; #pragma omp parallel for private(sum) \ shared(x, y, z, j, k, nrx, nry, ncy, ncx) for(i = 0; i < *nrx; i++) for(j = 0; j < *ncy; j++){ sum = 0.0; for(k = 0; k < *ncx; k++) sum += x[i + k**nrx]*y[k + j**nry]; z[i + j**nrx] = sum; } } Back

40 MPI: Algorithm, Master (1) mm_rmpi <- function(a, B, n_cpu = 1, spawnrworkers = FALSE) { da <- dim(a) ## dimensions of matrix A db <- dim(b) ## dimensions of matrix B ## Input validation matrix_mult_validate( A, B, da, db ) if( n_cpu == 1 ) return(a %*% B) ## spawn R workers? if( spawnrworkers ) mpi.spawn.rslaves( nslaves = n_cpu ) ## broadcast data and functions mpi.bcast.robj2slave( A ) mpi.bcast.robj2slave( B ) mpi.bcast.robj2slave( n_cpu ) Back

41 MPI: Algorithm, Master (2) ## how many rows on workers? nrows_on_workers <- ceiling( da[ 1 ] / n_cpu ) nrows_on_last <- da[ 1 ] - ( n_cpu - 1 ) * nrows_on_workers ## broadcast number of rows and foo to apply mpi.bcast.robj2slave( nrows_on_workers ) mpi.bcast.robj2slave( nrows_on_last ) mpi.bcast.robj2slave( mm_rmpi_worker ) ## start partial matrix multiplication on workers mpi.bcast.cmd( mm_rmpi_worker() ) ## gather partial results from workers (the master does not ## contribute to calculation) local_results <- NULL results <- mpi.gather.robj(local_results, root = 0, comm = 1) C <- NULL ## Rmpi returns a list if the vectors are of different length for(i in 1:n_cpu) C <- rbind(c, results[[ i + 1 ]]) if( spawnrworkers ) mpi.close.rslaves() C } Back

42 MPI: Algorithm, Workers mm_rmpi_worker <- function(){ commrank <- mpi.comm.rank() - 1 if(commrank == ( n_cpu - 1 )) local_results <- A[ (nrows_on_workers * commrank + 1): (nrows_on_workers * commrank + nrows_on_last), ] %*% B else local_results <- A[ (nrows_on_workers * commrank + 1): (nrows_on_workers * commrank + nrows_on_workers), ] %*% B mpi.gather.robj(local_results, root = 0, comm = 1) } Back

OpenMP and MPI. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico.

OpenMP and MPI. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico. OpenMP and MPI Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico November 15, 2010 José Monteiro (DEI / IST) Parallel and Distributed Computing

More information

State of the art in Parallel Computing with R

State of the art in Parallel Computing with R State of the art in Parallel Computing with R Markus Schmidberger (schmidb@ibe.med.uni muenchen.de) The R User Conference 2009 July 8 10, Agrocampus Ouest, Rennes, France The Future is Parallel Prof. Bill

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

OpenMP and MPI. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico.

OpenMP and MPI. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico. OpenMP and MPI Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico November 16, 2011 CPD (DEI / IST) Parallel and Distributed Computing 18

More information

Scientific Programming in C XIV. Parallel programming

Scientific Programming in C XIV. Parallel programming Scientific Programming in C XIV. Parallel programming Susi Lehtola 11 December 2012 Introduction The development of microchips will soon reach the fundamental physical limits of operation quantum coherence

More information

Parallel Programming. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Parallel Programming. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Parallel Programming Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Challenges Difficult to write parallel programs Most programmers think sequentially

More information

pr: AUTOMATIC PARALLELIZATION OF DATA- PARALLEL STATISTICAL COMPUTING CODES FOR R IN HYBRID MULTI-NODE AND MULTI-CORE ENVIRONMENTS

pr: AUTOMATIC PARALLELIZATION OF DATA- PARALLEL STATISTICAL COMPUTING CODES FOR R IN HYBRID MULTI-NODE AND MULTI-CORE ENVIRONMENTS pr: AUTOMATIC PARALLELIZATION OF DATA- PARALLEL STATISTICAL COMPUTING CODES FOR R IN HYBRID MULTI-NODE AND MULTI-CORE ENVIRONMENTS Paul Breimyer 1,2 Guruprasad Kora 2 William Hendrix 1,2 Neil Shah 1,2

More information

Acknowledgments. Amdahl s Law. Contents. Programming with MPI Parallel programming. 1 speedup = (1 P )+ P N. Type to enter text

Acknowledgments. Amdahl s Law. Contents. Programming with MPI Parallel programming. 1 speedup = (1 P )+ P N. Type to enter text Acknowledgments Programming with MPI Parallel ming Jan Thorbecke Type to enter text This course is partly based on the MPI courses developed by Rolf Rabenseifner at the High-Performance Computing-Center

More information

Parallel Computing with R and How to Use it on High Performance Computing Cluster

Parallel Computing with R and How to Use it on High Performance Computing Cluster UNIVERSITY OF TEXAS AT SAN ANTONIO Parallel Computing with R and How to Use it on High Performance Computing Cluster Liang Jing Nov. 2010 1 1 ABSTRACT Methodological advances have led to much more computationally

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

Introduction to MPI. EAS 520 High Performance Scientific Computing. University of Massachusetts Dartmouth. Spring 2014

Introduction to MPI. EAS 520 High Performance Scientific Computing. University of Massachusetts Dartmouth. Spring 2014 Introduction to MPI EAS 520 High Performance Scientific Computing University of Massachusetts Dartmouth Spring 2014 References This presentation is almost an exact copy of Dartmouth College's Introduction

More information

affypara: Parallelized preprocessing algorithms for high-density oligonucleotide array data

affypara: Parallelized preprocessing algorithms for high-density oligonucleotide array data affypara: Parallelized preprocessing algorithms for high-density oligonucleotide array data Markus Schmidberger Ulrich Mansmann IBE August 12-14, Technische Universität Dortmund, Germany Preprocessing

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

Parallel Programming. Libraries and Implementations

Parallel Programming. Libraries and Implementations Parallel Programming Libraries and Implementations Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_us

More information

Lecture 16: Recapitulations. Lecture 16: Recapitulations p. 1

Lecture 16: Recapitulations. Lecture 16: Recapitulations p. 1 Lecture 16: Recapitulations Lecture 16: Recapitulations p. 1 Parallel computing and programming in general Parallel computing a form of parallel processing by utilizing multiple computing units concurrently

More information

Parallel Programming Libraries and implementations

Parallel Programming Libraries and implementations Parallel Programming Libraries and implementations Partners Funding Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License.

More information

Parallel Computing Why & How?

Parallel Computing Why & How? Parallel Computing Why & How? Xing Cai Simula Research Laboratory Dept. of Informatics, University of Oslo Winter School on Parallel Computing Geilo January 20 25, 2008 Outline 1 Motivation 2 Parallel

More information

Map3D V58 - Multi-Processor Version

Map3D V58 - Multi-Processor Version Map3D V58 - Multi-Processor Version Announcing the multi-processor version of Map3D. How fast would you like to go? 2x, 4x, 6x? - it's now up to you. In order to achieve these performance gains it is necessary

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

Dense matrix algebra and libraries (and dealing with Fortran)

Dense matrix algebra and libraries (and dealing with Fortran) Dense matrix algebra and libraries (and dealing with Fortran) CPS343 Parallel and High Performance Computing Spring 2018 CPS343 (Parallel and HPC) Dense matrix algebra and libraries (and dealing with Fortran)

More information

Simple Parallel Statistical Computing in R

Simple Parallel Statistical Computing in R Simple Parallel Statistical Computing in R Luke Tierney Department of Statistics & Actuarial Science University of Iowa December 7, 2007 Luke Tierney (U. of Iowa) Simple Parallel Statistical Computing

More information

A Few Numerical Libraries for HPC

A Few Numerical Libraries for HPC A Few Numerical Libraries for HPC CPS343 Parallel and High Performance Computing Spring 2016 CPS343 (Parallel and HPC) A Few Numerical Libraries for HPC Spring 2016 1 / 37 Outline 1 HPC == numerical linear

More information

Shared Memory Parallel Programming. Shared Memory Systems Introduction to OpenMP

Shared Memory Parallel Programming. Shared Memory Systems Introduction to OpenMP Shared Memory Parallel Programming Shared Memory Systems Introduction to OpenMP Parallel Architectures Distributed Memory Machine (DMP) Shared Memory Machine (SMP) DMP Multicomputer Architecture SMP Multiprocessor

More information

Some possible directions for the R engine

Some possible directions for the R engine Some possible directions for the R engine Luke Tierney Department of Statistics & Actuarial Science University of Iowa July 22, 2010 Luke Tierney (U. of Iowa) Directions for the R engine July 22, 2010

More information

Our new HPC-Cluster An overview

Our new HPC-Cluster An overview Our new HPC-Cluster An overview Christian Hagen Universität Regensburg Regensburg, 15.05.2009 Outline 1 Layout 2 Hardware 3 Software 4 Getting an account 5 Compiling 6 Queueing system 7 Parallelization

More information

OpenMP * Past, Present and Future

OpenMP * Past, Present and Future OpenMP * Past, Present and Future Tim Mattson Intel Corporation Microprocessor Technology Labs timothy.g.mattson@intel.com * The name OpenMP is the property of the OpenMP Architecture Review Board. 1 OpenMP

More information

12:00 13:20, December 14 (Monday), 2009 # (even student id)

12:00 13:20, December 14 (Monday), 2009 # (even student id) Final Exam 12:00 13:20, December 14 (Monday), 2009 #330110 (odd student id) #330118 (even student id) Scope: Everything Closed-book exam Final exam scores will be posted in the lecture homepage 1 Parallel

More information

Introduction to OpenMP

Introduction to OpenMP Christian Terboven, Dirk Schmidl IT Center, RWTH Aachen University Member of the HPC Group terboven,schmidl@itc.rwth-aachen.de IT Center der RWTH Aachen University History De-facto standard for Shared-Memory

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

Runtime Address Space Computation for SDSM Systems

Runtime Address Space Computation for SDSM Systems Runtime Address Space Computation for SDSM Systems Jairo Balart Outline Introduction Inspector/executor model Implementation Evaluation Conclusions & future work 2 Outline Introduction Inspector/executor

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

Issues In Implementing The Primal-Dual Method for SDP. Brian Borchers Department of Mathematics New Mexico Tech Socorro, NM

Issues In Implementing The Primal-Dual Method for SDP. Brian Borchers Department of Mathematics New Mexico Tech Socorro, NM Issues In Implementing The Primal-Dual Method for SDP Brian Borchers Department of Mathematics New Mexico Tech Socorro, NM 87801 borchers@nmt.edu Outline 1. Cache and shared memory parallel computing concepts.

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

CPS343 Parallel and High Performance Computing Project 1 Spring 2018

CPS343 Parallel and High Performance Computing Project 1 Spring 2018 CPS343 Parallel and High Performance Computing Project 1 Spring 2018 Assignment Write a program using OpenMP to compute the estimate of the dominant eigenvalue of a matrix Due: Wednesday March 21 The program

More information

AMath 483/583 Lecture 11. Notes: Notes: Comments on Homework. Notes: AMath 483/583 Lecture 11

AMath 483/583 Lecture 11. Notes: Notes: Comments on Homework. Notes: AMath 483/583 Lecture 11 AMath 483/583 Lecture 11 Outline: Computer architecture Cache considerations Fortran optimization Reading: S. Goedecker and A. Hoisie, Performance Optimization of Numerically Intensive Codes, SIAM, 2001.

More information

AMath 483/583 Lecture 11

AMath 483/583 Lecture 11 AMath 483/583 Lecture 11 Outline: Computer architecture Cache considerations Fortran optimization Reading: S. Goedecker and A. Hoisie, Performance Optimization of Numerically Intensive Codes, SIAM, 2001.

More information

Some changes in snow and R

Some changes in snow and R Some changes in snow and R Luke Tierney Department of Statistics & Actuarial Science University of Iowa December 13, 2007 Luke Tierney (U. of Iowa) Some changes in snow and R December 13, 2007 1 / 22 Some

More information

Shared Memory programming paradigm: openmp

Shared Memory programming paradigm: openmp IPM School of Physics Workshop on High Performance Computing - HPC08 Shared Memory programming paradigm: openmp Luca Heltai Stefano Cozzini SISSA - Democritos/INFM

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

Parallel Programming and Optimization with GCC. Diego Novillo

Parallel Programming and Optimization with GCC. Diego Novillo Parallel Programming and Optimization with GCC Diego Novillo dnovillo@google.com Outline Parallelism models Architectural overview Parallelism features in GCC Optimizing large programs Whole program mode

More information

parallel Parallel R ANF R Vincent Miele CNRS 07/10/2015

parallel Parallel R ANF R Vincent Miele CNRS 07/10/2015 Parallel R ANF R Vincent Miele CNRS 07/10/2015 Thinking Plan Thinking Context Principles Traditional paradigms and languages Parallel R - the foundations embarrassingly computations in R the snow heritage

More information

Distributed Systems CS /640

Distributed Systems CS /640 Distributed Systems CS 15-440/640 Programming Models Borrowed and adapted from our good friends at CMU-Doha, Qatar Majd F. Sakr, Mohammad Hammoud andvinay Kolar 1 Objectives Discussion on Programming Models

More information

Parallel Computing. Hwansoo Han (SKKU)

Parallel Computing. Hwansoo Han (SKKU) Parallel Computing Hwansoo Han (SKKU) Unicore Limitations Performance scaling stopped due to Power consumption Wire delay DRAM latency Limitation in ILP 10000 SPEC CINT2000 2 cores/chip Xeon 3.0GHz Core2duo

More information

CMSC 714 Lecture 6 MPI vs. OpenMP and OpenACC. Guest Lecturer: Sukhyun Song (original slides by Alan Sussman)

CMSC 714 Lecture 6 MPI vs. OpenMP and OpenACC. Guest Lecturer: Sukhyun Song (original slides by Alan Sussman) CMSC 714 Lecture 6 MPI vs. OpenMP and OpenACC Guest Lecturer: Sukhyun Song (original slides by Alan Sussman) Parallel Programming with Message Passing and Directives 2 MPI + OpenMP Some applications can

More information

EE/CSCI 451: Parallel and Distributed Computation

EE/CSCI 451: Parallel and Distributed Computation EE/CSCI 451: Parallel and Distributed Computation Lecture #7 2/5/2017 Xuehai Qian Xuehai.qian@usc.edu http://alchem.usc.edu/portal/xuehaiq.html University of Southern California 1 Outline From last class

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

Lecture 13. Shared memory: Architecture and programming

Lecture 13. Shared memory: Architecture and programming Lecture 13 Shared memory: Architecture and programming Announcements Special guest lecture on Parallel Programming Language Uniform Parallel C Thursday 11/2, 2:00 to 3:20 PM EBU3B 1202 See www.cse.ucsd.edu/classes/fa06/cse260/lectures/lec13

More information

Parallelization, OpenMP

Parallelization, OpenMP ~ Parallelization, OpenMP Scientific Computing Winter 2016/2017 Lecture 26 Jürgen Fuhrmann juergen.fuhrmann@wias-berlin.de made wit pandoc 1 / 18 Why parallelization? Computers became faster and faster

More information

Parallel Architectures

Parallel Architectures Parallel Architectures CPS343 Parallel and High Performance Computing Spring 2018 CPS343 (Parallel and HPC) Parallel Architectures Spring 2018 1 / 36 Outline 1 Parallel Computer Classification Flynn s

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

MPI and OpenMP (Lecture 25, cs262a) Ion Stoica, UC Berkeley November 19, 2016

MPI and OpenMP (Lecture 25, cs262a) Ion Stoica, UC Berkeley November 19, 2016 MPI and OpenMP (Lecture 25, cs262a) Ion Stoica, UC Berkeley November 19, 2016 Message passing vs. Shared memory Client Client Client Client send(msg) recv(msg) send(msg) recv(msg) MSG MSG MSG IPC Shared

More information

JANUARY 2004 LINUX MAGAZINE Linux in Europe User Mode Linux PHP 5 Reflection Volume 6 / Issue 1 OPEN SOURCE. OPEN STANDARDS.

JANUARY 2004 LINUX MAGAZINE Linux in Europe User Mode Linux PHP 5 Reflection Volume 6 / Issue 1 OPEN SOURCE. OPEN STANDARDS. 0104 Cover (Curtis) 11/19/03 9:52 AM Page 1 JANUARY 2004 LINUX MAGAZINE Linux in Europe User Mode Linux PHP 5 Reflection Volume 6 / Issue 1 LINUX M A G A Z I N E OPEN SOURCE. OPEN STANDARDS. THE STATE

More information

Computer Architecture

Computer Architecture Jens Teubner Computer Architecture Summer 2016 1 Computer Architecture Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2016 Jens Teubner Computer Architecture Summer 2016 2 Part I Programming

More information

Parallel Programming Languages 1 - OpenMP

Parallel Programming Languages 1 - OpenMP some slides are from High-Performance Parallel Scientific Computing, 2008, Purdue University & CSCI-UA.0480-003: Parallel Computing, Spring 2015, New York University Parallel Programming Languages 1 -

More information

Multi-threaded Queries. Intra-Query Parallelism in LLVM

Multi-threaded Queries. Intra-Query Parallelism in LLVM Multi-threaded Queries Intra-Query Parallelism in LLVM Multithreaded Queries Intra-Query Parallelism in LLVM Yang Liu Tianqi Wu Hao Li Interpreted vs Compiled (LLVM) Interpreted vs Compiled (LLVM) Interpreted

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

A brief introduction to OpenMP

A brief introduction to OpenMP A brief introduction to OpenMP Alejandro Duran Barcelona Supercomputing Center Outline 1 Introduction 2 Writing OpenMP programs 3 Data-sharing attributes 4 Synchronization 5 Worksharings 6 Task parallelism

More information

General Purpose GPU Computing in Partial Wave Analysis

General Purpose GPU Computing in Partial Wave Analysis JLAB at 12 GeV - INT General Purpose GPU Computing in Partial Wave Analysis Hrayr Matevosyan - NTC, Indiana University November 18/2009 COmputationAL Challenges IN PWA Rapid Increase in Available Data

More information

HPC Parallel Programing Multi-node Computation with MPI - I

HPC Parallel Programing Multi-node Computation with MPI - I HPC Parallel Programing Multi-node Computation with MPI - I Parallelization and Optimization Group TATA Consultancy Services, Sahyadri Park Pune, India TCS all rights reserved April 29, 2013 Copyright

More information

Computing on GPUs. Prof. Dr. Uli Göhner. DYNAmore GmbH. Stuttgart, Germany

Computing on GPUs. Prof. Dr. Uli Göhner. DYNAmore GmbH. Stuttgart, Germany Computing on GPUs Prof. Dr. Uli Göhner DYNAmore GmbH Stuttgart, Germany Summary: The increasing power of GPUs has led to the intent to transfer computing load from CPUs to GPUs. A first example has been

More information

Parallel Programming. Marc Snir U. of Illinois at Urbana-Champaign & Argonne National Lab

Parallel Programming. Marc Snir U. of Illinois at Urbana-Champaign & Argonne National Lab Parallel Programming Marc Snir U. of Illinois at Urbana-Champaign & Argonne National Lab Summing n numbers for(i=1; i++; i

More information

Practical High Performance Computing

Practical High Performance Computing Practical High Performance Computing Donour Sizemore July 21, 2005 2005 ICE Purpose of This Talk Define High Performance computing Illustrate how to get started 2005 ICE 1 Preliminaries What is high performance

More information

HARNESSING IRREGULAR PARALLELISM: A CASE STUDY ON UNSTRUCTURED MESHES. Cliff Woolley, NVIDIA

HARNESSING IRREGULAR PARALLELISM: A CASE STUDY ON UNSTRUCTURED MESHES. Cliff Woolley, NVIDIA HARNESSING IRREGULAR PARALLELISM: A CASE STUDY ON UNSTRUCTURED MESHES Cliff Woolley, NVIDIA PREFACE This talk presents a case study of extracting parallelism in the UMT2013 benchmark for 3D unstructured-mesh

More information

Parallel Computing Ideas

Parallel Computing Ideas Parallel Computing Ideas K. 1 1 Department of Mathematics 2018 Why When to go for speed Historically: Production code Code takes a long time to run Code runs many times Code is not end in itself 2010:

More information

PROGRAMOVÁNÍ V C++ CVIČENÍ. Michal Brabec

PROGRAMOVÁNÍ V C++ CVIČENÍ. Michal Brabec PROGRAMOVÁNÍ V C++ CVIČENÍ Michal Brabec PARALLELISM CATEGORIES CPU? SSE Multiprocessor SIMT - GPU 2 / 17 PARALLELISM V C++ Weak support in the language itself, powerful libraries Many different parallelization

More information

Introduction to HPC and Optimization Tutorial VI

Introduction to HPC and Optimization Tutorial VI Felix Eckhofer Institut für numerische Mathematik und Optimierung Introduction to HPC and Optimization Tutorial VI January 8, 2013 TU Bergakademie Freiberg Going parallel HPC cluster in Freiberg 144 nodes,

More information

Parallel Computing Basics, Semantics

Parallel Computing Basics, Semantics 1 / 15 Parallel Computing Basics, Semantics Landau s 1st Rule of Education Rubin H Landau Sally Haerer, Producer-Director Based on A Survey of Computational Physics by Landau, Páez, & Bordeianu with Support

More information

Basic Communication Operations (Chapter 4)

Basic Communication Operations (Chapter 4) Basic Communication Operations (Chapter 4) Vivek Sarkar Department of Computer Science Rice University vsarkar@cs.rice.edu COMP 422 Lecture 17 13 March 2008 Review of Midterm Exam Outline MPI Example Program:

More information

Practical Introduction to Message-Passing Interface (MPI)

Practical Introduction to Message-Passing Interface (MPI) 1 Outline of the workshop 2 Practical Introduction to Message-Passing Interface (MPI) Bart Oldeman, Calcul Québec McGill HPC Bart.Oldeman@mcgill.ca Theoretical / practical introduction Parallelizing your

More information

CS 261 Fall Mike Lam, Professor. Threads

CS 261 Fall Mike Lam, Professor. Threads CS 261 Fall 2017 Mike Lam, Professor Threads Parallel computing Goal: concurrent or parallel computing Take advantage of multiple hardware units to solve multiple problems simultaneously Motivations: Maintain

More information

Package snow. R topics documented: February 20, 2015

Package snow. R topics documented: February 20, 2015 Package snow February 20, 2015 Title Simple Network of Workstations Version 0.3-13 Author Luke Tierney, A. J. Rossini, Na Li, H. Sevcikova Support for simple parallel computing in R. Maintainer Luke Tierney

More information

Topics. Introduction. Shared Memory Parallelization. Example. Lecture 11. OpenMP Execution Model Fork-Join model 5/15/2012. Introduction OpenMP

Topics. Introduction. Shared Memory Parallelization. Example. Lecture 11. OpenMP Execution Model Fork-Join model 5/15/2012. Introduction OpenMP Topics Lecture 11 Introduction OpenMP Some Examples Library functions Environment variables 1 2 Introduction Shared Memory Parallelization OpenMP is: a standard for parallel programming in C, C++, and

More information

OpenMP I. Diego Fabregat-Traver and Prof. Paolo Bientinesi WS16/17. HPAC, RWTH Aachen

OpenMP I. Diego Fabregat-Traver and Prof. Paolo Bientinesi WS16/17. HPAC, RWTH Aachen OpenMP I Diego Fabregat-Traver and Prof. Paolo Bientinesi HPAC, RWTH Aachen fabregat@aices.rwth-aachen.de WS16/17 OpenMP References Using OpenMP: Portable Shared Memory Parallel Programming. The MIT Press,

More information

HPC Architectures. Types of resource currently in use

HPC Architectures. Types of resource currently in use HPC Architectures Types of resource currently in use Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_us

More information

Parallel Paradigms & Programming Models. Lectured by: Pham Tran Vu Prepared by: Thoai Nam

Parallel Paradigms & Programming Models. Lectured by: Pham Tran Vu Prepared by: Thoai Nam Parallel Paradigms & Programming Models Lectured by: Pham Tran Vu Prepared by: Thoai Nam Outline Parallel programming paradigms Programmability issues Parallel programming models Implicit parallelism Explicit

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 processing with OpenMP. #pragma omp

Parallel processing with OpenMP. #pragma omp Parallel processing with OpenMP #pragma omp 1 Bit-level parallelism long words Instruction-level parallelism automatic SIMD: vector instructions vector types Multiple threads OpenMP GPU CUDA GPU + CPU

More information

Expressing Parallel Com putation

Expressing Parallel Com putation L1-1 Expressing Parallel Com putation Laboratory for Computer Science M.I.T. Lecture 1 Main St r eam Par allel Com put ing L1-2 Most server class machines these days are symmetric multiprocessors (SMP

More information

A Study of High Performance Computing and the Cray SV1 Supercomputer. Michael Sullivan TJHSST Class of 2004

A Study of High Performance Computing and the Cray SV1 Supercomputer. Michael Sullivan TJHSST Class of 2004 A Study of High Performance Computing and the Cray SV1 Supercomputer Michael Sullivan TJHSST Class of 2004 June 2004 0.1 Introduction A supercomputer is a device for turning compute-bound problems into

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

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

ECE 563 Spring 2012 First Exam

ECE 563 Spring 2012 First Exam ECE 563 Spring 2012 First Exam version 1 This is a take-home test. You must work, if found cheating you will be failed in the course and you will be turned in to the Dean of Students. To make it easy not

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

Communication and Optimization Aspects of Parallel Programming Models on Hybrid Architectures

Communication and Optimization Aspects of Parallel Programming Models on Hybrid Architectures Communication and Optimization Aspects of Parallel Programming Models on Hybrid Architectures Rolf Rabenseifner rabenseifner@hlrs.de Gerhard Wellein gerhard.wellein@rrze.uni-erlangen.de University of Stuttgart

More information

OpenMP 4.0/4.5: New Features and Protocols. Jemmy Hu

OpenMP 4.0/4.5: New Features and Protocols. Jemmy Hu OpenMP 4.0/4.5: New Features and Protocols Jemmy Hu SHARCNET HPC Consultant University of Waterloo May 10, 2017 General Interest Seminar Outline OpenMP overview Task constructs in OpenMP SIMP constructs

More information

Advanced Message-Passing Interface (MPI)

Advanced Message-Passing Interface (MPI) Outline of the workshop 2 Advanced Message-Passing Interface (MPI) Bart Oldeman, Calcul Québec McGill HPC Bart.Oldeman@mcgill.ca Morning: Advanced MPI Revision More on Collectives More on Point-to-Point

More information

Little Motivation Outline Introduction OpenMP Architecture Working with OpenMP Future of OpenMP End. OpenMP. Amasis Brauch German University in Cairo

Little Motivation Outline Introduction OpenMP Architecture Working with OpenMP Future of OpenMP End. OpenMP. Amasis Brauch German University in Cairo OpenMP Amasis Brauch German University in Cairo May 4, 2010 Simple Algorithm 1 void i n c r e m e n t e r ( short a r r a y ) 2 { 3 long i ; 4 5 for ( i = 0 ; i < 1000000; i ++) 6 { 7 a r r a y [ i ]++;

More information

COMP4510 Introduction to Parallel Computation. Shared Memory and OpenMP. Outline (cont d) Shared Memory and OpenMP

COMP4510 Introduction to Parallel Computation. Shared Memory and OpenMP. Outline (cont d) Shared Memory and OpenMP COMP4510 Introduction to Parallel Computation Shared Memory and OpenMP Thanks to Jon Aronsson (UofM HPC consultant) for some of the material in these notes. Outline (cont d) Shared Memory and OpenMP Including

More information

OpenACC. Part I. Ned Nedialkov. McMaster University Canada. October 2016

OpenACC. Part I. Ned Nedialkov. McMaster University Canada. October 2016 OpenACC. Part I Ned Nedialkov McMaster University Canada October 2016 Outline Introduction Execution model Memory model Compiling pgaccelinfo Example Speedups Profiling c 2016 Ned Nedialkov 2/23 Why accelerators

More information

Parallelising Scientific Codes Using OpenMP. Wadud Miah Research Computing Group

Parallelising Scientific Codes Using OpenMP. Wadud Miah Research Computing Group Parallelising Scientific Codes Using OpenMP Wadud Miah Research Computing Group Software Performance Lifecycle Scientific Programming Early scientific codes were mainly sequential and were executed on

More information

Introduction to parallel Computing

Introduction to parallel Computing Introduction to parallel Computing VI-SEEM Training Paschalis Paschalis Korosoglou Korosoglou (pkoro@.gr) (pkoro@.gr) Outline Serial vs Parallel programming Hardware trends Why HPC matters HPC Concepts

More information

How to perform HPL on CPU&GPU clusters. Dr.sc. Draško Tomić

How to perform HPL on CPU&GPU clusters. Dr.sc. Draško Tomić How to perform HPL on CPU&GPU clusters Dr.sc. Draško Tomić email: drasko.tomic@hp.com Forecasting is not so easy, HPL benchmarking could be even more difficult Agenda TOP500 GPU trends Some basics about

More information

SHARCNET Workshop on Parallel Computing. Hugh Merz Laurentian University May 2008

SHARCNET Workshop on Parallel Computing. Hugh Merz Laurentian University May 2008 SHARCNET Workshop on Parallel Computing Hugh Merz Laurentian University May 2008 What is Parallel Computing? A computational method that utilizes multiple processing elements to solve a problem in tandem

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 October 11, 2012 CPD (DEI / IST) Parallel and Distributed

More information

Point-to-Point Synchronisation on Shared Memory Architectures

Point-to-Point Synchronisation on Shared Memory Architectures Point-to-Point Synchronisation on Shared Memory Architectures J. Mark Bull and Carwyn Ball EPCC, The King s Buildings, The University of Edinburgh, Mayfield Road, Edinburgh EH9 3JZ, Scotland, U.K. email:

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

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

R for deep learning (III): CUDA and MultiGPUs Acceleration

R for deep learning (III): CUDA and MultiGPUs Acceleration R for deep learning (III): CUDA and MultiGPUs Acceleration Peng Zhao, ParallelR Notes: 1. The entire source code of this post in here In previous two blogs (here and here), we illustrated several skills

More information

CS691/SC791: Parallel & Distributed Computing

CS691/SC791: Parallel & Distributed Computing CS691/SC791: Parallel & Distributed Computing Introduction to OpenMP 1 Contents Introduction OpenMP Programming Model and Examples OpenMP programming examples Task parallelism. Explicit thread synchronization.

More information

OpenMP - II. Diego Fabregat-Traver and Prof. Paolo Bientinesi WS15/16. HPAC, RWTH Aachen

OpenMP - II. Diego Fabregat-Traver and Prof. Paolo Bientinesi WS15/16. HPAC, RWTH Aachen OpenMP - II Diego Fabregat-Traver and Prof. Paolo Bientinesi HPAC, RWTH Aachen fabregat@aices.rwth-aachen.de WS15/16 OpenMP References Using OpenMP: Portable Shared Memory Parallel Programming. The MIT

More information