Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f9ce1b4
Allow computing numerical error in benchmarks
matt-graham Jan 23, 2025
2df7205
Use internal functions for benchmark setup rather than pyssht
matt-graham Jan 23, 2025
a778204
Expose parameter in benchmarks to set HEALPix nside
matt-graham Jan 23, 2025
9a8d721
Expose parameter to control number of iterations in spherical benchmarks
matt-graham Jan 23, 2025
b22111b
Only override parameters defined for benchmark
matt-graham Jan 23, 2025
fdcba06
Remove pyssht dependency in benchmarks
matt-graham Jan 23, 2025
ebe51da
Pass through method to inverse transform in forward setup
matt-graham Jan 23, 2025
d5bbc1e
Remove flag for run once and discard in benchmarks
matt-graham Jan 23, 2025
58e16d0
Allow filtering which benchmarks in module are run
matt-graham Jan 23, 2025
4fb58ad
Update benchmarking usage example in README
matt-graham Jan 23, 2025
5534f6a
Split up longer functions
matt-graham Jan 23, 2025
4e01158
Use JAX AOT compilation to record cost + memory analysis estimates
matt-graham Jan 23, 2025
1791828
Normalize benchmark results key naming
matt-graham Jan 23, 2025
651c14f
Use tracemalloc instead of memory_profiler for measuring CPU memory
matt-graham Jan 23, 2025
1a6cce0
Add type hints to benchmarking module
matt-graham Jan 23, 2025
38dfbf4
Fix typo in docstring
matt-graham Jan 24, 2025
ff0baf0
Make robust to change in cost_analysis return type in recent JAX vers…
matt-graham Jan 24, 2025
6443203
Correct key name for printing error
matt-graham Jan 27, 2025
c663e88
Record mean abs error as well as max
matt-graham Jan 27, 2025
b57cdc6
Ensure error values of float type
matt-graham Jan 28, 2025
c30d0b6
Add benchmark plotting module
matt-graham Jan 29, 2025
f2562ab
Force floats when plotting scaling guides
matt-graham Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# Benchmarks for `s2fft`

Scripts for benchmarking `s2fft` with `timeit` (and optionally `memory_profiler`).
Scripts for benchmarking `s2fft` transforms.

Measures time to compute transforms for grids of parameters settings, optionally
outputting the results to a JSON file to allow comparing performance over versions
and/or systems.
If the [`memory_profiler` package](https://github.com/pythonprofilers/memory_profiler)
is installed an estimate of the peak (main) memory usage of the benchmarked functions
will also be recorded.
and/or systems.
If the [`py-cpuinfo` package](https://pypi.org/project/py-cpuinfo/)
is installed additional information about CPU of system benchmarks are run on will be
recorded in JSON output.


## Description

The benchmark scripts are as follows:
Expand Down Expand Up @@ -40,7 +36,7 @@ display the usage message:
```
usage: spherical.py [-h] [-number-runs NUMBER_RUNS] [-repeats REPEATS]
[-parameter-overrides [PARAMETER_OVERRIDES ...]] [-output-file OUTPUT_FILE]
[--run-once-and-discard]
[-benchmarks BENCHMARKS [BENCHMARKS ...]]

Benchmarks for on-the-fly spherical transforms.

Expand All @@ -55,17 +51,16 @@ options:
parameters. (default: None)
-output-file OUTPUT_FILE
File path to write JSON formatted results to. (default: None)
--run-once-and-discard
Run benchmark function once first without recording time to ignore the effect of any initial
one-off costs such as just-in-time compilation. (default: False)
-benchmarks BENCHMARKS [BENCHMARKS ...]
Names of benchmark functions to run. All benchmarks are run if omitted. (default: None)
```

For example to run the spherical transform benchmarks using only the JAX implementations,
running on a CPU (in double-precision) for `L` values 64, 128, 256, 512 and 1024 we
would run from the root of the repository:

```sh
JAX_PLATFORM_NAME=cpu JAX_ENABLE_X64=1 python benchmarks/spherical.py --run-once-and-discard -p L 64 128 256 512 1024 -p method jax
JAX_PLATFORM_NAME=cpu JAX_ENABLE_X64=1 python benchmarks/spherical.py -p L 64 128 256 512 1024 -p method jax
```

Note the usage of environment variables `JAX_PLATFORM_NAME` and `JAX_ENABLE_X64` to
Expand Down
Loading