Skip to content

Commit 6ae16ce

Browse files
antonwolfyvtavana
andauthored
Add device, sycl_queue and usm_type keywords to dpnp.ndarray.copy method (#1976)
* Add device, sycl_queue and usm_type keywords to dpnp.ndarray.copy * Align description of sycl_queue keyword * Applied black formatting * Updated third party tests * Added tests for SYCL queue and USM device * update fftfreq and rfftfreq docstring --------- Co-authored-by: Vahid Tavanashad <[email protected]> Co-authored-by: vtavana <[email protected]>
1 parent e4acd3e commit 6ae16ce

File tree

11 files changed

+342
-58
lines changed

11 files changed

+342
-58
lines changed

dpnp/dpnp_array.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,35 @@ def conjugate(self):
696696
else:
697697
return dpnp.conjugate(self)
698698

699-
def copy(self, order="C"):
699+
def copy(self, order="C", device=None, usm_type=None, sycl_queue=None):
700700
"""
701701
Return a copy of the array.
702702
703+
Refer to :obj:`dpnp.copy` for full documentation.
704+
705+
Parameters
706+
----------
707+
order : {"C", "F", "A", "K"}, optional
708+
Memory layout of the newly output array.
709+
Default: ``"C"``.
710+
device : {None, string, SyclDevice, SyclQueue}, optional
711+
An array API concept of device where the output array is created.
712+
The `device` can be ``None`` (the default), an OneAPI filter
713+
selector string, an instance of :class:`dpctl.SyclDevice`
714+
corresponding to a non-partitioned SYCL device, an instance of
715+
:class:`dpctl.SyclQueue`, or a `Device` object returned by
716+
:obj:`dpnp.dpnp_array.dpnp_array.device` property.
717+
Default: ``None``.
718+
usm_type : {None, "device", "shared", "host"}, optional
719+
The type of SYCL USM allocation for the output array.
720+
Default: ``None``.
721+
sycl_queue : {None, SyclQueue}, optional
722+
A SYCL queue to use for output array allocation and copying. The
723+
`sycl_queue` can be passed as ``None`` (the default), which means
724+
to get the SYCL queue from `device` keyword if present or to use
725+
a default queue.
726+
Default: ``None``.
727+
703728
Returns
704729
-------
705730
out : dpnp.ndarray
@@ -712,8 +737,9 @@ def copy(self, order="C"):
712737
713738
Notes
714739
-----
715-
This function is the preferred method for creating an array copy. The
716-
function :func:`dpnp.copy` is similar, but it defaults to using order 'K'.
740+
This function is the preferred method for creating an array copy.
741+
The function :func:`dpnp.copy` is similar, but it defaults to using
742+
order ``"K"``.
717743
718744
Examples
719745
--------
@@ -735,7 +761,13 @@ def copy(self, order="C"):
735761
736762
"""
737763

738-
return dpnp.copy(self, order=order)
764+
return dpnp.copy(
765+
self,
766+
order=order,
767+
device=device,
768+
usm_type=usm_type,
769+
sycl_queue=sycl_queue,
770+
)
739771

740772
# 'ctypes',
741773

0 commit comments

Comments
 (0)