11# Benchmarks for ` s2fft `
22
3- Scripts for benchmarking ` s2fft ` with ` timeit ` (and optionally ` memory_profiler ` ) .
3+ Scripts for benchmarking ` s2fft ` transforms .
44
55Measures time to compute transforms for grids of parameters settings, optionally
66outputting the results to a JSON file to allow comparing performance over versions
7- and/or systems.
8- If the [ ` memory_profiler ` package] ( https://github.com/pythonprofilers/memory_profiler )
9- is installed an estimate of the peak (main) memory usage of the benchmarked functions
10- will also be recorded.
7+ and/or systems.
118If the [ ` py-cpuinfo ` package] ( https://pypi.org/project/py-cpuinfo/ )
129is installed additional information about CPU of system benchmarks are run on will be
1310recorded in JSON output.
1411
15-
1612## Description
1713
1814The benchmark scripts are as follows:
@@ -40,7 +36,7 @@ display the usage message:
4036```
4137usage: spherical.py [-h] [-number-runs NUMBER_RUNS] [-repeats REPEATS]
4238 [-parameter-overrides [PARAMETER_OVERRIDES ...]] [-output-file OUTPUT_FILE]
43- [--run-once-and-discard ]
39+ [-benchmarks BENCHMARKS [BENCHMARKS ...] ]
4440
4541Benchmarks for on-the-fly spherical transforms.
4642
@@ -55,17 +51,16 @@ options:
5551 parameters. (default: None)
5652 -output-file OUTPUT_FILE
5753 File path to write JSON formatted results to. (default: None)
58- --run-once-and-discard
59- Run benchmark function once first without recording time to ignore the effect of any initial
60- one-off costs such as just-in-time compilation. (default: False)
54+ -benchmarks BENCHMARKS [BENCHMARKS ...]
55+ Names of benchmark functions to run. All benchmarks are run if omitted. (default: None)
6156```
6257
6358For example to run the spherical transform benchmarks using only the JAX implementations,
6459running on a CPU (in double-precision) for ` L ` values 64, 128, 256, 512 and 1024 we
6560would run from the root of the repository:
6661
6762``` sh
68- 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
63+ JAX_PLATFORM_NAME=cpu JAX_ENABLE_X64=1 python benchmarks/spherical.py -p L 64 128 256 512 1024 -p method jax
6964```
7065
7166Note the usage of environment variables ` JAX_PLATFORM_NAME ` and ` JAX_ENABLE_X64 ` to
0 commit comments