Skip to content

Conversation

@mgduda
Copy link
Contributor

@mgduda mgduda commented May 30, 2025

This PR fixes an OpenACC "partially present" error for rho_zz_int in the atm_advance_scalars_mono_work routine.

When compiled with OpenACC enabled using the nvfortran compiler, running with config_split_dynamics_transport = false in the namelist.atmsophere file results in a runtime error for rho_zz_int:

  FATAL ERROR: variable in data clause is partially present on the device: name=rho_zz_int(:,:)
   file:src/core_atmosphere/dynamics/mpas_atm_time_integration.F atm_advance_scalars_mono_work line:3942

The rho_zz_int array is only used if local_advance_density is .true. in the atm_advance_scalars_mono_work routine, and local_advance_density is true if and only if config_split_dynamics_transport is true.

Consequently, simulations with config_split_dynamics_transport = false in the namelist only allocate the rho_zz_int array with dimensions (1,1), rather than the full dimensions (nVertLevels,nCells+1) that are required when local_advance_density is true.

This difference in the allocated dimensions of rho_zz_int apparently causes problems for the OpenACC runtime, which expects rho_zz_int to be allocated as indicated by the explicit-shape specification, dimension(nVertLevels,nCells+1), for the rho_zz_int dummy argument to atm_advance_scalars_mono_work.

To work around the "partially present" error, this PR changes the rho_zz_int dummy argument to a deferred shape array, with dimension(:,:).

…lars_mono_work

When compiled with OpenACC enabled using the nvfortran compiler, running with
'config_split_dynamics_transport = false' in the namelist.atmsophere file
results in a runtime error for rho_zz_int:

  FATAL ERROR: variable in data clause is partially present on the device: name=rho_zz_int(:,:)
   file:src/core_atmosphere/dynamics/mpas_atm_time_integration.F atm_advance_scalars_mono_work line:3942

The rho_zz_int array is only used if local_advance_density is .true. in the
atm_advance_scalars_mono_work routine, and local_advance_density is true if and
only if config_split_dynamics_transport is true.

Consequently, simulations with 'config_split_dynamics_transport = false' in the
namelist only allocate the rho_zz_int array with dimensions (1,1), rather than
the full dimensions (nVertLevels,nCells+1) that are required when
local_advance_density is true.

This difference in the allocated dimensions of rho_zz_int apparently causes
problems for the OpenACC runtime, which expects rho_zz_int to be allocated as
indicated by the explicit-shape specification, dimension(nVertLevels,nCells+1),
for the rho_zz_int dummy argument to atm_advance_scalars_mono_work.

To work around the partially present error, this commit changes the rho_zz_int
dummy argument to a deferred shape array, with dimension(:,:).
@mgduda mgduda requested a review from abishekg7 May 30, 2025 20:51
@mgduda mgduda added Atmosphere OpenACC Work related to OpenACC acceleration of code labels May 30, 2025
Copy link
Collaborator

@abishekg7 abishekg7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@mgduda mgduda merged commit f5d7c3b into MPAS-Dev:develop Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Atmosphere OpenACC Work related to OpenACC acceleration of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants