dpctl.SyclTimer.dt¶
- property SyclTimer.dt¶
Returns a pair of elapsed times
host_dt
anddevice_dt
.The
host_dt
is the duration as measured by the host timer, while thedevice_dt
is the duration as measured by the device timer and encoded in profiling events.- Returns:
Data class with
host_dt
anddevice_dt
members which supports unpacking into a 2-tuple.- Return type:
HostDeviceDuration
- Example:
import dpctl from dpctl import tensor q = dpctl.SyclQueue(property="enable_profiling") device = tensor.Device.create_device(q) timer = dpctl.SyclTimer() with timer(q): x = tensor.linspace(-4, 4, num=10**6, dtype="float32") e = tensor.exp(-0.5 * tensor.square(x)) s = tensor.sin(2.3 * x + 0.11) f = e * s host_dt, device_dt = timer.dt
Note
Since different timers are used to measure host and device durations, one should not expect that
host_dt
is always strictly greater thandevice_dt
.Use tracing tools like
onetrace
, orunitrace
from intel/pti-gpu repository for more accurate measurements.