Using OpenCL In Snow Leopard For A New Application

September 04, 2009

After much internal debate (with myself) I decided to skip working on another game and focus on a graphics application for Snow Leopard only, using OpenCL.

Sure, it seems suicide to only build an application for a new OS version only a few days old, using a brand new technology which is not 100% solid yet. It does make some sense, as OpenCL/Grand Central are something that Apple has built that could be really important in the future as hardware goes more and more parallel. Being able to take advantage of this not only give me the ability to ship something difficult to do otherwise, and might even attract some marketing assistance from Apple.

I am building a niche graphics application than can really benefit from scalable processing power. One could build this without OpenCL but it would take a lot of time and effort to make it scalable. The groovy thing about OpenCL is you can build an algorithm that works well for small images on slow Macs, and have it scale to ridiculous levels for large, complex images simply by having better hardware.

My main Mac is a quad Nehalem MacPro, with 4 cores and 8 processing units, along with a relatively wimpy GT120 GPU. Running various OpenCL benchmark apps, its obvious the CPU is faster than this GPU. However upgrade to a GT285 and the GPU blows the CPU away. Adjust your algorithm to split work between multiple devices (I believe you can use multiple GT285 plus the CPU) and the ability to process scales to silly levels.

The beauty is once you have the code working on a single device, adding more is pretty easy. Then without any changes on the programmers part the scaling just happens based on whatever hardware the user has. Image processing applications are perfect for this type of scalability since the work can be divided up and run in parallel without much trouble.

Currently the ATI support for OpenCL has some troubles (which will be fixed in 10.6.1 I believe) but the NVidia support seems a bit more mature. There are no shipping applications (that I know of, I could be wrong) using OpenCL, and I imagine it will take time for it to be widespread. So for once I in front of the steamroller.

The other great thing about supporting Snow Leopard only is I can use all the new features of Objective-C, Cocoa, XCode and new Frameworks and not care about Windows or anything. Who know, maybe there will be a iTablet, which would be a cool bit of hardware to run my new app on!

I expect once I have something working I will look for alpha testers to help round out the features. If nothing else it will be fun to play with.

It also gives me something fun to work on, since finding a fulltime contract or job seems to be taking geologic time.