GPUs: Transforming What’s Possible—More Easily
In my previous post here, I looked at how we’ve got to where we are today with GPU technology—how it’s emerged from being just something that made Call of Duty run better to a potentially game-changing technology in a much wider range of environments—not least among them, the battlefield.
GPUs serve two primary purposes:
- Display visual information (2D and 3D) extremely fast. There are some big limitations: it can only draw points, lines, and images. There’s no direct ability to draw circles, squares, or even text.
- Process data extremely fast. This is limiting if the data is not parallelizable.
CPU (not GPU) based graphics packages can be used to display very fancy 2D graphics in a simple way (Qt, MS Visual Studio, Java Swing, HTML, etc.) but this is inefficient because all the work is done on the CPU, one pixel at a time, and then the result is passed to the GPU memory. The same is true of data processing on the CPU, where each data item is processed one at a time. Even with multiple CPU cores, it can be much slower compared to doing much of the processing on a GPU.
This traditional software design looks like:
A more efficient way to utilize the GPU is the following:
To fully utilize the power of the GPU to create and display graphics, developers use a low-level software API called OpenGL, which has been around since the early 1990s. Specific platforms have proprietary APIs, but OpenGL is a portable open standard for all popular platforms.
The difficulty with OpenGL is its complexity. There is a steep learning curve and a large amount of code is needed to do simple things:
- A filled rectangle needs about 200 lines of code.
- Drawing an anti-aliased circle is about 300 lines of code.
- Displaying text requires the creation of a glyph map for each character, or modeling the characters using lots of triangles. Either way, drawing a simple text message requires hundreds or thousands of lines of code.
To simplify creating and displaying graphics on the GPU, Abaco will soon be launching ImageFlex 2. With ImageFlex 2, drawing a rectangle, line, circle, arc or text becomes just a few lines of code—not hundreds. That can mean a significant time—and cost—saving. ImageFlex 2 also includes more advanced features such as cropping, rotating, warping, lens distortion correction and so on which can also be achieved with just a few lines of code.
Over the last decade, data processing on a GPU has become much simpler via C extensions called CUDA and OpenCL. Even better, there are high level abstraction libraries to simplify signal- and image processing on the GPU, such as OpenCV and OpenVX. To get the best performance with image processing, both CUDA and OpenCL have extensions to work with OpenGL images directly.
Unfortunately, this interop is not trivial. To help simplify the interop between OpenGL and CUDA/OpenCL, ImageFlex 2 includes functionality to do this for you. Allowing CUDA or OpenCL to draw directly into an OpenGL image is only about five lines of ImageFlex 2 code.
ImageFlex 2 is designed to let our customers easily harness the power of the GPU without the pain of the learning curve—giving GPU yet another advantage over FPGA in addition to those I mentioned in my earlier post.
ImageFlex 2 will provide yet another reason to take a closer look at Abaco GPU and graphics solutions. You can find out more about them here.