You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happens when we bind parameters to benchmarks via weakrefs' WeakValueDicts?
Since we keep benchmarks registered in the runner class, we are potentially keeping around references to parameter structs indefinitely. This means the same memory pressure that we just solved for the parametrization case via memos.
In the end, large in-memory values should be released once a particular benchmark set is unloaded from the runner. Consider this parametrization with a large array:
@nnbench.parametrize({"a": np.zeros((1000000,))})defmmul(a, b):
returna @ b
If I load four of these parametrized benchmarks, I will potentially run into memory troubles.
So in the end, there are some things to investigate:
Check how memory behaves when unloading a benchmark set from the runner, by calling runner.clear() at the end of a run in a loop.
If the memory usage does not go down, see if it's fixed by evicting the source module from sys.modules.
Check if weakrefs for the benchmark parameters (in all core decorators) help with automatic garbage collection, but also whether they introduce bugs / regressions in our current behavior (e.g. by running a current example with weakrefs).
The text was updated successfully, but these errors were encountered:
Experimentation only (for the time being).
What happens when we bind parameters to benchmarks via weakrefs'
WeakValueDict
s?Since we keep benchmarks registered in the runner class, we are potentially keeping around references to parameter structs indefinitely. This means the same memory pressure that we just solved for the parametrization case via memos.
In the end, large in-memory values should be released once a particular benchmark set is unloaded from the runner. Consider this parametrization with a large array:
If I load four of these parametrized benchmarks, I will potentially run into memory troubles.
So in the end, there are some things to investigate:
The text was updated successfully, but these errors were encountered: