5
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 5 Accelerators In HPC, an accelerator is a hardware component whose role is to speed up some aspect of the computing workload. In the olden days (1980s), supercomputers sometimes had array processors, which did vector operations on arrays, and PCs sometimes had floating point accelerators: little chips that did the floating point calculations in hardware rather than software. More recently, Field Programmable Gate Arrays (FPGAs) allow reprogramming deep into the hardware.

6
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 6 Why Accelerators are Good Accelerators are good because: they make your code run faster.

7
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 7 Why Accelerators are Bad Accelerators are bad because: theyre expensive; theyre hard to program; your code on them may not be portable to other accelerators, so the labor you invest in programming them has a very short half-life.

8
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 8 The King of the Accelerators The undisputed champion of accelerators is: the graphics processing unit.

9
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 9 Why GPU? Graphics Processing Units (GPUs) were originally designed to accelerate graphics tasks like image rendering. They became very very popular with videogamers, because theyve produced better and better images, and are lightning fast. And, prices have been extremely good, ranging from three figures at the low end to four figures at the high end.

10
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 10 GPUs are Popular Chips are expensive to design (hundreds of millions of $$$), expensive to build the factory for (billions of $$$), but cheap to produce. In 2006 – 2007, GPUs sold at a rate of about 80 million cards per year, generating about $20 billion per year in revenue. This means that the GPU companies have been able to recoup the huge fixed costs.

11
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 11 GPU Do Arithmetic GPUs mostly do stuff like rendering images. This is done through mostly floating point arithmetic – the same stuff people use supercomputing for!

13
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 13 Hard to Program? In the olden days – that is, until just the last few years – programming GPUs meant either: using a graphics standard like OpenGL (which is mostly meant for rendering), or getting fairly deep into the graphics rendering pipeline. To use a GPU to do general purpose number crunching, you had to make your number crunching pretend to be graphics. This was hard. So most people didnt bother.

14
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 14 Easy to Program? More recently, GPU manufacturers have worked hard to make GPUs easier to use for general purpose computing. This is known as General Purpose Graphics Processing Units.

16
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 16 NVIDIA CUDA NVIDIA proprietary Formerly known as Compute Unified Device Architecture Extensions to C to allow better control of GPU capabilities Modest extensions but major rewriting of the code Portland Group Inc (PGI) has released a Fortran implementation of CUDA available in their Fortran compiler.

19
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 19 AMD/ATI Brook+ AMD/ATI proprietary Formerly known as Close to Metal (CTM) Extensions to C to allow better control of GPU capabilities No Fortran version available

22
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 22 OpenCL Open Computing Language Open standard developed by the Khronos Group, which is a consortium of many companies (including NVIDIA, AMD and Intel, but also lots of others) Initial version of OpenCL standard released in Dec 2008. Many companies will create their own implementations. Apple was first to market, with an OpenCL implementation included in Mac OS X v10.6 (Snow Leopard) in 2009.

27
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 27 Portland Group Accelerator Directives Proprietary directives in Fortran and C Similar to OpenMP in structure If the compiler doesnt understand these directives, it ignores them, so the same code can work with an accelerator or without, and with the PGI compilers or other compilers. In principle, this will be able to work on a variety of accelerators, but the first instance is NVIDIA; PGI recently announced a deal with AMD/ATI. The directives tell the compiler what parts of the code happen in the accelerator; the rest happens in the regular hardware.

35
Your Logo Here Kepler and Maxwell NVIDIAs 20-series is also known by the codenameFermi. It runs at about 0.5 TFLOPs per GPU card (peak). The next generation, to be released in 2011, is codenamedKepler and will be capable of something like 1.4 TFLOPs double precision per GPU card. After Kepler will come Maxwell in 2013, capable of something like 4 TFLOPs double precision per GPU card. So, the increase in performance is likely to be roughly 2.5x – 3x per generation, roughly every two years. Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 35

36
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 36 What Are the Downsides? You have to rewrite your code into CUDA or OpenCL or PGI accelerator directives. CUDA: Proprietary, but maybe portable soon OpenCL: portable but cumbersome PGI accelerator directives: not clear whether you can have most of the code live inside the GPUs. BUT: Many groups are coming out with GPGPU code development tools that may help a lot, such as: Fortran-to-CUDA-C converter (NCAR) CUDA C automatic optimizer (memory, threading etc) OpenMP-to-CUDA converter CUDA-to-x86 converter (CUDA code on non-CUDA system)

37
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 37 Programming for Performance The biggest single performance bottleneck on GPU cards today is the PCIe slot: PCIe 2.0 x16: 8 GB/sec 1600 MHz Front Side Bus: 25 GB/sec GDDR5 GPU card RAM: 144 GB/sec per card Your goal: At startup, move the data from x86 server RAM into GPU RAM. Do almost all the work inside the GPU. Use the x86 server only for I/O and message passing, to minimize the amount of data moved through the PCIe slot.

41
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 41 Buzzword: Kernel In CUDA, a kernel is code (typically a function) that can be run inside the GPU. Typically, the kernel code operates in lock-step on the stream processors inside the GPU.

42
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 42 Buzzword: Thread In CUDA, a thread is an execution of a kernel with a given index. Each thread uses its index to access a specific subset of the elements of a target array, such that the collection of all threads cooperatively processes the entire data set. So these are very much like threads in the OpenMP or pthreads sense – they even have shared variables and private variables.

43
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 43 Buzzword: Block In CUDA, a block is a group of threads. Just like OpenMP threads, these could execute concurrently or independently, and in no particular order. Threads can be coordinated somewhat, using the _syncthreads() function as a barrier, making all threads stop at a certain point in the kernel before moving on en masse. (This is like what happens at the end of an OpenMP loop.)

44
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 44 Buzzword: Grid In CUDA, a grid is a group of (thread) blocks, with no synchronization at all among the blocks.

46
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR blockIdx.x, blockIdx.y, blockIdx.z are built-in variables that return the block ID in the x-axis, y-axis and z- axis of the block that is executing the given block of code. threadIdx.x, threadIdx.y, threadidx.z are built-in variables that return the thread ID in the x-axis, y-axis and z-axis of the thread that is being executed by this stream processor in this particular block. So, you can express your collection of blocks, and your collection of threads within a block, as a 1D array, a 2D array or a 3D array. These can be helpful when thinking of your data as 2D or 3D. CUDA Built-in Variables

47
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 47 __global__ Keyword In CUDA, if a function is declared with the __global__ keyword, that means that its intended to be executed inside a GPU. In CUDA, the term for the GPU is device, and the term for the x86 server is host. So, a kernel runs on a device, while the main function, and so on, run on the host. Note that a host can play host to multiple devices; for example, an S2050 server contains 4 C2050 GPU cards, and if a single host has two PCIe slots, then both of the PCIe plugs of the S2050 can be plugged into that same host.

48
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 48 Copying Data from Host to Device If data need to move from the host (where presumably the data are initially input or generated), then a copy has to exist in both places. Typically, whats copied are arrays, though of course you can also copy a scalar (the address of which is treated as an array of length 1).

50
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 50 CUDA Memory Hierarchy #2 CUDA has a hierarchy of several kinds of memory: Host memory (x86 server) Device memory (GPU) Constant: visible to all threads in all blocks; read only Texture: visible to all threads in all blocks; read only

57
Your Logo Here Supercomputing in Plain English: GPGPU INSTITUTION, DAY MONTH DATE YEAR 57 Would We Really Do It This Way? We wouldnt really do matrix-matrix multiply this way. NVIDIA has developed a CUDA implementation of the BLAS libraries, which include a highly tuned matrix-matrix multiply routine. (Well learn about BLAS next time.) Theres also a CUDA FFT library, if your code needs Fast Fourier Transforms.