Fnord

Random bits from a random nerd

CUDA on the MacBook Aluminum

One of the reasons to upgrade to the new MacBook is the new motherboard/chipset combo. It went from an Intel system to an Nvidia one, with the consequent addition of the NV9400M GPU. If you’ve not looked recently, this is a mobile part, which usually means slower and older than desktop chips. This one, however,

With 16 parallel processing cores and a 128-bit memory interface, the GeForce 9400M is able to deliver up to 54 Gigaflops of processor power

(That’s from this article)

54 gigaflops is fifty four billion floating point operations per second. That’s really, really fast. Nvidia has a programming system called CUDA that allows you to tap all of that goodness, and it’s available for OSX too. Version 2.0 works for me, but I had the following two problems that I wanted to mention:

  1. The initial ‘make’ from /Developer/CUDA fails with a library error. Running

    ranlib *

in /Developer/CUDA/lib solves this and then the build succeeds.

  1. The programs then all fail to run with this error
dyld: Library not loaded: @rpath/libcudart.dylib

The fix for that, found here, is to define DYLD_LIBRARY_PATH. My zshrc looks like this, also showing the modified path:

typeset CUDA_HOME=/usr/local/cuda

typeset DYLD_LIBRARY_PATH=$CUDA_HOME/lib

typeset PATH=${HOME}/bin:${ANT_HOME}/bin:/usr/local/bin:$CUDA_HOME/bin:/Library/
OpenSC/bin:${PATH}

I’m now experimenting to see how fast it runs the examples, so more later. I wonder how well this’d run the alphabet code? Hmm.

Comments