Skip to content
Snippets Groups Projects
Commit 5a2a29fb authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Update compyte, add stubs to work with legacy PyOpenCL

parent b69a31a2
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
Subproject commit fb6ba114d9d906403d47b0aaf69e2fe4cef382f2
Subproject commit ac1c71d46428c14aa1bd1c09d7da19cd0298d5cc
......@@ -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)
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment