BENCH_SSH Subroutine

public subroutine BENCH_SSH(LMAX, NX, OUTUNIT)

Benchmarks SSH_ALL (batch) against looped SSH (single-mode) calls, for , swept over NX colatitude points in at a fixed longitude.

LMAX N_MODES T_BATCH T_LOOP SPEEDUP (seconds per grid-point evaluation).

Arguments

Type IntentOptional 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:


Calls

proc~~bench_ssh~~CallsGraph proc~bench_ssh BENCH_SSH interface~ssh SSH proc~bench_ssh->interface~ssh interface~ssh_all SSH_ALL proc~bench_ssh->interface~ssh_all proc~wall_time WALL_TIME proc~bench_ssh->proc~wall_time proc~ssh_dp SSH_DP interface~ssh->proc~ssh_dp proc~ssh_all_dp SSH_ALL_DP interface~ssh_all->proc~ssh_all_dp dcos dcos proc~ssh_all_dp->dcos interface~assoc_legendre_norm_all ASSOC_LEGENDRE_NORM_ALL proc~ssh_all_dp->interface~assoc_legendre_norm_all proc~plm_index PLM_INDEX proc~ssh_all_dp->proc~plm_index proc~ylm_index YLM_INDEX proc~ssh_all_dp->proc~ylm_index proc~ssh_dp->dcos interface~assoc_legendre ASSOC_LEGENDRE proc~ssh_dp->interface~assoc_legendre interface~log_fact LOG_FACT proc~ssh_dp->interface~log_fact 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~log_fact_dp LOG_FACT_DP interface~log_fact->proc~log_fact_dp proc~assoc_legendre_dp->interface~log_fact proc~assoc_legendre_norm_all_dp->proc~plm_index

Called by

proc~~bench_ssh~~CalledByGraph proc~bench_ssh BENCH_SSH program~bench_main BENCH_MAIN program~bench_main->proc~bench_ssh

Source Code

  SUBROUTINE BENCH_SSH(LMAX, NX, OUTUNIT)
  IMPLICIT NONE
  INTEGER(KIND=i4), INTENT(IN) :: LMAX
  INTEGER(KIND=i4), INTENT(IN) :: NX
  INTEGER(KIND=i4), INTENT(IN) :: OUTUNIT
  INTEGER(KIND=i4) :: L, M, IX, R, NREP, NYLM
  REAL(KIND=dp) :: THETA, PHI, DTH, T0, T1, T_BATCH, T_LOOP
  COMPLEX(KIND=dp) :: ACC
  COMPLEX(KIND=dp), ALLOCATABLE :: YLM(:)

  NYLM = (LMAX+1)**2
  ALLOCATE(YLM(NYLM))
  PHI = 0.123d0   !- arbitrary fixed longitude
  DTH = pi / (NX - 1)

  NREP = 1
  DO
    T0 = WALL_TIME()
    DO R = 1, NREP
      DO IX = 0, NX-1
        THETA = IX*DTH
        CALL SSH_ALL(YLM, LMAX, THETA, PHI)
      ENDDO
    ENDDO
    T1 = WALL_TIME()
    IF (T1-T0 >= MIN_TIME .OR. NREP >= NREP_CAP) EXIT
    NREP = NREP*2
  ENDDO
  T_BATCH = (T1-T0) / (NREP*NX)
  ACC = SUM(YLM)
  IF (ACC == (-1.0d300,0.d0)) WRITE(*,'(A)') ""

  IF (LMAX <= LOOP_LMAX_CAP) THEN
    NREP = 1
    DO
      ACC = DCMPLX(0.d0,0.d0)
      T0 = WALL_TIME()
      DO R = 1, NREP
        DO IX = 0, NX-1
          THETA = IX*DTH
          DO L = 0, LMAX
            DO M = -L, L
              ACC = ACC + SSH(L, M, THETA, PHI)
            ENDDO
          ENDDO
        ENDDO
      ENDDO
      T1 = WALL_TIME()
      IF (T1-T0 >= MIN_TIME .OR. NREP >= NREP_CAP) EXIT
      NREP = NREP*2
    ENDDO
    T_LOOP = (T1-T0) / (NREP*NX)
    IF (ACC == (-1.0d300,0.d0)) WRITE(*,'(A)') ""
  ELSE
    T_LOOP = -1.0_dp   !- sentinel: not measured, see LOOP_LMAX_CAP
  END IF

  IF (T_LOOP >= 0.0_dp) THEN
    WRITE(OUTUNIT,'(I6,1X,I8,1X,ES14.6,1X,ES14.6,1X,F12.3)') &
      LMAX, NYLM, T_BATCH, T_LOOP, T_LOOP/T_BATCH
  ELSE
    WRITE(OUTUNIT,'(I6,1X,I8,1X,ES14.6,1X,ES14.6,1X,F12.3)') &
      LMAX, NYLM, T_BATCH, T_LOOP, -1.0_dp
  END IF

  DEALLOCATE(YLM)
  RETURN
  END SUBROUTINE BENCH_SSH