File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,18 @@ from .._backend cimport (
33
33
)
34
34
from ._usmarray cimport usm_ndarray
35
35
36
+ from platform import system as sys_platform
37
+
36
38
import numpy as np
37
39
38
40
import dpctl
39
41
import dpctl.memory as dpmem
40
42
41
43
44
+ cdef bint _IS_LINUX = sys_platform() == " Linux"
45
+
46
+ del sys_platform
47
+
42
48
cdef extern from ' dlpack/dlpack.h' nogil:
43
49
cdef int DLPACK_VERSION
44
50
@@ -159,7 +165,10 @@ cpdef to_dlpack_capsule(usm_ndarray usm_ary) except+:
159
165
ary_sycl_device = ary_sycl_queue.get_sycl_device()
160
166
161
167
try :
162
- default_context = ary_sycl_device.sycl_platform.default_context
168
+ if _IS_LINUX:
169
+ default_context = ary_sycl_device.sycl_platform.default_context
170
+ else :
171
+ default_context = None
163
172
except RuntimeError :
164
173
# RT does not support default_context, e.g. Windows
165
174
default_context = None
@@ -328,7 +337,10 @@ cpdef usm_ndarray from_dlpack_capsule(object py_caps) except +:
328
337
device_id = dlm_tensor.dl_tensor.device.device_id
329
338
root_device = dpctl.SyclDevice(str (< int > device_id))
330
339
try :
331
- default_context = root_device.sycl_platform.default_context
340
+ if _IS_LINUX:
341
+ default_context = root_device.sycl_platform.default_context
342
+ else :
343
+ default_context = None
332
344
except RuntimeError :
333
345
default_context = dpctl.SyclQueue(root_device).sycl_context
334
346
if dlm_tensor.dl_tensor.data is NULL :
You can’t perform that action at this time.
0 commit comments