diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be30067d87d604d3fcecfd58e639f71de2e377ce..f79c22be5c322fdaf2450b2e4dc05a6100858b3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,10 +35,10 @@ Python 2.7 POCL: - pocl except: - tags -Python 2.7 old PyOpenCL: +Python 2.7 with legacy PyOpenCL: script: - export PY_EXE=python2.7 - - export PYOPENCL_TEST=portable + - export PYOPENCL_TEST=amd:pu - export EXTRA_INSTALL="numpy mako" - export REQUIREMENTS_TXT="requirements-old-pyopencl.txt" - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index 8620996b026c4432c54837f4d45b647e8d57c227..520bb8a33e10a53d5d0335eee3095a514be41818 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -36,9 +36,9 @@ class CTarget(TargetBase): @memoize_method def get_dtype_registry(self): from loopy.target.c.compyte.dtypes import ( - DTypeRegistry, fill_with_registry_with_c_types) + DTypeRegistry, fill_registry_with_c_types) result = DTypeRegistry() - fill_with_registry_with_c_types(result, respect_windows=False, + fill_registry_with_c_types(result, respect_windows=False, include_bool=True) return result diff --git a/loopy/target/c/compyte b/loopy/target/c/compyte index fb6ba114d9d906403d47b0aaf69e2fe4cef382f2..ac1c71d46428c14aa1bd1c09d7da19cd0298d5cc 160000 --- a/loopy/target/c/compyte +++ b/loopy/target/c/compyte @@ -1 +1 @@ -Subproject commit fb6ba114d9d906403d47b0aaf69e2fe4cef382f2 +Subproject commit ac1c71d46428c14aa1bd1c09d7da19cd0298d5cc diff --git a/loopy/target/opencl/__init__.py b/loopy/target/opencl/__init__.py index e4533b86dd24a8dca973ac9c8ffd022a4bed204b..8392a7a9169acb3e1b2e4eedb334d555e539d150 100644 --- a/loopy/target/opencl/__init__.py +++ b/loopy/target/opencl/__init__.py @@ -214,17 +214,13 @@ class OpenCLTarget(CTarget): @memoize_method def get_dtype_registry(self): - from loopy.target.c.compyte.dtypes import DTypeRegistry, fill_with_registry_with_c_types - result = DTypeRegistry() - fill_with_registry_with_c_types(result, respect_windows=False) + from loopy.target.c.compyte.dtypes import (DTypeRegistry, + fill_registry_with_opencl_types) - # complex number support left out + result = DTypeRegistry() + fill_registry_with_opencl_types() - # CL defines 'long' as 64-bit - result.get_or_register_dtype( - ["unsigned long", "unsigned long int"], np.uint64) - result.get_or_register_dtype( - ["signed long", "signed long int", "long int"], np.int64) + # no complex number support--needs PyOpenCLTarget _register_vector_types(result) diff --git a/loopy/target/pyopencl/__init__.py b/loopy/target/pyopencl/__init__.py index ee936680016b6808723076034c8486a49544e2bc..d13384534c70df602785d4189739a7bc86ed37db 100644 --- a/loopy/target/pyopencl/__init__.py +++ b/loopy/target/pyopencl/__init__.py @@ -233,6 +233,18 @@ def pyopencl_preamble_generator(target, seen_dtypes, seen_functions): # {{{ pyopencl tools +class _LegacyTypeRegistryStub(object): + """Adapts legacy PyOpenCL type registry to be usable with PyOpenCLTarget.""" + + def get_or_register_dtype(self, names, dtype=None): + from pyopencl.compyte.dtypes import get_or_register_dtype + return get_or_register_dtype(names, dtype) + + def dtype_to_ctype(self, dtype): + from pyopencl.compyte.dtypes import dtype_to_ctype + return dtype_to_ctype(dtype) + + class PyOpenCLTarget(OpenCLTarget): def __init__(self, device=None): super(PyOpenCLTarget, self).__init__() @@ -260,8 +272,12 @@ class PyOpenCLTarget(OpenCLTarget): check_sizes(kernel, self.device) def get_dtype_registry(self): - from pyopencl.compyte.dtypes import TYPE_REGISTRY - return TYPE_REGISTRY + try: + from pyopencl.compyte.dtypes import TYPE_REGISTRY + except ImportError: + return _LegacyTypeRegistryStub() + else: + return TYPE_REGISTRY def is_vector_dtype(self, dtype): from pyopencl.array import vec