[PyCUDA] Get PyCuda 0.93 working on Snow Leopard

2010-01-23 Thread Krunal Patel
Hi there,
my name is Krunal and I'm a new user to PyCUDA.  I'm helping Nicolas out on his 
research.  My first order of business was to get PyCUDA installed on my iMac 
Snow Leopard.  Here were my experiences:

1) stick with the version of python installed by Mac, don't upgrade to the 
latest.  The default version is 2.6.1.  The main reason for this is because I 
couldn't figure out how to run a newly upgraded version of python in 32-bit 
mode.  
2) I tried 1.38-1.41 versions of Boost.  At the end, the one that worked for me 
was 1.39.

Here is how I got things working:
1) first follow: http://wiki.tiker.net/BoostInstallationHowto
but do this:
./bootstrap.sh --prefix=$HOME/pool --libdir=$HOME/pool/lib 
--with-libraries=signals,thread,python
./bjam address-model=32_64 architecture=x86 variant=release link=shared install
(the architecture stuff comes from 
http://old.nabble.com/Boost-on-Snow-Leopard-failing-to-build-32-bit-target-td25218466.html
 and is the key to not getting the architecture is invalid when running 
test_driver.py)

2) then follow: http://wiki.tiker.net/PyCuda/Installation/Mac
but do this:
python configure.py --boost-inc-dir=/Users/k5patel/pool/include/boost-1_39/ 
--boost-lib-dir=/Users/k5patel/pool/lib/ --boost-python-libname=boost_python 
--cuda-root=/usr/local/cuda/

siteconf.py shoud look like:
BOOST_INC_DIR = ['/Users/k5patel/pool/include/boost-1_39/']
BOOST_LIB_DIR = ['/Users/k5patel/pool/lib/']
BOOST_COMPILER = 'gcc42'
BOOST_PYTHON_LIBNAME = ['boost_python-xgcc42-mt']
BOOST_THREAD_LIBNAME = ['boost_thread-xgcc42-mt']
CUDA_TRACE = False
CUDA_ROOT = '/usr/local/cuda/'
CUDA_ENABLE_GL = False
CUDADRV_LIB_DIR = []
CUDADRV_LIBNAME = ['cuda']
CXXFLAGS = []
LDFLAGS = []

change setup.py so it has this:
if 'darwin' in sys.platform:
# prevent from building ppc since cuda on OS X is not compiled for ppc
if -arch not in conf[CXXFLAGS]:
conf[CXXFLAGS].extend(['-arch', 'i386','-m32'])
if -arch not in conf[LDFLAGS]:
conf[LDFLAGS].extend(['-arch', 'i386','-m32'])

the key is -m32 as indicated by 
http://article.gmane.org/gmane.comp.python.cuda/1089

3) do sudo make install.  ensure that there are no warnings around the line of 
different architecture
4) once built, go to the test directory and type in:
python test_driver.py
hopefully it passes

don't type:
sudo python test_driver.py as indicated elsewhere

I hope this could be of help to those who couldn't get PyCUDA 0.93 working on 
their system.  The main problem has to do with SL's 64-bitness and CUDA's lack 
of it (and hence PyCUDA)

krunal



___
PyCUDA mailing list
PyCUDA@tiker.net
http://tiker.net/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] Get PyCuda 0.93 working on Snow Leopard

2010-01-23 Thread Andreas Klöckner
Hi Krunal,

first of all, welcome, and thanks for writing up your experience. I'm
sorry that your install was as troublesome as it seems to have been.

To make things better for everyone, I would like to ask two favors of you:

1) If there is anything that we can do by default in PyCUDA to make a
default Mac install less painful, please let me know. For example,
should -m32 be the default for Mac installs?

2) Next, while many people might eventually find this information on the
mailing list, the Wiki (that you refer to) is designed to be the main
place for up-to-date installation information. It's a wiki for a
reason--to be edited! Don't be shy, and change that information where
it's wrong, or augment it where additional info is needed.

If I can be of any assistance, please let me know.

Thanks again,
Andreas

On Samstag 23 Januar 2010, Krunal Patel wrote:
 Hi there,
 my name is Krunal and I'm a new user to PyCUDA.  I'm helping Nicolas out on
  his research.  My first order of business was to get PyCUDA installed on
  my iMac Snow Leopard.  Here were my experiences:
 
 1) stick with the version of python installed by Mac, don't upgrade to the
  latest.  The default version is 2.6.1.  The main reason for this is
  because I couldn't figure out how to run a newly upgraded version of
  python in 32-bit mode. 2) I tried 1.38-1.41 versions of Boost.  At the
  end, the one that worked for me was 1.39.
 
 Here is how I got things working:
 1) first follow: http://wiki.tiker.net/BoostInstallationHowto
 but do this:
 ./bootstrap.sh --prefix=$HOME/pool --libdir=$HOME/pool/lib
  --with-libraries=signals,thread,python ./bjam address-model=32_64
  architecture=x86 variant=release link=shared install (the architecture
  stuff comes from
  http://old.nabble.com/Boost-on-Snow-Leopard-failing-to-build-32-bit-target
 -td25218466.html and is the key to not getting the architecture is invalid
  when running test_driver.py)
 
 2) then follow: http://wiki.tiker.net/PyCuda/Installation/Mac
 but do this:
 python configure.py --boost-inc-dir=/Users/k5patel/pool/include/boost-1_39/
  --boost-lib-dir=/Users/k5patel/pool/lib/
  --boost-python-libname=boost_python --cuda-root=/usr/local/cuda/
 
 siteconf.py shoud look like:
 BOOST_INC_DIR = ['/Users/k5patel/pool/include/boost-1_39/']
 BOOST_LIB_DIR = ['/Users/k5patel/pool/lib/']
 BOOST_COMPILER = 'gcc42'
 BOOST_PYTHON_LIBNAME = ['boost_python-xgcc42-mt']
 BOOST_THREAD_LIBNAME = ['boost_thread-xgcc42-mt']
 CUDA_TRACE = False
 CUDA_ROOT = '/usr/local/cuda/'
 CUDA_ENABLE_GL = False
 CUDADRV_LIB_DIR = []
 CUDADRV_LIBNAME = ['cuda']
 CXXFLAGS = []
 LDFLAGS = []
 
 change setup.py so it has this:
 if 'darwin' in sys.platform:
 # prevent from building ppc since cuda on OS X is not compiled for
  ppc if -arch not in conf[CXXFLAGS]:
 conf[CXXFLAGS].extend(['-arch', 'i386','-m32'])
 if -arch not in conf[LDFLAGS]:
 conf[LDFLAGS].extend(['-arch', 'i386','-m32'])
 
 the key is -m32 as indicated by
  http://article.gmane.org/gmane.comp.python.cuda/1089
 
 3) do sudo make install.  ensure that there are no warnings around the line
  of different architecture 4) once built, go to the test directory and
  type in:
 python test_driver.py
 hopefully it passes
 
 don't type:
 sudo python test_driver.py as indicated elsewhere
 
 I hope this could be of help to those who couldn't get PyCUDA 0.93 working
  on their system.  The main problem has to do with SL's 64-bitness and
  CUDA's lack of it (and hence PyCUDA)
 
 krunal


signature.asc
Description: This is a digitally signed message part.
___
PyCUDA mailing list
PyCUDA@tiker.net
http://tiker.net/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] Get PyCuda 0.93 working on Snow Leopard

2010-01-23 Thread Krunal Patel

Yes I think the default should be -m32.

The main issue is plain and simple. It all has to do with the lack of  
support of 64 bit by Cuda. That basically leaves a presence on which  
3rdpary libraries we can use. On the mac when I first tried everything  
through macports (which I don't recommend for our purpuse) i basically  
in config issues having to do with architecure.


I have done the needful on the wiki pages. 


___
PyCUDA mailing list
PyCUDA@tiker.net
http://tiker.net/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] Get PyCuda 0.93 working on Snow Leopard

2010-01-23 Thread Andreas Klöckner
On Samstag 23 Januar 2010, Krunal Patel wrote:
 Yes I think the default should be -m32.

Done in git. Thanks for your advice.

 I have done the needful on the wiki pages.

Thank you very much for your work!

Andreas



signature.asc
Description: This is a digitally signed message part.
___
PyCUDA mailing list
PyCUDA@tiker.net
http://tiker.net/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] Get PyCuda 0.93 working on Snow Leopard

2010-01-23 Thread Andreas Klöckner
On Samstag 23 Januar 2010, Andreas Klöckner wrote:
  I have done the needful on the wiki pages.
 
 Thank you very much for your work!

I've hacked the Wiki a little bit--can you please take a quick look?

Thanks!
Andreas


signature.asc
Description: This is a digitally signed message part.
___
PyCUDA mailing list
PyCUDA@tiker.net
http://tiker.net/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] Get PyCuda 0.93 working on Snow Leopard

2010-01-23 Thread Krunal Patel
It looks good...changed the DYNLIB to point to 
$HOME/pool/lib since the reset of the instructions use pool


___
PyCUDA mailing list
PyCUDA@tiker.net
http://tiker.net/mailman/listinfo/pycuda_tiker.net