File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -475,3 +475,24 @@ def test_memory_construction_from_other_memory_objects():
475
475
m3 = MemoryUSMShared (m_de , copy = True )
476
476
assert bytes (m1 ) == bytes (m_sh )
477
477
assert bytes (m2 ) == bytes (m3 )
478
+
479
+
480
+ def test_memory_copy_between_contexts ():
481
+ try :
482
+ q = dpctl .SyclQueue ("cpu" )
483
+ except dpctl .SyclQueueCreationError :
484
+ pytest .skip ("CPU queue could not be created" )
485
+ d = q .sycl_device
486
+ n = d .max_compute_units
487
+ n_half = n // 2
488
+ d0 , d1 = d .create_sub_devices (partition = [n_half , n - n_half ])
489
+ q0 = dpctl .SyclQueue (d0 )
490
+ q1 = dpctl .SyclQueue (d1 )
491
+ m0 = MemoryUSMDevice (256 , queue = q0 )
492
+ m1 = MemoryUSMDevice (256 , queue = q1 )
493
+ host_buf = b"abcd" * 64
494
+ m0 .copy_from_host (host_buf )
495
+ m1 .copy_from_device (m0 )
496
+ copy_buf = bytearray (256 )
497
+ m1 .copy_to_host (copy_buf )
498
+ assert host_buf == copy_buf
You can’t perform that action at this time.
0 commit comments