File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -157,3 +157,26 @@ def test_profiling_info():
157157 assert event .profiling_info_end
158158 else :
159159 pytest .skip ("No OpenCL CPU queues available" )
160+
161+
162+ def test_sycl_timer ():
163+ try :
164+ q = dpctl .SyclQueue (property = "enable_profiling" )
165+ except dpctl .SyclQueueCreationError :
166+ pytest .skip ("Queue creation of default device failed" )
167+ timer = dpctl .SyclTimer ()
168+ m1 = dpctl_mem .MemoryUSMDevice (256 * 1024 , queue = q )
169+ m2 = dpctl_mem .MemoryUSMDevice (256 * 1024 , queue = q )
170+ with timer (q ):
171+ # device task
172+ m1 .copy_from_device (m2 )
173+ # host task
174+ [x ** 2 for x in range (1024 )]
175+ host_dt , device_dt = timer .dt
176+ assert host_dt > device_dt
177+ q_no_profiling = dpctl .SyclQueue ()
178+ assert q_no_profiling .has_enable_profiling is False
179+ with pytest .raises (ValueError ):
180+ timer (queue = q_no_profiling )
181+ with pytest .raises (TypeError ):
182+ timer (queue = None )
You can’t perform that action at this time.
0 commit comments