Skip to content
7 changes: 7 additions & 0 deletions src/common/include/shared_parallel_macros.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
#:set USING_CCE = (MFC_COMPILER == CCE_COMPILER_ID)
#:set USING_AMD = (MFC_COMPILER == AMD_COMPILER_ID)

#! Fallback extents the USING_AMD guards substitute for device-global array bounds when case
#! optimization is off. They are not independent: sys_size counts the species, so AMD_SYS_SIZE_MAX
#! must cover 3*num_fluids + num_vels + 1 + AMD_NUM_SPECIES_MAX. Keep them here rather than as
#! literals at each declaration, so raising one cannot silently outgrow the other.
#:set AMD_NUM_SPECIES_MAX = 60
#:set AMD_SYS_SIZE_MAX = 70

#:def ASSERT_LIST(data, datatype)
#:assert data is not None
#:assert isinstance(data, list)
Expand Down
11 changes: 10 additions & 1 deletion src/common/m_checker_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ contains
#:if not MFC_CASE_OPTIMIZATION
@:PROHIBIT(num_fluids > 3, "num_fluids <= 3 for AMDFLang when Case optimization is off")
@:PROHIBIT((bubbles_euler .or. bubbles_lagrange) .and. nb > 3, "nb <= 3 for AMDFLang when Case optimization is off")
@:PROHIBIT(chemistry .and. num_species > 10, "num_species > 10 for AMDFLang when Case optimization is off")
@:PROHIBIT(chemistry .and. num_species > ${AMD_NUM_SPECIES_MAX}$, &
& "num_species <= ${AMD_NUM_SPECIES_MAX}$ for AMDFLang when Case optimization is off")
! The sys_size bound is not independent of the one above it. Chemistry pins num_fluids to 1, so with
! num_vels <= 3 the species terminate sys_size at 2*1 + 3 + 1 + 60 = 66 for five equations and
! 3*1 + 3 + 1 + 60 = 67 for six; 70 covers both with room, and hypoelastic stresses would add up to six
! more. It had no check of its own while the species cap was ten, because sys_size could not then reach
! the dimension(20) the guard gives every sys_size array; HLLC's star states have no other bound, so
! raising one cap without the other overruns them with nothing to say so.
@:PROHIBIT(sys_size > ${AMD_SYS_SIZE_MAX}$, &
& "sys_size <= ${AMD_SYS_SIZE_MAX}$ for AMDFLang when Case optimization is off")
#:endif

end subroutine s_check_amd
Expand Down
14 changes: 7 additions & 7 deletions src/common/m_chemistry.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ contains
real(wp) :: rho, omega_m

#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(10) :: Ys
real(wp), dimension(10) :: omega
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Ys
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: omega
#:else
real(wp), dimension(num_species) :: Ys
real(wp), dimension(num_species) :: omega
Expand Down Expand Up @@ -175,7 +175,7 @@ contains
real(wp), parameter :: stiff_target = 0.5_wp

#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(10) :: Ys, cdot, ddot, y0, prod0, Lloss, alp
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Ys, cdot, ddot, y0, prod0, Lloss, alp
#:else
real(wp), dimension(num_species) :: Ys, cdot, ddot, y0, prod0, Lloss, alp
#:endif
Expand Down Expand Up @@ -327,10 +327,10 @@ contains
type(scalar_field), intent(in) :: q_T_sf

#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(10) :: Xs_L, Xs_R, Xs_cell, Ys_L, Ys_R, Ys_cell
real(wp), dimension(10) :: mass_diffusivities_mixavg1, mass_diffusivities_mixavg2
real(wp), dimension(10) :: mass_diffusivities_mixavg_Cell, dXk_dxi, h_l, h_r, h_k
real(wp), dimension(10) :: Mass_Diffu_Flux, dYk_dxi
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Xs_L, Xs_R, Xs_cell, Ys_L, Ys_R, Ys_cell
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: mass_diffusivities_mixavg1, mass_diffusivities_mixavg2
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: mass_diffusivities_mixavg_Cell, dXk_dxi, h_l, h_r, h_k
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Mass_Diffu_Flux, dYk_dxi
#:else
real(wp), dimension(num_species) :: Xs_L, Xs_R, Xs_cell, Ys_L, Ys_R, Ys_cell
real(wp), dimension(num_species) :: mass_diffusivities_mixavg1, mass_diffusivities_mixavg2
Expand Down
10 changes: 5 additions & 5 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ contains
#:if USING_AMD and not MFC_CASE_OPTIMIZATION
real(wp), dimension(3) :: alpha_K, alpha_rho_K
real(wp), dimension(3) :: nRtmp
real(wp) :: rhoYks(1:10)
real(wp) :: rhoYks(1:${AMD_NUM_SPECIES_MAX}$)
#:else
real(wp), dimension(num_fluids) :: alpha_K, alpha_rho_K
real(wp), dimension(nb) :: nRtmp
Expand Down Expand Up @@ -1021,10 +1021,10 @@ contains
! functions, the shear and volume Reynolds numbers and the Weber numbers

#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3) :: alpha_rho_K
real(wp), dimension(3) :: alpha_K
real(wp), dimension(3) :: vel_K
real(wp), dimension(10) :: Y_K
real(wp), dimension(3) :: alpha_rho_K
real(wp), dimension(3) :: alpha_K
real(wp), dimension(3) :: vel_K
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Y_K
#:else
real(wp), dimension(num_fluids) :: alpha_rho_K
real(wp), dimension(num_fluids) :: alpha_K
Expand Down
20 changes: 10 additions & 10 deletions src/simulation/m_cbc.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,18 +475,18 @@ contains
real(wp) :: dpres_ds

#:if USING_AMD
real(wp), dimension(20) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$) :: L
#:else
real(wp), dimension(sys_size) :: L
#:endif
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3) :: alpha_rho, dalpha_rho_ds, mf
real(wp), dimension(3) :: vel, dvel_ds
real(wp), dimension(3) :: adv_local, dadv_ds
real(wp), dimension(3) :: dadv_dt
real(wp), dimension(3) :: dvel_dt
real(wp), dimension(3) :: dalpha_rho_dt
real(wp), dimension(10) :: Ys, h_k, dYs_dt, dYs_ds, Xs, Gamma_i, Cp_i
real(wp), dimension(3) :: alpha_rho, dalpha_rho_ds, mf
real(wp), dimension(3) :: vel, dvel_ds
real(wp), dimension(3) :: adv_local, dadv_ds
real(wp), dimension(3) :: dadv_dt
real(wp), dimension(3) :: dvel_dt
real(wp), dimension(3) :: dalpha_rho_dt
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Ys, h_k, dYs_dt, dYs_ds, Xs, Gamma_i, Cp_i
#:else
real(wp), dimension(num_fluids) :: alpha_rho, dalpha_rho_ds, mf
real(wp), dimension(num_vels) :: vel, dvel_ds
Expand Down Expand Up @@ -646,8 +646,8 @@ contains
!> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97.
call get_mole_fractions(Mw, Ys, Xs)
call get_species_specific_heats_r(T, Cp_i)
Gamma_i = Cp_i/(Cp_i - 1.0_wp)
gamma = sum(Xs(:)/(Gamma_i(:) - 1.0_wp))
Gamma_i(1:num_species) = Cp_i(1:num_species)/(Cp_i(1:num_species) - 1.0_wp)
gamma = sum(Xs(1:num_species)/(Gamma_i(1:num_species) - 1.0_wp))
else if (chem_params%gamma_method == 2) then
!> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats.
call get_mixture_specific_heat_cv_mass(T, Ys, Cv)
Expand Down
50 changes: 25 additions & 25 deletions src/simulation/m_compute_cbc.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contains

$:GPU_ROUTINE(parallelism='[seq]')
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand All @@ -62,7 +62,7 @@ contains

$:GPU_ROUTINE(parallelism='[seq]')
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand All @@ -85,7 +85,7 @@ contains

$:GPU_ROUTINE(parallelism='[seq]')
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand All @@ -108,12 +108,12 @@ contains

$:GPU_ROUTINE(parallelism='[seq]')
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(10), intent(in) :: dYs_ds
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$), intent(in) :: dYs_ds
#:else
real(wp), dimension(num_species), intent(in) :: dYs_ds
#:endif
Expand All @@ -135,7 +135,7 @@ contains

real(wp), dimension(3), intent(in) :: lambda
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand All @@ -159,15 +159,15 @@ contains

real(wp), dimension(3), intent(in) :: lambda
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(3), intent(in) :: dvel_ds
real(wp), dimension(3), intent(in) :: dadv_ds
real(wp), dimension(10), intent(in) :: dYs_ds
real(wp), dimension(3), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(3), intent(in) :: dvel_ds
real(wp), dimension(3), intent(in) :: dadv_ds
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$), intent(in) :: dYs_ds
#:else
real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(num_dims), intent(in) :: dvel_ds
Expand Down Expand Up @@ -199,7 +199,7 @@ contains

real(wp), dimension(3), intent(in) :: lambda
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand All @@ -223,15 +223,15 @@ contains

real(wp), dimension(3), intent(in) :: lambda
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(3), intent(in) :: dvel_ds
real(wp), dimension(3), intent(in) :: dadv_ds
real(wp), dimension(10), intent(in) :: dYs_ds
real(wp), dimension(3), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(3), intent(in) :: dvel_ds
real(wp), dimension(3), intent(in) :: dadv_ds
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$), intent(in) :: dYs_ds
#:else
real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(num_dims), intent(in) :: dvel_ds
Expand All @@ -257,7 +257,7 @@ contains

real(wp), dimension(3), intent(in) :: lambda
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand Down Expand Up @@ -288,7 +288,7 @@ contains

real(wp), dimension(3), intent(in) :: lambda
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand Down Expand Up @@ -317,7 +317,7 @@ contains

$:GPU_ROUTINE(function_name='s_compute_supersonic_inflow_L', parallelism='[seq]', cray_inline=True)
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
Expand All @@ -333,15 +333,15 @@ contains

real(wp), dimension(3), intent(in) :: lambda
#:if USING_AMD
real(wp), dimension(20), intent(inout) :: L
real(wp), dimension(${AMD_SYS_SIZE_MAX}$), intent(inout) :: L
#:else
real(wp), dimension(sys_size), intent(inout) :: L
#:endif
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(3), intent(in) :: dvel_ds
real(wp), dimension(3), intent(in) :: dadv_ds
real(wp), dimension(10), intent(in) :: dYs_ds
real(wp), dimension(3), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(3), intent(in) :: dvel_ds
real(wp), dimension(3), intent(in) :: dadv_ds
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$), intent(in) :: dYs_ds
#:else
real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds
real(wp), dimension(num_dims), intent(in) :: dvel_ds
Expand Down
12 changes: 6 additions & 6 deletions src/simulation/m_ibm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ contains
real(wp) :: c_IP

#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3) :: Gs
real(wp), dimension(3) :: alpha_rho_IP, alpha_IP
real(wp), dimension(3) :: r_IP, v_IP, pb_IP, mv_IP
real(wp), dimension(18) :: nmom_IP
real(wp), dimension(12) :: presb_IP, massv_IP
real(wp), dimension(10) :: Ys_IP
real(wp), dimension(3) :: Gs
real(wp), dimension(3) :: alpha_rho_IP, alpha_IP
real(wp), dimension(3) :: r_IP, v_IP, pb_IP, mv_IP
real(wp), dimension(18) :: nmom_IP
real(wp), dimension(12) :: presb_IP, massv_IP
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Ys_IP
#:else
real(wp), dimension(num_fluids) :: Gs
real(wp), dimension(num_fluids) :: alpha_rho_IP, alpha_IP
Expand Down
10 changes: 5 additions & 5 deletions src/simulation/m_riemann_solver_hll.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ contains
type(int_bounds_info), intent(in) :: ix, iy, iz

#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3) :: alpha_rho_L, alpha_rho_R
real(wp), dimension(3) :: vel_L, vel_R
real(wp), dimension(3) :: alpha_L, alpha_R
real(wp), dimension(10) :: Ys_L, Ys_R, R_species, h_iL, h_iR
real(wp), dimension(10) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR
real(wp), dimension(3) :: alpha_rho_L, alpha_rho_R
real(wp), dimension(3) :: vel_L, vel_R
real(wp), dimension(3) :: alpha_L, alpha_R
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Ys_L, Ys_R, R_species, h_iL, h_iR
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR
#:else
real(wp), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R
real(wp), dimension(num_vels) :: vel_L, vel_R
Expand Down
9 changes: 5 additions & 4 deletions src/simulation/m_riemann_solver_hllc.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ contains
real(wp) :: E_L, E_R
real(wp) :: H_L, H_R
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(10) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, R_species, h_iL, h_iR
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, R_species, &
& h_iL, h_iR
#:else
real(wp), dimension(num_species) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, R_species, h_iL, h_iR
#:endif
Expand Down Expand Up @@ -118,8 +119,8 @@ contains

! HLLC star-state helpers
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(20) :: U_L, U_R
real(wp), dimension(20) :: F_L, F_R, F_star_L, F_star_R, F_HLLC
real(wp), dimension(${AMD_SYS_SIZE_MAX}$) :: U_L, U_R
real(wp), dimension(${AMD_SYS_SIZE_MAX}$) :: F_L, F_R, F_star_L, F_star_R, F_HLLC
#:else
real(wp), dimension(sys_size) :: U_L, U_R
real(wp), dimension(sys_size) :: F_L, F_R, F_star_L, F_star_R, F_HLLC
Expand All @@ -140,7 +141,7 @@ contains

! ADC (HLL -> HLLC)
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(20) :: F_HLL
real(wp), dimension(${AMD_SYS_SIZE_MAX}$) :: F_HLL
#:else
real(wp), dimension(sys_size) :: F_HLL
#:endif
Expand Down
10 changes: 5 additions & 5 deletions src/simulation/m_riemann_solver_lf.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ contains
type(int_bounds_info), intent(in) :: ix, iy, iz

#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(3) :: alpha_rho_L, alpha_rho_R
real(wp), dimension(3) :: vel_L, vel_R
real(wp), dimension(3) :: alpha_L, alpha_R
real(wp), dimension(10) :: Ys_L, Ys_R
real(wp), dimension(10) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR
real(wp), dimension(3) :: alpha_rho_L, alpha_rho_R
real(wp), dimension(3) :: vel_L, vel_R
real(wp), dimension(3) :: alpha_L, alpha_R
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Ys_L, Ys_R
real(wp), dimension(${AMD_NUM_SPECIES_MAX}$) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR
real(wp), dimension(3, 3) :: vel_grad_L, vel_grad_R !< Averaged velocity gradient tensor `d(vel_i)/d(coord_j)`.
#:else
real(wp), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R
Expand Down
Loading
Loading