Timing benchmarks comparing the batch (_ALL) Legendre/SSH/VSH
routines against naive per-mode loops over the corresponding
single-mode routines, evaluated across a grid of NX colatitude/
argument points -- mirroring how a spectral MHD transform would call
these routines once per grid point every timestep. Each measurement is
auto-calibrated: the full grid sweep is repeated until elapsed wall
time crosses MIN_TIME, so timings stay resolvable across
the full sweep used for the manuscript's performance
figure, without a hardcoded repeat count. Not part of ctest (opt-in
VSH_BUILD_BENCHMARK CMake target instead) since wall-clock timings
are machine/compiler-dependent and shouldn't gate a pass/fail build.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=i4), | private, | parameter | :: | LOOP_LMAX_CAP | = | 200 |
Naive-loop measurements are skipped above this Lmax. Each single-mode call (ASSOC_LEGENDRE, SSH, ...) is itself an O(l) recurrence, so one naive-loop grid sweep costs O(NXLMAX^3), not O(NXLMAX^2) like the batch routines -- at LMAX=4000 a single measurement (NREP=1, before MIN_TIME calibration even gets a chance to stop doubling) took multiple hours and never completed. There's no reason to pay that cost anyway: the naive/single-mode routines are only verified-safe to l<=150 (see STABILITY_FINDINGS.md Part 2), so timing them past that range times how fast they compute wrong answers. |
| real(kind=dp), | private, | parameter | :: | MIN_TIME | = | 0.2_dp |
Minimum elapsed wall time (seconds) a calibration measurement must reach before its repeat count is accepted; below this, repeats double and the measurement is retried. |
| integer(kind=i4), | private, | parameter | :: | NREP_CAP | = | 1000000 |
Safety cap on the repeat-count doubling loop, so a pathologically fast measurement can't spin forever. |
Wall-clock seconds elapsed, via SYSTEM_CLOCK with an INTEGER(i8)
count so the calibration loops in every BENCH_* routine below cannot
roll the counter over during a long-running sweep.
Benchmarks ASSOC_LEGENDRE_NORM_ALL (batch) against looped
ASSOC_LEGENDRE (single-mode) calls, for , swept over NX points (one grid
sweep per timing, repeated/calibrated per WALL_TIME).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree benchmarked, . |
||
| integer(kind=i4), | intent(in) | :: | NX |
Number of points swept per timing measurement. |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to append one result row to: |
Benchmarks SSH_ALL (batch) against looped SSH (single-mode)
calls, for , swept over
NX colatitude points in at a fixed longitude.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree benchmarked, . |
||
| integer(kind=i4), | intent(in) | :: | NX |
Number of colatitude points swept per timing measurement. |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to append one result row to: |
Benchmarks VSH_POL_DN_ALL (batch) against looped VSH_POL_DN
(single-mode) calls, for , swept over NX colatitude points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree benchmarked, . |
||
| integer(kind=i4), | intent(in) | :: | NX |
Number of colatitude points swept per timing measurement. |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to append one result row to: |
Benchmarks VSH_POL_UP_ALL (batch) against looped VSH_POL_UP
(single-mode) calls, for , swept over NX colatitude points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree benchmarked, . |
||
| integer(kind=i4), | intent(in) | :: | NX |
Number of colatitude points swept per timing measurement. |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to append one result row to: |
Benchmarks VSH_TOR_ALL (batch) against looped VSH_TOR
(single-mode) calls, for , swept over NX colatitude points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree benchmarked, . |
||
| integer(kind=i4), | intent(in) | :: | NX |
Number of colatitude points swept per timing measurement. |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to append one result row to: |