Skip to content

Commit eaf67d2

Browse files
committed
src: move GPU_DECLAREs for hoisted state into m_global_parameters_common
Cray ftn rejects declare-target on use-associated names (ftn-1448 on Frontier gpu-omp): the dedup hoisted these declarations into the common module but left their GPU_DECLARE lines in simulation. Declares move to the declaring module; mixed lines split so locally-declared variables keep their declares in place. CPU-preprocessed output verified identical; declare-target scoping verified clean for both files under OpenMP emission.
1 parent 636ee91 commit eaf67d2

2 files changed

Lines changed: 48 additions & 43 deletions

File tree

src/common/m_global_parameters_common.fpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,44 @@ module m_global_parameters_common
6767
#ifdef MFC_SIMULATION
6868
$:GPU_DECLARE(create='[sys_size, eqn_idx, b_size, tensor_size]')
6969
$:GPU_DECLARE(create='[shear_num, shear_indices, shear_BC_flip_num, shear_BC_flip_indices]')
70+
! Device residency for namelist/case-opt state declared above via the generated
71+
! includes: declare directives must live in the declaring module (Cray ftn rejects
72+
! declare-target on use-associated names), so these moved here from simulation.
73+
$:GPU_DECLARE(create='[cyl_coord]')
74+
$:GPU_DECLARE(create='[dt, m, n, p]')
75+
$:GPU_DECLARE(create='[cfl_target]')
76+
$:GPU_DECLARE(create='[int_comp, ic_eps, ic_beta]')
77+
$:GPU_DECLARE(create='[muscl_eps]')
78+
$:GPU_DECLARE(create='[mpp_lim, model_eqns, mixture_err, alt_soundspeed]')
79+
$:GPU_DECLARE(create='[avg_state, mp_weno, weno_eps, teno_CT, hypoelasticity]')
80+
$:GPU_DECLARE(create='[hyperelasticity, elasticity, low_Mach]')
81+
$:GPU_DECLARE(create='[cont_damage, hyper_cleaning]')
82+
$:GPU_DECLARE(create='[relax, relax_model, palpha_eps, ptgalpha_eps]')
83+
$:GPU_DECLARE(create='[down_sample]')
84+
$:GPU_DECLARE(create='[fd_order]')
85+
$:GPU_DECLARE(create='[rhoref, pref]')
86+
$:GPU_DECLARE(create='[ib, num_ibs]')
87+
$:GPU_DECLARE(create='[ib_coefficient_of_friction]')
88+
$:GPU_DECLARE(create='[Ca, Web, Re_inv]')
89+
$:GPU_DECLARE(create='[bubbles_euler, polytropic, polydisperse]')
90+
$:GPU_DECLARE(create='[adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters]')
91+
$:GPU_DECLARE(create='[bubble_model, thermal]')
92+
$:GPU_DECLARE(create='[poly_sigma]')
93+
$:GPU_DECLARE(create='[qbmm, pi_fac]')
94+
$:GPU_DECLARE(create='[R0ref]')
95+
$:GPU_DECLARE(create='[acoustic_source, num_source]')
96+
$:GPU_DECLARE(create='[sigma, surface_tension]')
97+
$:GPU_DECLARE(create='[bubbles_lagrange]')
98+
$:GPU_DECLARE(create='[Bx0]')
99+
$:GPU_DECLARE(create='[tau_star, cont_damage_s, alpha_bar]')
100+
$:GPU_DECLARE(create='[hyper_cleaning_speed, hyper_cleaning_tau]')
101+
#:if not MFC_CASE_OPTIMIZATION
102+
$:GPU_DECLARE(create='[num_dims, num_vels, weno_polyn, weno_order]')
103+
$:GPU_DECLARE(create='[weno_num_stencils, num_fluids, wenojs]')
104+
$:GPU_DECLARE(create='[mapped_weno, wenoz, teno, wenoz_q, mhd, relativity]')
105+
$:GPU_DECLARE(create='[igr_iter_solver, igr_order, viscous, igr_pres_lim, igr]')
106+
$:GPU_DECLARE(create='[recon_type, muscl_order, muscl_polyn, muscl_lim]')
107+
#:endif
70108
#endif
71109

72110
!> @name Processor coordinates and parallel-IO addressing (identical declaration across all three targets)

src/simulation/m_global_parameters.fpp

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module m_global_parameters
4242
!> @{
4343
integer :: grid_geometry
4444
!> @}
45-
$:GPU_DECLARE(create='[cyl_coord, grid_geometry]')
45+
$:GPU_DECLARE(create='[grid_geometry]')
4646

4747
!> @name Cell-boundary (CB) locations in the x-, y- and z-directions, respectively
4848
!> @{
@@ -59,14 +59,11 @@ module m_global_parameters
5959
real(wp), target, allocatable, dimension(:) :: dx, dy, dz
6060
!> @}
6161

62-
$:GPU_DECLARE(create='[x_cb, y_cb, z_cb, x_cc, y_cc, z_cc, dx, dy, dz, dt, m, n, p]')
63-
64-
$:GPU_DECLARE(create='[cfl_target]')
62+
$:GPU_DECLARE(create='[x_cb, y_cb, z_cb, x_cc, y_cc, z_cc, dx, dy, dz]')
6563

6664
logical :: cfl_dt
6765
! Simulation Algorithm Parameters generated_case_opt_decls.fpp: now in m_global_parameters_common
6866

69-
$:GPU_DECLARE(create='[int_comp, ic_eps, ic_beta]')
7067
integer :: hyper_model !< hyperelasticity solver algorithm
7168
! elasticity, chemistry: in m_global_parameters_common
7269
logical :: shear_stress !< Shear stresses
@@ -78,21 +75,8 @@ module m_global_parameters
7875

7976
integer :: cpu_start, cpu_end, cpu_rate
8077

81-
#:if not MFC_CASE_OPTIMIZATION
82-
$:GPU_DECLARE(create='[num_dims, num_vels, weno_polyn, weno_order]')
83-
$:GPU_DECLARE(create='[weno_num_stencils, num_fluids, wenojs]')
84-
$:GPU_DECLARE(create='[mapped_weno, wenoz, teno, wenoz_q, mhd, relativity]')
85-
$:GPU_DECLARE(create='[igr_iter_solver, igr_order, viscous, igr_pres_lim, igr]')
86-
$:GPU_DECLARE(create='[recon_type, muscl_order, muscl_polyn, muscl_lim]')
87-
#:endif
88-
89-
$:GPU_DECLARE(create='[muscl_eps]')
90-
$:GPU_DECLARE(create='[mpp_lim, model_eqns, mixture_err, alt_soundspeed]')
91-
$:GPU_DECLARE(create='[avg_state, mp_weno, weno_eps, teno_CT, hypoelasticity]')
92-
$:GPU_DECLARE(create='[hyperelasticity, hyper_model, elasticity, low_Mach]')
93-
$:GPU_DECLARE(create='[shear_stress, bulk_stress, cont_damage, hyper_cleaning]')
94-
95-
$:GPU_DECLARE(create='[relax, relax_model, palpha_eps, ptgalpha_eps]')
78+
$:GPU_DECLARE(create='[hyper_model]')
79+
$:GPU_DECLARE(create='[shear_stress, bulk_stress]')
9680

9781
logical :: bc_io
9882
!> @name Boundary conditions (BC) in the x-, y- and z-directions, respectively
@@ -117,7 +101,6 @@ module m_global_parameters
117101
type(bounds_info) :: neighbor_domain_x, neighbor_domain_y, neighbor_domain_z
118102
integer :: num_gbl_ibs, num_local_ibs
119103
$:GPU_DECLARE(create='[x_domain, y_domain, z_domain, neighbor_domain_x, neighbor_domain_y, neighbor_domain_z, num_gbl_ibs]')
120-
$:GPU_DECLARE(create='[down_sample]')
121104

122105
! proc_coords, start_idx, mpiiofs, mpi_info_int: in m_global_parameters_common
123106
type(mpi_io_var), public :: MPI_IO_DATA
@@ -188,23 +171,20 @@ module m_global_parameters
188171
! Fluids Physical Parameters fluid_pp, bub_pp: auto-generated in generated_decls.fpp
189172

190173
integer :: fd_number !< Finite-difference half-stencil size: MAX(1, fd_order/2)
191-
$:GPU_DECLARE(create='[fd_order, fd_number]')
174+
$:GPU_DECLARE(create='[fd_number]')
192175

193176
! probe, integral: auto-generated in generated_decls.fpp
194177

195178
!> @name Reference density and pressure for Tait EOS
196179
!> @{
197-
$:GPU_DECLARE(create='[rhoref, pref]')
198-
199180
!> @name Immersed Boundaries
200181
!> patch_ib, ib_airfoil, stl_models, particle_cloud: auto-generated in generated_decls.fpp
201182
!> @{
202183
integer, dimension(num_local_ibs_max) :: local_ib_patch_ids !< lookup table of IBs in the local compute domain
203184
integer, allocatable, dimension(:,:,:) :: ib_neighbor_ranks !< MPI ranks of neighborhood domains, indexed (-N:N,-N:N,-N:N)
204185
type(ib_airfoil_grid), dimension(num_ib_airfoils_max) :: ib_airfoil_grids !< Per-airfoil computed surface grids
205186

206-
$:GPU_DECLARE(create='[ib, num_ibs, ib_airfoil_grids]')
207-
$:GPU_DECLARE(create='[ib_coefficient_of_friction]')
187+
$:GPU_DECLARE(create='[ib_airfoil_grids]')
208188
!> @}
209189

210190
!> @name Bubble modeling
@@ -216,25 +196,19 @@ module m_global_parameters
216196
#:endif
217197

218198
real(wp) :: Eu !< Euler number
219-
$:GPU_DECLARE(create='[Eu, Ca, Web, Re_inv]')
199+
$:GPU_DECLARE(create='[Eu]')
220200

221201
real(wp), dimension(:), allocatable :: weight !< Simpson quadrature weights
222202
real(wp), dimension(:), allocatable :: R0 !< Bubble sizes
223203
$:GPU_DECLARE(create='[weight, R0]')
224204

225-
$:GPU_DECLARE(create='[bubbles_euler, polytropic, polydisperse]')
226-
227-
$:GPU_DECLARE(create='[adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters]')
228-
229-
$:GPU_DECLARE(create='[bubble_model, thermal]')
230-
231205
real(wp), allocatable, dimension(:,:,:) :: ptil !< Pressure modification
232-
$:GPU_DECLARE(create='[ptil, poly_sigma]')
206+
$:GPU_DECLARE(create='[ptil]')
233207

234208
integer, parameter :: nmom = 6 !< Number of carried moments per R0 location
235209
integer :: nmomsp !< Number of moments required by ensemble-averaging
236210
integer :: nmomtot !< Total number of carried moments moments/transport equations
237-
$:GPU_DECLARE(create='[qbmm, nmomsp, nmomtot, pi_fac]')
211+
$:GPU_DECLARE(create='[nmomsp, nmomtot]')
238212

239213
#:if not MFC_CASE_OPTIMIZATION
240214
$:GPU_DECLARE(create='[nb]')
@@ -261,15 +235,13 @@ module m_global_parameters
261235
$:GPU_DECLARE(create='[gam, gam_m]')
262236

263237
real(wp) :: p0ref, rho0ref, T0ref, ss, pv, vd, mu_l, mu_v, mu_g, gam_v, gam_g, M_v, M_g, cp_v, cp_g, R_v, R_g
264-
$:GPU_DECLARE(create='[R0ref, p0ref, rho0ref, T0ref, ss, pv, vd, mu_l, mu_v, mu_g, gam_v, gam_g, M_v, M_g, cp_v, cp_g, R_v, R_g]')
238+
$:GPU_DECLARE(create='[p0ref, rho0ref, T0ref, ss, pv, vd, mu_l, mu_v, mu_g, gam_v, gam_g, M_v, M_g, cp_v, cp_g, R_v, R_g]')
265239
!> @}
266240

267241
! acoustic: auto-generated in generated_decls.fpp
268-
$:GPU_DECLARE(create='[acoustic_source, num_source]')
269242

270243
!> @name Surface tension parameters
271244
!> @{
272-
$:GPU_DECLARE(create='[sigma, surface_tension]')
273245
!> @}
274246

275247
real(wp), allocatable, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps
@@ -285,19 +257,14 @@ module m_global_parameters
285257
!> @name lagrangian subgrid bubble parameters
286258
!> lag_params: auto-generated in generated_decls.fpp
287259
!> @{!
288-
$:GPU_DECLARE(create='[bubbles_lagrange]')
289260
!> @}
290261

291-
$:GPU_DECLARE(create='[Bx0]')
292-
293262
!> @name Continuum damage model parameters
294263
!> @{!
295-
$:GPU_DECLARE(create='[tau_star, cont_damage_s, alpha_bar]')
296264
!> @}
297265

298266
!> @name MHD Hyperbolic cleaning parameters
299267
!> @{!
300-
$:GPU_DECLARE(create='[hyper_cleaning_speed, hyper_cleaning_tau]')
301268
!> @}
302269

303270
contains

0 commit comments

Comments
 (0)