Parallel Numerical Algorithms

Size: px
Start display at page:

Download "Parallel Numerical Algorithms"

Transcription

1 Parallel Numerical Algorithms [ 10 ] GPU and CUDA Parallel Numerical Algorithms / IST / UTokyo 1

2 PNA16 Lecture Plan General Topics 1. Architecture and Performance 2. Dependency 3. Locality 4. Scheduling MIMD / Distributed Memory 5. MPI: Message Passing Interface 6. Collective Communication 7. Distributed Data Structure MIMD / Shared Memory 8. OpenMP 9. Cache Performance Special Lectures 5/30 How to use FX10 (Prof. Ohshima) 6/6 Dynamic Parallelism (Prof. Peri) SIMD / Shared Memory 10. GPU and CUDA 11. SIMD Performance Parallel Numerical Algorithms / IST / UTokyo 2

3 World top 10 supercomputers Sunway 10 millions of cores! Xeon Phi GPU GPU Many-core accelerators Parallel Numerical Algorithms / IST / UTokyo 3

4 Accelerators Additional processor attached to CPU Xeon E v4 Tesla P100 CPU PCI Express GPU Host Memory Device Memory Parallel Numerical Algorithms / IST / UTokyo 4

5 Accelerators Additional processor attached to CPU 3.5 GHz 24 cores 845 Gflops Xeon E v4 CPU PCI Express 12.5x Tesla P100 GPU 1.48 GHz 3584 cores 10,600 Gflops Host Memory Device Memory Parallel Numerical Algorithms / IST / UTokyo 5

6 Accelerators Additional processor attached to CPU 3.5 GHz 24 cores 845 Gflops Xeon E v4 CPU PCI Express 16 GB/s Tesla P100 GPU 1.48 GHz 3584 cores 10,600 Gflops 102GB/s Host Memory 7.05x 720 GB/s Device Memory Parallel Numerical Algorithms / IST / UTokyo 6

7 Accelerators Additional processor attached to CPU 3.5 GHz 24 cores 845 Gflops Xeon E v4 CPU 102GB/s PCI Express 16 GB/s Tesla P100 GPU 720 GB/s 1.48 GHz 3584 cores 10,600 Gflops Host Memory Device Memory Relatively small number, but much faster than network Parallel Numerical Algorithms / IST / UTokyo 7

8 Source of high performance Use more transistors and electricity to arithmetics Slower clock (higher flops/watt) Higher parallelism and simpler hardware (not fast in sequential computations) Fixed form factor, fixed size of memory Parallel Numerical Algorithms / IST / UTokyo 8

9 GPU Programming Models Old days Direct 3D, OpenGL, Ct Specialized for graphics CUDA Extended C language General purpose, NVIDIA proprietary OpenCL C++ Library Open Standard, Low Level OpenACC, OpenMP 4.0 Directive API Parallel Numerical Algorithms / IST / UTokyo 9

10 Simplest CUDA code #include <stdio.h> #include <cuda_runtime.h> device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; sum<<<1,1>>>(1.0f, 2.0f); cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Parallel Numerical Algorithms / IST / UTokyo 10

11 Simplest CUDA code #include <stdio.h> #include <cuda_runtime.h> Include header file device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; sum<<<1,1>>>(1.0f, 2.0f); cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Parallel Numerical Algorithms / IST / UTokyo 11

12 Simplest CUDA code CPU GPU #include <stdio.h> #include <cuda_runtime.h> c_dev device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; sum<<<1,1>>>(1.0f, 2.0f); Variable on device memory cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Parallel Numerical Algorithms / IST / UTokyo 12

13 Simplest CUDA code #include <stdio.h> #include <cuda_runtime.h> device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; Kernel: a function runs on GPU called from CPU c_dev Can use only arguments and variables on Device Memory, sum<<<1,1>>>(1.0f, 2.0f); cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Parallel Numerical Algorithms / IST / UTokyo 13

14 Simplest CUDA code #include <stdio.h> #include <cuda_runtime.h> device float c_dev; global void sum(float a, float b) { c_dev = a + b; c_hos c_dev int main(void) { float c_hos; Variable on CPU sum<<<1,1>>>(1.0f, 2.0f); cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Parallel Numerical Algorithms / IST / UTokyo 14

15 Simplest CUDA code 1.0f 2.0f 1.0f 2.0f #include <stdio.h> #include <cuda_runtime.h> device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; c_hos c_dev sum<<<1,1>>>(1.0f, 2.0f); Launch a kernel cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Parallel Numerical Algorithms / IST / UTokyo 15

16 Simplest CUDA code 1.0f 2.0f 3.0f #include <stdio.h> #include <cuda_runtime.h> device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; c_hos c_dev sum<<<1,1>>>(1.0f, 2.0f); Launch a kernel cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Parallel Numerical Algorithms / IST / UTokyo 16

17 Simplest CUDA code 1.0f 2.0f 3.0f #include <stdio.h> #include <cuda_runtime.h> device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; sum<<<1,1>>>(1.0f, 2.0f); c_hos c_dev cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Copy data from GPU to CPU Parallel Numerical Algorithms / IST / UTokyo 17

18 Simplest CUDA code 1.0f 2.0f 3.0f #include <stdio.h> #include <cuda_runtime.h> device float c_dev; global void sum(float a, float b) { c_dev = a + b; int main(void) { float c_hos; sum<<<1,1>>>(1.0f, 2.0f); c_hos c_dev cudamemcpyfromsymbol(&c_hos, "c_dev", sizeof(float), 0, cudamemcpydevicetohost); printf("%f n", c_hos); return 0; Print result: 3.0 Can refer only variables on Host Memory Parallel Numerical Algorithms / IST / UTokyo 18

19 A little more detail of GPU Graphic Card Device Memory GDDR 5 Device Memory GDDR 5 GPU (Graphics Processing Unit) SM (Streaming Multiprocessor) SM (Streaming Multiprocessor) Device Memory GDDR 5 CUDA Cores CUDA Cores Device Memory GDDR 5 Register Shared Register Shared 16 lanes of PCI Express 3.0 to Host CPU Parallel Numerical Algorithms / IST / UTokyo 19

20 CUDA Cores SMs works independently (like CPU cores) 32/64 CUDA cores work in SIMD fashion A CUDA core is an ALU (arithmetic logic unit) rather than a processor core SM (Streaming Multiprocessor) CUDA Cores Scheduler Register Shared 2 sets of 64 CUDA cores are installed in an SM 2 64 = 128 CUDA cores per SM Maximum 56 SMs per GPU Maximum = 7168 CUDA cores per GPU Parallel Numerical Algorithms / IST / UTokyo 20

21 SIMD programming How to program SIMD parallelism? 1. Vectorization Programmer writes a usual code Compiler converts vectorizable loops into SIMD instructions for (i = 0; i < N; i++) c[i] = a[i] * b[i]; for (i = 0; i < N; i+=4) c[i:i+3] = a[i:i+3] * b[i:i+3]; 2. SIMT (Single Instruction, Multiple Threads) Parallel Numerical Algorithms / IST / UTokyo 21

22 Simple CUDA code #define N 1024 device float a_dev[n], b_dev[n]; global void shift(float s) { int i = blockidx.x * blockdim.x + threadidx.x; b_dev[i] = s + a_dev[i]; int main(void) {... cudamemcpytosymbol(&a_dev, &a_hos, sizeof(float) * N, 0, cudamemcpyhosttodevice); shift<<<n/256,256>>>(2.0f); cudamemcpyfromsymbol(&b_hos, &b_dev, sizeof(float) * N, 0, cudamemcpydevicetohost);... Parallel Numerical Algorithms / IST / UTokyo 22

23 Simple CUDA code #define N 1024 device float a_dev[n], b_dev[n]; global void shift(float s) { int i = blockidx.x * blockdim.x + threadidx.x; b_dev[i] = s + a_dev[i]; int main(void) {... cudamemcpytosymbol(&a_dev, &a_hos, sizeof(float) * N, 0, cudamemcpyhosttodevice); shift<<<n/256,256>>>(2.0f); Launch 4 blocks of 256 threads each cudamemcpyfromsymbol(&b_hos, &b_dev, sizeof(float) * N, 0, cudamemcpydevicetohost);... Parallel Numerical Algorithms / IST / UTokyo 23

24 Thread Hierarchy Host program Memcpy Block Grid Block Block Block Kernel launch Thread Memcpy shift<<<4,256>>>(2.0f); Launch a grid with 4 blocks of 256 threads each In total 1024 threads Note: 1024 is too small for 2880 CUDA cores Parallel Numerical Algorithms / IST / UTokyo 24

25 Simple CUDA code #define N 1024 device float a_dev[n], b_dev[n]; global void shift(float s) { int i = blockidx.x * blockdim.x + threadidx.x; b_dev[i] = s + a_dev[i]; int main(void) {... cudamemcpytosymbol(&a_dev, &a_hos, sizeof(float) * N, 0, cudamemcpyhosttodevice); shift<<<n/256,256>>>(2.0f); Launch 4 blocks of 256 threads each cudamemcpyfromsymbol(&b_hos, &b_dev, sizeof(float) * N, 0, cudamemcpydevicetohost);... Parallel Numerical Algorithms / IST / UTokyo 25

26 Simple CUDA code #define N 1024 device float a_dev[n], b_dev[n]; global void shift(float s) { int i = blockidx.x * blockdim.x + threadidx.x; b_dev[i] = s + a_dev[i]; Computes who am I GridDim: number of blocks in the grid blockidx: index of my block within the grid blockdim: number of threads in the block threadidx: index of my thread within the block int main(void) {... cudamemcpytosymbol(&a_dev, &a_hos, sizeof(float) * N, 0, cudamemcpyhosttodevice); shift<<<n/256,256>>>(2.0f); Block Block Block Block cudamemcpyfromsymbol(&b_hos, &b_dev, sizeof(float) * N, 0, cudamemcpydevicetohost);... blockidx.x = 2 threadidx.x = 1 Parallel Numerical Algorithms / IST / UTokyo 26

27 Simple CUDA code #define N 1024 device float a_dev[n], b_dev[n]; global void shift(float s) { int i = blockidx.x * blockdim.x + threadidx.x; b_dev[i] = s + a_dev[i]; int main(void) {... cudamemcpytosymbol(&a_dev, &a_hos, sizeof(float) * N, 0, cudamemcpyhosttodevice); shift<<<n/256,256>>>(2.0f); SIMD addition cudamemcpyfromsymbol(&b_hos, &b_dev, sizeof(float) * N, 0, cudamemcpydevicetohost);... Parallel Numerical Algorithms / IST / UTokyo 27

28 Conditional Branch in SIMD if (x < 0) x = -x; if (x < 0) x *= a; else x *= b; Some operations are masked Called Divergence Thread 0 x < 0 x = -x Thread 0 x < 0 x *= a x *= b Thread 1 x < 0 x = -x Thread 1 x < 0 x *= a x *= b Thread 2 x < 0 x = -x Thread 2 x < 0 x *= a x *= b Thread 3 x < 0 x = -x Thread 3 x < 0 x *= a x *= b Thread 4 x < 0 x = -x Thread 4 x < 0 x *= a x *= b Thread 5 x < 0 x = -x Thread 5 x < 0 x *= a x *= b Thread 6 x < 0 x = -x Thread 6 x < 0 x *= a x *= b Thread 7 x < 0 x = -x Thread 7 x < 0 x *= a x *= b Thread 8 x < 0 x = -x Thread 8 x < 0 x *= a x *= b Thread 9 x < 0 x = -x Thread 9 x < 0 x *= a x *= b Parallel Numerical Algorithms / IST / UTokyo 28

29 Warp 32 consecutive threads form a warp Block Warp Warp Warp Warp Warp Warp Threads in a warp runs in SIMD fashion Different warps can do different operations Parallel Numerical Algorithms / IST / UTokyo 29

30 Warp Divergence if (i < n) computinga(); else computingb(); if (p) { if (q) computinga(); else computingb(); else { if (q) computingc(); else computingd(); If n is a multiple of 32, then no warp diverges A A B B B B Otherwise, one warp diverges A A A 4-way divergence B Only ¼ of CUDA cores are working at each time B B B Up to 32-way divergence happens Very low utilization of hardware Parallel Numerical Algorithms / IST / UTokyo 30

31 Summary Hardware Number GPU Chip SM MIMD Core Up to 56 per GPU Scheduler 4 per SM CUDA Core SIMD element 128 per SM Number Run on Execution Grid 1 per kernel launch a GPU Block Specified number an SM MIMD Warp 32 threads a scheduler MIMD Thread Specified number a CUDA Core SIMD Parallel Numerical Algorithms / IST / UTokyo 31

32 Memory Hierarchy Register Each thread has a set of registers Visible only from the owner thread Local memory Visible only from the owner thread Shared memory Assigned to each block Visible from threads within the block Global memory Visible from all threads Per thread Per block Per program Parallel Numerical Algorithms / IST / UTokyo 32

33 Memory hardware Graphic Card Device Memory Device Memory Device Memory L2 cache L2 cache L2 cache GPU (Graphics Processing Unit) SM (Streaming Multiprocessor) CUDA Cores Device Memory L2 cache Register Shared L1 cache Global, Local Register Shared, (Local) Parallel Numerical Algorithms / IST / UTokyo 33

34 Memory Lifetime Register, Local, and Shared memory Allocated at start of the block Deallocated at end of the block Device memory Persistent through application program Allocated and deallocated by host program Parallel Numerical Algorithms / IST / UTokyo 34

35 Device memory allocation cudamalloc(void** p_dev, size_t size) Array is not cleared Return an error if physical memory is insufficient Starting address is aligned for textures cudafree(void* p_dev) Deallocates device memory allocated by cudamalloc (or cudamallocpitch) Static allocation is OK device float array[n]; in host codes

36 Data transfer cudamemcpy(void* dst, const void* src, size_t count, enum cudamemcpykind kind) Copy data of count bytes from src to dst kind is one of the followings: cudamemcpyhosttodevice cudamemcpydevicetohost cudamemcpyhosttohost cudamemcpydevicetodevice in host codes

37 Register and Local memory Automatically allocated to auto variables in device code Scalar variables are usually compiled into register Arrays are usually compiled into local memory in device codes Parallel Numerical Algorithms / IST / UTokyo 37

38 Shared Memory shared qualifier Use static allocation for array as: shared float a[nx][ny]; Dynamic allocation is not impossible Shared by a threads in a block Memory barrier: syncthreads() Slower (~40 cycles) and smaller (64 KB) than register memory (64K 4byte = 256KB) in device codes

39 Device Memory Allocated by host program or Static allocation with device qualifier All threads can access Memory barrier: new kernel launch Very high throughput on high-end GPUs Condition: coalesced access Latency is big (200 or more cycles) L1 cache:?kb, ~40 cycles L2 cache:?kb, ~200 cycles in device codes

40 Memory fence syncthreads() Synchronizes all threads in a block Makes writes to shared and global memory visible New kernel launch Is the way to synchronize all threads in a grid Or careful use of threadfence() functions Parallel Numerical Algorithms / IST / UTokyo 40

41 Shared memory example shared float a_sh[b][n], b_sh[n][b]; global matmul(float *a_dev, float *b_dev, float *c_dev) { int ilb = blockidx.x * B, jlb = blockidx.y * B; int i, k, thidx = threadidx.x; float c; for (k = 0; k < N; k++) { a_sh[thidx][k] = a_dev[(ilb + thidx) * N + k]; b_sh[k][thidx] = b_dev[k * N + (jlb + thidx)]; synchthreads(); for (i = 0; i < B; i++) { c = 0.0; for (k = 0; k < N; k++) c += a_sh[i][k] * b_sh[k][thidx]; c_dev[(ilb + i) * N + (jlb + thidx)] = c; Parallel Numerical Algorithms / IST / UTokyo 41

42 Shared memory example shared float a_sh[b][n], b_sh[n][b]; global matmul(float *a_dev, float *b_dev, float *c_dev) { int ilb = blockidx.x * B, jlb = blockidx.y * B; int i, k, thidx = threadidx.x; float c; for (k = 0; k < N; k++) { a_sh[thidx][k] = a_dev[(ilb + thidx) * N + k]; b_sh[k][thidx] = b_dev[k * N + (jlb + thidx)]; synchthreads(); for (i = 0; i < B; i++) { c = 0.0; for (k = 0; k < N; k++) c += a_sh[i][k] * b_sh[k][thidx]; c_dev[(ilb + i) * N + (jlb + thidx)] = c; a_sh b_sh Parallel Numerical Algorithms / IST / UTokyo 42

43 Shared memory example shared float a_sh[b][n], b_sh[n][b]; global matmul(float *a_dev, float *b_dev, float *c_dev) { int ilb = blockidx.x * B, jlb = blockidx.y * B; int i, k, thidx = threadidx.x; float c; for (k = 0; k < N; k++) { a_sh[thidx][k] = a_dev[(ilb + thidx) * N + k]; b_sh[k][thidx] = b_dev[k * N + (jlb + thidx)]; synchthreads(); for (i = 0; i < B; i++) { c = 0.0; for (k = 0; k < N; k++) c += a_sh[i][k] * b_sh[k][thidx]; c_dev[(ilb + i) * N + (jlb + thidx)] = c; ilb jlb Parallel Numerical Algorithms / IST / UTokyo 43

44 Shared memory example shared float a_sh[b][n], b_sh[n][b]; global matmul(float *a_dev, float *b_dev, float *c_dev) { int ilb = blockidx.x * B, jlb = blockidx.y * B; int i, k, thidx = threadidx.x; float c; for (k = 0; k < N; k++) { a_sh[thidx][k] = a_dev[(ilb + thidx) * N + k]; b_sh[k][thidx] = b_dev[k * N + (jlb + thidx)]; synchthreads(); for (i = 0; i < B; i++) { c = 0.0; for (k = 0; k < N; k++) c += a_sh[i][k] * b_sh[k][thidx]; c_dev[(ilb + i) * N + (jlb + thidx)] = c; Parallel Numerical Algorithms / IST / UTokyo 44

45 Shared memory example shared float a_sh[b][n], b_sh[n][b]; global matmul(float *a_dev, float *b_dev, float *c_dev) { int ilb = blockidx.x * B, jlb = blockidx.y * B; int i, k, thidx = threadidx.x; float c; for (k = 0; k < N; k++) { a_sh[thidx][k] = a_dev[(ilb + thidx) * N + k]; b_sh[k][thidx] = b_dev[k * N + (jlb + thidx)]; synchthreads(); for (i = 0; i < B; i++) { c = 0.0; for (k = 0; k < N; k++) c += a_sh[i][k] * b_sh[k][thidx]; c_dev[(ilb + i) * N + (jlb + thidx)] = c; Parallel Numerical Algorithms / IST / UTokyo 45

46 Shared memory example shared float a_sh[b][n], b_sh[n][b]; global matmul(float *a_dev, float *b_dev, float *c_dev) { int ilb = blockidx.x * B, jlb = blockidx.y * B; int i, k, thidx = threadidx.x; float c; for (k = 0; k < N; k++) { a_sh[thidx][k] = a_dev[(ilb + thidx) * N + k]; b_sh[k][thidx] = b_dev[k * N + (jlb + thidx)]; synchthreads(); for (i = 0; i < B; i++) { c = 0.0; for (k = 0; k < N; k++) c += a_sh[i][k] * b_sh[k][thidx]; c_dev[(ilb + i) * N + (jlb + thidx)] = c; Parallel Numerical Algorithms / IST / UTokyo 46

47 PNA16 Lecture Plan General Topics 1. Architecture and Performance 2. Dependency 3. Locality 4. Scheduling MIMD / Distributed Memory 5. MPI: Message Passing Interface 6. Collective Communication 7. Distributed Data Structure MIMD / Shared Memory 8. OpenMP 9. Cache Performance Special Lectures 5/30 How to use FX10 (Prof. Ohshima) 6/6 Dynamic Parallelism (Prof. Peri) SIMD / Shared Memory 10. GPU and CUDA 11. SIMD Performance Parallel Numerical Algorithms / IST / UTokyo 47

Introduction to CUDA CME343 / ME May James Balfour [ NVIDIA Research

Introduction 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 information

Tesla Architecture, CUDA and Optimization Strategies

Tesla 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 information

Register file. A single large register file (ex. 16K registers) is partitioned among the threads of the dispatched blocks.

Register 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 information

CS 179: GPU Computing. Lecture 2: The Basics

CS 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 information

GPU COMPUTING. Ana Lucia Varbanescu (UvA)

GPU 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 information

Introduc)on to GPU Programming

Introduc)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 information

CUDA 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 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 information

GPU CUDA Programming

GPU 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 information

Scientific discovery, analysis and prediction made possible through high performance computing.

Scientific 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 information

Stanford University. NVIDIA Tesla M2090. NVIDIA GeForce GTX 690

Stanford 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 information

COMP 322: Fundamentals of Parallel Programming. Flynn s Taxonomy for Parallel Computers

COMP 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 information

University of Bielefeld

University 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 information

Outline 2011/10/8. Memory Management. Kernels. Matrix multiplication. CIS 565 Fall 2011 Qing Sun

Outline 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 information

Lecture 9. Outline. CUDA : a General-Purpose Parallel Computing Architecture. CUDA Device and Threads CUDA. CUDA Architecture CUDA (I)

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 information

Introduction to CUDA Programming

Introduction 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 information

CUDA Basics. July 6, 2016

CUDA 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 information

HPC Middle East. KFUPM HPC Workshop April Mohamed Mekias HPC Solutions Consultant. Introduction to CUDA programming

HPC 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 information

Josef Pelikán, Jan Horáček CGG MFF UK Praha

Josef 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 information

Introduction to GPU Computing Using CUDA. Spring 2014 Westgid Seminar Series

Introduction 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 information

Introduction to GPU Computing Using CUDA. Spring 2014 Westgid Seminar Series

Introduction 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 information

Basic Elements of CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono

Basic 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 information

Lecture 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 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 information

By: Tomer Morad Based on: Erik Lindholm, John Nickolls, Stuart Oberman, John Montrym. NVIDIA TESLA: A UNIFIED GRAPHICS AND COMPUTING ARCHITECTURE In IEEE Micro 28(2), 2008 } } Erik Lindholm, John Nickolls,

More information

High-Performance Computing Using GPUs

High-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 information

COSC 6339 Accelerators in Big Data

COSC 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 information

CUDA Workshop. High Performance GPU computing EXEBIT Karthikeyan

CUDA Workshop. High Performance GPU computing EXEBIT Karthikeyan CUDA Workshop High Performance GPU computing EXEBIT- 2014 Karthikeyan CPU vs GPU CPU Very fast, serial, Low Latency GPU Slow, massively parallel, High Throughput Play Demonstration Compute Unified Device

More information

HPCSE II. GPU programming and CUDA

HPCSE 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 information

High Performance Linear Algebra on Data Parallel Co-Processors I

High Performance Linear Algebra on Data Parallel Co-Processors I 926535897932384626433832795028841971693993754918980183 592653589793238462643383279502884197169399375491898018 415926535897932384626433832795028841971693993754918980 592653589793238462643383279502884197169399375491898018

More information

Massively Parallel Algorithms

Massively 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 information

GPU Programming. Lecture 2: CUDA C Basics. Miaoqing Huang University of Arkansas 1 / 34

GPU 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 information

Introduction to GPGPUs and to CUDA programming model

Introduction 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 information

High Performance Computing and GPU Programming

High 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 information

Introduction to CUDA

Introduction 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 information

GPU Architecture and Programming. Andrei Doncescu inspired by NVIDIA

GPU Architecture and Programming. Andrei Doncescu inspired by NVIDIA GPU Architecture and Programming Andrei Doncescu inspired by NVIDIA Traditional Computing Von Neumann architecture: instructions are sent from memory to the CPU Serial execution: Instructions are executed

More information

GPU Computing: A Quick Start

GPU 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 information

An 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 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 information

GPU Fundamentals Jeff Larkin November 14, 2016

GPU 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 information

ECE 574 Cluster Computing Lecture 15

ECE 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 information

CUDA C Programming Mark Harris NVIDIA Corporation

CUDA 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 information

Introduction 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 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 information

Accelerator cards are typically PCIx cards that supplement a host processor, which they require to operate Today, the most common accelerators include

Accelerator 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 information

COSC 6385 Computer Architecture. - Data Level Parallelism (II)

COSC 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 information

CUDA PROGRAMMING MODEL. Carlo Nardone Sr. Solution Architect, NVIDIA EMEA

CUDA 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 information

GPU Programming Using CUDA

GPU 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 information

Parallel 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 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 information

COSC 6374 Parallel Computations Introduction to CUDA

COSC 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 information

CS 179: GPU Computing LECTURE 4: GPU MEMORY SYSTEMS

CS 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 information

GPU programming. Dr. Bernhard Kainz

GPU 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 information

Information Coding / Computer Graphics, ISY, LiTH. Introduction to CUDA. Ingemar Ragnemalm Information Coding, ISY

Information 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 information

CS377P Programming for Performance GPU Programming - I

CS377P 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 information

An 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 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 information

CUDA 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 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 information

GPU programming: CUDA basics. Sylvain Collange Inria Rennes Bretagne Atlantique

GPU 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 information

EEM528 GPU COMPUTING

EEM528 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 information

CUDA 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 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 information

What is GPU? CS 590: High Performance Computing. GPU Architectures and CUDA Concepts/Terms

What 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 information

Overview. Lecture 1: an introduction to CUDA. Hardware view. Hardware view. hardware view software view CUDA programming

Overview. 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 information

Lecture 10!! Introduction to CUDA!

Lecture 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 information

Introduction to GPU Computing Junjie Lai, NVIDIA Corporation

Introduction 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 information

INTRODUCTION TO GPU COMPUTING WITH CUDA. Topi Siro

INTRODUCTION 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 information

Programming with CUDA, WS09

Programming 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 information

CUDA Programming Model

CUDA 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 information

NVIDIA GTX200: TeraFLOPS Visual Computing. August 26, 2008 John Tynefield

NVIDIA GTX200: TeraFLOPS Visual Computing. August 26, 2008 John Tynefield NVIDIA GTX200: TeraFLOPS Visual Computing August 26, 2008 John Tynefield 2 Outline Execution Model Architecture Demo 3 Execution Model 4 Software Architecture Applications DX10 OpenGL OpenCL CUDA C Host

More information

CUDA Programming (Basics, Cuda Threads, Atomics) Ezio Bartocci

CUDA 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 information

Introduction 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 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 information

CS179 GPU Programming Recitation 4: CUDA Particles

CS179 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 information

Lecture 8: GPU Programming. CSE599G1: Spring 2017

Lecture 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 information

Memory concept. Grid concept, Synchronization. GPU Programming. Szénási Sándor.

Memory 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 information

Parallel Accelerators

Parallel 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 information

Parallel Numerical Algorithms

Parallel Numerical Algorithms Parallel Numerical Algorithms http://sudalab.is.s.u-tokyo.ac.jp/~reiji/pna16/ [ 8 ] OpenMP Parallel Numerical Algorithms / IST / UTokyo 1 PNA16 Lecture Plan General Topics 1. Architecture and Performance

More information

GPU 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. 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 information

Basics of CADA Programming - CUDA 4.0 and newer

Basics 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 information

Real-time Graphics 9. GPGPU

Real-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 information

GPU Computing: Introduction to CUDA. Dr Paul Richmond

GPU 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 information

Parallel Accelerators

Parallel 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 information

Lecture 2: CUDA Programming

Lecture 2: CUDA Programming CS 515 Programming Language and Compilers I Lecture 2: CUDA Programming Zheng (Eddy) Zhang Rutgers University Fall 2017, 9/12/2017 Review: Programming in CUDA Let s look at a sequential program in C first:

More information

Information Coding / Computer Graphics, ISY, LiTH. Introduction to CUDA. Ingemar Ragnemalm Information Coding, ISY

Information 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 information

Review. Lecture 10. Today s Outline. Review. 03b.cu. 03?.cu CUDA (II) Matrix addition CUDA-C API

Review. 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 information

Introduction to CUDA CIRC Summer School 2014

Introduction 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 information

ECE 574 Cluster Computing Lecture 17

ECE 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 information

CUDA Programming. Aiichiro Nakano

CUDA 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 information

GPGPU. Alan Gray/James Perry EPCC The University of Edinburgh.

GPGPU. Alan Gray/James Perry EPCC The University of Edinburgh. GPGPU Alan Gray/James Perry EPCC The University of Edinburgh a.gray@ed.ac.uk Contents Introduction GPU Technology Programming GPUs GPU Performance Optimisation 2 Introduction 3 Introduction Central Processing

More information

Basic Elements of CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono

Basic 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 information

CSE 160 Lecture 24. Graphical Processing Units

CSE 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 information

GPU Programming Using CUDA. Samuli Laine NVIDIA Research

GPU 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 information

Parallel Computing. Lecture 19: CUDA - I

Parallel 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 information

CUDA BASICS Matt Heavner -- 10/21/2010

CUDA BASICS Matt Heavner -- 10/21/2010 CUDA BASICS Matt Heavner -- mheavner@buffalo.edu 10/21/2010 Why CUDA? Image From: http://developer.download.nvidia.com/compute/cuda/3_1/toolkit/docs/nvidia_cuda_c_programmingguide_3.1.pdf CUDA: Where does

More information

Real-time Graphics 9. GPGPU

Real-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 information

Introduction to Parallel Computing with CUDA. Oswald Haan

Introduction 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 information

Lecture 11: GPU programming

Lecture 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 information

Graph 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. 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 information

Massively Parallel Architectures

Massively Parallel Architectures Massively Parallel Architectures A Take on Cell Processor and GPU programming Joel Falcou - LRI joel.falcou@lri.fr Bat. 490 - Bureau 104 20 janvier 2009 Motivation The CELL processor Harder,Better,Faster,Stronger

More information

Lecture 3: Introduction to CUDA

Lecture 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 information

CUDA Architecture & Programming Model

CUDA 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 information

Lecture 3. Programming with GPUs

Lecture 3. Programming with GPUs Lecture 3 Programming with GPUs GPU access Announcements lilliput: Tesla C1060 (4 devices) cseclass0{1,2}: Fermi GTX 570 (1 device each) MPI Trestles @ SDSC Kraken @ NICS 2011 Scott B. Baden / CSE 262

More information

GPU Programming Using CUDA. Samuli Laine NVIDIA Research

GPU 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 information

Today s Content. Lecture 7. Trends. Factors contributed to the growth of Beowulf class computers. Introduction. CUDA Programming CUDA (I)

Today 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 information

Lecture 1: an introduction to CUDA

Lecture 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 information

COMP 322: Fundamentals of Parallel Programming

COMP 322: Fundamentals of Parallel Programming COMP 322: Fundamentals of Parallel Programming Lecture 38: General-Purpose GPU (GPGPU) Computing Guest Lecturer: Max Grossman Instructors: Vivek Sarkar, Mack Joyner Department of Computer Science, Rice

More information

Design of Digital Circuits Lecture 21: GPUs. Prof. Onur Mutlu ETH Zurich Spring May 2017

Design of Digital Circuits Lecture 21: GPUs. Prof. Onur Mutlu ETH Zurich Spring May 2017 Design of Digital Circuits Lecture 21: GPUs Prof. Onur Mutlu ETH Zurich Spring 2017 12 May 2017 Agenda for Today & Next Few Lectures Single-cycle Microarchitectures Multi-cycle and Microprogrammed Microarchitectures

More information