From 77e273aadca72eff788facc3551ad1410fdc20fa Mon Sep 17 00:00:00 2001 From: Sotiris Niarchos <sot.niarchos@gmail.com> Date: Thu, 2 Apr 2020 13:26:03 +0300 Subject: [PATCH] recursive array dtype check; no nested arrays --- pyopencl/tools.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 69c3d855..6e13479b 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -464,10 +464,7 @@ class _CDeclList: return if hasattr(dtype, "subdtype") and dtype.subdtype is not None: - if dtype.subdtype[0] in [np.float64 or np.complex128]: - self.saw_double = True - if dtype.subdtype[0].kind == "c": - self.saw_complex = True + self.add_dtype(dtype.subdtype[0]) return for name, field_data in sorted(six.iteritems(dtype.fields)): @@ -556,6 +553,8 @@ def match_dtype_to_c_struct(device, name, dtype, context=None): field_dtype, offset = dtype_and_offset[:2] if hasattr(field_dtype, "subdtype") and field_dtype.subdtype is not None: array_dtype = field_dtype.subdtype[0] + if hasattr(array_dtype, "subdtype") and array_dtype.subdtype is not None: + raise NotImplementedError("nested array dtypes are not supported") array_dims = field_dtype.subdtype[1] dims_str = "" try: -- GitLab