Mac PyCUDA with Snow Leopard and EPD

/!\ This page has not been updated for the removal of the Boost dependency in 0.94. If you use this page, please perform the necessary updates. Thanks! -- AndreasKloeckner 2010-09-21 00:17:38

Install Dependencies

Install XCode (from the Snow Leopard Install DVD that came with the machines) and get all Software Updates for it to ensure it's on the latest version.

Install these applications (download from the appropriate locations):

Update Shell Startup Script

If the machine is running BASH, then you would open your ~/.profile file (creating it if it does not exist) and add the following lines (make sure to open a new terminal once you have done this):

export PATH="/usr/local/cuda/bin:${PATH}"
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$HOME/pool/lib:${DYLD_LIBRARY_PATH}

But if it's running the old and out-dated and inferior TCSH you'll need to edit your .cshrc file to have this:

set path=(/usr/local/cuda/bin $path)
setenv DYLD_LIBRARY_PATH /usr/local/cuda/lib:$HOME/pool/lib
setenv PYTHONPATH $HOME/lib/python

Create the lib/python directory:

mkdir -p ~/lib/python

Install Boost

Download boost_1_42_0.tar.bz2, extract it:

tar xvjf boost_1_42_0.tar.bz2
cd boost_1_42_0

install it (this is two lines)

./ --prefix=$HOME/pool --libdir=$HOME/pool/lib

./bjam -j2 address-model=32_64 architecture=x86 variant=release
link=shared install

Fix the linking, which seems to be broken:

cd ~/pool/lib

install_name_tool -change

Install PyCuda

Download pycuda-VERSION.tar.gz (tested with 0.94rc), extract it

tar xvzf pycuda-0.94rc.tar.gz
cd pycuda-0.94rc

# Run configure
./ --cuda-root=/usr/local/cuda/

Edit to point at your boost python and thread libraries in ~/pool/lib and LDFLAGS:


CXXFLAGS = ["-arch", "x86_64", "-arch", "i386"]
LDFLAGS = ["-arch", "x86_64", "-arch", "i386"]

# Change SDK dir if needed:
CXXFLAGS.extend(['-isysroot', '/Developer/SDKs/MacOSX10.6.sdk'])
LDFLAGS.extend(['-isysroot', '/Developer/SDKs/MacOSX10.6.sdk'])

Install to ~/lib/python directory:

python install --home=~

Make sure it works:

python test/

(Instructions by Per Sederberg)

Note: the test in the last line above requires that you install pytest:

sudo easy_install pytest

(Contributed by David Ketcheson)

PyCuda/Installation/Mac/EnthoughtPython (last edited 2012-07-06 16:37:02 by hec-171-140)