npx skills add ...
npx skills add nvidia/nvalchemi-toolkit --skill nvalchemi-reporting
How to add observability to nvalchemi dynamics and training workflows using ReportingOrchestrator, RichReporter, TensorBoardReporter, scalar extraction, custom reporter callbacks, and dynamics LoggingHook. Use when showing live progress, writing TensorBoard summaries, preserving dynamics CSV rows, adding rank-safe distributed reporting, previewing Rich dashboards, or deciding between logging and reporting for training or molecular dynamics runs.
npx skills add nvidia/nvalchemi-toolkit --skill nvalchemi-reporting
Use reporting for curated workflow summaries and dashboards. Use logging for
direct event records such as per-system dynamics rows. See
docs/userguide/reporting.md, docs/userguide/training.md,
docs/userguide/dynamics.md, and docs/userguide/hooks.md for full details.
Use ReportingOrchestrator when the user wants progress summaries, live Rich
dashboards, TensorBoard scalar snapshots, rank reductions, or one observability
hook that works across training, dynamics, and custom hook-enabled workflows.
ReportingOrchestrator is the hook to register with hooks=[...] or
register_hook(...); RichReporter, TensorBoardReporter, and custom
Reporter objects are sinks owned by that hook and are not registered directly.
Workflow engines enter and close hook context managers automatically during
run(), so user code should not wrap reporting hooks manually in normal cases.
Use nvalchemi.dynamics.hooks.LoggingHook when the user wants a durable
per-graph dynamics event stream. It computes dynamics observables such as
energy, fmax, temperature, status, and graph index, then writes one row per
system to CSV, TensorBoard, or a custom writer.
Do not reuse the dynamics LoggingHook as a training logger. For training,
prefer reporters unless the task explicitly requires a raw training-event log;
then implement a training-specific hook with the same hook protocol.
Attach the ReportingOrchestrator as a normal training hook. Pick stages by
enum name when the code already serializes hook specs or when avoiding imports
in config files. Use AFTER_OPTIMIZER_STEP for high-frequency loss and
learning-rate progress, and validation stages when summaries should align with
validation output.
Guidelines:
hooks=[reporting]; strategy.run(...) enters and
closes the reporting hook automatically.RichReporter(layout="training") for terminal monitoring during local or
interactive runs.TensorBoardReporter(...) for durable scalar summaries and later review.frequency high enough to avoid excessive terminal refresh or file I/O on
large distributed runs.For live summaries or TensorBoard dashboards, use ReportingOrchestrator with a
dynamics layout. The dynamics Rich layout asks the reporter to collect default
dynamics scalars such as energy, fmax, temperature, convergence fraction,
active count, graduated count, and status counts when available.
For a durable per-system trajectory-adjacent log, add LoggingHook instead of
or in addition to reporting:
Guidelines:
hooks=[...]; dynamics run(...) enters
and closes hook context managers automatically.SnapshotHook or data
sinks for full batch states and trajectories.LoggingHook(backend="custom", writer_fn=...) when rows should go to
loguru, a database, or a user-owned writer.log_path when using dynamics
LoggingHook; it writes directly and does not coordinate file access.DynamicsStage.AFTER_STEP unless the metric needs
a more specific stage.Reporters can be rank-gated. Defaults are conservative for terminal and file
outputs: rank zero writes or renders unless a reporter requires all ranks for a
collective reduction. For setting up the distributed training run itself, see
the nvalchemi-training-api skill's Scaling to multiple GPUs section.
Guidelines:
rank_reduction="mean" for loss curves in DDP when every rank reports
matching scalar keys."runs/ddp/rank-{rank}" only when every rank
intentionally writes its own artifact.Pass custom_scalars to reporters when metrics are present in the context or
batch but are not part of the default extraction path. Return plain numbers or
scalar tensors; keep callbacks cheap because they run at reporting frequency.
For dynamics LoggingHook, callbacks receive DynamicsContext and must return
either a per-graph tensor with shape (B,) or a scalar that can be broadcast to
all graphs:
Use RichReporter.preview(...) when choosing or checking a dashboard surface
without running a real workflow:
Use BaseRichLayout for custom table-plus-plot dashboards. Implement the
RichLayout protocol directly only when the output needs a custom Rich
renderable. Do not create a nested rich.live.Live; RichReporter owns the
console, lifecycle, refresh rate, history, and rank filtering.
ReportingOrchestrator([RichReporter(...), TensorBoardReporter(...)])
for training progress.LoggingHook(backend="csv", ...) for dynamics runs that need analyzable
per-system rows.ReportingOrchestrator as the hook; let TrainingStrategy.run()
and dynamics run() enter and close hook context managers automatically.LoggingHook manually unless
they are invoking hook calls outside a workflow engine..item() calls inside hot training code
unless they run at a controlled reporting frequency.