flopscope.budget_live
flopscope.budget_live(by_namespace=False)[flopscope source]
Return a live-updating budget summary context manager.
Parameters
- by_namespace:bool, optional
If
True, include the namespace breakdown in the live display. DefaultFalse.
Returns
- :object
A context manager that refreshes the session-wide budget summary while the
withblock is active. When Rich is installed this is a live-rendered display; otherwise it falls back to a plain-text summary printed when the block exits.
Examples
>>> import flopscope as flops
>>> import flopscope.numpy as fnp
>>> with flops.budget_live():
... with flops.BudgetContext(flop_budget=100):
... _ = fnp.add(fnp.array([1.0]), fnp.array([2.0]))