Graphics Processing Units (GPUs) have been evolving very fast, turning into high performance programmable processors. Though GPUs have been designed to compute graphics algorithms, their power and flexibility makes them a very attractive platform for generalpurpose computing. In the last years they have been used to accelerate calculations in physics, computer vision, artificial intelligence, database operations, etc. (Owens, 2007). In this paper an approach to general purpose computing with GPUs is made, followed by a description of artificial intelligence algorithms based on Artificial Neural Networks (ANN) and Evolutionary Computation (EC) accelerated using GPU.
General-Purpose Computation using Graphics Processing Units (GPGPU) consists in the use of the GPU as an alternative platform for parallel computing taking advantage of the powerful performance provided by the graphics processor (General-Purpose Computation Using Graphics Hardware Website; Owens, 2007).
There are several reasons that justify the use of the GPU to do general-purpose computing (Luebke, 2006):
Last generation GPUs are very fast in comparison with current processors. For instance, a NVIDIA 8800 GTX card has computing capability of approximately 330 GFLOPS, whereas an Intel Core2 Duo 3.0 GHz processor has only a capability of about 48 GFLOPS.
GPUs are highly-programmable. In the last years graphical chip programming capacities have grown very much, replacing fixed-programming engines with programmable ones, like pixel and vertex engines. Moreover, this has derived in the appearance of high-level languages that help its programming.
GPUs evolution is faster than CPU’s one. The increase in GPU’s performance is nowadays from 1.7x to 2.3x per year, whereas in CPUs is about 1.4x. The pressure exerted by videogame market is one of the main reasons of this evolution, what forces companies to evolve graphics hardware continuously.
GPUs use high-precision data types. Although in the very beginning graphics hardware was designed to work with low-precision data types, at the present time internal calculations are computed using 32 bits float point numbers.
Graphics cards have low cost in relation to the capacities that they provide. Nowadays, GPUs are affordable for any user.
GPUs are highly-parallel and they can have multiple processors that allow making high-performance parallel arithmetic calculations.
Nevertheless, there are some obstacles. First, not all the algorithms fit for the GPU’s programming model, because GPUs are designed to compute high-intensive parallel algorithms (Harris, 2005). Second, there are difficulties in using GPUs, due mainly to:
GPU’s programming model is different from CPU’s one.
GPUs are designed to graphics algorithms, therefore, to graphics programming. The implementation of general-purpose algorithms on GPU is quite different to traditional implementations.
Some limitations or restrictions exist in programming capacities. Most functions on GPU’s programming languages are very specific and dedicated to make calculations in graphics algorithms.
GPU’s architectures are quite variable due to their fast evolution and the incorporation of new features.
Therefore it is not easy to port an algorithm developed for CPUs to run in a GPU.
Key Terms in this Chapter
General-Purpose Computation on GPUs (GPGPU): Trend in computing devices dedicated to implement general-purpose algorithms using graphics devices, called GPUs. At the moment, the high programmability and performance of GPUs allow developers run classical algorithms in these devices to speed non-graphics applications up, especially those algorithms with parallel nature
Vertex Processor: Graphics system component that receives as input a set of 3D vertex and process them to obtain 2D screen positions. Present GPUs have multiple vertex processors working in parallel and can be programmed using vertex programs.
Fragment Processor: Graphics system element that receives as input a set of fragments and processes it to obtain pixel, writing them in a target buffer. Present GPUs have multiple fragment processors working in parallel and can be programmed using fragment programs
Render-to-Texture: GPU feature that allows stocking the fragment processor output on a texture instead on a screen buffer.
Stream Programming Model: This parallel programming model is based on defining, by one side, sets of input and output data, called streams, and by the other side, intensive computing operations, called kernel functions, to be applied sequentially on the streams
Graphics Pipeline: Three dimensional graphics oriented architecture, composed by several stages that run sequentially
Rasterizer: Graphics Pipeline element, which from graphic primitives provides appropriate fragments to a target buffer
Graphics Processing Unit (GPU): Electronic device designed for graphics rendering in computers. Its architecture is specialized in graphics calculations.
Vertex: In computer graphics field, it refers to a clearly defined point in a tridimensional space, which is processed by Graphics Pipeline. Relationships can be established between those vertices (like triangles) to assembly structures that define a tridimensional object. Talking about GPGPU, an vertex array can be considered as a data stream
Texture: In computer graphics field, it refers to a digital image used to modify the appearance of a tridimensional object. The operation that wraps around a texture over an object is called texture mapping. Talking about GPGPU, a texture can be considered as a data stream
Fragment: Potential pixel containing all the necessary information (color, depth, etc.) to generate the final fragment color
Pixel: Picture Element abbreviation, used for referring graphic image points