Add GPGPU post.
[blog.git] / posts / GPGPU.mdwn
1 [[!meta  title="General-purpose computing on graphics processing units"]]
2
3 [GPGPU][] utilizes the number crunching speed and massive
4 parallelization of your [graphics card][GPU] to accelerate
5 general-purpose tasks.  When your algorithm is compatible with GPU
6 hardware, the speedup of running hundreds of concurrent threads can be
7 enormous.
8
9 There are a number of ways to implement GPGPU, ranging from
10 multi-platform frameworks such as [OpenCL][] to single-company
11 frameworks such as [NVIDIA][]'s [CUDA][].  I've gotten to play around
12 with [CUDA][] while TAing the [[parallel computing]] class, and its
13 lots of fun.
14
15 With NVIDIA (other vendors are probably similar, I'll update this as I
16 learn more), each GPU *device* has a block of global memory serving a
17 number of multi-processors, and each multi-processor contains several
18 cores which can execute concurrent threads.
19
20 Specs on NVIDIA's [GeForce GTX 580][]:
21
22 * 512 cores (16 (MP) ⋅ 32 (Cores/MP))
23 * 1.5 GB GDDR5 RAM
24 * 192.4 GB/sec memory bandwidth
25 * 1.54 GHz processor clock rate
26 * 1,581.1 GFLOPs per second
27
28 Zoom.
29
30 The GFLOP/s computaton is `cores⋅clock⋅2`, because (from [page 94][]
31 of the CUDA programming guide) each core can exectute a single
32 multiply-add operation (2 FLOPs) per cycle.  Also take a look at the
33 graph of historical performance on [page 14], the table of device
34 capabilities that starts on [page 111][], and the description of
35 *warps* on [page 93][].
36
37 [GPGPU]: http://en.wikipedia.org/wiki/GPGPU
38 [GPU]: http://en.wikipedia.org/wiki/Graphics_processing_unit
39 [NVIDIA]: http://www.nvidia.com/
40 [CUDA]: http://en.wikipedia.org/wiki/CUDA
41 [GeForce GTX 580]: http://www.nvidia.com/object/product-geforce-gtx-580-us.html
42 [page 14]: http://developer.download.nvidia.com/compute/cuda/3_2/toolkit/docs/CUDA_C_Programming_Guide.pdf#page=14
43 [page 93]: http://developer.download.nvidia.com/compute/cuda/3_2/toolkit/docs/CUDA_C_Programming_Guide.pdf#page=93
44 [page 94]: http://developer.download.nvidia.com/compute/cuda/3_2/toolkit/docs/CUDA_C_Programming_Guide.pdf#page=94
45 [page 111]: http://developer.download.nvidia.com/compute/cuda/3_2/toolkit/docs/CUDA_C_Programming_Guide.pdf#page=111
46
47 [[!tag tags/hardware]]
48 [[!tag tags/programming]]