From a2219c59482972fc1882ae6e4a7dfb0f6bf6ff42 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 3 May 2012 21:54:48 -0400 Subject: [PATCH] Deprecate Array.set() with differing strides. --- pyopencl/array.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyopencl/array.py b/pyopencl/array.py index 8d84bb4a..66ad40ef 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -340,14 +340,18 @@ class Array(object): def set(self, ary, queue=None, async=False): assert ary.size == self.size assert ary.dtype == self.dtype - assert self.flags.forc if not ary.flags.forc: - raise RuntimeError( - "cannot set from non-contiguous array") + raise RuntimeError("cannot set from non-contiguous array") ary = ary.copy() + if ary.strides != self.strides: + from warnings import warn + warn("Setting array from one with different strides/storage order. " + "This will cease to work in 2013.x.", + stacklevel=2) + if self.size: cl.enqueue_copy(queue or self.queue, self.data, ary, is_blocking=not async) -- GitLab