Skip to main content

Headless profiling capture for Python: per-step metrics + flame scopes to a .vor stream, read back with the Rust vor tooling.

Project description

vor

Python bindings for the vor profiler. Instrument a training or inference loop, write per-step metrics (and optional flame frames) to a .vor file, and read it back in Python with vor.Reader. The GUI replay panel stays in the Rust tools.

Install

uv add vor-profile      # or: pip install vor-profile

The distribution is vor-profile (the name vor is taken on PyPI); the import is vor.

Usage

import vor

vor.enable()
vor.record_metric_unit("throughput", "tok/s")  # optional, once

@vor.profile
def train_step(batch):
    ...

for batch in loader:
    loss = train_step(batch)
    vor.record_metric("loss", loss)
    vor.frame_mark()
vor.flush()

Set VOR_RECORD to capture; leave it unset and nothing is written:

VOR_RECORD=/scratch/run.vor python train.py

VOR_RECORD_FLAME=1 also records flame frames (VOR_RECORD_EVERY=N samples 1 step in N). See examples/train.py.

API

  • enable() - turn collection on; arm capture when VOR_RECORD is set.
  • frame_mark() - end a step; writes one record.
  • record_metric(name, value) - a named scalar for this step.
  • record_metric_unit(name, unit) - label a metric's row, once.
  • flush() - write buffered records before exit.
  • @profile - flame scope per call, named module.qualname.
  • profile_scope(name) - flame scope for a with block.
  • Reader(path) - iterate a capture; each Frame has .system (aligned to reader.columns), .user (dict of named scalars), and .flame (raw puffin bytes or None).

Reading a capture

import vor

reader = vor.Reader("/scratch/run.vor")
for frame in reader:
    step_ms = frame.system[0]      # columns are reader.columns
    loss = frame.user.get("loss")

Into a DataFrame for plotting (no pandas dependency in this package):

import pandas as pd

reader = vor.Reader("/scratch/run.vor")
cols = [name for name, _unit in reader.columns]
df = pd.DataFrame(
    {**dict(zip(cols, f.system)), **f.user} for f in reader
)
df["loss"].rolling(50).mean().plot()

The GUI replay panel stays in the Rust crate:

cargo run --example replay --features viz,mac -- /scratch/run.vor

Build from source

Needs maturin. The base build is portable (metrics only); add a platform feature for GPU rows:

maturin develop                        # metrics
maturin develop --features mac         # + Apple Silicon GPU (IOKit)
maturin build --release --features cuda  # + NVIDIA GPU (NVML)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vor_profile-0.2.1.tar.gz (92.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vor_profile-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (535.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

vor_profile-0.2.1-cp39-abi3-macosx_11_0_arm64.whl (425.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file vor_profile-0.2.1.tar.gz.

File metadata

  • Download URL: vor_profile-0.2.1.tar.gz
  • Upload date:
  • Size: 92.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vor_profile-0.2.1.tar.gz
Algorithm Hash digest
SHA256 30d4bc8c8837a117e1b4e99bf2bfb153a35aee851c77768872c90a64f23d2eb3
MD5 b6b179a5e4bb7b3ca93101f258aed271
BLAKE2b-256 0318d639c04ccbc28c20a0a8102072f616e7765ae7a74e9e4643aaa4216ba1fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for vor_profile-0.2.1.tar.gz:

Publisher: python.yml on SConsul/vor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vor_profile-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vor_profile-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86bf52855ea2f29765b7d5696469f1d8136d13e24f4d40ced9ef0c261a9cd3f8
MD5 6261be314f1375de0c3828e34c7900a2
BLAKE2b-256 1cf1ff4427888bf72faa9bc38541065bb1f9278aeec08c88c1b8584b5e02bf27

See more details on using hashes here.

Provenance

The following attestation bundles were made for vor_profile-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on SConsul/vor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vor_profile-0.2.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vor_profile-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3de480a3462a7f84373ff20174da06a1e3d58ed4871ef8e068df418cbbd8b16
MD5 229d8b21061e4061cd2a05b2d6398628
BLAKE2b-256 5d7df02439a9884eeff6daa16bd522b9b90f137da8a4ce3bd325702eb0998dbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for vor_profile-0.2.1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: python.yml on SConsul/vor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page