File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,19 +30,27 @@ def usm_allocation():
3030 """
3131 # allocate USM-shared byte-buffer
3232 ms = dpmem .MemoryUSMShared (16 )
33+ print (f"USM-shared buffer allocated with size: { len (ms )} " )
3334
3435 # allocate USM-device byte-buffer
3536 md = dpmem .MemoryUSMDevice (16 )
37+ print (f"USM-device buffer allocated with size: { len (md )} " )
3638
3739 # allocate USM-host byte-buffer
3840 mh = dpmem .MemoryUSMHost (16 )
41+ print (f"USM-host buffer allocated with size: { len (mh )} " )
3942
4043 # specify alignment
4144 mda = dpmem .MemoryUSMDevice (128 , alignment = 16 )
45+ print (f"16-byte aligned USM-device buffer allocated with size: { len (mda )} " )
4246
4347 # allocate using given queue,
4448 # i.e. on the device and bound to the context stored in the queue
4549 mdq = dpmem .MemoryUSMDevice (256 , queue = mda .sycl_queue )
50+ print (
51+ "USM-device buffers share the same queue: "
52+ f"{ mdq .sycl_queue == mda .sycl_queue } "
53+ )
4654
4755 # information about device associate with USM buffer
4856 print ("Allocation performed on device:" )
@@ -82,7 +90,7 @@ def usm_host_access():
8290 # USM-device buffer is not host accessible
8391 md = dpmem .MemoryUSMDevice (16 )
8492 try :
85- mdv = memoryview (md )
93+ memoryview (md )
8694 except Exception as e :
8795 print ("" )
8896 print (
You can’t perform that action at this time.
0 commit comments