CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Wiki > GPGPU

GPGPU

From CFD-Wiki

(Difference between revisions)
Jump to: navigation, search
(Still need to work on Performance and Languages Sub-Sections)
(Cleaned)
Line 7: Line 7:
==Graphics Architecture==
==Graphics Architecture==
   This section is written by a non english speaker; please excuse the bad grammar (And correct it!).
   This section is written by a non english speaker; please excuse the bad grammar (And correct it!).
-
A GPU has a main memory (up to 1536 MB in 2010), many stages and parallel processors.  Traditional GPUs have a linear pipeline with several distinct stages: application, command, geometry, rasterization, fragment, and display.  Intel's project [http://en.wikipedia.org/wiki/Larrabee_%28microarchitecture%29 Larrabee] promises a reconfigurable graphics pipeline, with many of the traditional steps being handled in software.  Such a development would expose even more of the GPUs compute power to parallel programmers.
+
A GPU has a main memory, many stages and parallel processors.  Traditional GPUs have a linear pipeline with several distinct stages: application, command, geometry, rasterization, fragment, and display.  Intel's project [http://en.wikipedia.org/wiki/Larrabee_%28microarchitecture%29 Larrabee] promises a reconfigurable graphics pipeline, with many of the traditional steps being handled in software.  Such a development would expose even more of the GPUs compute power to parallel programmers.
===Traditional Pipeline===
===Traditional Pipeline===
Line 21: Line 21:
===Performance===
===Performance===
-
In a Geforce 7800 have been measured 160 Gigaflops (not peak, but maintained performance). But expect half to 1/3 this power in a general purpose/novice program.
+
NVidia has been actively promoting GPGPU computing in recent years. They introduced CUDA in 2007, giving programmer direct access to the GPU. NVidia maintains a [http://www.nvidia.com/object/cuda_showcase_html.html CUDA community showcase] on their CUDA website showing the performance boost to a variety of applications when making use of the GPU.
-
There are at least double chips video cards, and PC motherboards that support up to 4 video cards. This mean 160x2x4=1.2 Teraflops (1.2/2=600 Gigaflops) on one PC with 512*4=2 Gb of 'video' RAM.
+
 
-
But nvidia drivers support '''transparently''' only up to 2 chips running like one and without the double of memory. Then, for the novice there are only (160/3)x2=100 Gflops and 512 Mb of video RAM available on 2005 at cost of near 1000 U$S. In comparison, there is possible to put 2 x86 processors with double CPU on a motherboard, allowing up to a peak of 15/20*4=60/80 Gflops in a PC, that can be reached by programs that not fill the cache.
+
When programming GPGPU systems, it is important to remember that there is significant overhead involved in transferring data between the CPU and the GPU.  Serial programs with memory requirements beyond those available on the GPU will not see the same dramatic performance enhancements as programs with low memory transfer overhead.
===Languages===
===Languages===
-
Is possible to program directly with OpenGL Shading Language --, his equivalent of Microsoft, DirectX shading language HLSL, or Nvidia CG ; all in a format very similar to c/c++. OpenGL and CG are full portable to non Microsoft environments. Those 3 languages are almost identical.
+
There exist several languages which support direct control of the GPU.  OpenCL, Microsoft's DirectCompute, and Nvidia's CUDA are good examples of these.  For more information about how to program on the GPU, see the [http://en.wikipedia.org/wiki/GPGPU Wikipedia] site on GPGPU computing. Coding syntax is similar to C/C++ programming syntax.
-
Also exist languages like  and c/c++ libraries/wrappings.
+
-
Since representation of CFD data requires graphic drawing, learning OpenGl is extremely useful for CFD, and from here, programming GPUs is a very straight forward step to do.
+
-
==References==
+
Additionally, if a programmer wants to use the graphics card to compute, and then display the results of their CFD equations. OpenGL hooks into C++ to enable that, and Microsoft's DirectX performs a similar role.
-
===Guides and Information===
+
-
[http://oss.sgi.com/projects/ogl-sample/registry/ARB/GLSLangSpec.Full.1.10.59.pdf GLSL]
+
-
[http://developer.nvidia.com/object/cg_toolkit.html free CG toolkit]
+
All of these languages have active communities participating in their further development. There are many code samples and tools on the internet to help a programmer get started with GPGPU computing. Go for it!
-
[http://graphics.stanford.edu/projects/brookgpu/ Brook GPU]
+
==References==
-
 
+
===Resources===
-
[http://www.gpgpu.org www.gpgpu.org]
+
[http://developer.nvidia.com/object/gpucomputing.html CUDA]\n
-
 
+
[http://www.khronos.org/opencl/ OpenCL]\n
-
[http://download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/src/gpgpu_fluid/docs/GPU_Gems_Fluids_Chapter.pdf GPU Gems Fluid Chapter]
+
[http://www.opengl.org OpenGL]\n
-
 
+
[http://www.nvidia.com/object/cuda_showcase_html.html CUDA Showcase]\n
-
[http://www.opengl.org www.opengl.org]
+
[http://graphics.stanford.edu/projects/brookgpu/ Brook GPU]\n
-
 
+
[http://download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/src/gpgpu_fluid/docs/GPU_Gems_Fluids_Chapter.pdf GPU Gems Fluid Chapter]\n
-
[http://oss.sgi.com/projects/ogl-sample/registry/ARB/GLSLangSpec.Full.1.10.59.pdf GLSL]
+
[http://oss.sgi.com/projects/ogl-sample/registry/ARB/GLSLangSpec.Full.1.10.59.pdf GLSL]\n
-
===Journalism===
+
===News Sites===
-
[http://www.tomshardware.com/2005/12/14/sneak_preview_of_the_nvidia_quad_gpu_setup/ Two's Company, Four's a WOW! Sneak Preview of NVIDIA Quad GPU SLI]
+
[http://www.gpgpu.org gpgpu.org]\n
Line 52: Line 48:
[[Category: Acronyms]]
[[Category: Acronyms]]
-
 
-
{{stub}}
 

Revision as of 06:09, 18 March 2010

Contents

Introduction

GPGPU is an acronym for General Purpose Graphic Processor Unit. A GPGPU is any graphics processor being used for general computing beyond graphics. GPUsare widely available, and often targeted at the computer gaming industry. Graphics workloads are very parallel, and so GPUs developed as large-scale parallel computation machines. Originally GPGPU processing was done by tricking the GPU by disguising computation loads as graphic loads. In recent years, GPU manufacturers have been actively encouraging GPGPU computing with the release of specialized languages which support GPGPU commands. GPUs incorporate many more computational cores than their equivalent CPUs, and so the performance of parallel operations can be greatly enhanced. Programming in parallel on a GPU has the same justification given for parallel computing in general.

Application to CFD

GPGPU computing offers large amounts of compute power, which can be tapped for parallel components of CFD algorithms, while the CPU performs the serial portions of the algorithm. GPGPU languages also support data-parallel computation, similar to vector processors. In short, modern GPUs provide raw computational power orders of magnitude larger than a CPU and can fit inside a single computer case.

Graphics Architecture

 This section is written by a non english speaker; please excuse the bad grammar (And correct it!).

A GPU has a main memory, many stages and parallel processors. Traditional GPUs have a linear pipeline with several distinct stages: application, command, geometry, rasterization, fragment, and display. Intel's project Larrabee promises a reconfigurable graphics pipeline, with many of the traditional steps being handled in software. Such a development would expose even more of the GPUs compute power to parallel programmers.

Traditional Pipeline

A traditional pipeline will have three main computation stages: geometry, rasterization, and fragment. Graphics is traditionally done with triangles, and a GPU will operate on a batch of triangle verticies to first create fragments, which will help create the pixels that end up on the monitor.

Geometry

Vertex processing is handled in the geometry step. Geometry from the CPU is transformed based on the vertex shaders (programs) written to the GPU. These processors specialized in matrix transformations. Common operations include projecting 3D coordinates onto 2D screen coordinates. The closest analogue would be a vector or quaternion processor since each vector operation takes a series of components which represent a triangle vertex. Lagrangian frame computations might be well suited to vertex shaders.

Rasterization

Rasterization takes the transformed vectors from the geometry step and creates fragments from the geometry. The easiest way to think of rasterization, is "chunking" a large triangle into many fragments. This stage is typically done with fixed function specialized hardware.

Fragment

Fragment processing requires floating point math, as the fragments are colored and filtered to become pixels. This stage is where muchof the interesting compute for CFD can happen, as the parallel floating point processors can be repurposed with either fragment shaders or special purpose languages to do non-graphics floating point math.

Performance

NVidia has been actively promoting GPGPU computing in recent years. They introduced CUDA in 2007, giving programmer direct access to the GPU. NVidia maintains a CUDA community showcase on their CUDA website showing the performance boost to a variety of applications when making use of the GPU.

When programming GPGPU systems, it is important to remember that there is significant overhead involved in transferring data between the CPU and the GPU. Serial programs with memory requirements beyond those available on the GPU will not see the same dramatic performance enhancements as programs with low memory transfer overhead.

Languages

There exist several languages which support direct control of the GPU. OpenCL, Microsoft's DirectCompute, and Nvidia's CUDA are good examples of these. For more information about how to program on the GPU, see the Wikipedia site on GPGPU computing. Coding syntax is similar to C/C++ programming syntax.

Additionally, if a programmer wants to use the graphics card to compute, and then display the results of their CFD equations. OpenGL hooks into C++ to enable that, and Microsoft's DirectX performs a similar role.

All of these languages have active communities participating in their further development. There are many code samples and tools on the internet to help a programmer get started with GPGPU computing. Go for it!

References

Resources

CUDA\n OpenCL\n OpenGL\n CUDA Showcase\n Brook GPU\n GPU Gems Fluid Chapter\n GLSL\n

News Sites

gpgpu.org\n

My wiki