Skip to content

Commit 92aa81d

Browse files
Merge pull request #1304 from IntelPython/usm-ndarray-sycl-device-accessor
Implement usm_ndarray::get_device()
2 parents f9e3014 + 9bfc6d9 commit 92aa81d

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)