From 359db9a2d5bf8e214de19cc6587e9920bdcad86f Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 24 May 2018 16:29:22 +0200 Subject: [PATCH 1/6] Run flake8 on py3.6 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d347af93..f6673894 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -188,6 +188,6 @@ Flake8: - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh - ". ./prepare-and-run-flake8.sh pyopencl test" tags: - - python3.5 + - python3.6 except: - tags -- GitLab From 58168322a9969194c8eb6a1fc22ba18c0842e1b2 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 24 May 2018 16:31:28 +0200 Subject: [PATCH 2/6] Print better error message for Array.get() on array without queue --- pyopencl/array.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyopencl/array.py b/pyopencl/array.py index 4d5334be..2d032079 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -677,8 +677,15 @@ class Array(object): assert self.flags.forc, "Array in get() must be contiguous" + queue = queue or self.queue + if queue is None: + raise ValueError("Cannot copy array to host. " + "Array has no queue. Use " + "'new_array = array.with_queue(queue)' " + "to associate one.") + if self.size: - cl.enqueue_copy(queue or self.queue, ary, self.base_data, + cl.enqueue_copy(queue, ary, self.base_data, device_offset=self.offset, is_blocking=not async_) -- GitLab From 93a7a54b2bc26f7e936b8f3c11a86033d8959d3d Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 24 May 2018 16:59:50 +0200 Subject: [PATCH 3/6] Clean up definitely-unused bits from shipped ext header --- src/c_wrapper/clinfo_ext.h | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/c_wrapper/clinfo_ext.h b/src/c_wrapper/clinfo_ext.h index 9263981e..43b7b608 100644 --- a/src/c_wrapper/clinfo_ext.h +++ b/src/c_wrapper/clinfo_ext.h @@ -20,42 +20,6 @@ #define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT 0x104B #endif -/* 2.0 headers are not very common for the time being, so - * let's copy the defines for the new CL_DEVICE_* properties - * here. - */ -#ifndef CL_VERSION_2_0 -#define CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS 0x104C -#define CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE 0x104D -#define CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES 0x104E -#define CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE 0x104F -#define CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE 0x1050 -#define CL_DEVICE_MAX_ON_DEVICE_QUEUES 0x1051 -#define CL_DEVICE_MAX_ON_DEVICE_EVENTS 0x1052 -#define CL_DEVICE_SVM_CAPABILITIES 0x1053 -#define CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE 0x1054 -#define CL_DEVICE_MAX_PIPE_ARGS 0x1055 -#define CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS 0x1056 -#define CL_DEVICE_PIPE_MAX_PACKET_SIZE 0x1057 -#define CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT 0x1058 -#define CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT 0x1059 -#define CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT 0x105A - -#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER (1 << 0) -#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER (1 << 1) -#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM (1 << 2) -#define CL_DEVICE_SVM_ATOMICS (1 << 3) - -typedef cl_bitfield cl_device_svm_capabilities; -#endif - -#ifndef CL_VERSION_2_1 -#define CL_PLATFORM_HOST_TIMER_RESOLUTION 0x0905 -#define CL_DEVICE_IL_VERSION 0x105B -#define CL_DEVICE_MAX_NUM_SUB_GROUPS 0x105C -#define CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS 0x105D -#endif - /* * Extensions */ -- GitLab From e3f3940e08962397988a483f5b96b68ea22cb760 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 24 May 2018 17:00:16 +0200 Subject: [PATCH 4/6] Define Nvidia device props if not available in system ext header --- src/c_wrapper/pyopencl_ext.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/c_wrapper/pyopencl_ext.h b/src/c_wrapper/pyopencl_ext.h index cd5d7112..b9b7782d 100644 --- a/src/c_wrapper/pyopencl_ext.h +++ b/src/c_wrapper/pyopencl_ext.h @@ -26,9 +26,33 @@ typedef union } cl_device_topology_amd; #endif +/* {{{ these NV defines are often missing from the system headers */ + +#ifndef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV +#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 +#endif +#ifndef CL_DEVICE_INTEGRATED_MEMORY_NV +#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 +#endif + +#ifndef CL_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT_NV +#define CL_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT_NV 0x4007 +#endif + +#ifndef CL_DEVICE_PCI_BUS_ID_NV +#define CL_DEVICE_PCI_BUS_ID_NV 0x4008 +#endif + +#ifndef CL_DEVICE_PCI_SLOT_ID_NV +#define CL_DEVICE_PCI_SLOT_ID_NV 0x4009 +#endif + +/* }}} */ + #endif #endif #endif +/* vim: foldmethod=marker */ -- GitLab From 89072daf1f7511cf4cf2e6a23b991274b1e7f08a Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 24 May 2018 17:00:38 +0200 Subject: [PATCH 5/6] Default to non-shipped ext header after all --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3a66674d..1c9ca77d 100644 --- a/setup.py +++ b/setup.py @@ -79,7 +79,7 @@ def get_config_schema(): Switch("CL_TRACE", False, "Enable OpenCL API tracing"), Switch("CL_ENABLE_GL", False, "Enable OpenCL<->OpenGL interoperability"), Switch( - "CL_USE_SHIPPED_EXT", True, + "CL_USE_SHIPPED_EXT", False, "Use the pyopencl version of CL/cl_ext.h which includes" + " a broader range of vendor-specific OpenCL extension attributes" + " than the standard Khronos (or vendor specific) CL/cl_ext.h."), @@ -126,7 +126,7 @@ def main(): major, minor = [int(x) for x in conf["CL_PRETEND_VERSION"].split(".")] extra_defines["PYOPENCL_PRETEND_CL_VERSION"] = \ 0x1000*major + 0x10 * minor - except: + except Exception: print("CL_PRETEND_VERSION must be of the form M.N, " "with two integers M and N") raise -- GitLab From d0542debd80be9b34bc864e7dfe4c8261cab0729 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 24 May 2018 17:18:21 +0200 Subject: [PATCH 6/6] Also define missing ext bits on Apple --- src/c_wrapper/pyopencl_ext.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/c_wrapper/pyopencl_ext.h b/src/c_wrapper/pyopencl_ext.h index b9b7782d..a9792d8b 100644 --- a/src/c_wrapper/pyopencl_ext.h +++ b/src/c_wrapper/pyopencl_ext.h @@ -16,6 +16,8 @@ #include #include +#endif + #ifndef CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD #define CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD 1 @@ -53,6 +55,4 @@ typedef union #endif -#endif - /* vim: foldmethod=marker */ -- GitLab