BENCH_MAIN Program

Uses

  • program~~bench_main~~UsesGraph program~bench_main BENCH_MAIN module~benchmark BENCHMARK program~bench_main->module~benchmark module~kinds KINDS program~bench_main->module~kinds module~benchmark->module~kinds module~globals GLOBALS module~benchmark->module~globals module~vsh VSH module~benchmark->module~vsh module~globals->module~kinds module~vsh->module~kinds module~vsh->module~globals

Driver for the BENCHMARK suite (opt-in VSH_BUILD_BENCHMARK CMake target, not part of ctest): runs every BENCH_* routine across a fixed sweep of values, writing one row per to ./benchmark/bench_*.dat (consumed by py/plot_benchmark.py for the manuscript's performance figure).


Calls

program~~bench_main~~CallsGraph program~bench_main BENCH_MAIN proc~bench_legendre BENCH_LEGENDRE program~bench_main->proc~bench_legendre proc~bench_ssh BENCH_SSH program~bench_main->proc~bench_ssh proc~bench_vsh_pol_dn BENCH_VSH_POL_DN program~bench_main->proc~bench_vsh_pol_dn proc~bench_vsh_pol_up BENCH_VSH_POL_UP program~bench_main->proc~bench_vsh_pol_up proc~bench_vsh_tor BENCH_VSH_TOR program~bench_main->proc~bench_vsh_tor interface~assoc_legendre ASSOC_LEGENDRE proc~bench_legendre->interface~assoc_legendre interface~assoc_legendre_norm_all ASSOC_LEGENDRE_NORM_ALL proc~bench_legendre->interface~assoc_legendre_norm_all proc~wall_time WALL_TIME proc~bench_legendre->proc~wall_time interface~ssh SSH proc~bench_ssh->interface~ssh interface~ssh_all SSH_ALL proc~bench_ssh->interface~ssh_all proc~bench_ssh->proc~wall_time interface~vsh_pol_dn VSH_POL_DN proc~bench_vsh_pol_dn->interface~vsh_pol_dn interface~vsh_pol_dn_all VSH_POL_DN_ALL proc~bench_vsh_pol_dn->interface~vsh_pol_dn_all proc~bench_vsh_pol_dn->proc~wall_time interface~vsh_pol_up VSH_POL_UP proc~bench_vsh_pol_up->interface~vsh_pol_up interface~vsh_pol_up_all VSH_POL_UP_ALL proc~bench_vsh_pol_up->interface~vsh_pol_up_all proc~bench_vsh_pol_up->proc~wall_time interface~vsh_tor VSH_TOR proc~bench_vsh_tor->interface~vsh_tor interface~vsh_tor_all VSH_TOR_ALL proc~bench_vsh_tor->interface~vsh_tor_all proc~bench_vsh_tor->proc~wall_time proc~assoc_legendre_dp ASSOC_LEGENDRE_DP interface~assoc_legendre->proc~assoc_legendre_dp proc~assoc_legendre_norm_all_dp ASSOC_LEGENDRE_NORM_ALL_DP interface~assoc_legendre_norm_all->proc~assoc_legendre_norm_all_dp proc~ssh_dp SSH_DP interface~ssh->proc~ssh_dp proc~ssh_all_dp SSH_ALL_DP interface~ssh_all->proc~ssh_all_dp proc~vsh_pol_dn_dp VSH_POL_DN_DP interface~vsh_pol_dn->proc~vsh_pol_dn_dp proc~vsh_pol_dn_all_dp VSH_POL_DN_ALL_DP interface~vsh_pol_dn_all->proc~vsh_pol_dn_all_dp proc~vsh_pol_up_dp VSH_POL_UP_DP interface~vsh_pol_up->proc~vsh_pol_up_dp proc~vsh_pol_up_all_dp VSH_POL_UP_ALL_DP interface~vsh_pol_up_all->proc~vsh_pol_up_all_dp proc~vsh_tor_dp VSH_TOR_DP interface~vsh_tor->proc~vsh_tor_dp proc~vsh_tor_all_dp VSH_TOR_ALL_DP interface~vsh_tor_all->proc~vsh_tor_all_dp interface~log_fact LOG_FACT proc~assoc_legendre_dp->interface~log_fact proc~plm_index PLM_INDEX proc~assoc_legendre_norm_all_dp->proc~plm_index proc~ssh_all_dp->interface~assoc_legendre_norm_all dcos dcos proc~ssh_all_dp->dcos proc~ssh_all_dp->proc~plm_index proc~ylm_index YLM_INDEX proc~ssh_all_dp->proc~ylm_index proc~ssh_dp->interface~assoc_legendre proc~ssh_dp->dcos proc~ssh_dp->interface~log_fact interface~vsh_core VSH_CORE proc~vsh_pol_dn_all_dp->interface~vsh_core proc~vsh_pol_dn_all_dp->proc~ylm_index proc~vsh_pol_dn_dp->dcos dsin dsin proc~vsh_pol_dn_dp->dsin interface~assoc_legendre_and_deriv ASSOC_LEGENDRE_AND_DERIV proc~vsh_pol_dn_dp->interface~assoc_legendre_and_deriv proc~vsh_pol_dn_dp->interface~log_fact proc~vsh_pol_up_all_dp->interface~vsh_core proc~vsh_pol_up_all_dp->proc~ylm_index proc~vsh_pol_up_dp->dcos proc~vsh_pol_up_dp->dsin proc~vsh_pol_up_dp->interface~assoc_legendre_and_deriv proc~vsh_pol_up_dp->interface~log_fact interface~pvsh_tor_all PVSH_TOR_ALL proc~vsh_tor_all_dp->interface~pvsh_tor_all interface~pvsh_tor PVSH_TOR proc~vsh_tor_dp->interface~pvsh_tor proc~assoc_legendre_and_deriv_dp ASSOC_LEGENDRE_AND_DERIV_DP interface~assoc_legendre_and_deriv->proc~assoc_legendre_and_deriv_dp proc~log_fact_dp LOG_FACT_DP interface~log_fact->proc~log_fact_dp proc~pvsh_tor_dp PVSH_TOR_DP interface~pvsh_tor->proc~pvsh_tor_dp proc~pvsh_tor_all_dp PVSH_TOR_ALL_DP interface~pvsh_tor_all->proc~pvsh_tor_all_dp proc~vsh_core_dp VSH_CORE_DP interface~vsh_core->proc~vsh_core_dp proc~assoc_legendre_and_deriv_dp->interface~log_fact proc~pvsh_tor_all_dp->interface~vsh_core proc~pvsh_tor_all_dp->proc~ylm_index proc~pvsh_tor_dp->dcos proc~pvsh_tor_dp->dsin proc~pvsh_tor_dp->interface~assoc_legendre_and_deriv proc~pvsh_tor_dp->interface~log_fact proc~vsh_core_dp->interface~assoc_legendre_norm_all proc~vsh_core_dp->dcos proc~vsh_core_dp->dsin proc~vsh_core_dp->proc~plm_index proc~vsh_core_dp->proc~ylm_index interface~ddx_assoc_legendre_norm_all DDX_ASSOC_LEGENDRE_NORM_ALL proc~vsh_core_dp->interface~ddx_assoc_legendre_norm_all proc~ddx_assoc_legendre_norm_all_dp DDX_ASSOC_LEGENDRE_NORM_ALL_DP interface~ddx_assoc_legendre_norm_all->proc~ddx_assoc_legendre_norm_all_dp proc~ddx_assoc_legendre_norm_all_dp->proc~plm_index

Variables

Type Attributes Name Initial
integer(kind=i4) :: I
integer(kind=i4), parameter, DIMENSION(NLMAX) :: LMAX_LIST = (/1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 1500, 2000/)
integer(kind=i4), parameter :: NLMAX = 12
integer(kind=i4), parameter :: NX = 50

Source Code

PROGRAM BENCH_MAIN
USE KINDS,     ONLY: i4
USE BENCHMARK, ONLY: &
  BENCH_LEGENDRE, BENCH_SSH, &
  BENCH_VSH_TOR, BENCH_VSH_POL_UP, BENCH_VSH_POL_DN
IMPLICIT NONE

INTEGER(KIND=i4), PARAMETER :: NX = 50   !- grid points swept per Lmax
!- Capped at 2000 (BATCH_SAFE_LMAX in plot_benchmark.py, matching
!- STABILITY_FINDINGS.md Part 1) -- no need to spend time computing batch
!- timings past the range the manuscript figure actually plots. The naive
!- loop is separately capped inside BENCHMARK (LOOP_LMAX_CAP=200; see
!- src/benchmark.f90) since its per-measurement cost is O(NX*Lmax^3), not
!- O(NX*Lmax^2) like batch's, and became a multi-hour runaway at Lmax=4000
!- before that cap was added.
INTEGER(KIND=i4), PARAMETER :: NLMAX = 12
INTEGER(KIND=i4), DIMENSION(NLMAX), PARAMETER :: &
  LMAX_LIST = (/1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 1500, 2000/)
INTEGER(KIND=i4) :: I

OPEN(UNIT=51, FILE="./benchmark/bench_legendre.dat")
OPEN(UNIT=52, FILE="./benchmark/bench_ssh.dat")
OPEN(UNIT=53, FILE="./benchmark/bench_vsh_tor.dat")
OPEN(UNIT=54, FILE="./benchmark/bench_vsh_pol_up.dat")
OPEN(UNIT=55, FILE="./benchmark/bench_vsh_pol_dn.dat")

WRITE(51,'(A)') '# LMAX  N_MODES  T_BATCH_sec  T_LOOP_sec  SPEEDUP'
WRITE(52,'(A)') '# LMAX  N_MODES  T_BATCH_sec  T_LOOP_sec  SPEEDUP'
WRITE(53,'(A)') '# LMAX  N_MODES  T_BATCH_sec  T_LOOP_sec  SPEEDUP'
WRITE(54,'(A)') '# LMAX  N_MODES  T_BATCH_sec  T_LOOP_sec  SPEEDUP'
WRITE(55,'(A)') '# LMAX  N_MODES  T_BATCH_sec  T_LOOP_sec  SPEEDUP'

DO I = 1, NLMAX
  WRITE(*,'(A,I0)') "Benchmarking Lmax=", LMAX_LIST(I)
  CALL BENCH_LEGENDRE  (LMAX_LIST(I), NX, 51)
  CALL BENCH_SSH       (LMAX_LIST(I), NX, 52)
  CALL BENCH_VSH_TOR   (LMAX_LIST(I), NX, 53)
  CALL BENCH_VSH_POL_UP(LMAX_LIST(I), NX, 54)
  CALL BENCH_VSH_POL_DN(LMAX_LIST(I), NX, 55)
ENDDO

CLOSE(51)
CLOSE(52)
CLOSE(53)
CLOSE(54)
CLOSE(55)

WRITE(*,'(A)') "RESULT: benchmark complete - see ./benchmark/*.dat"

END PROGRAM BENCH_MAIN