On 6/25/2011 6:31 PM, Andreas Kloeckner wrote:
Hi all,

Version 2011.1 has made it out, finally! The list of changes is copied
below. This is a big release, and a huge step forward for PyOpenCL. As
time progresses, I'll try to move to smaller, more frequent
releases. Have fun, and if you find bugs in the release code, please
speak up on the list.

Andreas


Hello,

Thank you! This release builds and tests well on Python 2.6 & 2.7 for Windows.


What is the status of Python 3 support? I saw that PyPi classifies it as Python 3 compatible but I ran into several problems:


1) Wrap_cl.cpp does not compile under Python 3.2 because PySlice_GetIndicesEx() expects a PyObject as first argument. This seems to fix the issue:

#if PY_VERSION_HEX >= 0x03020000
        if (PySlice_GetIndicesEx(reinterpret_cast<PyObject *>(slc.ptr()),
#else
if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject *>(slc.ptr()),
#endif


2) `import pyopencl` fails on Python 3.1.4 (it works with Python 3.2):

python -c"import pyopencl"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
SyntaxError: can not delete variable 'e' referenced in nested scope


Clearly it is a bug in Python not listing file name and line number. I traced it to this code in pyopencl/__init__.py:

except Exception as e:
    from pytools import Record
    class ErrorRecord(Record):
        pass

    raise _cl.RuntimeError(
            ErrorRecord(
                what=lambda : e.what + "\n\n" + (75*"="+"\n").join(
                    "Build on %s:\n\n%s" % (dev, log)
                    for dev, log in self._get_build_logs()),
                code=lambda : e.code,
                routine=lambda : e.routine))


Not sure what's going on. These Python bugs be related:
http://bugs.python.org/issue4613
http://bugs.python.org/issue4617


3) Demo.py and other examples (after conversion with 2to3) fail with a TypeError:

Traceback (most recent call last):
  File "demo.py", line 24, in <module>
    """).build()
File "X:\Python32\lib\site-packages\pyopencl\__init__.py", line 438, in build
    cache_dir=cache_dir)
File "X:\Python32\lib\site-packages\pyopencl\cache.py", line 420, in create_built_program_from_source_cached
    ctx, src, options, devices, cache_dir)
File "X:\Python32\lib\site-packages\pyopencl\cache.py", line 313, in _create_built_program_from_source_cached cache_keys = [get_cache_key(device, options, src) for device in devices] File "X:\Python32\lib\site-packages\pyopencl\cache.py", line 313, in <listcomp> cache_keys = [get_cache_key(device, options, src) for device in devices] File "X:\Python32\lib\site-packages\pyopencl\cache.py", line 205, in get_cache_key
    checksum.update(src)
TypeError: Unicode-objects must be encoded before hashing


This is easy to fix by converting `src` to a byte string but there are other similar issues. I'll try again later.

Christoph

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to