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

q = dpctl.SyclQueue(property="enable_profiling")

timer = dpctl.SyclTimer()
x = np.linspace(-4, 4, num=10**6, dtype="float32")

with timer(q):
    x_usm = dpctl.memory.MemoryUSMDevice(x.nbytes, queue=q)
    q.memcpy(dest=x_usm, src=x, count=x.nbytes)

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.