// I need to

ModernizeUpgrade without breaking it RescueFix what someone else started Build NewTurn an idea into a product Reach More PeopleGet found, get used, include everyone

// Company

Case StudiesExpertiseAbout + CareersResourcesContact Book a call →
≡articleBuild New

Prototyping with OpenCL in Quartz Composer

Prototype and run parallel OpenCL algorithms on your Mac's GPU with Quartz Composer, a graphical tool already included with Xcode.

Art+Logic Mar 14, 20131 min read

From the Art+Logic archive · written in 2013. The tools may have moved on; the thinking still holds.

Software screen capture

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.

keep going

More to explore in Build New.

All Build New resources →
let's talk

Got a problem like this one?

Tell us what's stuck. A real person replies within one business day.

Talk to our team →

Talk to people who know software, not a sales script.

Your first call is with Aja, our VP of Sales. He'll help make sure you're solving the right problem. Here's what you'll cover together:

  1. What you're trying to accomplish

    The business goal first, then the technology.

  2. Possible approaches

    And the tradeoffs of each, in plain language.

  3. Risks you may not have considered

    Technical and business, before they cost you.

  4. Whether AI changes the math

    What's practical, and what's just hype for your project.

  5. Sensible next steps

    Even if the right next step is not us.

book-a-call.ics

Loading the scheduler…

Open the booking page →

Some problems are easier to explain in writing. Send us a few lines about what you're working on, and we'll reply within one business day. Helpful to include:

  1. What the software does, or should do
  2. What's stuck, or what's worrying you
  3. Any deadline or budget you have in mind
note.md

Loading the form…