CUDA by Example. The University of Mississippi Computer Science Seminar Series. April 28, 2010
|
|
- Justina Bailey
- 6 years ago
- Views:
Transcription
1 CUDA by Example The University of Mississippi Computer Science Seminar Series SINTEF ICT Department of Applied Mathematics April 28, 2010
2 Outline 1 The GPU 2 cudapi 3 CUDA MJPEG-encoding 4 Summary Applied Mathematics 2/50
3 Moore's Law Moore's Law states that the number of transistors that can be placed inexpensively on an integrated circuit has doubled approximately every two years. Applied Mathematics 3/50
4 Why GPUs? Three problems for serial computing: The power wall The von Neumann bottleneck The Instruction Level Parallelism wall We need more ops, and serial computing is no longer capable of delievering it. The frequency of new processors is not increasing anymore. One possible solution: Compute on multiple cores! Applied Mathematics 4/50
5 GPU history Applied Mathematics 5/50
6 GPU history Applied Mathematics 6/50
7 GPU history Applied Mathematics 7/50
8 The GPU cudapi CUDA MJPEG-encoding Summary GPU history Applied Mathematics 8/50
9 The GPU today The graphics card GPU - massively parallel processor (480 cores) Memory: 1.5 GB (177.4 GB/sec) Connected to the host through a PCIe x 16 Gen2 bus (8 GB/s) Processor 1401 MHz Figure: The NVIDIA GeForce GTX 480 card. Applied Mathematics 9/50
10 The GPU vs. the CPU A lot more transistors for oating point operations! But: Algorithms cannot simply be translated 1-to-1 from serial CPU-code to GPU-code. You have to parallelize the whole or parts of your algorithm to achieve eective GPU-code. Applied Mathematics 10/50
11 A heterogeneous architecture On a heterogeneous architecture several types of processors work together, each one solving the task for which it is best suited, e.g., the CPU in cooperation with the GPU. The CPU is running the show, and the GPU launches programs on many cores in parallel, as requested by the CPU-program. Do data parallel processing on the GPU, and high-level logic on the CPU. Applied Mathematics 11/50
12 CUDA - Compute Unied Device Architecture Small set of extensions to the C language Made to expose the GPU to the programmer, and allow easy access to the computational resources of the GPU Does support some C++-features, like templates, and more are being added A Fortran compiler is also available, developed by NVIDIA in cooperation with The Portland Group Applied Mathematics 12/50
13 The CUDA tools What you need to get started: 1 CUDA driver (device driver for the graphics card) 2 CUDA toolkit (CUDA compiler, runtime library etc.) 3 CUDA SDK (software development kit, with code examples) All this can be found at Applied Mathematics 13/50
14 OpenCL Open Computing Language Initially developed by Apple Has a lot in common with CUDA Released in December 2008 (version 1.0) Applied Mathematics 14/50
15 Our rst example A HelloWorld-type of application using CUDA. Calculate decimals of π by using geometric observations. This is not the best way to calculate π, but is serves us good as an example of parallel programming with CUDA. Applied Mathematics 15/50
16 p = πr 2 4r 2 (1) π = 4p (2) We can calculate the ratio p to get an estimate of π: 1 By placing n dots within the square, some fraction k of these dots will lie inside the circle. 2 This gives us p k n and π 4k n. Applied Mathematics 16/50
17 The CUDA grid Applied Mathematics 17/50
18 The CUDA grid We set our block size to 16x16. The block size is a dicult parameter to set, and it can have a big impact on performance. Applied Mathematics 18/50
19 The CUDA grid Then we set our grid to be 8x8. This gives us (16 8) x (16 8) = threads totally. If we use a larger grid we get a ner resultion, and a better estimate of π. Applied Mathematics 19/50
20 The thread workload We could let each thread represent one pixel, but this would not give each thread much of a workload. Therefore, we let each thread calculate several points. Applied Mathematics 20/50
21 Setup on the CPU (host) The dim3-variables are used later when we call our CUDA-program. const int width = 128; const int height = 128; // set the block size const dim3 blocksize (16, 16); // determine the size of the grid const size_t gridwidth = width / blocksize. x; const size_t gridheight = height / blocksize. y; const dim3 gridsize ( gridwidth, gridheight ); // number of points per thread (=m ^2) const int m = 10; Applied Mathematics 21/50
22 Allocating device memory First we allocate memory on the device (the GPU), which we will use to save our intermediate results to. cudamallocpitch allocates width*height*sizeof(float) bytes of linear memory on the device. Ensures ecient memory access, when address is updated from row to row. float * d_results ; size_t d_pitch ; // allocate device memory CUDA_SAFE_CALL ( cudamallocpitch (( void **)& d_results, & d_pitch, width * sizeof ( float ), height )); Applied Mathematics 22/50
23 Allocating host memory We also need to allocate memory on the host, so we have somewhere to download our intermediate results to. // allocate host memory float * h_results = new float [ width * height ]; Applied Mathematics 23/50
24 The CUDA kernel The global -keyword denes a CUDA kernel. global void cudapikernel ( float * results, size_t pitch ) { int i = blockidx. x * blockdim. x + threadidx. x; int j = blockidx. y * blockdim. y + threadidx. y; float dx = 1.0 f / ( float ) ( griddim. x * blockdim. x ); float dy = 1.0 f / ( float ) ( griddim. y * blockdim. y );... int inside = 0; Applied Mathematics 24/50
25 The CUDA kernel cont'd... Calculate whether the points (x, y) are inside our outside the unit circle. for ( int l = 0; l < m; ++ l) { float y = j / ( float ) ( griddim.y * blockdim.y ); y += dy * (l /( float )m ); for ( int k = 0; k < m; ++ k) { float x = i / ( float ) ( griddim.x * blockdim.x ); x += dx * (k /( float )m ); if ( x * x + y * y < 1.0 f) { // point is inside circle! ++ inside ; } } } float * elementptr = ( float *) (( char *) results + j * pitch ); } elementptr [ i] = inside ; Applied Mathematics 25/50
26 Calling the CUDA kernel Now we know enough to write our call to the CUDA-kernel. // run kernel cudapikernel <<< gridsize, blocksize >>>( d_results, d_pitch ); CUT_CHECK_ERROR (" cudapikernel " ); Applied Mathematics 26/50
27 Device to host copy Now we copy the intermediate results from the GPU to the CPU. // fetch results from device CUDA_SAFE_CALL ( cudamemcpy2d ( h_results, width * sizeof ( float ), d_results, d_pitch, width * sizeof ( float ), height, cudamemcpydevicetohost )); Applied Mathematics 27/50
28 The host code Lastly, we calculate π from the intermediate results we fetched from the device. // sum up results from each CUDA - thread float k = 0.0; for ( int i = 0; i < width * height ; ++i) { k += h_results [ i ]; } // calculate final result int n = ( width * m) * ( height * m ); float pi = 4 * (( float ) k / n ); cout << " PI is ( approximately ): " << pi << endl ; Applied Mathematics 28/50
29 Optimization: Allocating host memory using the CUDA API We should also allocate memory on the host using the CUDA API. This ensures fast memory transfers between the device and the host. cudamallochost allocates page-locked memory that is accessible to the device. float * h_results ; // allocate host memory CUDA_SAFE_CALL ( cudamallochost (( void **)& h_results, width * height * sizeof ( float ))); Applied Mathematics 29/50
30 Demo Applied Mathematics 30/50
31 JPEG A lossy compression method for photographic images Applied Mathematics 31/50
32 Motion-JPEG A videoformat where each frame is individually compressed as a JPEG image Uses no inter-frame compression (motion compensation) Used by many portable devices, e.g., webcams and other devices that stream video Applied Mathematics 32/50
33 CPU-version of the algorithm We already have a CPU-version of the algorithm for M-JPEG encoding. It is often the case that you want to accelerate some already existing algorithm. Understanding the algorithm in detail is important. Applied Mathematics 33/50
34 M-JPEG encoding RGB > YUV Split up image into macroblocks DCT Quantize Zig zag image, truncate and do Huffman Split the image into macroblocks of size 8x8. Applied Mathematics 34/50
35 M-JPEG encoding RGB > YUV Split up image into macroblocks DCT Quantize Zig zag image, truncate and do Huffman Subtract 128 to shift the values so that they are centered around zero. Perform a two-dimensional DCT on each macroblock, converting them into a frequency-domain representation. Applied Mathematics 34/50
36 M-JPEG encoding RGB > YUV Split up image into macroblocks DCT Quantize Zig zag image, truncate and do Huffman Reduce the amount of information in the high frequency components, by simply dividing each component by a predened constant. The human eye is not so good at distinguishing the exact strength of a high frequency brightness variation. Applied Mathematics 34/50
37 M-JPEG encoding RGB > YUV Split up image into macroblocks DCT Quantize Zig zag image, truncate and do Huffman Go through the macroblock in a zigzag-pattern. Remove the trailing zeros. Human-encoding is a lossless compression algorithm which further compresses the result. Applied Mathematics 34/50
38 Mapping an algorithm to the GPU 1 Identify which parts are most computationally demanding (by proling) 2 Investigate if all or some of these parts can be done in a parallel fashion 3 Write CUDA-kernels for these parts, which are called from the host code 4 Repeat Applied Mathematics 35/50
39 Proling the CPU-version By running a proler like gprof (remember to compile your code with -gp), we can determine which functions are dominating our programs runtime. We nd that the DCT spends well over 90% of the runtime. Applied Mathematics 36/50
40 Overview CPU Read frame from file GPU Split up image into macroblocks DCT Zigzag, truncate and Huffman Quantize Write to file Figure: Overview CPU/GPU. Applied Mathematics 37/50
41 DCT on the CPU Let us take a look at the CPU-version's DCT. For each macroblock, the following code is executed: for ( int u = 0; u < 8; ++u) { for ( int v = 0; v < 8; ++v) { float dct = 0; for ( int j = 0; j < 8; ++j) { for ( int i = 0; i < 8; ++i) { float coeff = in_data [( y+j )* width +( x+i )] f; dct += coeff * ( float ) ( cos ((2* i +1)* u* PI /16.0 f) * cos ((2* j +1)* v* PI /16.0 f )); } } float a1 =! u? ISQRT2 : 1.0 f; float a2 =! v? ISQRT2 : 1.0 f; /* Scale according to normalizing function */ dct *= a1 * a2 /4.0 f;... Applied Mathematics 38/50
42 Quantization on the CPU......and the quantization: } } /* Quantize */ out_data [( y+v )* width +( x+u )] = ( int16_t )( floor (0.5 f + dct / ( float )( quantization [v *8+ u ]))); Applied Mathematics 39/50
43 The GPU compute grid VIDEO FRAME MACROBLOCK PIXEL GPU COMPUTE GRID GPU COMPUTE BLOCK THREAD Figure: One videoframe and the GPU compute grid. Applied Mathematics 40/50
44 Quantization matrices We store the three quantization matrices (for Y, U and V) in constant memory on the device. /* * * Quantization matrices */ constant float yquanttbl [] = { 16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40, 26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61, 30, 57, 51, 56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80, 109, 81, 87, 95, 98, 103, 104, 103, 62, 77, 113, 121, 112, 100, 120, 92, 101, 103, 99 };... Applied Mathematics 41/50
45 The CUDA-kernel Reads one macroblock into shared memory. syncthreads() is a barrier, which make threads wait until all threads have reached this point in the kernel. global void cudadct ( float * output, size_t output_pitch float * input, size_t input_pitch ) { const int bx = blockidx. x; const int by = blockidx. y; const int tx = threadidx. x; const int ty = threadidx. y; const int x = ( bx * 8) + tx ; const int y = ( by * 8) + ty ; shared float macroblock [8][8]; float * inputptr = ( float *)(( char *) input + y * input_pitch ); macroblock [ ty ][ tx ] = inputptr [ x ]; syncthreads (); Applied Mathematics 42/50
46 The CUDA-kernel cont'd... cosf is an intrinsic function. float dct = 0; for ( int j = 0; j < 8; ++ j) { for ( int i = 0; i < 8; ++ i) { float coeff = macroblock [ j ][ i] f; dct += coeff * cosf ((2 * i + 1) * tx * PI / 16.0 f) * cosf ((2 * j + 1) * ty * PI / 16.0 f ); } } float a1 =! tx? ISQRT2 : 1.0 f; float a2 =! ty? ISQRT2 : 1.0 f; /* Scale according to normalizing function */ dct *= a1 * a2 / 4.0 f; /* Quantize */ float * inputptr = ( float *)(( char *) output + y * output_pitch ); } output [ x] = dct / yquanttbl [ ty * 8 + tx ]; Applied Mathematics 43/50
47 Moving data between host and device Using cudamemcpy2d, similar to the cudapi-example: // copy image to device CUDA_SAFE_CALL ( cudamemcpy2d ( h_in_data, h_pitch_in, d_in_data, d_pitch_in, width * sizeof ( float ), height, cudamemcpyhosttodevice )); // launch kernel cudadct <<< gridsize, blocksize >>>( d_out_data, d_pitch_out d_in_data, d_pitch_in ); CUT_CHECK_ERROR (" cudadct " ); // copy image back to host CUDA_SAFE_CALL ( cudamemcpy2d ( d_out_data, d_pitch_out, h_out_data, h_pitch_out, width * sizeof ( float ), height, cudamemcpydevicetohost )); Applied Mathematics 44/50
48 Optimizations Run kernel on four consecutive macroblocks to achieve coalescing. Applied Mathematics 45/50
49 Optimizations cont'd Threaded I/O on host Double-buering input and output buers on the CPU Makes it possible to do le IO and GPU memory transfers simultaneously Can be implemented using threading on the CPU, e.g., boost::thread Could also run the Human-encoding in a separate thread, since this is a compute intensive algorithm Applied Mathematics 46/50
50 Optimizations cont'd Streams Utilizing CUDA streams Uses asynchronous memory transfers Allows overlapping of uploading, kernel invocation, and downloading Applied Mathematics 47/50
51 Is GPU-computing worth the eort? It takes time to learn a new technology and a new platform. It will take time to rewrite your existing algorithms. But: You will get signicant speed ups (5-100X) of algorithms that benet from parallelism. Once you have your parallel algorithms, they will scale on newer generations of parallel hardware. Applied Mathematics 48/50
52 CUDA Documentation Programming Guide Reference Manual Best Practices Guide Pay special attention to the Performance Guidelines-section of the programming guide to get the most performance out of your CUDA-apps Applied Mathematics 49/50
53 Good luck with your CUDA-programming, and thank you :-) Contact: Applied Mathematics 50/50
Lecture 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 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 informationOutline 2011/10/8. Memory Management. Kernels. Matrix multiplication. CIS 565 Fall 2011 Qing Sun
Outline Memory Management CIS 565 Fall 2011 Qing Sun sunqing@seas.upenn.edu Kernels Matrix multiplication Managing Memory CPU and GPU have separate memory spaces Host (CPU) code manages device (GPU) memory
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 informationCUDA. Schedule API. Language extensions. nvcc. Function type qualifiers (1) CUDA compiler to handle the standard C extensions.
Schedule CUDA Digging further into the programming manual Application Programming Interface (API) text only part, sorry Image utilities (simple CUDA examples) Performace considerations Matrix multiplication
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 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 informationGPU Programming Using CUDA. Samuli Laine NVIDIA Research
GPU Programming Using CUDA Samuli Laine NVIDIA Research Today GPU vs CPU Different architecture, different workloads Basics of CUDA Executing code on GPU Managing memory between CPU and GPU CUDA API Quick
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 informationIntroduction to CUDA
Introduction to CUDA Overview HW computational power Graphics API vs. CUDA CUDA glossary Memory model, HW implementation, execution Performance guidelines CUDA compiler C/C++ Language extensions Limitations
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 informationProgramming with CUDA, WS09
Programming with CUDA and Parallel Algorithms Waqar Saleem Jens Müller Lecture 3 Thursday, 29 Nov, 2009 Recap Motivational videos Example kernel Thread IDs Memory overhead CUDA hardware and programming
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 informationIntroduction to CUDA (1 of n*)
Administrivia Introduction to CUDA (1 of n*) Patrick Cozzi University of Pennsylvania CIS 565 - Spring 2011 Paper presentation due Wednesday, 02/23 Topics first come, first serve Assignment 4 handed today
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 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 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 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 informationGPU Programming Using CUDA. Samuli Laine NVIDIA Research
GPU Programming Using CUDA Samuli Laine NVIDIA Research Today GPU vs CPU Different architecture, different workloads Basics of CUDA Executing code on GPU Managing memory between CPU and GPU CUDA API Quick
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 informationModule 3: CUDA Execution Model -I. Objective
ECE 8823A GPU Architectures odule 3: CUDA Execution odel -I 1 Objective A more detailed look at kernel execution Data to thread assignment To understand the organization and scheduling of threads Resource
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 informationCUDA (Compute Unified Device Architecture)
CUDA (Compute Unified Device Architecture) Mike Bailey History of GPU Performance vs. CPU Performance GFLOPS Source: NVIDIA G80 = GeForce 8800 GTX G71 = GeForce 7900 GTX G70 = GeForce 7800 GTX NV40 = GeForce
More informationGeneral-purpose computing on graphics processing units (GPGPU)
General-purpose computing on graphics processing units (GPGPU) Thomas Ægidiussen Jensen Henrik Anker Rasmussen François Rosé November 1, 2010 Table of Contents Introduction CUDA CUDA Programming Kernels
More informationGeneral Purpose GPU programming (GP-GPU) with Nvidia CUDA. Libby Shoop
General Purpose GPU programming (GP-GPU) with Nvidia CUDA Libby Shoop 3 What is (Historical) GPGPU? General Purpose computation using GPU and graphics API in applications other than 3D graphics GPU accelerates
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 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 informationNVIDIA GPU CODING & COMPUTING
NVIDIA GPU CODING & COMPUTING WHY GPU S? ARCHITECTURE & PROGRAM MODEL CPU v. GPU Multiprocessor Model Memory Model Memory Model: Thread Level Programing Model: Logical Mapping of Threads Programing Model:
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 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 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 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 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 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 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 informationMathematical computations with GPUs
Master Educational Program Information technology in applications Mathematical computations with GPUs CUDA Alexey A. Romanenko arom@ccfit.nsu.ru Novosibirsk State University CUDA - Compute Unified Device
More informationCSE 591: GPU Programming. Programmer Interface. Klaus Mueller. Computer Science Department Stony Brook University
CSE 591: GPU Programming Programmer Interface Klaus Mueller Computer Science Department Stony Brook University Compute Levels Encodes the hardware capability of a GPU card newer cards have higher compute
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 informationIntroduction to GPU Computing Junjie Lai, NVIDIA Corporation
Introduction to GPU Computing Junjie Lai, NVIDIA Corporation Outline Evolution of GPU Computing Heterogeneous Computing CUDA Execution Model & Walkthrough of Hello World Walkthrough : 1D Stencil Once upon
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 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 informationCOMP 322: Fundamentals of Parallel Programming. Flynn s Taxonomy for Parallel Computers
COMP 322: Fundamentals of Parallel Programming Lecture 37: General-Purpose GPU (GPGPU) Computing Max Grossman, Vivek Sarkar Department of Computer Science, Rice University max.grossman@rice.edu, vsarkar@rice.edu
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 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 informationCUDA Programming. Aiichiro Nakano
CUDA Programming Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials Science
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 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 informationHigh Performance Linear Algebra on Data Parallel Co-Processors I
926535897932384626433832795028841971693993754918980183 592653589793238462643383279502884197169399375491898018 415926535897932384626433832795028841971693993754918980 592653589793238462643383279502884197169399375491898018
More informationCUDA Basics. July 6, 2016
Mitglied der Helmholtz-Gemeinschaft CUDA Basics July 6, 2016 CUDA Kernels Parallel portion of application: execute as a kernel Entire GPU executes kernel, many threads CUDA threads: Lightweight Fast switching
More informationGPU Computing: A Quick Start
GPU Computing: A Quick Start Orest Shardt Department of Chemical and Materials Engineering University of Alberta August 25, 2011 Session Goals Get you started with highly parallel LBM Take a practical
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 informationCS179 GPU Programming Recitation 4: CUDA Particles
Recitation 4: CUDA Particles Lab 4 CUDA Particle systems Two parts Simple repeat of Lab 3 Interacting Flocking simulation 2 Setup Two folders given particles_simple, particles_interact Must install NVIDIA_CUDA_SDK
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 informationImage convolution with CUDA
Image convolution with CUDA Lecture Alexey Abramov abramov _at_ physik3.gwdg.de Georg-August University, Bernstein Center for Computational Neuroscience, III Physikalisches Institut, Göttingen, Germany
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 informationECE 408 / CS 483 Final Exam, Fall 2014
ECE 408 / CS 483 Final Exam, Fall 2014 Thursday 18 December 2014 8:00 to 11:00 Central Standard Time You may use any notes, books, papers, or other reference materials. In the interest of fair access across
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 informationThis is a draft chapter from an upcoming CUDA textbook by David Kirk from NVIDIA and Prof. Wen-mei Hwu from UIUC.
David Kirk/NVIDIA and Wen-mei Hwu, 2006-2008 This is a draft chapter from an upcoming CUDA textbook by David Kirk from NVIDIA and Prof. Wen-mei Hwu from UIUC. Please send any comment to dkirk@nvidia.com
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 informationINTRODUCTION TO GPU COMPUTING IN AALTO. Topi Siro
INTRODUCTION TO GPU COMPUTING IN AALTO Topi Siro 11.6.2014 PART I Introduction to GPUs Basics of CUDA (and OpenACC) Running GPU jobs on Triton Hands-on 1 PART II Optimizing CUDA codes Libraries Hands-on
More informationBasic Elements of CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono
Basic Elements of CUDA Algoritmi e Calcolo Parallelo References q This set of slides is mainly based on: " CUDA Technical Training, Dr. Antonino Tumeo, Pacific Northwest National Laboratory " Slide of
More informationCUDA C/C++ BASICS. NVIDIA Corporation
CUDA C/C++ BASICS NVIDIA Corporation What is CUDA? CUDA Architecture Expose GPU parallelism for general-purpose computing Retain performance CUDA C/C++ Based on industry-standard C/C++ Small set of extensions
More informationLessons learned from a simple application
Computation to Core Mapping Lessons learned from a simple application A Simple Application Matrix Multiplication Used as an example throughout the course Goal for today: Show the concept of Computation-to-Core
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 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 informationOpenCL parallel Processing using General Purpose Graphical Processing units TiViPE software development
TiViPE Visual Programming OpenCL parallel Processing using General Purpose Graphical Processing units TiViPE software development Technical Report Copyright c TiViPE 2012. All rights reserved. Tino Lourens
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 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 informationData Parallel Execution Model
CS/EE 217 GPU Architecture and Parallel Programming Lecture 3: Kernel-Based Data Parallel Execution Model David Kirk/NVIDIA and Wen-mei Hwu, 2007-2013 Objective To understand the organization and scheduling
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 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 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 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 informationComputation to Core Mapping Lessons learned from a simple application
Lessons learned from a simple application Matrix Multiplication Used as an example throughout the course Goal for today: Show the concept of Computation-to-Core Mapping Block schedule, Occupancy, and thread
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 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 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 informationCS 179: GPU Computing
CS 179: GPU Computing LECTURE 2: INTRO TO THE SIMD LIFESTYLE AND GPU INTERNALS Recap Can use GPU to solve highly parallelizable problems Straightforward extension to C++ Separate CUDA code into.cu and.cuh
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 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 informationParallel Programming and Debugging with CUDA C. Geoff Gerfin Sr. System Software Engineer
Parallel Programming and Debugging with CUDA C Geoff Gerfin Sr. System Software Engineer CUDA - NVIDIA s Architecture for GPU Computing Broad Adoption Over 250M installed CUDA-enabled GPUs GPU Computing
More informationCUDA Performance Optimization. Patrick Legresley
CUDA Performance Optimization Patrick Legresley Optimizations Kernel optimizations Maximizing global memory throughput Efficient use of shared memory Minimizing divergent warps Intrinsic instructions Optimizations
More informationPerformance Diagnosis for Hybrid CPU/GPU Environments
Performance Diagnosis for Hybrid CPU/GPU Environments Michael M. Smith and Karen L. Karavanic Computer Science Department Portland State University Performance Diagnosis for Hybrid CPU/GPU Environments
More informationAutomatic translation from CUDA to C++ Luca Atzori, Vincenzo Innocente, Felice Pantaleo, Danilo Piparo
Automatic translation from CUDA to C++ Luca Atzori, Vincenzo Innocente, Felice Pantaleo, Danilo Piparo 31 August, 2015 Goals Running CUDA code on CPUs. Why? Performance portability! A major challenge faced
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 informationCUDA Parallel Programming Model. Scalable Parallel Programming with CUDA
CUDA Parallel Programming Model Scalable Parallel Programming with CUDA Some Design Goals Scale to 100s of cores, 1000s of parallel threads Let programmers focus on parallel algorithms not mechanics of
More informationGPU Computing Workshop CSU Getting Started. Garland Durham Quantos Analytics
1 GPU Computing Workshop CSU 2013 Getting Started Garland Durham Quantos Analytics nvidia-smi 2 At command line, run command nvidia-smi to get/set GPU properties. nvidia-smi Options: -q query -L list attached
More informationCUDA Parallel Programming Model Michael Garland
CUDA Parallel Programming Model Michael Garland NVIDIA Research Some Design Goals Scale to 100s of cores, 1000s of parallel threads Let programmers focus on parallel algorithms not mechanics of a parallel
More informationGPU Programming for Mathematical and Scientific Computing
GPU Programming for Mathematical and Scientific Computing Ethan Kerzner and Timothy Urness Department of Mathematics and Computer Science Drake University Des Moines, IA 50311 ethan.kerzner@gmail.com timothy.urness@drake.edu
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 informationCUDA Memory Types All material not from online sources/textbook copyright Travis Desell, 2012
CUDA Memory Types All material not from online sources/textbook copyright Travis Desell, 2012 Overview 1. Memory Access Efficiency 2. CUDA Memory Types 3. Reducing Global Memory Traffic 4. Example: Matrix-Matrix
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 informationModule Memory and Data Locality
GPU Teaching Kit Accelerated Computing Module 4.4 - Memory and Data Locality Tiled Matrix Multiplication Kernel Objective To learn to write a tiled matrix-multiplication kernel Loading and using tiles
More informationCOSC 462 Parallel Programming
November 22, 2017 1/12 COSC 462 Parallel Programming CUDA Beyond Basics Piotr Luszczek Mixing Blocks and Threads int N = 100, SN = N * sizeof(double); global void sum(double *a, double *b, double *c) {
More informationGPU ACCELERATED DATABASE MANAGEMENT SYSTEMS
CIS 601 - Graduate Seminar Presentation 1 GPU ACCELERATED DATABASE MANAGEMENT SYSTEMS PRESENTED BY HARINATH AMASA CSU ID: 2697292 What we will talk about.. Current problems GPU What are GPU Databases GPU
More informationLecture 2: Introduction to CUDA C
CS/EE 217 GPU Architecture and Programming Lecture 2: Introduction to CUDA C David Kirk/NVIDIA and Wen-mei W. Hwu, 2007-2013 1 CUDA /OpenCL Execution Model Integrated host+device app C program Serial or
More informationToday s Content. Lecture 7. Trends. Factors contributed to the growth of Beowulf class computers. Introduction. CUDA Programming CUDA (I)
Today s Content Lecture 7 CUDA (I) Introduction Trends in HPC GPGPU CUDA Programming 1 Trends Trends in High-Performance Computing HPC is never a commodity until 199 In 1990 s Performances of PCs are getting
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 informationNVJPEG. DA _v0.2.0 October nvjpeg Libary Guide
NVJPEG DA-06762-001_v0.2.0 October 2018 Libary Guide TABLE OF CONTENTS Chapter 1. Introduction...1 Chapter 2. Using the Library... 3 2.1. Single Image Decoding... 3 2.3. Batched Image Decoding... 6 2.4.
More information