Memory Management. Memory Access Bandwidth. Memory Spaces. Memory Spaces
|
|
- Camron Dawson
- 6 years ago
- Views:
Transcription
1 Memory Access Bandwidth Memory Management Bedrich Benes, Ph.D. Purdue University Department of Computer Graphics Technology High Performance Computer Graphics Lab Host and device different memory spaces How fast is the access? (2009 CPU Intel Pentium i7, GT200) CPU Memory approx 20 GB/sec GPU Main memory 2x 4 GB/sec (r/w) GPU GDRAM approx 150 GB/sec GTX GB/s 1.5 GB GTX GB/s Device manages its own memory Host manages its own memory and some device memory Host manages data copy between host and device and d2d Image courtesy of NVIDIA Image courtesy of NVIDIA 1
2 - speed Main Memory L3 cache 200 cycles L3 cache L1/L2 cache cycles, Device Memory Linear memory The most commonly used cudafree(), cudamalloc(),cudamallocpitch(), cudamalloc3d(), etc. L1/L2 cache registers 5-12 cycles CUDA Arrays Texture memory Surface memory 1) Global Memory (R/W) Slow. Accessible to all threads. Much slower than SM. Accessible from device and host. Lives with the application. Up to 6GB. 2) Constant Memory (R) Fast read when all threads access the same location. Accessed by all threads. Accessible from device and host. Lives with the application. Limit to 65 kb 2
3 3) Shared Memory (R/W) On-chip. Very fast. As fast as register (if no bank conflicts or not reading the same space). Allocated to thread blocks. 3) Shared Memory (R/W) Accessible by ANY thread within block Dies with the block. Accessible from device kB 4) Registers (R/W) On-chip. Very fast. 5) Local Memory (R/W) Can be much slower than SM. Allocated to a thread Accessible by one thread Dies with a thread. Dies with a thread. Accessible from device Accessible from device. 3
4 5) Texture Memory (R) (Cuda Array) Can be 150x slower than SM. If cached can be faster. Accessible to all threads. Lives with the application. Special look-up functions Accessible from device and host. SM vs. Global/Local memory: GPU access memory command: 4 clock cycles Local/Global memory access: cycles GPU SM access: 4 clock cycles SM access is approx x faster!!! Local variables are by default in registers. If too many local resources are used, compiler can locate a variable into the local memory How do I know where my variable lives? Compile with ptx or keep parameter and see the assembly code 4
5 the assembly code.reg.u16 %rh<6>;//register unsigned int16.reg.u32 %r<29>;//register unsigned int32.reg.f32 %f<24>;//register float 32.loc //local variable Device and Host Pointers Coding suggestions Starting a variable with d indicates it points to device h indicates it points to host float *dptr; //pointer to device float *hptr; //pointer to host Device and Host Pointers Both pointers live in the host memory But they point to different spaces Device and Host Pointers Host pointers are accessed/manipulated by standard C/C++ constructs malloc, free, new, delete *dptr; *hptr; Host Memory *hptr Device Memory Device pointers cannot be used in the same way. They need special functions. *dptr 5
6 GPU Linear Memory 1D cudamalloc(void **ptr, sizet_t n) cudamemset(void **ptr, int val, sizet_t n) cudafree(void *ptr) Example: int n=128; int size=n*sizeof(float); int *da; cudamalloc((void **)&da,size); cudamemset(da,0,size); cudafree(da); Data Copy Linear Memory 1D cudamemcpy(void *dst, void *src, size_t n, enum cudamemorykind direction) enum cudamemorykind cudamemorycpyhosttodevice cudamemorycpydevicetohost cudamemorycpydevicetodevice Data Copy Linear Memory 1D Does NOT start until all CUDA calls complete (synchronous) Does NOT let CPU work, while copying (blocks CPU thread) It is a safe call Note: Asynchronous calls exist in CUDA Data Copy 1D Example float* h_a,* h_b,* h_c; //host pts float* d_a,* d_b,* d_c; //device ptrs int N = 50000; size_t size = N * sizeof(float); // Allocate input vectors h_a and h_b in host memory h_a = (float*)malloc(size); h_b = (float*)malloc(size); h_c = (float*)malloc(size); for (int i=0;i<n;i++) { a[i]= (float)i/n; b[i]=1-(float)i/n; } 6
7 Data Copy 1D Example // Allocate vectors in device memory cudamalloc((void**)&d_a,size); cudamalloc((void**)&d_b,size); cudamalloc((void**)&d_c,size); // Copy vectors from host memory to device memory cudamemcpy(d_a,h_a,size,cudamemcpyhosttodevice); cudamemcpy(d_b,h_b,size,cudamemcpyhosttodevice); //kernel would be executed here cudamemcpy(d_b,d_a,size,cudamemcpydevicetodevice); // Copy result from device memory to host memory cudamemcpy(h_c,d_c,size,cudamemcpydevicetohost); GPU Linear Memory 2D cudamallocpitch(void **ptr, sizet_t &pitch, size_t width, size_t height) Used for 2D arrays of width x height GPU performs better when the data is correctly aligned (on multiples of 2 ) pitch says what is being used per row (can be bigger than the column expected) It pads the allocation for a good performance GPU Linear Memory 2D Having an array of 12 float rows, CUDA may pad it to pitch=16 floats: an array row: [ ] GPU Linear Memory 2D rows you have to deal with this while using it columns pitch 7
8 GPU Linear Memory 2D 2D Memory allocation: const int w=h=500;//with and height are the same float *dptr, a[w][h]; size_t pitch; //size_t is important error=cudamallocpitch((void**)&dptr;&pitch,w,h); //check the error Kernel<<<100,512>>>(dPtr,pitch,w,h); Kernel2<<<100,512>>>(dPtr,pitch); GPU Linear Memory 2D 2D Memory Access row and column are known (from the kernel indices), pitch is known from the allocation, and the element is of type *T. Its location is: T* pelement =(T*)((char*)baseAddress+ row*pitch)+column; GPU Linear Memory 2D //kernel with nested cycles global void Kernel(float *dptr, int pitch, int w, int h) { for (int r=0;r<h;r++) { float *row=(float*)((char*)dptr+r*pitch); for (int c=0;c<w;c++) { float element=row[c]; //do some operation }//of for c }//of for r }//of Kernel GPU Linear Memory 2D //kernel with implicit indexing global void Kernel2(float *dptr, int pitch) { int i=blockdim.x*blockidx.x+threadidx.x; int j=blockdim.y*blockidx.y+threadidx.y; if ((i>=n) (j>=n)) return; float *elm=(float*)((char*)dptr+j*pitch)+i; *elm=0.5;//sets the value in the 2D array }//of Kernel 8
9 Data Copy Linear Memory 2D cudamemcpy2d(void *dst, size_t dpitch, void *src, size_t spitch, size_t w, size_t h, enum cudamemorykind direction) enum cudamemorykind cudamemorycpyhosttodevice cudamemorycpydevicetohost cudamemorycpydevicetodevice Data Copy Linear Memory 2D uses two pitch values, one for the source and one for the destination in the host memory, the pitch is usually the size of the row (in bytes) Data Copy 2D Example const int MAX=500;//will need to be pitched float a[max][max] float *dptr; size_t pitch; int maxbytes=max*sizeof(float); error=cudamallocpitch((void**)&dptr,&pitch,maxbytes,max); error=cudamemcpy2d(dptr,pitch, a,maxbytes, maxbytes,max, cudamemcpyhosttodevice); Kernel2<<<100,200>>>(dPtr,pitch); error=cudamemcpy2d(a,maxbytes, dptr,pitch,maxbytes,max, cudamemcpydevicetohost); GPU Linear Memory 3D cudamalloc3d( struct cudapitchedptr *pitcheddevptr, struct cudaextent extent) cudamemcpy3d( const struct cudamemcpy3dparms *p) 9
10 Constant Memory Similar to global variables. Read only. 64kB only, but very useful. Defined with global scope within the kernel file constant Initialized by the host cudamemcpytosymbol, cudamemcpyfromsymbol Constant Memory Similar to global variables but read only. Defined with global scope within the kernel file constant Initialized by the host cudamemcpytosymbol, cudamemcpyfromsymbol Constant Variables const float PI= ; Page-locked (Pinned) Memory On the host Will be in registers, as long as there is enough space otherwise in global memory. Can be read by the GPU directly and processed concurrently with the kernel execution Will not be in the constant memory. Useful for single read 10
11 Page-locked (Pinned) Memory cudaallochost(void **ph,sizet_t n,int attribs) cudafreehost(void *ph) attribs can be: cudahostallocwritecombined cudahostallocmapped cudahostallocportable Portable Memory page-locked memory has the benefits only for the host thread that created it by making it portable the memory is available for all host threads Write-Combining memory page-locked memory uses L1 and L2 cudahostallocwritecombined makes it write-combined does not use cache (more cache for other things) not snooped during PCIEx (40% faster) reading from the host is slow should be used for host writes only Mapped Memory some devices can map the page-locked memory to the device address space no need for reads/writes between host and device! the same page has two pointers one for the host and one for the device multiple GPUs can access the same page 11
12 Mapped Memory cudahostgetdevicepointer(void **pd, void *phost, unsigned int flags) maps the pointer at host ph (taken from cudamallochost()) and maps it to the device space pd flags is unused for now Mapped Memory #if CUDART_VERSION<2020 #error No support for mapped memory!\n #endif //Check if device 0 supports mapped memory cudadeviceprop devprop; cudagetdeviceproperties(&devprop,0); if(!devprop.canmaphostmemory) { printf("device cannot map host memory!\n ); exit(exit_failure); } Mapped Memory size_t=1024*sizeof(float); float *ah,*ad; cudahostalloc((void **)&ah, size, cudahostallocmapped); Page-locked (Pinned) Memory Speedup? vector addition on Quadro FX 770M 10,000x reading and writing the results //Get the device pointers to memory mapped cudahostgetdevicepointer((void **)&ad, (void *)ah,0); 12
13 Device Memory Linear memory The most commonly used cudafree(), cudamalloc(),cudamallocpitch(), cudamalloc3d(), etc. CUDA Arrays Texture memory Surface memory Texture Memory (CUDA Array) can be faster than the global memory is a global memory with cached access cache is optimized for 2D spatial locality designed for streaming fetches read by kernel using texture fetches Texture Memory texture reference is an object texture must be bounded, has attributes texture can be linear mem or CUDA array texture can be shared with OpenGL Texture Declaration texture<type,dim,readmode> texref; type: float, basic integer dim: 1,2,3 readmode: cudareadmodenormalizedfloat ranges: [0,1] or [-1,1] cudareadmodeelementtype ranges: 0 0XFF 13
14 Texture Declaration NTC (normalized texture coordinates) are in range [0,1] using floating point textures allows for wrapping filtering using integer textures outside values are clamped Texture Binding cudabindtexture( size_t *offset, const struct texturereference *texref, const void *devptr, const struct cudachannelformatdesc *desc, size_t size) offset - returned because of alignment texref the texture to bind devptr memory address on the device desc channel format size size of the memory Texture Binding struct texturereference{ int normalized; enum cudatexturefiltermode filtermode, enum cudatextureaddressmode addressmode[3]; struct cudachannelformatdesc channeldesc; } normalized: ~ if 0, values are [0,,width-1]x[0,,height-1]x[0,,depth-1] ~ if 1, values are [0,1] 3 Texture Binding filter mode: specifies the filtering mode cudafiltermodepoint nearest neighbor sampling cudafiltermodelinear (bi/tri) linear intrpolation (valid only for floating point types) 14
15 Texture Binding address mode: defines what values out of range cudaaddressmodeclamp clamped to the valid range cudaaddressmodewrap wrapped to the valid range (valid only for floating point types) Texture Binding channel Description: struct cudachannelformatdesc( int x,y,z,w; # of bits per component enum cudachannelformatkind f) cudachannelformatkind cudachannelformatkindsigned cudachannelformatkindunsigned cudachannelformatkindfloat Texture Binding Example cudachannelformatdesc channeldesc= cudacreatechanneldesc(32,0,0,0,cudachannelformatkindfloat); cudaarray* cu_array;//cuda array cudamallocarray(&cu_array,&channeldesc,width,height); cudamemcpytoarray(cu_array,0,0,h_data,size, cudamemcpyhosttodevice)); tex.addressmode[0]=cudaaddressmodewrap; tex.addressmode[1]=cudaaddressmodewrap; tex.filtermode=cudafiltermodelinear; tex.normalized=true; cudabindtexturetoarray(tex,cu_array,channeldesc); //there is no input of the kernel, it is the texture BlurKernel<<<dimGrid,dimBlock>>>(d_data,width,height); Texture Binding Example texture<float,2,cudareadmodeelementtype> tex; global void BlurKernel(float* d_data,int w, int h) { unsigned int x=blockidx.x*blockdim.x + threadidx.x; unsigned int y=blockidx.y*blockdim.y + threadidx.y; float u=x/(float)w;float v=y/(float)h;//the textel itself //plus minus one in botm u and v float up=(x+1)/(float)w;float um=(x-1)/(float)w; float vp=(y+1)/(float)h;float vm=(y-1)/(float)h; //read from texture, sum all nine neighbors, divide by nine //and write to global memory d_data[y*width + x]=(tex2d(tex,u,v)+tex2d(tex,up,v)+ tex2d(tex,um,v)+tex2d(tex,u,vp)+tex2d(tex,u,vm)+ tex2d(tex,up,vp)+tex2d(tex,up,vm)+tex2d(tex,um,vp)+ tex2d(tex,um,vm))/9.f; } 15
16 Texture Memory rather complicated setup can be faster than the global memory (it is cached) Surface Memory (CUDA Array) Cubemap Textures with R and W access surf2dread( ) surf2dwrite( ) good for large read-only inputs Reading CUDA Programming Guide Kirk, D.B., Hwu, W.W., Programming Massively Parallel Processors, NVIDIA, Morgan Kaufmann 2010 Sanders, J., Kandrot, E., CUDA by Example, Addison-Wesley 16
NVIDIA CUDA Compute Unified Device Architecture
NVIDIA CUDA Compute Unified Device Architecture Programming Guide Version 0.8 2/12/2007 ii CUDA Programming Guide Version 0.8 Table of Contents Chapter 1. Introduction to CUDA... 1 1.1 The Graphics Processor
More informationProgramming with CUDA
Programming with CUDA Jens K. Mueller jkm@informatik.uni-jena.de Department of Mathematics and Computer Science Friedrich-Schiller-University Jena Tuesday 19 th April, 2011 Today s lecture: Synchronization
More informationShared Memory and Synchronizations
and Synchronizations Bedrich Benes, Ph.D. Purdue University Department of Computer Graphics Technology SM can be accessed by all threads within a block (but not across blocks) Threads within a block can
More informationClass. Windows and CUDA : Shu Guo. Program from last time: Constant memory
Class Windows and CUDA : Shu Guo Program from last time: Constant memory Windows on CUDA Reference: NVIDIA CUDA Getting Started Guide for Microsoft Windows Whiting School has Visual Studio Cuda 5.5 Installer
More informationCS179 GPU Programming: CUDA Memory. Lecture originally by Luke Durant and Tamas Szalay
: CUDA Memory Lecture originally by Luke Durant and Tamas Szalay CUDA Memory Review of Memory Spaces Memory syntax Constant Memory Allocation Issues Global Memory Gotchas Shared Memory Gotchas Texture
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 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 Memory Hierarchy
CUDA Memory Hierarchy Piotr Danilewski October 2012 Saarland University Memory GTX 690 GTX 690 Memory host memory main GPU memory (global memory) shared memory caches registers Memory host memory GPU global
More informationCMPSCI 691AD General Purpose Computation on the GPU
CMPSCI 691AD General Purpose Computation on the GPU Spring 2009 Lecture 5: Quantitative Analysis of Parallel Algorithms Rui Wang (cont. from last lecture) Device Management Context Management Module Management
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 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 informationMemory concept. Grid concept, Synchronization. GPU Programming. Szénási Sándor.
Memory concept Grid concept, Synchronization GPU Programming http://cuda.nik.uni-obuda.hu Szénási Sándor szenasi.sandor@nik.uni-obuda.hu GPU Education Center of Óbuda University MEMORY CONCEPT Off-chip
More informationCUDA Memories. Introduction 5/4/11
5/4/11 CUDA Memories James Gain, Michelle Kuttel, Sebastian Wyngaard, Simon Perkins and Jason Brownbridge { jgain mkuttel sperkins jbrownbr}@cs.uct.ac.za swyngaard@csir.co.za 3-6 May 2011 Introduction
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 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 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 informationTextures & Surfaces CUDA Webinar Gernot Ziegler, Developer Technology (Compute)
Textures & Surfaces CUDA Webinar Gernot Ziegler, Developer Technology (Compute) Outline Intro to Texturing and Texture Unit CUDA Array Storage Textures in CUDA C (Setup, Binding Modes, Coordinates) Texture
More informationBasic Elements of CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono
Basic Elements of CUDA Algoritmi e Calcolo Parallelo References This set of slides is mainly based on: CUDA Technical Training, Dr. Antonino Tumeo, Pacific Northwest National Laboratory Slide of Applied
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 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 informationCUDA Performance Optimization Mark Harris NVIDIA Corporation
CUDA Performance Optimization Mark Harris NVIDIA Corporation Outline Overview Hardware Memory Optimizations Execution Configuration Optimizations Instruction Optimizations Summary Optimize Algorithms for
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 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 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 informationCUDA programming. CUDA requirements. CUDA Querying. CUDA Querying. A CUDA-capable GPU (NVIDIA) NVIDIA driver A CUDA SDK
CUDA programming Bedrich Benes, Ph.D. Purdue University Department of Computer Graphics CUDA requirements A CUDA-capable GPU (NVIDIA) NVIDIA driver A CUDA SDK Standard C compiler http://www.nvidia.com/cuda
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 informationCS 179: GPU Computing. Lecture 2: The Basics
CS 179: GPU Computing Lecture 2: The Basics Recap Can use GPU to solve highly parallelizable problems Performance benefits vs. CPU Straightforward extension to C language Disclaimer Goal for Week 1: Fast-paced
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 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 informationMassively Parallel Algorithms
Massively Parallel Algorithms Introduction to CUDA & Many Fundamental Concepts of Parallel Programming G. Zachmann University of Bremen, Germany cgvr.cs.uni-bremen.de Hybrid/Heterogeneous Computation/Architecture
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 informationCOSC 6385 Computer Architecture. - Multi-Processors (V) The Intel Larrabee, Nvidia GT200 and Fermi processors
COSC 6385 Computer Architecture - Multi-Processors (V) The Intel Larrabee, Nvidia GT200 and Fermi processors Fall 2012 References Intel Larrabee: [1] L. Seiler, D. Carmean, E. Sprangle, T. Forsyth, M.
More informationCUDA Advanced Techniques 2 Mohamed Zahran (aka Z)
CSCI-GA.3033-004 Graphics Processing Units (GPUs): Architecture and Programming CUDA Advanced Techniques 2 Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Alignment Memory Alignment Memory
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 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 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 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 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 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 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 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 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 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 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 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 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 informationCOSC 6339 Accelerators in Big Data
COSC 6339 Accelerators in Big Data Edgar Gabriel Fall 2018 Motivation Programming models such as MapReduce and Spark provide a high-level view of parallelism not easy for all problems, e.g. recursive algorithms,
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 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 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 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 informationCUDA GPGPU Workshop CUDA/GPGPU Arch&Prog
CUDA GPGPU Workshop 2012 CUDA/GPGPU Arch&Prog Yip Wichita State University 7/11/2012 GPU-Hardware perspective GPU as PCI device Original PCI PCIe Inside GPU architecture GPU as PCI device Traditional PC
More informationCOSC 6385 Computer Architecture. - Data Level Parallelism (II)
COSC 6385 Computer Architecture - Data Level Parallelism (II) Fall 2013 SIMD Instructions Originally developed for Multimedia applications Same operation executed for multiple data items Uses a fixed length
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 informationZero-copy. Table of Contents. Multi-GPU Learning CUDA to Solve Scientific Problems. Objectives. Technical Issues Zero-copy. Multigpu.
Table of Contents Multi-GPU Learning CUDA to Solve Scientific Problems. 1 Objectives Miguel Cárdenas Montes 2 Zero-copy Centro de Investigaciones Energéticas Medioambientales y Tecnológicas, Madrid, Spain
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 informationLecture 8: GPU Programming. CSE599G1: Spring 2017
Lecture 8: GPU Programming CSE599G1: Spring 2017 Announcements Project proposal due on Thursday (4/28) 5pm. Assignment 2 will be out today, due in two weeks. Implement GPU kernels and use cublas library
More informationGPGPU in Film Production. Laurence Emms Pixar Animation Studios
GPGPU in Film Production Laurence Emms Pixar Animation Studios Outline GPU computing at Pixar Demo overview Simulation on the GPU Future work GPU Computing at Pixar GPUs have been used for real-time preview
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 informationCSE 599 I Accelerated Computing - Programming GPUS. Advanced Host / Device Interface
CSE 599 I Accelerated Computing - Programming GPUS Advanced Host / Device Interface Objective Take a slightly lower-level view of the CPU / GPU interface Learn about different CPU / GPU communication techniques
More informationDebugging and Optimization strategies
Debugging and Optimization strategies Philip Blakely Laboratory for Scientific Computing, Cambridge Philip Blakely (LSC) Optimization 1 / 25 Writing a correct CUDA code You should start with a functional
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 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 informationGPU computing Simulating spin models on GPU Lecture 1: GPU architecture and CUDA programming. GPU computing. GPU computing.
GPU computing Simulating spin models on GPU Lecture 1: GPU architecture and CUDA programming Martin Weigel Applied Mathematics Research Centre, Coventry University, Coventry, United Kingdom and Institut
More informationEEM528 GPU COMPUTING
EEM528 CS 193G GPU COMPUTING Lecture 2: GPU History & CUDA Programming Basics Slides Credit: Jared Hoberock & David Tarjan CS 193G History of GPUs Graphics in a Nutshell Make great images intricate shapes
More informationAdvanced CUDA Optimizations. Umar Arshad ArrayFire
Advanced CUDA Optimizations Umar Arshad (@arshad_umar) ArrayFire (@arrayfire) ArrayFire World s leading GPU experts In the industry since 2007 NVIDIA Partner Deep experience working with thousands of customers
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 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 informationZero Copy Memory and Multiple GPUs
Zero Copy Memory and Multiple GPUs Goals Zero Copy Memory Pinned and mapped memory on the host can be read and written to from the GPU program (if the device permits this) This may result in performance
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 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 information04. CUDA Data Transfer
04. CUDA Data Transfer Fall Semester, 2015 COMP427 Parallel Programming School of Computer Sci. and Eng. Kyungpook National University 2013-5 N Baek 1 CUDA Compute Unified Device Architecture General purpose
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 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 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 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 Exercises. CUDA Programming Model Lukas Cavigelli ETZ E 9 / ETZ D Integrated Systems Laboratory
CUDA Exercises CUDA Programming Model 05.05.2015 Lukas Cavigelli ETZ E 9 / ETZ D 61.1 Integrated Systems Laboratory Exercises 1. Enumerate GPUs 2. Hello World CUDA kernel 3. Vectors Addition Threads and
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 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 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 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 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 informationEfficient Data Transfers
Efficient Data fers Slide credit: Slides adapted from David Kirk/NVIDIA and Wen-mei W. Hwu, 2007-2016 PCIE Review Typical Structure of a CUDA Program Global variables declaration Function prototypes global
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 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 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 informationConvolution Soup: A case study in CUDA optimization. The Fairmont San Jose 10:30 AM Friday October 2, 2009 Joe Stam
Convolution Soup: A case study in CUDA optimization The Fairmont San Jose 10:30 AM Friday October 2, 2009 Joe Stam Optimization GPUs are very fast BUT Naïve programming can result in disappointing performance
More informationHPCSE II. GPU programming and CUDA
HPCSE II GPU programming and CUDA What is a GPU? Specialized for compute-intensive, highly-parallel computation, i.e. graphic output Evolution pushed by gaming industry CPU: large die area for control
More informationConvolution Soup: A case study in CUDA optimization. The Fairmont San Jose Joe Stam
Convolution Soup: A case study in CUDA optimization The Fairmont San Jose Joe Stam Optimization GPUs are very fast BUT Poor programming can lead to disappointing performance Squeaking out the most speed
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 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 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 informationGPU COMPUTING. Ana Lucia Varbanescu (UvA)
GPU COMPUTING Ana Lucia Varbanescu (UvA) 2 Graphics in 1980 3 Graphics in 2000 4 Graphics in 2015 GPUs in movies 5 From Ariel in Little Mermaid to Brave So 6 GPUs are a steady market Gaming CAD-like activities
More informationGPU 1. CSCI 4850/5850 High-Performance Computing Spring 2018
GPU 1 CSCI 4850/5850 High-Performance Computing Spring 2018 Tae-Hyuk (Ted) Ahn Department of Computer Science Program of Bioinformatics and Computational Biology Saint Louis University Learning Objectives
More 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 informationCUDA Memory Model. Monday, 21 February Some material David Kirk, NVIDIA and Wen-mei W. Hwu, (used with permission)
CUDA Memory Model Some material David Kirk, NVIDIA and Wen-mei W. Hwu, 2007-2009 (used with permission) 1 G80 Implementation of CUDA Memories Each thread can: Grid Read/write per-thread registers Read/write
More informationIntroduction to GPU Programming
Introduction to GPU Programming Volodymyr (Vlad) Kindratenko Innovative Systems Laboratory @ NCSA Institute for Advanced Computing Applications and Technologies (IACAT) Part III Performance considerations
More informationParallel Accelerators
Parallel Accelerators Přemysl Šůcha ``Parallel algorithms'', 2017/2018 CTU/FEL 1 Topic Overview Graphical Processing Units (GPU) and CUDA Vector addition on CUDA Intel Xeon Phi Matrix equations on Xeon
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 informationPANOPTES: A BINARY TRANSLATION FRAMEWORK FOR CUDA. Chris Kennelly D. E. Shaw Research
PANOPTES: A BINARY TRANSLATION FRAMEWORK FOR CUDA Chris Kennelly D. E. Shaw Research Outline The Motivating Problems Binary Translation as a Solution Results of Panoptes Future Work My Story: Buffer Ping-Ponging
More information