Dnia 2013-03-13, śro o godzinie 21:15 -0400, Andreas Kloeckner pisze: > Tomasz Rybak <[email protected]> writes: > > Dnia 2013-03-11, pon o godzinie 11:52 -0400, Andreas Kloeckner pisze: > >> Tomasz Rybak <[email protected]> writes: > >> > >> > I've fixed problem with Python 3 str vs. bytearray. > >> > You can find my changes at > >> > git://github.com/rybaktomasz/pycuda.git > >> > in branch python3 > >> > >> I've applied most of those. Some seem to break compatibility with old > >> Python 2.x and should be caught by 2to3, so I haven't applied them. > >> > >> > There is new problem under Python 3, see log below. > >> > I do not know for now how to fix it. > >> > > >> > from pycuda._pvt_struct import pack > >> >> arg_buf = pack(func.arg_format, *args) > >> > E struct.error: required argument is not an integer > >> > > >> > /usr/lib/python3/dist-packages/pycuda/driver.py:475: error > >> > >> I'll take a look at this in a bit. Not quite sure what's going on. > > > > I have looked a bit at this. > > Exception is generated in file _pvt_struct_v3.cpp in function > > get_pylong. > > This function is called by many functions - in our case > > by np_ulong and np_void_p. > > func.arg_format is PffL and args is <DeviceAllocation, 1.0, 1.0, 10>. > > I suspect the problem lies with DeviceAllocation. > > > > Analogous code in PyOpenCL differs. > > When pack is called, it gets <Buffer, 1.0, 1.0, 10>, but arg_letters is: > > [None, 'f', 'f', 'l']. > > So problem might be with transforming DeviceAllocation into PyLong. > > DeviceAllocation either is not seen as PyLong (which is strange > > as it is wrapped with __int__ and __long__) or it does not contain > > __index__. > > I've thrown DeviceAllocation.__index__ into git. Can you please try > again?
I've checked. Current version of PyCUDA from git almost works under Python 3.2.3. test_driver fails with one error: test_vector_types fails with struct.error: argument for 's' must be a bytes object which is caused because numpy.ndarray is not understood by "s" packing. The error is reported s_pack_internal, line 1226, in _pvt_struct_v3.cpp. It looks like numpy.ndarray does not speak PyBytes nor PyByteArray. test_cumath passes without any fail. test_gpuarray has 3 failures: test_vector_fill, again with struct.error: argument for 's' must be a bytes object test_curand_wrappers, with struct.error: required argument is not an integer This is caused by box_muller optimisation. Dividing data_size by 2 changes its type from int to float, and packing it to PPi fails. Fixed in branch "python3" of my repository. test_divide_scalar, again fixed in branch "python3" of my repository Fix is just: __rtruediv__ = __rdiv__ instead of __rtruediv__ = __div__ I've opened pull request to those fixes. I haven't yet found fix to "s" packing problem; I'll let you know if I find some solution. Thanks for fixing PyCUDA/Python3 so far! Best regards. -- Tomasz Rybak <[email protected]> GPG/PGP key ID: 2AD5 9860 Fingerprint A481 824E 7DD3 9C0E C40A 488E C654 FB33 2AD5 9860 http://member.acm.org/~tomaszrybak
signature.asc
Description: This is a digitally signed message part
_______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
