Channels ▼
RSS

Design

Testing OpenCL GPU Capabilities


Gaston Hillar is an IT consultant and author of more than 40 books. He can be contacted at gastonhillar@hotmail.com.


If you have a poweful OpenCL GPU available in a system, it is a good idea to understand its capabilities. You can do so by running algorithms in their CPU and GPU versions, and comparing the results. You might be surprised with the processing power that most modern software is wasting when it runs on a computer with an OpenCL GPU.

A few months ago, I wrote an article about an interesting utility called GPU Caps Viewer v1.8.6 which returns detailed information about the graphics cards and the GPU (short for "Graphics Processing Units") installed in a computer.

If GPU Caps Viewer lists your GPU as one of the CL devices, it is interesting to compare the results of running a few OpenCL demos in their CPU and GPU versions. The CPU version creates many threads that take advantage of the multiple cores, and therefore tries to take advantage of multicore microprocessors. The GPU version uses the multiple compute units offered by the OpenCL GPU and tries to minimize the CPU usage. Both tests produce the same real-time visual output with different frame rates according to their diverse capabilities.

The results will depend on your CPU and the OpenCL GPU. However, here I present some interesting results that will let you see the power that most modern software is wasting on high-end laptops. In this case, I am not going to consider power consumption but you must take into account that it is another important variable to watch when running these tests.

First, I ran the CL CPU-Mesh Deformer OpenCL demo. You just have to select it in the dropdown list located below OpenGL and OpenCL demos in GPU Caps Viewer, then click on the Start button. This demo shows a surface deformed by an OpenCL kernel running on the CPU, and then rendered through OpenGL. A dialog box lets you set the desired width and height for the window size that will render the animated surface and a dropdown list to specify the desired MSAA (short for "MultiSample Anti-Aliasing"). I left the default values for the window size, 600 for both width and height, but I selected 8X in MSAA. Once you have selected the desired values for the parameters, you just have to click Go!.

The demo is capable of generating 29 or 30 FPS ("Frames Per Second") most of the time. The average CPU usage is 40%.

[Click image to view at full size]
Figure 1: An OpenCL kernel running on the eight logical cores offered by the CPU is deforming the surface. The OpenGL render generates 29 or 30 FPS.

[Click image to view at full size]
Figure 2: The average CPU usage is 40% when the OpenCL kernel runs on the eight logical cores.

Then I ran the CL GPU-Mesh Deformer OpenCL demo. Again, you just have to select its name in the dropdown list located at the right below OpenGL and OpenCL demos in GPU Caps Viewer and then click on the Start | button. This demo shows the same surface deformed by an OpenCL kernel running on the GPU instead of the CPU. The rendering process is performed by OpenGL as in the previous execution. It is necessary to choose the same values selected for the CL CPU-Mesh Deformer OpenCL demo. And then again, you just click Go!.

The demo is capable of generating 40 or 41 FPS most of the time. The average CPU usage is 7%. There is more code running on the GPU.

[Click image to view at full size]
Figure 3: The OpenCL kernel running on the GPU is deforming the surface. The OpenGL render generates 40 or 41 FPS.

[Click image to view at full size]
Figure 4: The average CPU usage is 7% when the OpenCL kernel runs on the GPU.

The demo generates the same results with a difference in the sustained FPS rate. When the demo runs the OpenCL kernel on the GPU, it leaves a lot of CPU power free, because it is deforming the surface by running general-purpose code in the GPU. This demo is an excellent example of the new possibilities offered by OpenCL.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video