Repository navigation
Cached benchmark file I/O - #1700
Conversation
ASV BenchmarkingBenchmark Comparison ResultsBenchmarks that have improved:
Benchmarks that have stayed the same:
Benchmarks that have got worse:
|
|
In timing the |
asv preimports the benchmark suite before it runs any setup_cache (asv/runner.py, spawner.preimport() ahead of the run loop), so on a cold cache bench_connectivity's import-time preload_topologies is what fills it -- serially, in the forkserver parent, before a single benchmark starts. CachedFixtures.setup_cache then finds everything already built, and prime(workers=...) never runs on the path it was written for. Filling it from the CLI first puts those reads back in the parallel prime. Worth a second or two on the GitHub runners, which only see the oQU grids; worth rather more on a machine that can reach the four dyamond grids on campaign storage. Co-Authored-By: Claude Opus 5 <[email protected]>
fd82317 to
4dad004
Compare
dylannelson
left a comment
There was a problem hiding this comment.
This branch's benchmarks can run in around 20 minutes as opposed to previous PR's runtime of around 50+ minutes, so this is a significant boost (looking at past and current runs here).
The cached grids/datasets match what a fresh read in every time would provide, while saving a significant amount of time. Once again ran into the SCRIP non-determinism problem again while looking into this so maybe we should get that done soon, ha.
Tried to run locally and had a few Window's related issues but I don't think that matters much for this
The only thing that popped up was how a single test seems to be slower now
Before (grabbed from my old PR):
After:
It was suggested it may be caused by it now now measuring numba dispatch overhead. Don't think this is a blocker by any means, just strange.
Thanks!
|
@dylannelson Hmm, I'll take a look. It could be that since these timings are so small, they may get swamped by something else. |
Sevans711
left a comment
There was a problem hiding this comment.
This looks great to me, happy to see these improvements!
Seeing that @dylannelson already took a closer look including running benchmarks locally and comparing benchmark suite timings before and after these changes, and considering that this code isn't getting run by uxarray users directly, I didn't investigate more closely than just reading through the changes. But, I did read through them, and everything looks reasonable as far as I can tell.
In addition to the benchmark suite speedup here, moving code into the central helpers files like _fixtures.py also makes the suite easier to read, and hopefully easier to maintain in the future, because there is now a single source of truth, e.g. filenames are defined in one place, and more ASV quirks handled in one place, instead of repeated throughout the suite.
Approving as-is!
Main now carries squash-merged versions of work this branch had unsquashed (cached benchmark I/O UXARRAY#1700, lazy/cached neighborhood kernels UXARRAY#1708/UXARRAY#1768, asv env installs UXARRAY#1776, connectivity peakmem benchmarks UXARRAY#1661). Conflicts resolved in main's favor except where the branch adds sharding: - asv-benchmarking-pr.yml: keep the sharded setup/shard/merge jobs; adopt UXARRAY#1776's asv env cache key (ci/environment.yml + asv.conf.json, no restore-keys) in both jobs; drop a duplicated CPU topology step. - asv-benchmarking.yml: take main's unguarded fixture priming; apply the same env cache key fix. - asv.conf.json: take main's matrix and comments; keep the branch's BLAS thread pins in env_nobuild. - .gitignore: keep the per-shard config/results entries. - bench_connectivity.py: accept deletion; superseded by connectivity.py. - neighbors.py, _fixtures.py, _warmup.py, mpas_ocean.py, geometry_samebody*: take main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cmd/bench_io is stale: its content landed on main as UXARRAY#1700 and has since been superseded there (UXARRAY#1768 neighborhood kernels, UXARRAY#1776 asv env). This branch already carries main, so every conflict resolves to the branch's side and the tree is unchanged; the merge only records bench_io's history so PR #2 against it is mergeable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #1698
Overview
This PR is a large-scale overhaul of the benchmarks to support single-loads of files per benchmark suite.
Currently, the ASV benchmark suite runs a new process per benchmark, requiring full-scale loads of files for every single benchmark. There are a limited number of files that are actually used to benchmark, so we end up loading many files dozens of times, running up wallclock time on the benchmark suite as a whole. This PR instead has a unified approach, where a parent process is launched for the whole benchmark suite, uncached files are retrieved into
/uxarray/benchmarks/_io_cache/, and benchmarks are spawned on forked processes that inherit visibility into the file cache and some other properties.Simultaneously, this reorganization of file I/O will help to expand the scope of what most non-I/O benchmarks are able to test, since some of them were artificially restricted to smaller grids. That raises another question about how many benchmarks really need to be run at every resolution, but I think that's out of scope for this PR, since it would alter the actual benchmark suite, rather than just changing how they are run.
General CI runs should see a wallclock improvement for whole benchmark suites. CI benchmark runs are showing improvements of about 19 minutes so far (38min -> 19min). Runs on HPC can expect larger improvements. Larger benchmark suites will benefit more from cached file I/O, while benchmarks run individually won't see much improvement.
Other general speed improvements:
This PR has merged in PR #1708 already, since it is a precondition for the optimizations here to be thread-safe.
PR Checklist
General
Testing & Benchmarking
Documentation
_)AI Disclosure
AI Usage: Claude Opus 5