stormlog.infer.trace_import
Import profiler traces (Kineto, Nsight Systems) into an inference artifact.
The artifact’s infer.artifact record supplies the run and session. Each
trace is registered in the run envelope and its GPU activity is appended as
infer.activity_ref records through append_inference_capture.
Functions
|
Return the run and session IDs recorded by the artifact's identity record. |
|
Merge per-trace captures; a capability is collected if any trace had it. |
|
Append the traces' GPU activity to |
|
Resolved paths of the traces whose GPU activity the artifact already holds. |
|
Parse |
|
A stable ID per file: its name and a digest of its resolved path. |
Classes
|
GPU UUIDs by CUDA ordinal: shared by every trace, or for one trace. |
|
A |
- class stormlog.infer.trace_import.DeviceUuids(shared=<factory>, per_trace=<factory>, bound=False)[source]
Bases:
objectGPU UUIDs by CUDA ordinal: shared by every trace, or for one trace.
An ordinal is local to the traced process (after
CUDA_VISIBLE_DEVICES), so a shared mapping is only safe when each ordinal belongs to one process.per_traceis keyed by the selector as given untilbindmatches each selector to one trace; from then on it is keyed by the trace’s resolved path.- Parameters:
shared (dict[int, str])
per_trace (dict[str, dict[int, str]])
bound (bool)
- per_trace: dict[str, dict[int, str]]
- bound: bool = False
- bind(paths)[source]
Match every selector to exactly one of
paths, or refuse.A selector is a trace’s path, as given or resolved, or its file name when only one of
pathshas that name. A selector that names no trace, or a name that several traces share, is a usage error.- Parameters:
paths (Sequence[str | Path])
- Return type:
- class stormlog.infer.trace_import.TraceFileCollector(paths, *, device_uuids=None, detail='launch', max_bytes=None, worker_index=None)[source]
Bases:
objectA
TraceCollectorover profiler trace files, chosen by file type..sqlitefiles are read as Nsight Systems exports;.nsys-repreports are registered but not read (export them to SQLite first); anything else is read as a Kineto Chrome trace.- Parameters:
paths (Sequence[str | Path])
device_uuids (DeviceUuids | dict[int, str] | None)
detail (Detail)
max_bytes (int | None)
worker_index (WorkerIndex | None)
- stormlog.infer.trace_import.artifact_run_identity(path)[source]
Return the run and session IDs recorded by the artifact’s identity record.
- Parameters:
path (str | Path)
- Return type:
tuple[str, str]
- stormlog.infer.trace_import.combine_captures(captures)[source]
Merge per-trace captures; a capability is collected if any trace had it.
- Parameters:
captures (Sequence[TraceCapture])
- Return type:
- stormlog.infer.trace_import.import_traces_into_artifact(artifact, traces, *, device_uuids=None, detail='launch', envelope_path=None, execution_dir=None)[source]
Append the traces’ GPU activity to
artifactand return what was added.A trace this artifact already imported from the same file is skipped and listed in the summary’s
already_imported; importing it again would only duplicate its records. A trace that was only registered, for example over a size bound, can still be imported.execution_diris the vLLM execution hook’s directory, whose worker hellos name each traced process’s GPU.- Parameters:
artifact (str | Path)
traces (Sequence[str | Path])
device_uuids (DeviceUuids | dict[int, str] | None)
detail (Literal['kernel', 'launch'])
envelope_path (str | Path | None)
execution_dir (str | Path | None)
- Return type:
- stormlog.infer.trace_import.imported_trace_paths(artifact)[source]
Resolved paths of the traces whose GPU activity the artifact already holds.
Read from the trace collectors’ capability summaries, which name each trace’s file; a trace registered without being parsed does not count.
- Parameters:
artifact (str | Path)
- Return type:
set[Path]
- stormlog.infer.trace_import.parse_device_uuids(values)[source]
Parse
[TRACE_FILE:]INDEX=UUIDentries; a bareUUIDmeans device 0.The index is the CUDA device ordinal inside the traced process, after
CUDA_VISIBLE_DEVICES. It is not necessarily the host’s NVML index. ATRACE_FILEprefix limits the entry to one trace: the trace’s path as passed to the command, or its file name when only one trace has it.DeviceUuids.bindchecks the prefixes against the traces.- Parameters:
values (Sequence[str])
- Return type:
- stormlog.infer.trace_import.trace_attachment_id(path, prefix='kineto')[source]
A stable ID per file: its name and a digest of its resolved path.
The name alone would make
run-a/rank0.pt.trace.json.gzandrun-b/rank0.pt.trace.json.gzthe same attachment.- Parameters:
path (Path)
prefix (str)
- Return type:
str