Profiling#
Per-step timing of a training run.
Per-step profiling for train_basis_batched.
- Two outputs:
Python-side per-step wall-clock CSV (no JIT distortion — uses
jax.block_until_readyafter each step). Lets you see step-to-step variance and identify outliers (recompiles, val passes).Optional JAX/XLA HLO trace dumped to
trace_dirfor TensorBoard viewing. Annotated withStepTraceAnnotationso each step shows up as a discrete unit.
Usage:
from pdft.profiling import profile_training
report = profile_training(
basis=basis,
dataset=imgs,
loss=pdft.MSELoss(k=...),
n_steps=20,
batch_size=4,
trace_dir="profile_out", # optional — TensorBoard trace
)
print(report.summary())
report.to_csv("step_times.csv")
This is a profiling utility — not used by the main training path. It
re-implements the inner Adam loop (calling the same JIT’d step_fn) so
that per-step block_until_ready can be inserted without disturbing
train_basis_batched’s production behavior.
Contents
Profile |
|