Skip to content

Commit 9bfc6d9

Browse files
Implement usm_ndarray::get_device()
1 parent 616c21e commit 9bfc6d9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dpctl/apis/include/dpctl4pybind11.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,15 @@ class usm_ndarray : public py::object
965965
return *(reinterpret_cast<sycl::queue *>(QRef));
966966
}
967967

968+
sycl::device get_device() const
969+
{
970+
PyUSMArrayObject *raw_ar = usm_array_ptr();
971+
972+
auto const &api = ::dpctl::detail::dpctl_capi::get();
973+
DPCTLSyclQueueRef QRef = api.UsmNDArray_GetQueueRef_(raw_ar);
974+
return reinterpret_cast<sycl::queue *>(QRef)->get_device();
975+
}
976+
968977
int get_typenum() const
969978
{
970979
PyUSMArrayObject *raw_ar = usm_array_ptr();

0 commit comments

Comments
 (0)