A computer’s CPU traditionally carries the application workload, but developers can now tap a programming approach that also engages the graphics processing unit (GPU). The concept, referred to as “General Purpose GPU,” or “GPGPU,” essentially makes the GPU available for computing chores other than graphics. The ability to offload over-taxed CPUs can boost application performance. A key and increasingly used framework for making GPGPU happen is OpenCL*. This Khronos Group specification provides an API set and programming language that lets coders write programs that use all of a system’s resources.
To date, GPGPU, or GPU programming, has had the largest effect on desktop and notebook computers. Although mobile devices—processor-constrained smartphones and tablets—also stand to benefit, widespread use of GPGPU in that space may be a few years away.
“The key benefit of programming GPUs is high performance of calculation operations,” said Eugene Filipkov, senior game developer at Eligraphics Studio in Minsk, Belarus. “GPUs can carry out an enormous number of simple operations in parallel to CPUs. More complex operations can be calculated by CPUs and simpler operations by GPUs.”
As a game developer, Eligraphics’ involvement with GPU programming is currently limited to the programming of vertex and pixel shaders for games, Filipkov explained. He suggested the company’s use of GPU programming could increase in the future. “For example, if the company decides to create its own 3D engine, the effort would involve parallelizing tasks and transitioning elements of computing to the GPU,” he said.
Arnon Peleg, software products marketing manager at Intel, takes a broader view of GPU programing. He points to OpenCL as a key enabler. “We are talking about platform programmability and not only CPU or graphics,” he said. Peleg called OpenCL a standard programming language that provides a way to access the computing horsepower of the entire platform.
At this point, Intel supports OpenCL on client PCs and Ultrabook™ devices. The company has not announced support for OpenCL on smartphones and tablets. But in the case of Intel-equipped Ultrabook devices, for example, OpenCL lets developers access both the CPU and Intel® HD Graphics in a standard manner. “The performance on the entire platform is the key here,” Peleg said. “It is the ability to program the overall platform and utilize the power of the entire platform and get the most power efficiency.”
“The goal for developers,” he said, “is to utilize all of a system’s resources. If a developer uses OpenCL to run code on a GPU or Intel HD Graphics, they can actually free CPU cycles to perform other tasks.”
Power consumption is another aspect of platform programmability. Writing programs to leverage more resources helps improve energy management—tasks can be targeted toward the parts of a system that consume less power.
And as for the power efficiency, a developer can program an application to run code on the least power-consuming system component, which is typically the graphics component. Peleg also noted that, “Developers who balance their code between the CPU and Intel HD Graphics potentially can create applications that use energy more efficiently.”
User experience, however, comes before the power management issue. Developers will shrink from compromising user experience to save battery life.
TAPPING OPENCL ON INTEL PLATFORMS
To take further advantage of OpenCL on the Intel platform, Peleg said developers can use Intel SDK for OpenCL* Applications 2012 in conjunction with the Intel Media SDK. The Intel SDK for OpenCL Applications 2012 provides a software development environment for OpenCL.
Intel Media SDK offers a cross-platform library API that exposes Intel Quick Sync Video, the media acceleration capabilities of the Intel platform. Those capabilities include encoding, decoding, and transcoding. When OpenCL and Intel Quick Sync Video are used together, media applications can be fully hardware accelerated without the overhead of memory copies.
“Developers have access to numerous Intel resources, helping them get the most out of the tools. Intel SDK for OpenCL Applications 2012 comes with code samples, a user guide, an optimization guide, and tutorials,” Peleg said. Those resources are available on Intel’s OpenCL website. “The guides focus on how to write more efficient code on the platform,” Peleg said.
The goal for developers is to utilize all of a system’s resources. If a developer uses OpenCL to run code on a GPU or Intel HD Graphics, they can actually free CPU cycles to perform other tasks."
— Arnon Peleg, Software Products Marketing Manager, Intel
Peleg notes that not every algorithm or compute workload will be matched to the graphics device. So developers will need to do their homework to understand whether a given algorithm fits the graphics processing scenario. Intel tools can help developers with this investigation, he added.
Among those tools are the Intel Graphics Performance Analyzers (Intel GPA), a suite of graphics analysis tools that help developers pinpoint performance opportunities. In addition, developers can use Intel VTune™ Amplifier XE in conjunction with Intel GPA to fine-tune games and media for optimal performance, according to Intel.
The Intel GPA System Analyzers component “has some very useful metrics for CPU and graphics utilization as well as power consumption of the system,” Peleg said, noting that the System Analyzers tool also reports on socket power, a metric that reflects CPU power.
“The quality of the app and its performance depends on the type of algorithm the developer has implemented...and the design choice the developer makes,” Peleg said. “So it’s important to understand how to optimize your code to the underlying hardware. This is where the content on the website can help developers.”
Peleg said graphics and media applications benefit the most from APIs such as OpenCL. But he added that most OpenCL programmers today for the Ultrabook device and PC platforms are media developers. For the most part, game and graphics developers aren’t using OpenCL.
Intel stated the Intel SDK for OpenCL Applications 2012 targets visual computing applications including video, media, and 3D content. “This is where you benefit most from doing compute on the graphics devices,” Peleg said. “OpenCL was designed with visual computing developers in mind.” The Intel SDK for OpenCL Applications also offers developers interoperability between OpenCL and other APIs including OpenGL* and Microsoft DirectX*. “Developers already using those APIs can benefit from this interoperability,” Peleg said.
Neil Trevett, vice president of mobile content at NVIDIA and president of Khronos Group, said GPU and cross-platform programming will eventually work their way down to mobile devices. That goes for both OpenCL and CUDA, NVIDIA’s parallel computing platform and programming model, which also takes advantage of GPU power.
“Silicon and IP vendors are working now to build CUDA and OpenCL programmable GPUs into the power budget of mobile phones at a useful level of performance,” Trevett said. He called that task a non-trivial exercise. That said, Trevett believes the next two years will see multiple system-on-a-chip integrated circuits for phones and tablets emerging with that capability, making it a useful feature for developers to target. “I think the first beachhead applications to take advantage of GPU programmability will be image and vision processing, computational photography, and video editing and analysis,” Trevett said. “Also, games will use this capability to accelerate physics and simulation engines, just like desktop games today.”
YOUi Labs, based in Ottawa, Ontario, adds Natural User Interfaces (NUIs) to the list of software that can benefit from GPU computing. The company, which focuses on developing NUIs for embedded platforms, reasons that NUIs require more computational power than traditional graphical user interfaces.
A YOUi Labs white paper stated that making use of available GPU cycles is important for maximizing the hardware’s capability for an NUI: “This process of using GPUs as [GPGPUs] has been traditionally limited to desktop computing platforms, but as portable devices are becoming more powerful, encompassing multiple-core CPU and GPU elements, implementation becomes crucial for efficient use of the hardware’s capability.”
Jason Flick, chief executive officer of YOUi Labs, said GPU programming is headed for mobile devices, noting that OpenCL drivers already are showing up on pre-production hardware. He said about half of the development boards in the next six months will have OpenCL support, although currently only a few have that feature.
“It certainly will be moving into that space,” he said of GPGPU and mobile devices.
For more information and to download Intel tools, go to http://intel.com/software/vcsource
ABOUT THE AUTHOR
John Moore has been writing about business and technology for more than 20 years. Moore’s articles have appeared in Baseline, CIO.com, Federal Computer Week, Government Health IT and TechTarget. Areas of focus include cloud computing, health information technology, systems integration, and virtualization.