By Christian Laforte
Do you know what CUDA and OpenCL stand for and how they could make your computer 50 times faster? If so, you can safely jump to the “Ending the mess” section below. Otherwise read on for a gentle introduction.
A computer has two important processing units: the CPU and GPU. Think of them as the two brothers in Rain Man.

The GPU is the ultimate autistic savant. He’s really, really good at counting stuff and doing a lot of complex math at the same time. For example, he can multiply two long sequences of numbers in his head, faster than you can type it in a calculator. But ask him to do something he’s not used to like buying milk and he’ll just ignore you or throw a fit. He only listens to people who know him well. Even if you spend years learning to communicate with a given autistic savant, chances are you’ll have to start anew when you meet a new one.
The CPU is your regular guy. He can do all kinds of stuff that the savant can’t. He goes along well with everybody, as long as they speak English. If he learns to take advantage of the savant, the two of them can do amazing things like count cards at Poker.
In other words, the GPU is natural at some operations that involve repetitive calculations, like those necessary for drawing 3D graphics and doing basic image manipulation. It can do those operations hundreds of times faster than regular CPUs. The high performance comes at the cost of ease of programming. As long as you stick with basic 3D graphics, it’s pretty easy. But say you want to make your financial application run 50 times faster, or making your protein folding simulator run a hundred times faster. It can be done, but for every ten thousand programmers out there, you’ll be lucky if you find one GPU expert capable of achieving that. (Shameless hint: you’ll have a much higher chance to find what you’re looking for at Feeling Software.)
The main GPU vendors — NVIDIA, AMD and Intel — have created new programming languages in the hope to simplify this process for non-GPU experts. For the time being NVIDIA seems to be leading the pack with CUDA. AMD has the Stream SDK. Intel provides Ct. Apple has OpenCL. And Microsoft has… well Microsoft doesn’t have anything yet, it’s too busy introducing new bugs in Vista.
History lesson
Wouldn’t it be nice if everyone could play nice together, if we could get any computing-intensive application to run ten or a hundred times faster without having to deal with all these vendor-specific languages? A potential solution is looming. Before I give you the answer, a short history lesson:

Back when the dinosaurs roamed the earth, in the early 1990s, there were dozens of 3D graphics workstation vendors whose name have long been forgotten who tried to dominate the 3D graphics industry. One of them, SGI, offered generously to transform its superior technology into an open standard called OpenGL. With OpenGL, programming simple 3D graphics algorithms on different hardware became easy.
Shortly after, SGI tragically lost its mind. Every smart graphics engineers fled the company to join upstarts like NVIDIA and ATI (bought by AMD recently). On its death bed, SGI gave up OpenGL and allowed a standard group called Khronos to take it over, where is has since evolved at a moderate but consistent rate. Khronos also maintains other 3D standards like COLLADA.
Ending the mess
Today Khronos announced that it wants to repeat the exploit. This time, they are starting a Compute Working Group so NVIDIA, AMD, Intel and many more can try to agree on a cross-platform standard, i.e. a programming language that will run super fast on multi-core CPUs and on GPUs alike. History shows that this is a good move, that can make it possible for new applications to come to life, applications that would have been too complicated to implement otherwise.
I have seen a couple of these standardization cycles in action, and since I’m not participating in this working group (so far) I will simply speculate from past experience and from the little that has been publicly stated so far. (Feel free in the comments section!) I think there are important questions that will make or break this initiative:
- Are the main players in a collaborative mindset, or are trying to dominate each other? In previous cycles (e.g. GLSL) Apple acted as the mediator, since they badly needed that technology and it had a strong business influence on NVIDIA and ATI. Intel didn’t have a strong participation. This time Intel is very active in 3D graphics. ATI/AMD is in a tough spot where they badly need to get back some market share, maybe through deals with Apple. I’m hopeful that there will be enough collaboration to create a decent standard, with unusual high-performance features continuing to be exposed only in the proprietary standards.
- Typically, the resulting standard is strongly inspired by one precedent. OpenGL was derived from IrisGL from SGI. COLLADA came straight from Sony. Arguably GLSL was inspired by early versions of NVIDIA Cg and a long line of predecessors. This time around, Apple apparently likes NVIDIA’s CUDA which is likely to form the basis of their OpenCL. OpenCL would be the right name for the resulting standard, if the other players can accept it. So my bet is on CUDA rechristened as OpenCL, with bits of Intel Ct thrown in to keep everyone happy. AMD will keep its low-level interface and will implement the high-level standard on top.
- How long will it take for a something usable to come out of this? In the past, such standards have typically taken at least a year, often because modifications were necessary to make the hardware compatible. In this case, it sounds like the technology will primarily be software-based (e.g. compilers), so it could happen much faster if a majority of the vendors accept to play nice. The deciding factor here will be the chair of the working group. A diplomatic yet decisive chair can make things happen ten times faster than a less decisive or a visibly biased one. Since I don’t know yet who is chairing the group, I will refrain from commenting publicly.
[digg=http://digg.com/programming/Making_CPU_and_GPU_play_nice_together_ENLIGHTEN3D]
Subscribe to RSS feed!