I’ve found a great way to experiment with OpenCL-C and discover how to access the power you have on your lap or at your feet. With tools you already have if you are developing with Xcode, you can prototype and run highly parallelized algorithms. Here’s how.
Apple has been installing Quartz Composer with its developer tools for many years. If you aren’t familiar with it, it’s a graphical programming environment which can be used for everything from helping to create the dynamic, animated user experience Apple has been advocating to producing professional animations. But It is also useful as a development tool if you want to provided accelerated versions of some CPU intensive functionality in your application.
Since OS X 10.6, Apple has provided the OpenCL framework giving programmatic access to the GPU of supported graphics cards. The OpenCL standard supports computing on “heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), DSPs and other processors.” One problem with the disparate computing units available has been that you had to provide an implementation for each to get the benefit of it. Many machines your code would run on wouldn’t have a unit of that type, and it was up to your code to figure that out at runtime. OpenCL fixes this by providing a generic interface to these “heterogenous platforms” through a subset of C, OpenCL-C. (Microsoft announced a similar effort last year, C++ AMP.) The magic happens when the OpenCL-C code is compiled on the machine it will be running on at runtime.
Where these two worlds meet is the OpenCL module of Quartz Composer. It allows you to paste in some OpenCL-C source code, connect it with any other Quartz Composer module providing the right kind of data for your kernel, then execute your kernel code with that data. After debugging the kernel in this forgiving environment, move it into your project. Easy.
Does your business still have an XT computer in the back office because it's running that one version of some database software that your business depends on? Yeah, we know there is. Most modern software doesn't work like that. If you aren't keeping your custom...