File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 12
12
lambda : Stream (non_blocking = True ),
13
13
lambda : Stream (null = True ),
14
14
lambda : Stream (ptds = True ),
15
- pytest .param (
16
- lambda : 123 ,
17
- id = "dlpack stream" ,
18
- marks = pytest .mark .skip (reason = "segmentation fault reported (#326)" )
19
- ),
20
15
],
21
16
)
22
17
def test_to_device_with_stream (make_stream ):
@@ -32,3 +27,19 @@ def test_to_device_with_stream(make_stream):
32
27
# device context.
33
28
b = to_device (a , dev , stream = stream )
34
29
assert device (b ) == dev
30
+
31
+
32
+ def test_to_device_with_dlpack_stream ():
33
+ devices = xp .__array_namespace_info__ ().devices ()
34
+
35
+ a = xp .asarray ([1 , 2 , 3 ])
36
+ for dev in devices :
37
+ # Streams are device-specific and must be created within
38
+ # the context of the device...
39
+ with dev :
40
+ s1 = Stream ()
41
+
42
+ # ... however, to_device() does not need to be inside the
43
+ # device context.
44
+ b = to_device (a , dev , stream = s1 .ptr )
45
+ assert device (b ) == dev
You can’t perform that action at this time.
0 commit comments