Changed in master. Thx!

Andreas

On Dienstag 11 August 2009, wtftc wrote:
> I got pycuda working Vista x64 machine with python 2.6, but the
> platform_bits method in tools.py is not working for me. It returns 32 on my
> 64 bit platform, which is causing test_driver.py to fail.
>
> The error I am getting is the following:
> C:\Python26\lib\site-packages\pycuda-0.94beta-py2.6-win-amd64.egg\pycuda\to
>ols.py:343: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _
>
> dtype = dtype('uint64'), with_fp_tex_hack = False
>
>     def dtype_to_ctype(dtype, with_fp_tex_hack=False):
>         if dtype is None:
>             raise ValueError("dtype may not be None")
>
>         import numpy
>         dtype = numpy.dtype(dtype)
>         if dtype == numpy.int64 and platform_bits() == 64:
>             return "long"
>         elif dtype == numpy.uint64 and platform_bits() == 64:
>             return "unsigned long"
>         elif dtype == numpy.int32:
>             return "int"
>         elif dtype == numpy.uint32:
>             return "unsigned int"
>         elif dtype == numpy.int16:
>             return "short int"
>         elif dtype == numpy.uint16:
>             return "short unsigned int"
>         elif dtype == numpy.int8:
>             return "signed char"
>         elif dtype == numpy.uint8:
>             return "unsigned char"
>         elif dtype == numpy.float32:
>             if with_fp_tex_hack:
>                 return "fp_tex_float"
>             else:
>                 return "float"
>         elif dtype == numpy.float64:
>             if with_fp_tex_hack:
>                 return "fp_tex_double"
>             else:
>                 return "double"
>
>         else:
> >           raise ValueError, "unable to map dtype '%s'" % dtype
>
> E           ValueError: unable to map dtype 'uint64'
>
> May I suggest an alternate implementation to this (platform_bits1):
> Python 2.6.2 (r262:71605, Apr 14 2009, 22:46:50) [MSC v.1500 64 bit
> (AMD64)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> def platform_bits():
>
> ...     from struct import calcsize
> ...     return calcsize('l') * 8
> ...
>
> >>> print platform_bits()
>
> 32
>
> >>> def platform_bits1():
>
> ...     return tuple.__itemsize__ * 8
> ...
>
> >>> print platform_bits1()
>
> 64

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PyCUDA mailing list
[email protected]
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to