About Open CL for OS X
OpenCL™ (Open Computing Language) is an open standard for cross-platform, parallel programming of modern processors such as multicore CPUs and programmable GPUs. Introduced with OS X v10.6, OpenCL lets your application tap into the parallel computing power of these processors to improve performance and deliver features made possible by compute-intensive algorithms. OpenCL is comprised of thee parts: a C99-based kernel programing language, a powerful scheduling API and a runtime that efficiently executes kernels on the CPU or GPU.
Going beyond the standard, OS X v10.7 adds integration between OpenCL, Grand Central Dispatch and Xcode making it even easer take advantage of the power of the OpenCL in your application.
At a Glance
Using OpenCL is easier than ever in OS X v10.7:
-
OpenCL is fully supported by Xcode. The Xcode offline compiler removes a configuration step that used to have to be performed before the kernel could be run and aids in debugging earlier in the development process. See “Hello World!.”
You can write OpenCL functions in separate files and include them in your Xcode project. These files can be compiled as your application is built. This improves application performance because kernels need not be compiled when the application is running
-
OpenCL now integrates with Grand Central Dispatch, making it easier for you to focus on making your OpenCL kernels more efficient. See “Using Grand Central Dispatch With OpenCL.”
-
The autovectorizer is used for compiling kernels that will run on the CPU. It accelerates performance up to four times without additional effort. The autovectorizer allows you to write one kernel that runs efficiently on both a CPU and a GPU. It is invoked regardless of whether the openclc compiler is called from Xcode or if the kernel is built at runtime. See “Autovectorizer.”
-
You can, of course, continue to use code you’ve already written to the OpenCL 1.1 standard.
Prerequisites
This guide assumes that you program in C and have access to The OpenCL Specification. Although this guide discusses many key OpenCL API functions, it does not provide detailed information on the OpenCL API or the OpenCL-C programming language.
See Also
The OpenCL Specification, available from the Khronos Group at http://www.khronos.org/registry/cl/ provides information on the OpenCL standard.
The OpenCL Programming Guide by Aaftab Munshi, Benedict Gaster, Timothy G. Mattson, James Fung, and Dan Ginsburg, available from Pearson Education, Inc.
For more information about Grand Central Dispatch queues, see Concurrency Programming Guide: Dispatch Queues.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-07-23)