Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ The :class:`GPUArray` Array Class
size (not necessarily shape) and dtype. If it is not given,
a *page-locked* array is newly allocated.

.. method :: copy()
.. method :: copy(stream=None)

.. versionadded :: 2013.1

Expand Down Expand Up @@ -187,7 +187,7 @@ The :class:`GPUArray` Array Class

.. method :: astype(dtype, stream=None)

Return *self*, cast to *dtype*.
Return copy of the array, cast to a specified type.

.. method :: any(stream=None, allocator=None)

Expand Down
8 changes: 4 additions & 4 deletions pycuda/gpuarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ def get(self, ary=None, pagelocked=False, async_=False, stream=None, **kwargs):
def get_async(self, stream=None, ary=None):
return self.get(ary=ary, async_=True, stream=stream)

def copy(self):
def copy(self, stream=None):
new = GPUArray(self.shape, self.dtype, self.allocator, strides=self.strides)
_memcpy_discontig(new, self)
_memcpy_discontig(new, self, **{"async_": True, "stream": stream} if stream is not None else {})
return new

def __str__(self):
Expand Down Expand Up @@ -926,11 +926,11 @@ def reverse(self, stream=None):
def astype(self, dtype, stream=None):
if not self.flags.forc:
raise RuntimeError(
"only contiguous arrays may " "be used as arguments to this operation"
"only contiguous arrays may be used as arguments to this operation"
)

if dtype == self.dtype:
return self.copy()
return self.copy(stream=stream)

result = self._new_like_me(dtype=dtype)

Expand Down
Loading