diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d347af93e79ced925088583b5799848af222a10d..f667389484ea1de393ca8de7795769409857d450 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 diff --git a/pyopencl/array.py b/pyopencl/array.py index 4d5334be6a025561c397f748b4cabb531bf928d7..2d03207962b5fb1c6f5c9c4edb48ad1d3478e231 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_) diff --git a/setup.py b/setup.py index 3a66674dbe324abdf79a795d8869f40000c6ad86..1c9ca77d0b1a05716ce20caaa09f3e7ac0cbde4f 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 diff --git a/src/c_wrapper/clinfo_ext.h b/src/c_wrapper/clinfo_ext.h index 9263981e743a947b895cfd1344f2432cbebdbbd6..43b7b6082fda28ad433f26c5d9a5e2e743e24940 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 */ diff --git a/src/c_wrapper/pyopencl_ext.h b/src/c_wrapper/pyopencl_ext.h index cd5d7112ea6325d1770f2fbf4431c33ef2edec0d..a9792d8b07cb5be7a2def7d0b4a50941639442e1 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 @@ -26,9 +28,31 @@ 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 +/* vim: foldmethod=marker */