GPGPU. Alan Gray/James Perry EPCC The University of Edinburgh.
|
|
- Bathsheba Osborne
- 6 years ago
- Views:
Transcription
1 GPGPU Alan Gray/James Perry EPCC The University of Edinburgh
2 Contents Introduction GPU Technology Programming GPUs GPU Performance Optimisation 2
3 Introduction 3
4 Introduction Central Processing Unit (CPU) of a computer system must be able to perform a wide variety of tasks efficiently. Until recently, most CPUs comprised of 1 sophisticated compute core (for arithmetic), plus complex arrangement of controllers, memory caches, etc Increases in CPU performance were achieved through increases in the clock frequency of the core. This has now reached it s limit mainly due to power requirements and heat dissipation restrictions Today, processor cores are not getting any faster, but instead we are getting increasing numbers of cores per chip. Plus other forms of parallelism such as SSE vector instruction support Harder for applications to exploit such technology advances. 4
5 Introduction Meanwhile. In recent years computer gaming industry has driven development of a different type of chip: the Graphics Processing Unit (GPU) Silicon largely dedicated to high numbers (hundreds) of simplistic cores, at the expense of controllers, caches, sophistication etc GPUs work in tandem with the CPU (communicating over PCIe), and are responsible for generating the graphical output display Computing pixel values Inherently parallel - each core computes a certain set of pixels Architecture has evolved for this purpose 5
6 Introduction GPU peak performance has been increasing much more rapidly than CPU Can we use GPUs for general purpose computation? Yes (with some effort). 6
7 GPGPU GPGPU: General Purpose computation on Graphics Processing Units. GPU acts as an accelerator to the CPU (heterogeneous system) Most lines of code are executed on the CPU (serial computing) Key computational kernels are executed on the GPU (stream computing) Taking advantage of the large number of cores and high graphics memory bandwidth AIM: code performs better than use of CPU alone. Source: NVIDIA CUDA Programming Guide, serial serial stream stream 7
8 GPGPU: Stream Computing Data set decomposed into a stream of elements A single computational function (kernel) operates on each element thread defined as execution of kernel on one data element Multiple cores can process multiple elements in parallel i.e. many threads running in parallel Suitable for data-parallel problems Modern GPUs are more flexible than traditional stream processors Some level of communication is possible between threads, but with restrictions 8
9 GPUs in HPC Can augment each node of a system with GPU(s) Use MPI between nodes as normal November 2010 Top500 list: GPUs (next generation will have GPUs) GPUs GPUs GPUs now firmly established in HPC industry They possess those characteristics necessary for approaching the Exascale : very high numbers of simple low-power cores 9
10 Programming Considerations Standard (CPU) code will not run on a GPU unless it is adapted Programmer must decompose problem onto the hardware in a specific way (e.g. using a hierarchical thread/grid model in CUDA) Manage data transfers between the separate CPU and GPU memory spaces. Traditional language (C, C++, Fortran etc) not enough, need extensions, directives, or new language. Once code is ported to GPU, it is usually the case that much more optimization work is required to tailor it to the hardware to achieve decent performance Despite this, many researchers reporting impressive results Across a wide range of application areas 10
11 GPU Technology 11
12 Latest Technology NVIDIA Tesla HPC specific GPUs have evolved from GeForce series Leading product: the focus of this talk Intel AMD Knights Corner many-core x86 chip is a derivative of delayed Larrabee Interesting hybrid chip, not yet released FireStream HPC specific GPUs have evolved from (ATI) Radeon series Lagging behind NVIDIA (both hardware and software) but may catch up in the future 12
13 NVIDIA Tesla NVIDIA Tesla: derivatives of the GeForce chips with HPC enhancements Released May 2010: Tesla 20-series (codenamed Fermi) Tesla C cores 515 Gflops (Double Precision) 1.03 Tflops (Single Precision) Error Correcting Code support For all internal and external memory On-chip automatic caches L2 shared between all cores, L1 per SM (32 cores) 6 GB GDDR5 C2050 variant with lower memory also available Rack-mount unit available (S2050/S2070): contains 4 GPUs 13
14 Programming GPUs 14
15 Programming Options CUDA C is the proprietary interface to the NVIDIA architecture, and most common programming method at the moment NVIDIA only Cuda Fortran also available through PGI OpenCL: Cross platform API Directives based approaches 15
16 NVIDIA CUDA CUDA allows NVIDIA GPUs to be programmed in C and C++ defines language extensions for defining kernels kernels execute in multiple threads concurrently on the GPU provides API functions for e.g. device memory management PGI provide a commercial Fortran version of CUDA
17 CUDA Concepts The GPU acts as an accelerator to the main CPU Most code still runs on the main CPU including startup code, I/O, user interface Key computational kernels are executed on the GPU Characteristics of kernels: simple operations repeated many times on different data items typically found in innermost loop of code account for a significant proportion of overall runtime CUDA allows us to implement the kernels on the GPU
18 Stream Multiprocessors NVIDIA GPUs are partitioned into Stream Multiprocessors each SM contains a number of cores plus a shared memory
19 Problem Decomposition CUDA enables a 2-level decomposition of a problem into threads: multiple threads per block multiple blocks per grid This is so that the code can map efficiently to a variety of hardware thread blocks map onto SMs (automatically) an SM may run multiple thread blocks no need to change code in order to scale to larger GPUs CUDA allows thread blocks and grid to be 1D, 2D or 3D whichever maps best onto algorithm
20 E.g grid of 2x2=4 blocks, each with 3x2=6 threads (24 threads total) 20
21 CUDA C Syntax CUDA extends C with new syntax for defining and launching kernels The global declaration specifier defines a kernel when called, a kernel runs in parallel in many CUDA threads on the GPU whereas normal C functions run in serial on the CPU New <<<...>>> syntax is used to specify grid and block dimensions when calling a kernel CUDA also adds useful global variables (e.g. threadidx, blockdim) and functions (e.g. cudamalloc, cudamemcpy)
22 CUDA C Example Example kernel and invocation: global void vectoradd(float *a, float *b, float *c) { int i = threadidx.x; c[i] = a[i] + b[i]; } int main() { dim3 dimgrid(1); /* 1 block per grid (1D) */ dim3 dimblock(n); /* N threads per block (1D) */ vectoradd<<<dimgrid, dimblock>>>(a, b, c); } The kernel is executed in parallel by N threads, each processing a single element of the vector
23 2D Example global void matrixadd(float a[n][n], float b[n][n], float c[n][n]) { int i = threadidx.x; int j = threadidx.y; } c[i][j] = a[i][j] + b[i][j]; int main() { dim3 dimgrid(1); /* 1 block per grid (1D) */ dim3 dimblock(n, N); /* NxN threads per block (2D) */ matrixadd<<<dimgrid, dimblock>>>(a, b, c); }
24 Multiple Block Example We need to use multiple blocks in order to utilise multiple SMs on the GPU global void matrixadd(float a[n][n], float b[n][n], float c [N][N]) { int i = blockidx.x * blockdim.x + threadidx.x; int j = blockidx.y * blockdim.y + threadidx.y; } c[i][j] = a[i][j] + b[i][j]; int main() { } dim3 dimgrid(n/16,n/16); /* (N/16)x(N/16) blocks/grid (2D) */ dim3 dimblock(16, 16); /* 16x16 threads/block (2D) */ matrixadd<<<dimgrid, dimblock>>>(a, b, c);
25 Memory Management - allocation The GPU has a separate memory space from the host CPU We cannot simply pass normal C pointers to CUDA threads Need to manage GPU memory and copy data to and from it explicitly cudamalloc is used to allocate GPU memory cudafree releases it again float *a; cudamalloc((void **)&a, N*sizeof(float)); cudafree(a);
26 Memory Management - cudamemcpy Once we've allocated GPU memory, we need to be able to copy data to and from it cudamemcpy does this: cudamemcpy(a, (void *)input, N*sizeof(float), cudamemcpyhosttodevice); cudamemcpy((void *)output, c, N*sizeof(float), cudamemcpydevicetohost); Transfers between host and device memory are relatively slow and can become a bottleneck, so should be minimised when possible
27 CUDA Fortran Allows Fortran codes to take advantage of GPU acceleration Available in the commercial PGI Fortran compiler from the Portland Group Very similar to CUDA C define kernels to be executed on the device with global attribute invoke them using <<< >>> syntax same API functions available (cudamalloc, cudafree, cudamemcpy, etc.)
28 CUDA Fortran Example! Kernel declaration attributes(global) subroutine vectoradd(a, b, c) real, dimension(*) :: a, b, c integer :: i i = threadidx%x c(i) = a(i) + b(i) end subroutine! Kernel invocation call vectoradd<<<1, 64>>>(a, b, c)
29 Compiling CUDA Code CUDA C code is compiled using nvcc: nvcc o example example.cu CUDA Fortran is compiled using PGI compiler either use.cuf filename extension for CUDA files or pass Mcuda to the compiler command line
30 OpenCL Overview OpenCL is an open standard for developing parallel applications on heterogeneous architectures originally developed by Apple supports CPUs, GPUs (not just NVIDIA) and other devices analogous to OpenGL and OpenAL now on version 1.1 Many similarities with CUDA ability to define kernels which execute on the GPU device similar C APIs multi-dimensional problem space with multiple levels of decomposition NVIDIA support both CUDA and OpenCL as APIs to the hardware. But put much more effort into CUDA CUDA more mature, well documented and performs better See
31 Example OpenCL kernel kernel void vectoradd(global const float *a, global const float *b, global float *c) { int i = get_global_id(0); c[i] = a[i] + b[i]; } kernel and global are OpenCL extensions to C get_global_id is OpenCL function Performs similar role to CUDA s blockidx/threadidx
32 Accelerator Directives Language extensions, e.g. Cuda or OpenCL, allow programmers to interface with the GPU This gives control to the programmer, but is often tricky and time consuming, and results in complex/non-portable code An alternative approach is to allow the compiler to automatically accelerate code sections on the GPU (including decomposition, data transfer, etc). There must be a mechanism to provide the compiler with hints regarding which sections to be accelerated, parallelism, data usage, etc Directives provide this mechanism Special syntax which is understood by accelerator compilers and ignored (treated as code comments) by non-accelerator compilers. Same source code can be compiled for CPU/GPU combo or CPU only c.f. OpenMP 32
33 Accelerator Directives Compiler Availability PGI Accelerator Compiler for C/Fortran Using directives, translates to CUDA (future releases to PTX) NVIDIA GPUs only CAPS HMPP compiler Using directives, translates to CUDA or OpenCL NVIDIA or AMD GPUs Recently announced Pathscale compiler supports NVIDIA GPUs through HMPP programming model Cray compiler Under development to incorporate accelerator directives Not yet released All of above are commercial products Directives different but similar across products 33
34 OpenMP Accelerator Directives There is an effort underway to standardise accelerator directives. Cray, PGI, CAPS (plus several other organisations including EPCC) have formed a subcommittee of the OpenMP committee, looking at extending the OpenMP directive standard to support accelerators. The Cray directives are a prototype of such an OpenMP standard 34
35 GPU Performance Optimisation 35
36 Hardware NVIDIA accelerated system: Memory Memory 36
37 GPU vs CPU: Theoretical Peak capabilities NVIDIA Fermi AMD Magny-Cours (6172) Cores 448 (1.15GHz) 12 (2.1GHz) Operations/cycle 1 4 DP Performance (peak) 515 GFlops 101 GFlops Memory Bandwidth (peak) 144 GB/s 27.5 GB/s GPU theoretical advantage is ~5x for both compute and main memory bandwidth Application performance very much depends on application Typically a small fraction of peak Depends how well application is suited to/tuned for architecture 37
38 GPU performance inhibitors Lack of available parallelism Copying data to/from device Global memory latency Global memory bandwidth Code branching Device under-utilisation This lecture will address each of these And advise how to maximise performance Concentrating on NVIDIA, but many concepts will be transferable to e.g. AMD 38
39 Exploiting parallelism GPU performance relies on parallel use of many threads Amdahl s law for parallel speedup: P αp + (1 α) P: number of parallel tasks α: fraction of app which is serial P is very large, even within a single GPU α must be extremely small to achieve good speedup Effort must be made to exploit as much parallelism as possible within application May involve rewriting/refactoring 39
40 Host Device Data Copy CPU (host) and GPU (device) have separate memories. All data read/written on the device must be copied to/from the device (over PCIe bus). This very expensive Must try to minimise copies Keep data resident on device May involve porting more routines to device, even if they are not computationally expensive Might be quicker to calculate something from scratch on device instead of copying from host 40
41 Data copy optimisation example Loop over timesteps inexpensive_routine_on_host(data_on_host) copy data from host to device expensive_routine_on_device(data_on_device) copy data from device to host End loop over timesteps Port inexpensive routine to device and move data copies outside of loop copy data from host to device Loop over timesteps inexpensive_routine_on_device(data_on_device) expensive_routine_on_device(data_on_device) End loop over timesteps copy data from device to host 41
42 Code Branching On NVIDIA GPUs, there are less instruction scheduling units than cores Threads are scheduled in groups of 32, called a warp N.B. It may take multiple cycles to process all threads in a warp, e.g. 4 cycles on Tesla 10-series SM, which only has 8 cores Threads within a warp must execute the same instruction in lock-step (on different data elements) The CUDA programming allows branching, but this results in all cores following all branches With only the required results saved This is obviously suboptimal Must avoid intra-warp branching wherever possible (especially in key computational sections) 42
43 Branching example E.g you want to split your threads into 2 groups: threadid = blockidx.x*blockdim.x + threadidx.x; if (threadid%2 == 0) else Threads within warp diverge threadid = blockidx.x*blockdim.x + threadidx.x; if ((threadid/blockdim.x)%2 == 0) else Threads within warp follow same path 43
44 Occupancy and Memory Latency hiding Programmer decomposes loops in code to threads Obviously, there must be at least as many total threads as cores, otherwise cores will be left idle. For best performance, actually want #threads >> #cores Accesses to global memory have several hundred cycles latency When a thread stalls waiting for data, if another thread can switch in this latency can be hidden. NVIDIA GPUs have very fast thread switching, and support many concurrent threads Fermi supports up to 1536 concurrent threads on an SM, e.g. if there are 256 threads per block, it can run up to 6 blocks concurrently per SM. Remaining blocks will queue. But note that resources must be shared between threads: High use of on-chip memory and registers will limit number of concurrent threads. Best to experiment measuring performance NVIDIA provide a CUDA Occupancy Calculator spreadsheet to help. 44
45 Occupancy example Loop over i from 1 to 512 Loop over j from 1 to 512 independent iteration Original code 1D decomposition Calc i from thread/block ID Loop over j from 1 to 512 independent iteration 2D decomposition Calc i & j from thread/block ID independent iteration 512 threads 262,144 threads 45
46 Memory coalescing Global memory bandwidth for graphics memory on GPU is high compared to CPU But there are many data-hungry cores Memory bandwidth is a botteneck Maximum bandwidth achieved when data is loaded for multiple threads in a single transaction: coalescing This will happen when data access patterns meet certain conditions: 16 consecutive threads (half-warp) must access data from within the same memory segment E.g. condition met when consecutive threads read consecutive memory addresses within a warp. Otherwise, memory accesses are serialised, significantly degrading performance Adapting code to allow coalescing can dramatically improve performance 46
47 Memory coalescing example Condition met when consecutive threads read consecutive memory addresses In C, outermost index runs fastest row = blockidx.x*blockdim.x + threadidx.x; for (col=0; col<n; col++) output[row][col]=2*input[row][col]; Not coalesced col = blockidx.x*blockdim.x + threadidx.x; for (row=0; row<n; row++) output[row][col]=2*input[row][col]; coalesced 47
48 Use of On-Chip Memory Global Memory accesses can be avoided altogether if the on-chip memory and registers can be utilised. But these are small Shared memory: shared between threads in a block Prefix variable declarations with shared qualifier Fermi has 64 kb configurable as shared or cached partitioned as 16KB/48KB or 48KB/16KB Automatic caching in Fermi GPUs, but you may get better results doing it manually (but can be very involved) Constant memory: 64kB read only memory Prefix variable declarations with constant qualifier and use cudamemcpytosymbol to copy from host (see programming guide) Registers: will be utilised automatically, but sometimes you can manipulate this in you favour by e.g. copying key data to small temporary data structures. 48
49 Conclusions GPUs offer performance advantages over CPUs And are now firmly established in the HPC industry Programming GPUs is more complex than CPUs NVIDIA GPUs are currently leaders in the field CUDA is the most prominent (and mature) programming model But for NVIDIA GPUs only OpenCL, similar to CUDA, is a cross-platform alternative (but is not so mature) Directives based techniques are promising for the future Performance optimisation is essential to get the most from GPUs It is important to have a good understanding of the application, architecture and programming model. 49
GPU Performance Optimisation. Alan Gray EPCC The University of Edinburgh
GPU Performance Optimisation EPCC The University of Edinburgh Hardware NVIDIA accelerated system: Memory Memory GPU vs CPU: Theoretical Peak capabilities NVIDIA Fermi AMD Magny-Cours (6172) Cores 448 (1.15GHz)
More informationLearn CUDA in an Afternoon. Alan Gray EPCC The University of Edinburgh
Learn CUDA in an Afternoon Alan Gray EPCC The University of Edinburgh Overview Introduction to CUDA Practical Exercise 1: Getting started with CUDA GPU Optimisation Practical Exercise 2: Optimising a CUDA
More informationGPU Programming. Alan Gray, James Perry EPCC The University of Edinburgh
GPU Programming EPCC The University of Edinburgh Contents NVIDIA CUDA C Proprietary interface to NVIDIA architecture CUDA Fortran Provided by PGI OpenCL Cross platform API 2 NVIDIA CUDA CUDA allows NVIDIA
More informationGPU Architecture. Alan Gray EPCC The University of Edinburgh
GPU Architecture Alan Gray EPCC The University of Edinburgh Outline Why do we want/need accelerators such as GPUs? Architectural reasons for accelerator performance advantages Latest GPU Products From
More informationTesla Architecture, CUDA and Optimization Strategies
Tesla Architecture, CUDA and Optimization Strategies Lan Shi, Li Yi & Liyuan Zhang Hauptseminar: Multicore Architectures and Programming Page 1 Outline Tesla Architecture & CUDA CUDA Programming Optimization
More informationRegister file. A single large register file (ex. 16K registers) is partitioned among the threads of the dispatched blocks.
Sharing the resources of an SM Warp 0 Warp 1 Warp 47 Register file A single large register file (ex. 16K registers) is partitioned among the threads of the dispatched blocks Shared A single SRAM (ex. 16KB)
More informationIntroduction to Numerical General Purpose GPU Computing with NVIDIA CUDA. Part 1: Hardware design and programming model
Introduction to Numerical General Purpose GPU Computing with NVIDIA CUDA Part 1: Hardware design and programming model Dirk Ribbrock Faculty of Mathematics, TU dortmund 2016 Table of Contents Why parallel
More informationGPU Computing: Introduction to CUDA. Dr Paul Richmond
GPU Computing: Introduction to CUDA Dr Paul Richmond http://paulrichmond.shef.ac.uk This lecture CUDA Programming Model CUDA Device Code CUDA Host Code and Memory Management CUDA Compilation Programming
More informationG P G P U : H I G H - P E R F O R M A N C E C O M P U T I N G
Joined Advanced Student School (JASS) 2009 March 29 - April 7, 2009 St. Petersburg, Russia G P G P U : H I G H - P E R F O R M A N C E C O M P U T I N G Dmitry Puzyrev St. Petersburg State University Faculty
More informationHigh Performance Computing and GPU Programming
High Performance Computing and GPU Programming Lecture 1: Introduction Objectives C++/CPU Review GPU Intro Programming Model Objectives Objectives Before we begin a little motivation Intel Xeon 2.67GHz
More informationAccelerator cards are typically PCIx cards that supplement a host processor, which they require to operate Today, the most common accelerators include
3.1 Overview Accelerator cards are typically PCIx cards that supplement a host processor, which they require to operate Today, the most common accelerators include GPUs (Graphics Processing Units) AMD/ATI
More informationJosef Pelikán, Jan Horáček CGG MFF UK Praha
GPGPU and CUDA 2012-2018 Josef Pelikán, Jan Horáček CGG MFF UK Praha pepca@cgg.mff.cuni.cz http://cgg.mff.cuni.cz/~pepca/ 1 / 41 Content advances in hardware multi-core vs. many-core general computing
More informationIntroduction to CUDA Programming
Introduction to CUDA Programming Steve Lantz Cornell University Center for Advanced Computing October 30, 2013 Based on materials developed by CAC and TACC Outline Motivation for GPUs and CUDA Overview
More informationCUDA Programming. Week 1. Basic Programming Concepts Materials are copied from the reference list
CUDA Programming Week 1. Basic Programming Concepts Materials are copied from the reference list G80/G92 Device SP: Streaming Processor (Thread Processors) SM: Streaming Multiprocessor 128 SP grouped into
More informationCUDA PROGRAMMING MODEL. Carlo Nardone Sr. Solution Architect, NVIDIA EMEA
CUDA PROGRAMMING MODEL Carlo Nardone Sr. Solution Architect, NVIDIA EMEA CUDA: COMMON UNIFIED DEVICE ARCHITECTURE Parallel computing architecture and programming model GPU Computing Application Includes
More informationAn Introduction to GPGPU Pro g ra m m ing - CUDA Arc hitec ture
An Introduction to GPGPU Pro g ra m m ing - CUDA Arc hitec ture Rafia Inam Mälardalen Real-Time Research Centre Mälardalen University, Västerås, Sweden http://www.mrtc.mdh.se rafia.inam@mdh.se CONTENTS
More informationIntroduction to CUDA CME343 / ME May James Balfour [ NVIDIA Research
Introduction to CUDA CME343 / ME339 18 May 2011 James Balfour [ jbalfour@nvidia.com] NVIDIA Research CUDA Programing system for machines with GPUs Programming Language Compilers Runtime Environments Drivers
More informationGPU programming. Dr. Bernhard Kainz
GPU programming Dr. Bernhard Kainz Overview About myself Motivation GPU hardware and system architecture GPU programming languages GPU programming paradigms Pitfalls and best practice Reduction and tiling
More informationOverview. Lecture 1: an introduction to CUDA. Hardware view. Hardware view. hardware view software view CUDA programming
Overview Lecture 1: an introduction to CUDA Mike Giles mike.giles@maths.ox.ac.uk hardware view software view Oxford University Mathematical Institute Oxford e-research Centre Lecture 1 p. 1 Lecture 1 p.
More informationECE 574 Cluster Computing Lecture 15
ECE 574 Cluster Computing Lecture 15 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 30 March 2017 HW#7 (MPI) posted. Project topics due. Update on the PAPI paper Announcements
More informationIntroduction to GPU Computing Using CUDA. Spring 2014 Westgid Seminar Series
Introduction to GPU Computing Using CUDA Spring 2014 Westgid Seminar Series Scott Northrup SciNet www.scinethpc.ca March 13, 2014 Outline 1 Heterogeneous Computing 2 GPGPU - Overview Hardware Software
More informationIntroduction to GPU Computing Using CUDA. Spring 2014 Westgid Seminar Series
Introduction to GPU Computing Using CUDA Spring 2014 Westgid Seminar Series Scott Northrup SciNet www.scinethpc.ca (Slides http://support.scinet.utoronto.ca/ northrup/westgrid CUDA.pdf) March 12, 2014
More informationGPU CUDA Programming
GPU CUDA Programming 이정근 (Jeong-Gun Lee) 한림대학교컴퓨터공학과, 임베디드 SoC 연구실 www.onchip.net Email: Jeonggun.Lee@hallym.ac.kr ALTERA JOINT LAB Introduction 차례 Multicore/Manycore and GPU GPU on Medical Applications
More informationIntroduction to Parallel Computing with CUDA. Oswald Haan
Introduction to Parallel Computing with CUDA Oswald Haan ohaan@gwdg.de Schedule Introduction to Parallel Computing with CUDA Using CUDA CUDA Application Examples Using Multiple GPUs CUDA Application Libraries
More informationLecture 15: Introduction to GPU programming. Lecture 15: Introduction to GPU programming p. 1
Lecture 15: Introduction to GPU programming Lecture 15: Introduction to GPU programming p. 1 Overview Hardware features of GPGPU Principles of GPU programming A good reference: David B. Kirk and Wen-mei
More informationUniversity of Bielefeld
Geistes-, Natur-, Sozial- und Technikwissenschaften gemeinsam unter einem Dach Introduction to GPU Programming using CUDA Olaf Kaczmarek University of Bielefeld STRONGnet Summerschool 2011 ZIF Bielefeld
More informationGPU Programming. Lecture 2: CUDA C Basics. Miaoqing Huang University of Arkansas 1 / 34
1 / 34 GPU Programming Lecture 2: CUDA C Basics Miaoqing Huang University of Arkansas 2 / 34 Outline Evolvements of NVIDIA GPU CUDA Basic Detailed Steps Device Memories and Data Transfer Kernel Functions
More informationParallel Programming Principle and Practice. Lecture 9 Introduction to GPGPUs and CUDA Programming Model
Parallel Programming Principle and Practice Lecture 9 Introduction to GPGPUs and CUDA Programming Model Outline Introduction to GPGPUs and Cuda Programming Model The Cuda Thread Hierarchy / Memory Hierarchy
More informationWhat is GPU? CS 590: High Performance Computing. GPU Architectures and CUDA Concepts/Terms
CS 590: High Performance Computing GPU Architectures and CUDA Concepts/Terms Fengguang Song Department of Computer & Information Science IUPUI What is GPU? Conventional GPUs are used to generate 2D, 3D
More informationParallel Numerical Algorithms
Parallel Numerical Algorithms http://sudalab.is.s.u-tokyo.ac.jp/~reiji/pna14/ [ 10 ] GPU and CUDA Parallel Numerical Algorithms / IST / UTokyo 1 PNA16 Lecture Plan General Topics 1. Architecture and Performance
More informationECE 574 Cluster Computing Lecture 17
ECE 574 Cluster Computing Lecture 17 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 28 March 2019 HW#8 (CUDA) posted. Project topics due. Announcements 1 CUDA installing On Linux
More informationLecture 3: Introduction to CUDA
CSCI-GA.3033-004 Graphics Processing Units (GPUs): Architecture and Programming Lecture 3: Introduction to CUDA Some slides here are adopted from: NVIDIA teaching kit Mohamed Zahran (aka Z) mzahran@cs.nyu.edu
More informationScientific discovery, analysis and prediction made possible through high performance computing.
Scientific discovery, analysis and prediction made possible through high performance computing. An Introduction to GPGPU Programming Bob Torgerson Arctic Region Supercomputing Center November 21 st, 2013
More informationReal-time Graphics 9. GPGPU
Real-time Graphics 9. GPGPU GPGPU GPU (Graphics Processing Unit) Flexible and powerful processor Programmability, precision, power Parallel processing CPU Increasing number of cores Parallel processing
More informationAn Introduction to GPU Architecture and CUDA C/C++ Programming. Bin Chen April 4, 2018 Research Computing Center
An Introduction to GPU Architecture and CUDA C/C++ Programming Bin Chen April 4, 2018 Research Computing Center Outline Introduction to GPU architecture Introduction to CUDA programming model Using the
More informationCSE 160 Lecture 24. Graphical Processing Units
CSE 160 Lecture 24 Graphical Processing Units Announcements Next week we meet in 1202 on Monday 3/11 only On Weds 3/13 we have a 2 hour session Usual class time at the Rady school final exam review SDSC
More informationIntroduction to GPU hardware and to CUDA
Introduction to GPU hardware and to CUDA Philip Blakely Laboratory for Scientific Computing, University of Cambridge Philip Blakely (LSC) GPU introduction 1 / 35 Course outline Introduction to GPU hardware
More informationLecture 1: an introduction to CUDA
Lecture 1: an introduction to CUDA Mike Giles mike.giles@maths.ox.ac.uk Oxford University Mathematical Institute Oxford e-research Centre Lecture 1 p. 1 Overview hardware view software view CUDA programming
More informationInformation Coding / Computer Graphics, ISY, LiTH. Introduction to CUDA. Ingemar Ragnemalm Information Coding, ISY
Introduction to CUDA Ingemar Ragnemalm Information Coding, ISY This lecture: Programming model and language Introduction to memory spaces and memory access Shared memory Matrix multiplication example Lecture
More informationGPU programming: CUDA basics. Sylvain Collange Inria Rennes Bretagne Atlantique
GPU programming: CUDA basics Sylvain Collange Inria Rennes Bretagne Atlantique sylvain.collange@inria.fr This lecture: CUDA programming We have seen some GPU architecture Now how to program it? 2 Outline
More informationParallel Computing. Lecture 19: CUDA - I
CSCI-UA.0480-003 Parallel Computing Lecture 19: CUDA - I Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com GPU w/ local DRAM (device) Behind CUDA CPU (host) Source: http://hothardware.com/reviews/intel-core-i5-and-i7-processors-and-p55-chipset/?page=4
More informationCUDA Programming Model
CUDA Xing Zeng, Dongyue Mou Introduction Example Pro & Contra Trend Introduction Example Pro & Contra Trend Introduction What is CUDA? - Compute Unified Device Architecture. - A powerful parallel programming
More informationINTRODUCTION TO GPU COMPUTING WITH CUDA. Topi Siro
INTRODUCTION TO GPU COMPUTING WITH CUDA Topi Siro 19.10.2015 OUTLINE PART I - Tue 20.10 10-12 What is GPU computing? What is CUDA? Running GPU jobs on Triton PART II - Thu 22.10 10-12 Using libraries Different
More informationCSC266 Introduction to Parallel Computing using GPUs Introduction to CUDA
CSC266 Introduction to Parallel Computing using GPUs Introduction to CUDA Sreepathi Pai October 18, 2017 URCS Outline Background Memory Code Execution Model Outline Background Memory Code Execution Model
More informationParticle-in-Cell Simulations on Modern Computing Platforms. Viktor K. Decyk and Tajendra V. Singh UCLA
Particle-in-Cell Simulations on Modern Computing Platforms Viktor K. Decyk and Tajendra V. Singh UCLA Outline of Presentation Abstraction of future computer hardware PIC on GPUs OpenCL and Cuda Fortran
More informationCUDA Lecture 2. Manfred Liebmann. Technische Universität München Chair of Optimal Control Center for Mathematical Sciences, M17
CUDA Lecture 2 Manfred Liebmann Technische Universität München Chair of Optimal Control Center for Mathematical Sciences, M17 manfred.liebmann@tum.de December 15, 2015 CUDA Programming Fundamentals CUDA
More informationReal-time Graphics 9. GPGPU
9. GPGPU GPGPU GPU (Graphics Processing Unit) Flexible and powerful processor Programmability, precision, power Parallel processing CPU Increasing number of cores Parallel processing GPGPU general-purpose
More informationFundamental CUDA Optimization. NVIDIA Corporation
Fundamental CUDA Optimization NVIDIA Corporation Outline Fermi/Kepler Architecture Kernel optimizations Launch configuration Global memory throughput Shared memory access Instruction throughput / control
More informationGPU & High Performance Computing (by NVIDIA) CUDA. Compute Unified Device Architecture Florian Schornbaum
GPU & High Performance Computing (by NVIDIA) CUDA Compute Unified Device Architecture 29.02.2008 Florian Schornbaum GPU Computing Performance In the last few years the GPU has evolved into an absolute
More informationFundamental CUDA Optimization. NVIDIA Corporation
Fundamental CUDA Optimization NVIDIA Corporation Outline! Fermi Architecture! Kernel optimizations! Launch configuration! Global memory throughput! Shared memory access! Instruction throughput / control
More informationIntroduc)on to GPU Programming
Introduc)on to GPU Programming Mubashir Adnan Qureshi h3p://www.ncsa.illinois.edu/people/kindr/projects/hpca/files/singapore_p1.pdf h3p://developer.download.nvidia.com/cuda/training/nvidia_gpu_compu)ng_webinars_cuda_memory_op)miza)on.pdf
More informationGPU Computing: Development and Analysis. Part 1. Anton Wijs Muhammad Osama. Marieke Huisman Sebastiaan Joosten
GPU Computing: Development and Analysis Part 1 Anton Wijs Muhammad Osama Marieke Huisman Sebastiaan Joosten NLeSC GPU Course Rob van Nieuwpoort & Ben van Werkhoven Who are we? Anton Wijs Assistant professor,
More informationPractical Introduction to CUDA and GPU
Practical Introduction to CUDA and GPU Charlie Tang Centre for Theoretical Neuroscience October 9, 2009 Overview CUDA - stands for Compute Unified Device Architecture Introduced Nov. 2006, a parallel computing
More informationOverview: Graphics Processing Units
advent of GPUs GPU architecture Overview: Graphics Processing Units the NVIDIA Fermi processor the CUDA programming model simple example, threads organization, memory model case study: matrix multiply
More informationInformation Coding / Computer Graphics, ISY, LiTH. Introduction to CUDA. Ingemar Ragnemalm Information Coding, ISY
Introduction to CUDA Ingemar Ragnemalm Information Coding, ISY This lecture: Programming model and language Memory spaces and memory access Shared memory Examples Lecture questions: 1. Suggest two significant
More informationLecture 11: GPU programming
Lecture 11: GPU programming David Bindel 4 Oct 2011 Logistics Matrix multiply results are ready Summary on assignments page My version (and writeup) on CMS HW 2 due Thursday Still working on project 2!
More informationIntroduction to GPGPUs and to CUDA programming model
Introduction to GPGPUs and to CUDA programming model www.cineca.it Marzia Rivi m.rivi@cineca.it GPGPU architecture CUDA programming model CUDA efficient programming Debugging & profiling tools CUDA libraries
More informationCUDA OPTIMIZATIONS ISC 2011 Tutorial
CUDA OPTIMIZATIONS ISC 2011 Tutorial Tim C. Schroeder, NVIDIA Corporation Outline Kernel optimizations Launch configuration Global memory throughput Shared memory access Instruction throughput / control
More informationAccelerating image registration on GPUs
Accelerating image registration on GPUs Harald Köstler, Sunil Ramgopal Tatavarty SIAM Conference on Imaging Science (IS10) 13.4.2010 Contents Motivation: Image registration with FAIR GPU Programming Combining
More informationProgrammable Graphics Hardware (GPU) A Primer
Programmable Graphics Hardware (GPU) A Primer Klaus Mueller Stony Brook University Computer Science Department Parallel Computing Explained video Parallel Computing Explained Any questions? Parallelism
More informationFundamental Optimizations in CUDA Peng Wang, Developer Technology, NVIDIA
Fundamental Optimizations in CUDA Peng Wang, Developer Technology, NVIDIA Optimization Overview GPU architecture Kernel optimization Memory optimization Latency optimization Instruction optimization CPU-GPU
More informationIntroduction to GPU programming. Introduction to GPU programming p. 1/17
Introduction to GPU programming Introduction to GPU programming p. 1/17 Introduction to GPU programming p. 2/17 Overview GPUs & computing Principles of CUDA programming One good reference: David B. Kirk
More informationLecture 10!! Introduction to CUDA!
1(50) Lecture 10 Introduction to CUDA Ingemar Ragnemalm Information Coding, ISY 1(50) Laborations Some revisions may happen while making final adjustments for Linux Mint. Last minute changes may occur.
More informationHPC Middle East. KFUPM HPC Workshop April Mohamed Mekias HPC Solutions Consultant. Introduction to CUDA programming
KFUPM HPC Workshop April 29-30 2015 Mohamed Mekias HPC Solutions Consultant Introduction to CUDA programming 1 Agenda GPU Architecture Overview Tools of the Trade Introduction to CUDA C Patterns of Parallel
More informationGPU Programming Using CUDA
GPU Programming Using CUDA Michael J. Schnieders Depts. of Biomedical Engineering & Biochemistry The University of Iowa & Gregory G. Howes Department of Physics and Astronomy The University of Iowa Iowa
More informationGraph Partitioning. Standard problem in parallelization, partitioning sparse matrix in nearly independent blocks or discretization grids in FEM.
Graph Partitioning Standard problem in parallelization, partitioning sparse matrix in nearly independent blocks or discretization grids in FEM. Partition given graph G=(V,E) in k subgraphs of nearly equal
More informationModule 2: Introduction to CUDA C. Objective
ECE 8823A GPU Architectures Module 2: Introduction to CUDA C 1 Objective To understand the major elements of a CUDA program Introduce the basic constructs of the programming model Illustrate the preceding
More informationLecture 9. Outline. CUDA : a General-Purpose Parallel Computing Architecture. CUDA Device and Threads CUDA. CUDA Architecture CUDA (I)
Lecture 9 CUDA CUDA (I) Compute Unified Device Architecture 1 2 Outline CUDA Architecture CUDA Architecture CUDA programming model CUDA-C 3 4 CUDA : a General-Purpose Parallel Computing Architecture CUDA
More informationGPU Fundamentals Jeff Larkin November 14, 2016
GPU Fundamentals Jeff Larkin , November 4, 206 Who Am I? 2002 B.S. Computer Science Furman University 2005 M.S. Computer Science UT Knoxville 2002 Graduate Teaching Assistant 2005 Graduate
More informationMemory. Lecture 2: different memory and variable types. Memory Hierarchy. CPU Memory Hierarchy. Main memory
Memory Lecture 2: different memory and variable types Prof. Mike Giles mike.giles@maths.ox.ac.uk Oxford University Mathematical Institute Oxford e-research Centre Key challenge in modern computer architecture
More informationCS377P Programming for Performance GPU Programming - I
CS377P Programming for Performance GPU Programming - I Sreepathi Pai UTCS November 9, 2015 Outline 1 Introduction to CUDA 2 Basic Performance 3 Memory Performance Outline 1 Introduction to CUDA 2 Basic
More informationKernel optimizations Launch configuration Global memory throughput Shared memory access Instruction throughput / control flow
Fundamental Optimizations (GTC 2010) Paulius Micikevicius NVIDIA Outline Kernel optimizations Launch configuration Global memory throughput Shared memory access Instruction throughput / control flow Optimization
More informationHPC COMPUTING WITH CUDA AND TESLA HARDWARE. Timothy Lanfear, NVIDIA
HPC COMPUTING WITH CUDA AND TESLA HARDWARE Timothy Lanfear, NVIDIA WHAT IS GPU COMPUTING? What is GPU Computing? x86 PCIe bus GPU Computing with CPU + GPU Heterogeneous Computing Low Latency or High Throughput?
More informationHigh-Performance Computing Using GPUs
High-Performance Computing Using GPUs Luca Caucci caucci@email.arizona.edu Center for Gamma-Ray Imaging November 7, 2012 Outline Slide 1 of 27 Why GPUs? What is CUDA? The CUDA programming model Anatomy
More informationWriting and compiling a CUDA code
Writing and compiling a CUDA code Philip Blakely Laboratory for Scientific Computing, University of Cambridge Philip Blakely (LSC) Writing CUDA code 1 / 65 The CUDA language If we want fast code, we (unfortunately)
More informationCOSC 6374 Parallel Computations Introduction to CUDA
COSC 6374 Parallel Computations Introduction to CUDA Edgar Gabriel Fall 2014 Disclaimer Material for this lecture has been adopted based on various sources Matt Heavener, CS, State Univ. of NY at Buffalo
More informationStanford University. NVIDIA Tesla M2090. NVIDIA GeForce GTX 690
Stanford University NVIDIA Tesla M2090 NVIDIA GeForce GTX 690 Moore s Law 2 Clock Speed 10000 Pentium 4 Prescott Core 2 Nehalem Sandy Bridge 1000 Pentium 4 Williamette Clock Speed (MHz) 100 80486 Pentium
More informationCUDA Architecture & Programming Model
CUDA Architecture & Programming Model Course on Multi-core Architectures & Programming Oliver Taubmann May 9, 2012 Outline Introduction Architecture Generation Fermi A Brief Look Back At Tesla What s New
More informationCUDA and GPU Performance Tuning Fundamentals: A hands-on introduction. Francesco Rossi University of Bologna and INFN
CUDA and GPU Performance Tuning Fundamentals: A hands-on introduction Francesco Rossi University of Bologna and INFN * Using this terminology since you ve already heard of SIMD and SPMD at this school
More informationGPU Acceleration of HPC Applications
T E H U N I V E R S I T Y O H F R G E D I N B U GPU Acceleration of HPC Applications Alan Richardson August 21, 2009 MSc in High Performance Computing The University of Edinburgh Year of Presentation:
More informationTechnische Universität München. GPU Programming. Rüdiger Westermann Chair for Computer Graphics & Visualization. Faculty of Informatics
GPU Programming Rüdiger Westermann Chair for Computer Graphics & Visualization Faculty of Informatics Overview Programming interfaces and support libraries The CUDA programming abstraction An in-depth
More informationBasics of CADA Programming - CUDA 4.0 and newer
Basics of CADA Programming - CUDA 4.0 and newer Feb 19, 2013 Outline CUDA basics Extension of C Single GPU programming Single node multi-gpus programing A brief introduction on the tools Jacket CUDA FORTRAN
More informationModule 2: Introduction to CUDA C
ECE 8823A GPU Architectures Module 2: Introduction to CUDA C 1 Objective To understand the major elements of a CUDA program Introduce the basic constructs of the programming model Illustrate the preceding
More informationGeneral 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 informationTechnology for a better society. hetcomp.com
Technology for a better society hetcomp.com 1 J. Seland, C. Dyken, T. R. Hagen, A. R. Brodtkorb, J. Hjelmervik,E Bjønnes GPU Computing USIT Course Week 16th November 2011 hetcomp.com 2 9:30 10:15 Introduction
More informationCUDA Parallelism Model
GPU Teaching Kit Accelerated Computing CUDA Parallelism Model Kernel-Based SPMD Parallel Programming Multidimensional Kernel Configuration Color-to-Grayscale Image Processing Example Image Blur Example
More informationIntroduction to GPGPU and GPU-architectures
Introduction to GPGPU and GPU-architectures Henk Corporaal Gert-Jan van den Braak http://www.es.ele.tue.nl/ Contents 1. What is a GPU 2. Programming a GPU 3. GPU thread scheduling 4. GPU performance bottlenecks
More informationCUDA Optimizations WS Intelligent Robotics Seminar. Universität Hamburg WS Intelligent Robotics Seminar Praveen Kulkarni
CUDA Optimizations WS 2014-15 Intelligent Robotics Seminar 1 Table of content 1 Background information 2 Optimizations 3 Summary 2 Table of content 1 Background information 2 Optimizations 3 Summary 3
More informationIntroduction to CUDA CIRC Summer School 2014
Introduction to CUDA CIRC Summer School 2014 Baowei Liu Center of Integrated Research Computing University of Rochester October 20, 2014 Introduction Overview What will you learn on this class? Start from
More informationCUDA Programming (Basics, Cuda Threads, Atomics) Ezio Bartocci
TECHNISCHE UNIVERSITÄT WIEN Fakultät für Informatik Cyber-Physical Systems Group CUDA Programming (Basics, Cuda Threads, Atomics) Ezio Bartocci Outline of CUDA Basics Basic Kernels and Execution on GPU
More informationCUDA Optimization: Memory Bandwidth Limited Kernels CUDA Webinar Tim C. Schroeder, HPC Developer Technology Engineer
CUDA Optimization: Memory Bandwidth Limited Kernels CUDA Webinar Tim C. Schroeder, HPC Developer Technology Engineer Outline We ll be focussing on optimizing global memory throughput on Fermi-class GPUs
More informationParallel Hybrid Computing F. Bodin, CAPS Entreprise
Parallel Hybrid Computing F. Bodin, CAPS Entreprise Introduction Main stream applications will rely on new multicore / manycore architectures It is about performance not parallelism Various heterogeneous
More informationCUDA C Programming Mark Harris NVIDIA Corporation
CUDA C Programming Mark Harris NVIDIA Corporation Agenda Tesla GPU Computing CUDA Fermi What is GPU Computing? Introduction to Tesla CUDA Architecture Programming & Memory Models Programming Environment
More informationGPGPUs in HPC. VILLE TIMONEN Åbo Akademi University CSC
GPGPUs in HPC VILLE TIMONEN Åbo Akademi University 2.11.2010 @ CSC Content Background How do GPUs pull off higher throughput Typical architecture Current situation & the future GPGPU languages A tale of
More informationReview. Lecture 10. Today s Outline. Review. 03b.cu. 03?.cu CUDA (II) Matrix addition CUDA-C API
Review Lecture 10 CUDA (II) host device CUDA many core processor threads thread blocks grid # threads >> # of cores to be efficient Threads within blocks can cooperate Threads between thread blocks cannot
More informationParalization on GPU using CUDA An Introduction
Paralization on GPU using CUDA An Introduction Ehsan Nedaaee Oskoee 1 1 Department of Physics IASBS IPM Grid and HPC workshop IV, 2011 Outline 1 Introduction to GPU 2 Introduction to CUDA Graphics Processing
More informationCS 179: GPU Computing LECTURE 4: GPU MEMORY SYSTEMS
CS 179: GPU Computing LECTURE 4: GPU MEMORY SYSTEMS 1 Last time Each block is assigned to and executed on a single streaming multiprocessor (SM). Threads execute in groups of 32 called warps. Threads in
More informationINTRODUCTION TO GPU COMPUTING IN AALTO. Topi Siro
INTRODUCTION TO GPU COMPUTING IN AALTO Topi Siro 12.6.2013 OUTLINE PART I Introduction to GPUs Basics of CUDA PART II Maximizing performance Coalesced memory access Optimizing memory transfers Occupancy
More informationUtilisation of the GPU architecture for HPC
Utilisation of the GPU architecture for HPC A. Richardson, A. Gray EPCC, The University of Edinburgh, James Clerk Maxwell Building, Mayfield Road, Edinburgh, EH9 3JZ, UK December 15, 2008 Abstract We describe
More informationDense Linear Algebra. HPC - Algorithms and Applications
Dense Linear Algebra HPC - Algorithms and Applications Alexander Pöppl Technical University of Munich Chair of Scientific Computing November 6 th 2017 Last Tutorial CUDA Architecture thread hierarchy:
More information