Skip to content

Commit 060ca29

Browse files
committed
GPU workarounds for OLCF Frontier
1 parent 5735da5 commit 060ca29

File tree

6 files changed

+43
-6
lines changed

6 files changed

+43
-6
lines changed

src/common/m_phase_change.fpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,11 @@ contains
298298
!! @param rhoe mixture energy
299299
!! @param TS equilibrium temperature at the interface
300300
subroutine s_infinite_pt_relaxation_k(j, k, l, MFL, pS, p_infpT, rM, q_cons_vf, rhoe, TS)
301+
#ifdef CRAY_ACC_WAR
302+
!DIR$ INLINEALWAYS s_compute_speed_of_sound
303+
#else
301304
!$acc routine seq
305+
#endif
302306

303307
! initializing variables
304308
integer, intent(in) :: j, k, l, MFL
@@ -402,7 +406,11 @@ contains
402406
!! @param TS equilibrium temperature at the interface
403407
subroutine s_infinite_ptg_relaxation_k(j, k, l, pS, p_infpT, rhoe, q_cons_vf, TS)
404408

409+
#ifdef CRAY_ACC_WAR
410+
!DIR$ INLINEALWAYS s_infinite_ptg_relaxation_k
411+
#else
405412
!$acc routine seq
413+
#endif
406414

407415
integer, intent(in) :: j, k, l
408416
real(kind(0.0d0)), intent(inout) :: pS
@@ -522,7 +530,11 @@ contains
522530
!! @param k generic loop iterator for y direction
523531
!! @param l generic loop iterator for z direction
524532
subroutine s_correct_partial_densities(MCT, q_cons_vf, rM, j, k, l)
533+
#ifdef CRAY_ACC_WAR
534+
!DIR$ INLINEALWAYS s_correct_partial_densities
535+
#else
525536
!$acc routine seq
537+
#endif
526538
527539
!> @name variables for the correction of the reacting partial densities
528540
!> @{
@@ -580,7 +592,12 @@ contains
580592
!! @param q_cons_vf Cell-average conservative variables
581593
!! @param TJac Transpose of the Jacobian Matrix
582594
subroutine s_compute_jacobian_matrix(InvJac, j, Jac, k, l, mCPD, mCVGP, mCVGP2, pS, q_cons_vf, TJac)
595+
596+
#ifdef CRAY_ACC_WAR
597+
!DIR$ INLINEALWAYS s_compute_jacobian_matrix
598+
#else
583599
!$acc routine seq
600+
#endif
584601
585602
real(kind(0.0d0)), dimension(2, 2), intent(out) :: InvJac
586603
integer, intent(in) :: j
@@ -682,7 +699,12 @@ contains
682699
!! @param rhoe mixture energy
683700
!! @param R2D (2D) residue array
684701
subroutine s_compute_pTg_residue(j, k, l, mCPD, mCVGP, mQD, q_cons_vf, pS, rhoe, R2D)
702+
703+
#ifdef CRAY_ACC_WAR
704+
!DIR$ INLINEALWAYS s_compute_pTg_residue
705+
#else
685706
!$acc routine seq
707+
#endif
686708
687709
integer, intent(in) :: j, k, l
688710
real(kind(0.0d0)), intent(in) :: mCPD, mCVGP, mQD
@@ -728,7 +750,11 @@ contains
728750
!! @param TSat Saturation Temperature
729751
!! @param TSIn equilibrium Temperature
730752
subroutine s_TSat(pSat, TSat, TSIn)
753+
#ifdef CRAY_ACC_WAR
754+
!DIR$ INLINEALWAYS s_compute_speed_of_sound
755+
#else
731756
!$acc routine seq
757+
#endif
732758
733759
real(kind(0.0d0)), intent(in) :: pSat
734760
real(kind(0.0d0)), intent(out) :: TSat

src/simulation/m_chemistry.fpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,19 @@ contains
117117

118118
#:if chemistry
119119

120-
!$acc parallel loop collapse(3) private(Ys)
120+
!$acc parallel loop collapse(3) gang vector default(present) &
121+
!$acc private(Ys, omega, enthalpies)
121122
do x = 0, m
122123
do y = 0, n
123124
do z = 0, p
124125

125126
rho = 0d0
127+
!$acc loop seq
126128
do eqn = chemxb, chemxe
127129
rho = rho + q_cons_qp(eqn)%sf(x, y, z)
128130
end do
129131

132+
!$acc loop seq
130133
do eqn = chemxb, chemxe
131134
Ys(eqn - chemxb + 1) = q_prim_qp(eqn)%sf(x, y, z)
132135
end do
@@ -143,7 +146,7 @@ contains
143146

144147
call get_net_production_rates(rho, T, Ys, omega)
145148

146-
!$acc routine seq
149+
!$acc loop seq
147150
do eqn = chemxb, chemxe
148151

149152
omega_m = mol_weights(eqn - chemxb + 1)*omega(eqn - chemxb + 1)

src/simulation/m_rhs.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ contains
10061006
call s_compute_chemistry_reaction_flux(rhs_vf, q_cons_qp%vf, q_prim_qp%vf)
10071007
call nvtxEndRange
10081008
else
1009-
!$acc parallel loop default(present)
1009+
!$acc parallel loop gang vector default(present)
10101010
do i = chemxb, chemxe
10111011
rhs_vf(i)%sf(:, :, :) = 0d0
10121012
end do

src/simulation/m_riemann_solvers.fpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,11 @@ contains
363363
#:for NORM_DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')]
364364

365365
if (norm_dir == ${NORM_DIR}$) then
366-
!$acc parallel loop collapse(3) gang vector default(present) private(alpha_rho_L, alpha_rho_R, vel_L, vel_R, alpha_L, alpha_R, vel_avg, tau_e_L, tau_e_R, G_L, G_R, Re_L, Re_R, &
367-
!$acc rho_avg, h_avg, gamma_avg, s_L, s_R, s_S, Y_L, Ys_L, Y_R, Ys_R)
366+
!$acc parallel loop collapse(3) gang vector default(present) &
367+
!$acc private(alpha_rho_L, alpha_rho_R, vel_L, vel_R, alpha_L, &
368+
!$acc alpha_R, vel_avg, tau_e_L, tau_e_R, G_L, G_R, Re_L, Re_R, &
369+
!$acc rho_avg, h_avg, gamma_avg, s_L, s_R, s_S, Y_L, Ys_L, Y_R, &
370+
!$acc Ys_R)
368371
do l = is3%beg, is3%end
369372
do k = is2%beg, is2%end
370373
do j = is1%beg, is1%end

src/simulation/m_sim_helpers.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ module m_sim_helpers
3131
!! @param k y index
3232
!! @param l z index
3333
subroutine s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha, vel, vel_sum, j, k, l)
34+
#ifdef CRAY_ACC_WAR
35+
!DIR$ INLINEALWAYS s_compute_enthalpy
36+
#else
3437
!$acc routine seq
38+
#endif
39+
3540
type(scalar_field), dimension(sys_size) :: q_prim_vf
3641
real(kind(0d0)), dimension(num_fluids) :: alpha_rho
3742
real(kind(0d0)), dimension(num_fluids) :: alpha

toolchain/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ dependencies = [
4141
]
4242

4343
[tool.hatch.metadata]
44-
allow-direct-references = true
44+
allow-direct-references = true

0 commit comments

Comments
 (0)