Channels ▼

Gastón Hillar

Dr. Dobb's Bloggers

Intel OpenCL SDK 1.1

July 11, 2011

Powerful multicore CPUs are available in almost every modern laptop, workstation, or server. These powerful CPUs are very attractive for running OpenCL kernels that demand high throughput. An optimized OpenCL runtime that targets specific CPUs can take full advantage of both the latest enhancements found in modern microarchitectures and the powerful extended instruction sets. Intel does exactly that job by providing an OpenCL 1.1-compliant implementation that targets Core 2 Duo (Penryn) or later Intel microprocessors and provides unique features and tools.

Do you really want to use the GPU as the target device for your OpenCL kernels? What about testing your OpenCL kernels with a powerful Intel multicore CPU as its target? The Intel OpenCL SDK 1.1 runs on both 32-bit and 64-bit versions of Windows 7 and Windows Vista SP2. In addition, there is a 64-bit Linux version.

If you want to take full advantage of all the optimizations on the second generation Intel Core CPUs, you will need Windows 7 with SP1 installed. In a previous post, I explained that the second generation Intel Core processor family, codenamed "Sandy Bridge," introduced Intel Advanced Vector Extensions (AVX). The Intel OpenCL 1.1 runtime takes advantage of AVX when available, but that requires the operating system support introduced in Windows 7 SP1, as I explained in that post.

The Intel OpenCL 1.1 runtime makes extensive use of SIMD instructions in order to increase throughput; therefore, it requires support for Intel Streaming SIMD Extensions 4.1 or higher. In addition, the runtime uses the Intel Math Kernel Library (MKL), which is also optimized to take full advantage of the latest SIMD instructions available in modern Intel multicore CPUs. When you use math functions in the OpenCL kernels, you can take advantage of Intel MKL.

Intel OpenCL SDK 1.1 includes an OpenCL offline compiler. The offline compiler allows you to see both the assembly code and the LLVM code for your OpenCL kernel. This way, you can compile kernels for correctness and check the intermediate representation without having to use additional APIs. Figure 1 shows a screenshot of the 64-bit Windows version of the Intel OpenCL SDK offline compiler with the source code of one of the sample OpenCL kernels provided with the SDK.

Figure 1: The source code for a kernel loaded in Intel OpenCL SDK offline compiler.

You can build the kernel by selecting Tools -> Build in the main menu. After the build completes, you can select View -> Show Assembly Code, and the window will add a new panel with the assembly view for the kernel (see Figure 2). In addition, you can select View -> Show LLVM Code, and the window will add another new panel with the LLVM view (see Figure 3).

Figure 2: The assembly code for a built kernel in Intel OpenCL SDK offline compiler.

Figure 3: The LLVM for a built kernel in Intel OpenCL SDK offline compiler.

If you want to write optimal OpenCL code that targets an Intel CPU, I suggest reading Tips and Tricks for Kernel Development and Writing Optimal OpenCL Code with Intel OpenCL SDK (the latter is a PDF). In these two articles, you will find valuable information about the most convenient way to code your kernels when you target an Intel CPU. It is especially important to learn how to write kernels to benefit from implicit CPU vectorization and to avoid needless synchronization. This way, you will be able to achieve the highest throughput on Intel CPUs.

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.
 

Comments:



Video