dpctl.SyclTimer.dt

property SyclTimer.dt

Returns a pair of elapsed times host_dt and device_dt.

The host_dt is the duration as measured by the host timer, while the device_dt is the duration as measured by the device timer and encoded in profiling events.

Returns:

Data class with host_dt and device_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 than device_dt.

Use tracing tools like onetrace, or unitrace from intel/pti-gpu repository for more accurate measurements.