diff --git a/doc/source/array.rst b/doc/source/array.rst index bec0365b18041981782a76223367c842038575f4..087b583bfd338768e1942b78384e6c41aab65c94 100644 --- a/doc/source/array.rst +++ b/doc/source/array.rst @@ -209,6 +209,10 @@ The :class:`Array` Class :mod:`numpy.ndarray`. If *ary* is given, it must have the right size (not necessarily shape) and dtype. + .. method :: copy(queue=None) + + .. versionadded:: 2012.2 + .. method :: __str__() .. method :: __repr__() diff --git a/pyopencl/array.py b/pyopencl/array.py index a4cf9ff5cfa39073d5c80bbbef32da5b0374a851..c06e21b275b22cf6a7369680a92b4d7257f48c5e 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -377,6 +377,12 @@ class Array(object): return ary + def copy(self, queue=None): + queue = queue or self.queue + result = self._new_like_me() + cl.enqueue_copy(queue, result.data, self.data, byte_count=self.nbytes) + return result + def __str__(self): return str(self.get())