Python API
| import hapti
import hapti.kineto
|
The Python API is provided for code annotations and PyTorch profiler integration. It names specific code ranges so
that they appear in the trace and registers the Kineto plugin; it does not start, stop, or configure profiling
(profiling control belongs to the haprof CLI).
Sections
| Page |
Module |
Contents |
| Annotations |
hapti |
Range and Mark annotations that name parts of your code |
| Kineto |
hapti.kineto |
Registers the Kineto plugin that integrates LPU activity into torch.profiler |
What the Python API Does Not Do
The Python API focuses on the small, well-defined roles of code annotation and Kineto plugin registration, so it
does not directly support the following.
| Unsupported feature |
Alternative or where it is handled |
| Starting and stopping profiling |
The haprof launcher (per-process runs) or the torch.profiler session block |
| Selecting collected activity kinds and output formats |
haprof CLI options (--runtime-trace, --device-trace, -f, and so on) |
| Reading counters directly from program code |
Not supported (check collected hardware counters in the trace viewer) |
| Loading and visualizing trace files |
Not provided (open the generated .pftrace file in a dedicated viewer such as ui.perfetto.dev) |
| Naming ranges on the Kineto path |
Use the standard PyTorch API torch.profiler.record_function() |
See Also