Replace nnbench.BenchmarkRunner
with modular nnbench.collect()
and nnbench.run()
APIs
#193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The class had little to no useful state, anyways, and these two standalone APIs play
way better with threading and concurrency, so we opt for functional APIs instead of
a monolithic class.
This is effectively an idiom change - before, we were instantiating as
runner = nnbench.BenchmarkRunner
, whereas now, we go the extra mile tocollect in the open (
benchmarks = nnbench.collect(path, tags=...)
), andthen pass them as the first argument to the "new"
nnbench.run()
API, whichis just the BenchmarkRunner.run() with the path and tags arguments removed.
This also prevents erroneous caching and persistence of large params to an extent,
since the benchmark list is made explicit.
We had relatively few consumers, namely the main module and the CLI, so the migration was
not as hard as previously thought.
Replaces the previous zero-state BenchmarkRunner with the new "collect-then-run" idiom
in the examples and documentation.
In most of the docs, this is only a syntax change, but some formulations had to be tweaked,
since there is no more single runner resource.
Work towards #189. I already have a local concurrency setup using
multiprocessing
up and running, but it is very crude, and does not work by just passing the benchmark objects, due to limitations with Python'spickle
with respect to serializing functions.