GPU Accelerates Normal Vector Computation by Up to 5x Faster Than CPU
1. 2010/2/25
1
GPGPU
Ked
Result
Computation of Normal Vector
Image resolution: 640 x 480
CPU: 625 clock time
GPU: 125 clock time
Result
Computation of Normal Vector
Image resolution: 1280 x 1024
CPU: 2500 clock time
GPU: 172 clock time
OK, What is GPU
A graphics accelerator incorporates custom
microchips which contain special mathematical
operations commonly used in graphics rendering.
GPGPU
• General purpose computing on GPU
GPGPU
GPGP
GP2
(boring RD -.-||)
hi, I am R2-D2
Why faster
2. 2010/2/25
2
Why faster Why faster
CPU GPU
General purpose Specialized hardware
Serial execution Parallel execution
Minimum latency Maximum throughput
Development tools:
Focus on GPGPU
CUDA:
Compute Unified Device Architecture
Developed by NVIDIA
C like language
Full developing environment
Compiler
Debugger
Math libraries
Development tools:
Focus on GPGPU
Advantage:
Shared memory amongst threads
16k
Faster downloads and readbacks to and from GPU
Full support for integer and bitwise operations
Development tools:
Shader programming
ARB low-level assembly language
OpenGL shading language
Cg programming language
DirectX high-level shader language
Development tools:
Shader programming
3. 2010/2/25
3
Development tools:
Shader programming
Developing tools of GLSL:
Pipeline of GPU processing
Shader programming
Vertex shader
Fragment shader
Geometry shader
RenderMan shading language
Developed by Pixar has uncompromising image
quality as its fundamental goal
Light shader
Displacement shader
Surface shader
Volume shader
Imager shader
Vertex shader Fragment shader
4. 2010/2/25
4
Streaming of fragment shader
Stream processing is a computer programming paradigm,
related to SIMD, that allows some applications to more
easily exploit a limited form of parallel processing. Such
applications can use multiple computational units, such
as the floating point units on a GPU, without explicitly
managing allocation, synchronization, or communication
among those units.
Branch of fragment shader
Conception of GPGPU
Textures => Computing arrays
Vertex Coordinates => Computational range
Fragment programs => Computation
Read from framebuffer => Get result
Case study:
Computation of normal vector
Normal(V0) =
[ normal(F401) +
normal(F102) +
normal(F203) +
normal(F304) ] / 4
Normal(F102) =
cross(v1v0, v2v0)
Prepare:
Choose graphic card
Prepare:
Test the graphic card
need
5. 2010/2/25
5
Use GLSL in BCB environment:
Call GLee library Other choice: GLew
Install shader:
Run-time building
Texture:
Computing array
Vertex coordinate:
Computational range
Fragment program:
Computation
Read from framebuffer:
Get result
FameBuffer Object is a better choice
6. 2010/2/25
6
Trivia:
Ghost in numerical computing
Review the result
Image resolution: 640 x 480
CPU: 625 clock time
GPU: 125 clock time
Image resolution: 1280 x 1024
CPU: 2500 clock time
GPU: 172 clock time
Reference
GPU Gems 2
OpenGL Shading Language
OpenGL Programming Guide
Dominik Göddeke
-- GPGPU::Basic Math Tutorial
(website)
GPGPU: SIGGRAPH 2004 course
Batch, batch, batch:
what does it really means
Thx.