Re: [PyCUDA] mac64 PyCUDA

2010-10-16 Thread Andreas Kloeckner
Hi Cyrus,

On Wed, 22 Sep 2010 16:30:26 -0700, Cyrus Omar cy...@cmu.edu wrote:
 Using the latest git pycuda (and included boost) and CUDA 3.2 driver and
 toolkit, it seems that installation works with 64-bit Python on Snow
 Leopard. Both test_driver and test_cumath work. However, not all of the
 tests in test_gpuarray pass. Here is the output I get from that. I am using
 the version of Python 2.6.4 that comes with Sage.

can you try again with current git, including Tomasz's patch? Also,
please update your pytools--I saw something like 'from pytools import
any' failing, which indicates that that package may be out of date.
(PyCUDA et al still target 2.4+, hence the 'any' fallback.)

Andreas



pgpXLBdZCjksx.pgp
Description: PGP signature
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-21 Thread Alan
Dear Andreas,

It seems that finally we're getting there. You may not remember anymore but
I've been pursuing this issue since from the very beginning (if I've not
even started it this discussion at all), but didn't have time lately.

I would appreciate when you do your next pycuda and pyopencl release to have
64 bits available out-of-box for Mac and updated instructions for installing
and testing.

Many thanks to you all guys who cracked this issue.

Alan

On 21 September 2010 00:53, Andreas Kloeckner li...@informa.tiker.netwrote:

 Hi Art, Min, Bryan,

 On Mon, 20 Sep 2010 15:25:24 -0700, Art grenan...@gmail.com wrote:
  Thanks for posting the fork. I used your modification to compiler.py (my
  original one was incorrect) and I built a 64-bit only version of pycuda
 and
  all tests under tests/ passed for the first time. I also was able to call
  cublas and cufft using something similar to parret [1].

 Thanks very much for getting to the bottom of this pesky problem! (Or
 that's at least what it seems like to me--right?) I've pulled both Min's
 and Bryan's fixes into PyCUDA's git.

 Thanks again,
 Andreas


 ___
 PyCUDA mailing list
 PyCUDA@tiker.net
 http://lists.tiker.net/listinfo/pycuda




-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
http://www.bio.cam.ac.uk/~awd28
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-21 Thread Alan
Dear all,

I did on my MBP SL 10.6.4:


#pycuda 21/09/10

wget -c http://pypi.python.org/packages/source/p/pycuda/pycuda-0.94.1.tar.gz

tar xvfz pycuda-0.94.1.tar.gz

cd pycuda-0.94.1

/usr/bin/python2.6 configure.py

make

sudo make install

cd test

/usr/bin/python2.6 test_driver.py

/usr/bin/python2.6 test_gpuarray.py

/usr/bin/python2.6 test_cumath.py

ALL TESTS PASSED!!!

I did also with /sw/bin/python2.6 and /sw/bin/python2.7 and everything
worked.


Many thanks,


Alan



On 21 September 2010 08:03, Alan alanwil...@gmail.com wrote:

 Dear Andreas,

 It seems that finally we're getting there. You may not remember anymore but
 I've been pursuing this issue since from the very beginning (if I've not
 even started it this discussion at all), but didn't have time lately.

 I would appreciate when you do your next pycuda and pyopencl release to
 have 64 bits available out-of-box for Mac and updated instructions for
 installing and testing.

 Many thanks to you all guys who cracked this issue.

 Alan

 On 21 September 2010 00:53, Andreas Kloeckner li...@informa.tiker.netwrote:

 Hi Art, Min, Bryan,

 On Mon, 20 Sep 2010 15:25:24 -0700, Art grenan...@gmail.com wrote:
  Thanks for posting the fork. I used your modification to compiler.py (my
  original one was incorrect) and I built a 64-bit only version of pycuda
 and
  all tests under tests/ passed for the first time. I also was able to
 call
  cublas and cufft using something similar to parret [1].

 Thanks very much for getting to the bottom of this pesky problem! (Or
 that's at least what it seems like to me--right?) I've pulled both Min's
 and Bryan's fixes into PyCUDA's git.

 Thanks again,
 Andreas


 ___
 PyCUDA mailing list
 PyCUDA@tiker.net
 http://lists.tiker.net/listinfo/pycuda




 --
 Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
 Department of Biochemistry, University of Cambridge.
 80 Tennis Court Road, Cambridge CB2 1GA, UK.
 http://www.bio.cam.ac.uk/~awd28




-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
http://www.bio.cam.ac.uk/~awd28
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-20 Thread Bryan Catanzaro
I think it should be changed to check to see if the Python interpreter is 
currently running in 32 bit mode, and then compile to match:

if 'darwin' in sys.platform and sys.maxint == 2147483647:
# The Python interpreter is running in 32 bit mode on OS X
if -arch not in conf[CXXFLAGS]:
  conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
if -arch not in conf[LDFLAGS]:
  conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])

Some people (myself included) have to run Python in 32-bit mode on 64-bit OS X 
for various compatibility reasons (currently including libcudart.dylib, which 
is only shipped as a 32-bit library).  Since the Python which Apple ships is 
compiled as a fat binary with both 32 and 64 bit versions, we can't know a 
priori what the right compiler flags are.

- bryan



On Sep 19, 2010, at 5:55 PM, Andreas Kloeckner wrote:

 On Thu, 16 Sep 2010 14:37:31 -0400, gerald wrong psillymathh...@gmail.com 
 wrote:
 Looking at PyCUDA setup.py, I found this:
 
if 'darwin' in sys.platform:
# prevent from building ppc since cuda on OS X is not compiled for
 ppc
# also, default to 32-bit build, since there doesn't appear to be a
# 64-bit CUDA on Mac yet.
if -arch not in conf[CXXFLAGS]:
conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
if -arch not in conf[LDFLAGS]:
conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])
 
 Since 64bit CUDA support on Mac OS X is a reality since at least CUDA3.1,
 this should be changed.  I know there are other problems regarding 32/64
 python stopping 64bit mac users at the moment (including myself), but since
 changes are being made to the PyCUDA code to make it compatible with CUDA3.2
 anyway...
 
 It looks like this should just be killed wholesale--right? Or is there
 anything more appropriate that it should be changed to?
 
 Andreas
 
 ___
 PyCUDA mailing list
 PyCUDA@tiker.net
 http://lists.tiker.net/listinfo/pycuda

- bryan





smime.p7s
Description: S/MIME cryptographic signature
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-20 Thread MinRK
Bryan,

Note that in 3.2, all files in cuda/lib are UB, including cudart (finally!).

I build fat-binary on OS-X (up to date 10.6.4, cuda 3.2, etc.), simply by
setting the usual arch flags in siteconf.py:

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

The build succeeds just fine, but most functions don't actually work, and
I'm not well versed enough in the details to figure it out.  It seems that
all the memory/mempool related tests pass, but the rest don't. Perhaps
because something should be passed differently to nvcc when running 64-bit,
as opposed to 32?

-MinRK

On Mon, Sep 20, 2010 at 08:34, Bryan Catanzaro
catan...@eecs.berkeley.eduwrote:

 I think it should be changed to check to see if the Python interpreter is
 currently running in 32 bit mode, and then compile to match:

 if 'darwin' in sys.platform and sys.maxint == 2147483647:
# The Python interpreter is running in 32 bit mode on OS X
 if -arch not in conf[CXXFLAGS]:
  conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
if -arch not in conf[LDFLAGS]:
  conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])

 Some people (myself included) have to run Python in 32-bit mode on 64-bit
 OS X for various compatibility reasons (currently including libcudart.dylib,
 which is only shipped as a 32-bit library).  Since the Python which Apple
 ships is compiled as a fat binary with both 32 and 64 bit versions, we can't
 know a priori what the right compiler flags are.

 - bryan



 On Sep 19, 2010, at 5:55 PM, Andreas Kloeckner wrote:

  On Thu, 16 Sep 2010 14:37:31 -0400, gerald wrong 
 psillymathh...@gmail.com wrote:
  Looking at PyCUDA setup.py, I found this:
 
 if 'darwin' in sys.platform:
 # prevent from building ppc since cuda on OS X is not compiled
 for
  ppc
 # also, default to 32-bit build, since there doesn't appear to be
 a
 # 64-bit CUDA on Mac yet.
 if -arch not in conf[CXXFLAGS]:
 conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
 if -arch not in conf[LDFLAGS]:
 conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])
 
  Since 64bit CUDA support on Mac OS X is a reality since at least
 CUDA3.1,
  this should be changed.  I know there are other problems regarding 32/64
  python stopping 64bit mac users at the moment (including myself), but
 since
  changes are being made to the PyCUDA code to make it compatible with
 CUDA3.2
  anyway...
 
  It looks like this should just be killed wholesale--right? Or is there
  anything more appropriate that it should be changed to?
 
  Andreas
 
  ___
  PyCUDA mailing list
  PyCUDA@tiker.net
  http://lists.tiker.net/listinfo/pycuda

 - bryan




 ___
 PyCUDA mailing list
 PyCUDA@tiker.net
 http://lists.tiker.net/listinfo/pycuda


___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-20 Thread MinRK
Okay, with a tiny tweak to compiler.compile, I have UB pycuda working in
both 64 and 32-bit.  All I did was tell compile() to add '-m64' to options
if it detects 64-bit mode, in the same way as Bryan's trick.

I pushed a branch with the patch to my GitHub:
http://github.com/minrk/pycuda, as well as a siteconf that works for the
build.  There are still a few failures in test_gpuarray for 64-bit, but I
don't know what causes them.

On Mon, Sep 20, 2010 at 11:30, Art grenan...@gmail.com wrote:


 On Mon, Sep 20, 2010 at 8:34 AM, Bryan Catanzaro 
 catan...@eecs.berkeley.edu wrote:

 I think it should be changed to check to see if the Python interpreter is
 currently running in 32 bit mode, and then compile to match:

 if 'darwin' in sys.platform and sys.maxint == 2147483647:
# The Python interpreter is running in 32 bit mode on OS X
 if -arch not in conf[CXXFLAGS]:
  conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
if -arch not in conf[LDFLAGS]:
  conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])

 Some people (myself included) have to run Python in 32-bit mode on 64-bit
 OS X for various compatibility reasons (currently including libcudart.dylib,
 which is only shipped as a 32-bit library).  Since the Python which Apple
 ships is compiled as a fat binary with both 32 and 64 bit versions, we can't
 know a priori what the right compiler flags are.

 - bryan


 I have driver version 3.1.14 and:

 $ file /usr/local/cuda/lib/libcudart.dylib
 /usr/local/cuda/lib/libcudart.dylib: Mach-O universal binary with 2
 architectures
 /usr/local/cuda/lib/libcudart.dylib (for architecture x86_64): Mach-O
 64-bit dynamically linked shared library x86_64
 /usr/local/cuda/lib/libcudart.dylib (for architecture i386): Mach-O
 dynamically linked shared library i386

 Doesn't that mean it's UB?


You are right, that's UB, I guess the change was made at 3.1, not 3.2.  In
3.0, they introduced UB for libcuda, but left all other libraries as i386.


 I can build and test cudamat [1] (which uses ctypes to call libcudart and
 libcublas) fine in 64-bit macports python though I haven't otherwise used
 it. I had to make the following small change in it's Makefile:

 nvcc -O -m 64 -L/usr/local/cuda/lib --ptxas-options=-v --compiler-options
 '-fPIC' -o libcudamat.so --shared cudamat.cu cudamat_kernels.cu -lcublas

 from:

 nvcc -O --ptxas-options=-v --compiler-options '-fPIC' -o libcudamat.so
 --shared cudamat.cu cudamat_kernels.cu -lcublas

 I built pycuda as 64-bit and changed pycuda/compiler.py to pass --machine
 64 to nvcc and got examples/demo.py to run but the other examples and tests
 had failures and would eventually hang my machine. I don't know enough to
 fix this myself but I can try suggestions. Would using 3.2RC make a
 difference?


If the rest of libraries are UB, as cudart is at 3.1, then 3.2 shouldn't
make a difference from 3.1.x, I just knew that the switch was somewhere
between 3.0 and 3.2, and it appears to have been at 3.1.

-MinRK



 [1] http://code.google.com/p/cudamat/

 cheers,
 art



 ___
 PyCUDA mailing list
 PyCUDA@tiker.net
 http://lists.tiker.net/listinfo/pycuda


___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-20 Thread Art
On Mon, Sep 20, 2010 at 2:08 PM, MinRK mi...@berkeley.edu wrote:

 Okay, with a tiny tweak to compiler.compile, I have UB pycuda working in
 both 64 and 32-bit.  All I did was tell compile() to add '-m64' to options
 if it detects 64-bit mode, in the same way as Bryan's trick.

 I pushed a branch with the patch to my GitHub:
 http://github.com/minrk/pycuda, as well as a siteconf that works for the
 build.  There are still a few failures in test_gpuarray for 64-bit, but I
 don't know what causes them.

 On Mon, Sep 20, 2010 at 11:30, Art grenan...@gmail.com wrote:


 On Mon, Sep 20, 2010 at 8:34 AM, Bryan Catanzaro 
 catan...@eecs.berkeley.edu wrote:

 I think it should be changed to check to see if the Python interpreter is
 currently running in 32 bit mode, and then compile to match:

 if 'darwin' in sys.platform and sys.maxint == 2147483647:
# The Python interpreter is running in 32 bit mode on OS X
 if -arch not in conf[CXXFLAGS]:
  conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
if -arch not in conf[LDFLAGS]:
  conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])

 Some people (myself included) have to run Python in 32-bit mode on 64-bit
 OS X for various compatibility reasons (currently including libcudart.dylib,
 which is only shipped as a 32-bit library).  Since the Python which Apple
 ships is compiled as a fat binary with both 32 and 64 bit versions, we can't
 know a priori what the right compiler flags are.

 - bryan


 I have driver version 3.1.14 and:

 $ file /usr/local/cuda/lib/libcudart.dylib
 /usr/local/cuda/lib/libcudart.dylib: Mach-O universal binary with 2
 architectures
 /usr/local/cuda/lib/libcudart.dylib (for architecture x86_64): Mach-O
 64-bit dynamically linked shared library x86_64
 /usr/local/cuda/lib/libcudart.dylib (for architecture i386): Mach-O
 dynamically linked shared library i386

 Doesn't that mean it's UB?


 You are right, that's UB, I guess the change was made at 3.1, not 3.2.  In
 3.0, they introduced UB for libcuda, but left all other libraries as i386.


 I can build and test cudamat [1] (which uses ctypes to call libcudart and
 libcublas) fine in 64-bit macports python though I haven't otherwise used
 it. I had to make the following small change in it's Makefile:

 nvcc -O -m 64 -L/usr/local/cuda/lib --ptxas-options=-v --compiler-options
 '-fPIC' -o libcudamat.so --shared cudamat.cu cudamat_kernels.cu -lcublas

 from:

 nvcc -O --ptxas-options=-v --compiler-options '-fPIC' -o libcudamat.so
 --shared cudamat.cu cudamat_kernels.cu -lcublas

 I built pycuda as 64-bit and changed pycuda/compiler.py to pass --machine
 64 to nvcc and got examples/demo.py to run but the other examples and tests
 had failures and would eventually hang my machine. I don't know enough to
 fix this myself but I can try suggestions. Would using 3.2RC make a
 difference?


 If the rest of libraries are UB, as cudart is at 3.1, then 3.2 shouldn't
 make a difference from 3.1.x, I just knew that the switch was somewhere
 between 3.0 and 3.2, and it appears to have been at 3.1.

 -MinRK



 [1] http://code.google.com/p/cudamat/

 cheers,
 art



Thanks for posting the fork. I used your modification to compiler.py (my
original one was incorrect) and I built a 64-bit only version of pycuda and
all tests under tests/ passed for the first time. I also was able to call
cublas and cufft using something similar to parret [1].

This is the siteconf.py I used hacked from someone's earlier efforts on this
list:

BOOST_INC_DIR = ['/opt/local/include']
BOOST_LIB_DIR = ['/opt/local/lib']
BOOST_COMPILER = 'gcc-mp-4.4'  # not sure
USE_SHIPPED_BOOST = False
BOOST_PYTHON_LIBNAME = ['boost_python-mt']
BOOST_THREAD_LIBNAME = ['boost_thread-mt']
CUDA_TRACE = False
CUDA_ENABLE_GL = False
CUDADRV_LIB_DIR = []
CUDADRV_LIBNAME = ['cuda']
CXXFLAGS = ['-arch', 'x86_64', '-m64', '-isysroot',
'/Developer/SDKs/MacOSX10.6.sdk']
LDFLAGS = ['-arch', 'x86_64', '-m64', '-isysroot',
'/Developer/SDKs/MacOSX10.6.sdk']

[1] http://www.mathcs.emory.edu/~yfan/PARRET/doc/index.html
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-19 Thread Andreas Kloeckner
On Thu, 16 Sep 2010 14:37:31 -0400, gerald wrong psillymathh...@gmail.com 
wrote:
 Looking at PyCUDA setup.py, I found this:
 
 if 'darwin' in sys.platform:
 # prevent from building ppc since cuda on OS X is not compiled for
 ppc
 # also, default to 32-bit build, since there doesn't appear to be a
 # 64-bit CUDA on Mac yet.
 if -arch not in conf[CXXFLAGS]:
 conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
 if -arch not in conf[LDFLAGS]:
 conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])
 
 Since 64bit CUDA support on Mac OS X is a reality since at least CUDA3.1,
 this should be changed.  I know there are other problems regarding 32/64
 python stopping 64bit mac users at the moment (including myself), but since
 changes are being made to the PyCUDA code to make it compatible with CUDA3.2
 anyway...

It looks like this should just be killed wholesale--right? Or is there
anything more appropriate that it should be changed to?

Andreas



pgpKUqBy3t3tn.pgp
Description: PGP signature
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] mac64 PyCUDA

2010-09-19 Thread gerald wrong
I think PyCUDA should attempt to build correctly as 64bit so once the
python64 bugs are shaken out, PyCUDA will be able to build on Mac OS X
without special flags etc.

My understanding from multiple build attempts is that there is a bug in the
various Mac 64bit python implementations causing them to run in 32bit even
when forced 64; this should eventually get fixed (if it has not already).  I
admit after many days of frustration, I have not tried to build on mac64 in
about 2 months; perhaps I will give it another go this week and report here
to the list.

The ability to devel on Macs is very useful, since newer macs include CUDA
capable hardware... and there are lots of scientists with macs... Judging by
the old queries on the mailing list, there are many people who have spent
time fiddling with PyCUDA on mac64... so there must be significant interest
in this feature.

On Sun, Sep 19, 2010 at 8:55 PM, Andreas Kloeckner
li...@informa.tiker.netwrote:

 On Thu, 16 Sep 2010 14:37:31 -0400, gerald wrong psillymathh...@gmail.com
 wrote:
  Looking at PyCUDA setup.py, I found this:
 
  if 'darwin' in sys.platform:
  # prevent from building ppc since cuda on OS X is not compiled
 for
  ppc
  # also, default to 32-bit build, since there doesn't appear to be
 a
  # 64-bit CUDA on Mac yet.
  if -arch not in conf[CXXFLAGS]:
  conf[CXXFLAGS].extend(['-arch', 'i386', '-m32'])
  if -arch not in conf[LDFLAGS]:
  conf[LDFLAGS].extend(['-arch', 'i386', '-m32'])
 
  Since 64bit CUDA support on Mac OS X is a reality since at least CUDA3.1,
  this should be changed.  I know there are other problems regarding 32/64
  python stopping 64bit mac users at the moment (including myself), but
 since
  changes are being made to the PyCUDA code to make it compatible with
 CUDA3.2
  anyway...

 It looks like this should just be killed wholesale--right? Or is there
 anything more appropriate that it should be changed to?

 Andreas


___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda