dpctl.utils¶
- dpctl.utils.onetrace_enabled()[source]¶
Enable
onetracecollection for kernels executed in this context.Note
Proper working of this utility assumes that Python interpreter has been launched by
onetraceorunitracetool from project intel/pti-gpu.- Example:
Launch the Python interpreter using onetrace tool:
$ onetrace --conditional-collection -v -t --demangle python app.py
Now using the context manager in the Python sessions enables data collection and its output for every offloaded kernel:
import use_kernel as eg import dpctl.memory as dpmem from dpctl.utils import onetrace_enabled x_dev = dpmem.MemoryUSMDevice(1024) # onetrace output reporting on execution of the kernel # should be seen, starting with "Device Timeline" with onetrace_enabled(): eg.run_kernel(x_dev)
- dpctl.utils.intel_device_info(sycl_device)[source]¶
For Intel(R) GPU devices returns a dictionary with device architectural details, and an empty dictionary otherwise. The dictionary contains the following keys:
- device_id:
32-bits device PCI identifier
- gpu_eu_count:
Total number of execution units
- gpu_hw_threads_per_eu:
Number of thread contexts in EU
- gpu_eu_simd_width:
Physical SIMD width of EU
- gpu_slices:
Total number of slices
- gpu_subslices_per_slice:
Number of sub-slices per slice
- gpu_eu_count_per_subslice:
Number of EUs in subslice
- max_mem_bandwidth:
Maximum memory bandwidth in bytes/second
- free_memory:
Global memory available on the device in units of bytes
Unsupported descriptors are omitted from the dictionary.
Descriptors other than the PCI identifier are supported only for
SyclDeviceswith Level-Zero backend.Note
Environment variable
ZES_ENABLE_SYSMANmay need to be set to1for the"free_memory"key to be reported.
- dpctl.utils.SequentialOrderManager¶
Thread-local object mapping each
dpctl.SyclQueueto an order manager, used to ensure sequential ordering of offloaded tasks.Record submitted tasks with
add_eventand usesubmitted_eventsas the dependency list of subsequent submissions. To keep Python objects referenced by a task alive until it completes, usedpctl.SyclQueue.keep_args_alive().Record events that gate the release of objects used by a task with
add_cleanup_event, and find them incleanup_events. They are waited on, but never become dependencies of later tasks.Waiting with
waitalso drops the references thatdpctl.SyclQueue.keep_args_alive()took for tasks that have since completed, whichdpctlotherwise does on a thread of its own. This is best-effort: references that thread is already dropping are left to it, so they may still be held whenwaitreturns.For an in-order queue, if
dpctl.SyclQueue.is_get_last_event_available()isTrue,submitted_eventsalso has the event of the last command submitted to the queue. That covers tasks submitted to the queue without being added to the order manager, e.g. by other threads, and may be the event of an empty kernel submitted bydpctl.SyclQueue.keep_args_alive().wait,clearand thread exit wait for all work on the queue, including work submitted by other threads.Deprecated since version 0.24.0:
add_event_pair,host_task_eventsandnum_host_task_eventsare deprecated. Tasks are no longer paired with a host task event, soadd_eventtakes the computational event alone, and cleanup is tracked byadd_cleanup_event,cleanup_eventsandnum_cleanup_events.