Yesterday we looked at the performance of Apple's "Snow Leopard Graphics Update" for Mac OS X 10.6.4 designed to enhance both the image quality and rendering performance for OpenGL games and applications. For testing their graphics update we benchmarked Mac OS X 10.6.2, 10.6.3, 10.6.4, and 10.6.4 with the Snow Leopard Graphics Update 1.0 installed and benchmarked the Apple OpenGL performance against Ubuntu Linux. The results were mixed showing Apple still has room to optimize their OpenGL stack compared to NVIDIA's Linux implementation and in not all areas did this package update result in performance enhancements. After we finished that OpenGL comparison, we decided to see how the OpenCL performance compares between Mac OS X 10.6.4 and Ubuntu Linux 10.04.1 LTS. We tested the Open Computing Language on both the Intel Core 2 Duo CPU and on the NVIDIA GPU.
OpenCL was originally developed by Apple in collaboration with the major tier-one hardware vendors and is now maintained by the Khronos Group, which also sees after the OpenGL specification and various other industry APIs. Apple released Mac OS X 10.6 "Snow Leopard" with a full OpenCL implementation that is capable of running on either the Intel CPU or ATI/NVIDIA GPUs. Older Mac computers with Intel graphics cannot accelerate OpenCL. Apple's OpenCL implementation utilizes the LLVM (Low-Level Virtual Machine) with the Clang compiler, both of which projects Apple also sponsors. Unfortunately, Linux currently lacks an OpenCL implementation that is provided "out of the box". The only way right now to take advantage of OpenCL under Linux is by either installing the ATI Catalyst driver and the AMD Stream SDK or the latest proprietary NVIDIA driver. When using the AMD Stream SDK you can utilize OpenCL on Radeon/FirePro graphics processors as well as with x86 SSE2/SSE3/SSE4 CPUs, but installing the Stream Software Development Kit requires the Catalyst driver to also be installed. The latest ATI Stream SDK release, which is version 2.2, supports the latest OpenCL 1.1 specification.
The proprietary NVIDIA Linux driver ships with its OpenCL library and header file within the driver package itself, which is much more convenient than having to install a separate package like is required with ATI graphics. However, NVIDIA's OpenCL implementation for Linux is limited to running on the GPU and not any CPU. The latest stable NVIDIA Linux driver implements the OpenCL 1.0 specification, but their latest development drivers that CUDA/OpenCL developers are able to test do provide OpenCL 1.1 compatibility. The OpenCL 1.1 specification was released in June adds new data types, enhanced use of events, additional C built-in functions, and improved OpenGL interoperability, among other enhancements since the OpenCL 1.0 specification was ratified in 2008.
Sadly, these are the only two viable options for using OpenCL under Linux at this point. There is Clover, which is the work of Zack Rusin to bring OpenCL over Mesa and Gallium3D for open-source graphics drivers and from there it could be implemented on the CPU via LLVMpipe. Clover also uses LLVM and Clang for its OpenCL compilation. While Clover has been around for a year, it has not made much progress and is still far from being usable. Once there is Clover implemented in Mesa/Gallium3D, we may finally see OpenCL available "out of the box" for Linux distributions or when any other open-source projects come around aiming for just a CPU implementation of OpenCL 1.0/1.1 with LLVM+Clang.
For this testing we once again used the 2009 Mac Mini (Apple Mac-F22C86C8) with an Intel Core 2 Dup P7350 clocked at 2.00GHz, 1GB of system memory, a 120GB Fujitsu MHZ2120B SATA HDD, and NVIDIA GeForce 9400M graphics. On the Mac OS X side we were running the updated Mac OS X 10.6.4 installation and Xcode 3.2.3 while on the Linux side was Ubuntu 10.04.1 LTS with the Linux 2.6.32 x86_64 kernel, X.Org Server 1.7.6, GCC 4.4.3, and Clang/LLVM 2.7. Originally, we planned to use the NVIDIA 256.44 Linux driver for our OpenCL testing, but it had not worked with OpenCL on the NVIDIA GeForce 9400M (MCP79) graphics processor. Instead we had to use the not-publicly-released NVIDIA 258.19 driver with its initial OpenCL 1.1 implementation where the GeForce 9400M had worked fine with OpenCL. Unfortunately, due to the NVIDIA OpenCL implementation not supporting the Open Computing Language on the CPU and the ATI Stream SDK not working without the Catalyst driver installed, we were limited to OpenCL GPU testing on Linux. With Apple Mac OS X we ran OpenCL tests both on the Intel Core 2 Duo P7350 and NVIDIA GeForce 9400M. Unfortunately, this is the only available Apple hardware we had to test.
Testing was done with the JuliaGPU, MandelGPU, SmallPT GPU, and MandelbulbGPU tests via the Phoronix Test Suite.