2d games to hpc
DESCRIPTION
TRANSCRIPT
An Introduction to GPU3D Games to HPC
Krishnaraj RaoPresented at Bangalore DV Club, 03/12/2010
Agenda
3D GraphicsThe Big PictureQuick OverviewProgramming ModelImportance of 3D
High Performance Parallel ComputingWhy GPUs for HPPC?Available APIsGPU Computing architecture
Q & A
The Big Picture – Movies
Creation
Capture Models Scene API
Rendering Post Processing
Creation
The Big Picture - Games
Creation
Capture Models Scene API
Rendering Post Processing
Creation
GPU’sDrivers
HLSL,Cg
Models end up in World Space
Y
X
Z
Light Source
Screen
View Pointor Camera
World Coordinate Space
Worldspace includes everything!Position and orientation for allitems is needed to accurately calculatetransformations into screen space.
View Transformation world ends up on Screen
Screen Coordinate Space
Simple Interactive 3D Graphics App
A simple exampleStatic scene geometry, moving viewer
Repeat this loop:CPU takes user input from joystick or mouseCPU re-calculates viewer position, view direction, and light positions in 3-D world spaceGPU clears memory and draws the complete scene geometry with the new viewer and light positionsRepeat forever
VertexEngine Setup Raster
Z Cull
FragmentEngine
Texture
Raster Ops
ReadJoystickPosition
Update Viewer Position and Light
Direction
Draw all Scene
Objects
Adding Programmability to the Graphics Pipeline
3D Applicationor Game
3D API:OpenGL or Direct3D
ProgrammableVertex
Processor
PrimitiveAssembly
Rasterization & Interpolation
3D API Commands
Transformed Vertices
Assembled Polygons, Lines, and
Points
GPU Command &
Data Stream
ProgrammableFragmentProcessor
RasterizedPre-transformed
Fragments
TransformedFragments
RasterOperations Framebuffer
Pixel UpdatesGPU
Front End
Pre-transformed Vertices
Vertex Index Stream
Pixel Location Stream
CPU – GPU Boundary
NVIDIA Confidential
A History of Innovation
1999GeForce 256
22 Million Transistors
2002GeForce463 MillionTransistors
2003GeForce FX130 Million Transistors
2004GeForce 6 222 Million Transistors
1995NV1
1 Million Transistors
2005GeForce 7 302 Million Transistors 2008
GeForce GTX 2001.4 BillionTransistors
2006-2007GeForce 8 754 Million Transistors
…. but what do all these extra transistors do?
GPU continues to offload CPU work
GeomGather
GeomProc
TriangleProc
PixelProc Z / Blend
GPUCPU
GeomGather
GeomProc
TriangleProc
PixelProc Z / Blend
GPUCPU
GeomGather
GeomProc
TriangleProc
PixelProc Z / Blend
GPUCPU
Physics and AI
Scene Mgmt
GeomGather
GeomProc
TriangleProc
PixelProc Z / Blend
GPUCPU
Physics and AI
Scene Mgmt
1996
2000
2004
2008
Programming ModelAPI: Set of functions, procedures or classes that an OS, library or service provides to support requests made by computer programsDirectX: Collection of APIs to handle multimedia, esp. game programming and video tasks, on MS platforms.OpenGL (Open Graphics Library) is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics.
Why is 3D Graphics important?More than just Fun and Games....
Tokyo, Japan California Coastline
3D Consumer Applications
Music
Vista
Photos Maps
PDFsOffice
GPUS IN HPC
MassiveData
Parallelism
Data Fits in Cache Huge Data Sets
Evolution of Processors
InstructionLevel
Parallelism
GPU Processing Power
GPUNVIDIA GTX 285240 cores1.04 TFLOPS
CPUIntel Core i7 965
4 cores102 GFLOPS
CPU
GPU
CPU, meet your new partner!
With floating-point math and textures, graphics processors can be used for more than just graphics
GPGPU = “General Purpose Computing on GPUs”
Lots of ongoing research mapping algorithms and problems onto programmable GPUs
Solving Linear EquationsBlack-Scholes Options PricingRigid- and Soft-Body Dynamics
Middleware layers being developed to accelerate “eye candy” game physics on GPUs (HavokFX)
Beyond Graphics
What is GPGPU ?General Purpose computation using GPUin applications other than 3D graphics
GPU accelerates critical path of applicationData parallel algorithms leverage GPU attributes
Large data arrays, streaming throughputFine-grain SIMD parallelismFloating point (FP) computation
Great for “embarrassingly parallel” algorithms
Applications – see //GPGPU.orgGame effects (FX) physics, image processingPhysical modeling, computational engineering, matrix algebra, convolution, correlation, sorting
A quiet buildup of potentialCalculation Throughput and Memory Bandwidth: 10XEquivalent performance at fraction of power & costGPU in every PC – pervasive presence and massive impact
GPUs have always been parallel “multi-core”Natively designed to handle massive threadingEvery pixel is a threadIncreased precision (fp32), programmability, flexibilityGPUs are a mass-market parallel processor
Economies of scalePeak floating point performance is much higher than comparable CPUs
Why Computation on the GPU?
ATI x1900XT$400 (video card)250 GFLOPs (SP Float)46 GB main memory BW
Intel Core 2 Duo E6600$400 (processor only)40 GFLOPS (SP Float)8.5 GB main memory BW
Why Computation on the GPU?Supercomputing Performance
Inherently Parallel Architecture1000+ cores, massively parallel processing250x the compute performance of a PC
Personal“One Researcher, One Supercomputer”Supercomputer in a desktop system Plugs into standard power strip
AccessibleProgram in C, C++, Fortran for Windows or LinuxAvailable from OEMs and resellers worldwide and priced like a workstation
Compute ApplicationsComputational Fluid DynamicsComputer Aided EngineeringDigital Content CreationElectronic Design AutomationFinanceGame PhysicsGraphicsImaging and Computer VisionMedical ImagingNumericsBio-Informatics and Life SciencesComputational ChemistryComputational Electromagnetics & Electrodynamics
Data Mining, Analytics & DatabasesMATLAB AccelerationMolecular DynamicsWeather, Atmospheric, Ocean Modeling, and Space SciencesLibrariesOil & GasProgramming ToolsRay TracingSignal ProcessingVideo & Audio
Heterogeneous Computing
Multi-CoreCPU
Parallel-CoreGPU
APIS FOR HETEROGENEOUS COMPUTING
APIs for Heterogeneous ComputingCUDA (Compute Unified Device Architecture) is a parallel computing architecture developed by NVIDIA. Programmers use 'C for CUDA' (C with NVIDIA extensions), compiled through a PathScale Open64 C compiler, to code algorithms for execution on the GPU. Both low/high level APIs are providedOpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of CPUs, GPUs, and other processors.Microsoft DirectCompute is an API that supports General-purpose computing on GPUs on Microsoft Win Vista or Win 7. DirectCompute is part of the Microsoft DirectX collection of APIs.
One Host+ one or more Compute DevicesEach Compute Device is composed of one or more Compute UnitsEach Compute Unit is further divided into one or more Processing Elements
OpenCL: Platform Model & Program Structure
CUDA Parallel Computing Architecture
ISA and hardware compute engine
Includes a C-compiler plus support for OpenCL and DX11 Compute
Architected to natively support all computational interfaces (standard languages and APIs)
Shared back-end compiler and optimization technology
OpenCL and C for CUDA
OpenCL
C for CUDA
PTX
GPU
Entry point for developers who prefer high-level C
Entry point for developers who want
low-level API
Option 1
146X
Medical Imaging
U of Utah
36X
Molecular Dynamics
U of Illinois, Urbana
18X
Video Transcoding
Elemental Tech
50X
MatlabComputing
AccelerEyes
100X
Astrophysics
RIKEN
149X
Financial simulation
Oxford
47X
Linear AlgebraUniversidad
Jaime
20X
3D UltrasoundTechniscan
130X
Quantum Chemistry
U of Illinois, Urbana
30X
Gene Sequencing
U of Maryland
CUDA Success—Science & ComputationNot 2x or 3x, but speedups are 20x to 150x
$100K - $1MAccessibility
Perfo
rman
ce
250x
< $10 K
TeslaPersonal
Supercomputer
Today’sWorkstations
1x
250xFaster
100x more affordable20x less power consumption
SupercomputingCluster
Solving the World’s Most Complex Challenges
Oil & Gas
Science
Medicine
Broadcast Space Exploration
Film
Auto Design
Grand Computing Challenges
Renewable Energy
Personalized Medicine
Mathematics for Scientific Discovery
InformationData Mining
Machines That Think
Natural Human Machine
Interaction
Predict Environmental
Changes
Economic Analysis
Final Thoughts
GPU and heterogeneous parallel architecture will revolutionize computing
Parallel computing needed to solve some of the most interesting and important human challenges ahead
Learning parallel programming is imperative for students in computing and sciences
From Virtua Fighter to Tsubame
1995 – NV1 2008 – GT2000.8M transistors 1,200M transistors
50MHz 1.3GHz
1M Bytes 4G Bytes
0 GFLOPS 1 TFLOPS
Another 1000x in 15 years?
BACKUP
Graphics API History
Open GL1992: OpenGL 1.01996: OpenGL 1.1 (Vertex Arrays, Improved Texturing)
1998: OpenGL 1.2 (3D Textures, BGRA pixel format)
1998: OpenGL 1.2.1 (Multi-Texture)
2001: OpenGL 1.3 (Multi-sample AA, Cube/Compressed Textures)
2002: OpenGL 1.4 (Depth/Shadow mapping, Auto mipmap generation)
2003: OpenGL 1.5 (Vertex Attr from Vid Mem)
2005: OpenGL 2.0 (GLSL, Vertex/Pixel Shaders, MRT, Non P-of-2 Tex)
2006: OpenGL 2.1 (GLSL1.2, sRGB Textures)
2008: OpenGL 3.0 (GLSL1.3, 32b FP Textures)
2009: OpenGL 3.1 (March 2009, GLSL1.4, Perf, CopyBufferAPI)
2009: OpenGL 3.2 (Aug 2009, GLSL1.5, Geom Shaders)
OpenGL ES
Designed for hand-held and embedded devicesGoal is smaller footprint to support OpenGLPlayStation 3 and cell phone industry adopting ES
OpenGL ES 1.1Strips out anything deemed extra in OpenGLKeeps conventional fixed-function vertex and fragment processing
OpenGL ES 2.0Adds programmable vertex and fragment shadersShaders specified in binary formatDrops support for fixed-function vertex and fragment processing
OpenGL ES – Cont
OpenGL ES 1.0 : Symbian OS, Android PlatformOpenGL ES 1.0+ : Playstation 3OpenGL ES 1.1 : iPhone SDK, Bberry (Some Models)Open GL ES 2.0 : iPhone 3GS, iPOD touch
DirectX
GDI: legacy Windows graphics API ~1985DirectX 1.0 – 1995/6 (No 3D support, DirectDraw, DirectSound, DirectInput)
DirectX 3.0 – 1996 (Rasterization only 3D Support, Akward prog. Model, Not successful)DirectX 5.0 – 1997 (Draw Primitives, DirectX vs OpenGL War)DirectX 6.0 – 1998 (Multitexture, OGL/Glide features, Texture Compression)DirectX 7.0 – 1999 (Geometry HW accleration and Blending, Cube mapping)DirectX 8.0 – 2000/1 (Programable VS/PS Shaders, XBOX)DirectX 9.0 – 2002-2003 (More programmability, Branching, FP pixel prog.)DirectX 9.0c – 2004 (ShaderModel 3.0)DirectX 10.0 – 2006 (SM4.0, WinVista, Geometry Shaders, Streaming Output)DirectX 10.1 – 2008 (SM4.1, Better Image Quality)DirectX 11.0 - 2009 (SM5.0, DirectCompute Tesselation, WinVista SP2, Win7)