From b114ac4cf507f6229db6b3f27815141731630bf8 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Thu, 11 Apr 2013 14:05:19 -0400 Subject: [PATCH] Register 64-bit integer types on 32-bit machines. --- pyopencl/tools.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 753e5357..23f98f62 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -38,12 +38,23 @@ import re from pyopencl.compyte.dtypes import ( get_or_register_dtype, TypeNameNotKnown, - register_dtype, _fill_dtype_registry, - dtype_to_ctype) + register_dtype, dtype_to_ctype) -_fill_dtype_registry(respect_windows=False, include_bool=False) -get_or_register_dtype("cfloat_t", np.complex64) -get_or_register_dtype("cdouble_t", np.complex128) + +def _register_types(): + from pyopencl.compyte.dtypes import _fill_dtype_registry + + _fill_dtype_registry(respect_windows=False, include_bool=False) + + get_or_register_dtype("cfloat_t", np.complex64) + get_or_register_dtype("cdouble_t", np.complex128) + + is_64_bit = tuple.__itemsize__ * 8 == 64 + if not is_64_bit: + get_or_register_dtype(["unsigned long", "unsigned long int"], np.uint64) + get_or_register_dtype(["signed long", "signed long int", "long int"], np.int64) + +_register_types() -- GitLab