pycuda icon indicating copy to clipboard operation
pycuda copied to clipboard

`async` is a keyword in Python 3.7

Open cgohlke opened this issue 7 years ago • 6 comments

async has become a keyword in Python 3.7 and can not be used as an argument name . See https://mail.python.org/pipermail/python-dev/2017-March/147678.html

Python 3.7.0a3 (v3.7.0a3:90a6785, Dec  5 2017, 22:50:42) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycuda.gpuarray as gpuarray
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "X:\Python37\lib\site-packages\pycuda\gpuarray.py", line 230
    def set(self, ary, async=False, stream=None):
                           ^
SyntaxError: invalid syntax

Also affects PyOpenCL.

cgohlke avatar Dec 15 '17 07:12 cgohlke

For PyCUDA, async was never documented, to it's an easy change: https://gitlab.tiker.net/inducer/pycuda/merge_requests/9

One issue that I ran into with this change is that numpy 1.13.3 doesn't even seem to build against 3.7:

  • https://gitlab.tiker.net/inducer/pycuda/-/jobs/39532
  • https://github.com/numpy/numpy/issues/9578.

inducer avatar Dec 15 '17 20:12 inducer

numpy 1.13.3 doesn't even seem to build against 3.7

You need to use at least Cython-0.27.3. Works for me.

cgohlke avatar Dec 15 '17 20:12 cgohlke

Oh, OK. Thanks. Trying: https://gitlab.tiker.net/inducer/pycuda/-/jobs/39546

inducer avatar Dec 15 '17 20:12 inducer

Re PyOpenCL: https://github.com/inducer/pyopencl/commit/0e5a2fb12142f236c3219baeab76bc52d0aba1c1

inducer avatar Dec 15 '17 20:12 inducer

But you're right: PyOpenCL needs a release. Done: https://pypi.org/project/pyopencl/

inducer avatar Dec 15 '17 21:12 inducer

Tried with Cython 0.27.3: https://gitlab.tiker.net/inducer/pycuda/-/jobs/39551

Is there anything I need to do to make Numpy realized it should rebuild its Cython-generated C?

inducer avatar Dec 15 '17 21:12 inducer