Skip to content

Fix ifx errors in legacy GOCART GridComps (Ops emissions)#399

Open
mathomp4 wants to merge 3 commits into
developfrom
bugfix/ifx-ops-emissions-develop
Open

Fix ifx errors in legacy GOCART GridComps (Ops emissions)#399
mathomp4 wants to merge 3 commits into
developfrom
bugfix/ifx-ops-emissions-develop

Conversation

@mathomp4
Copy link
Copy Markdown
Member

@mathomp4 mathomp4 commented Mar 23, 2026

Summary

Fixes #398

When running GEOSgcm v12 with ifx 2025.3 and OPS emissions in Release mode, the CO_GridComp (and other legacy GOCART GridComps) would fail during initialization due to ifx's stricter enforcement of intent(in) on arguments that are temporarily modified internally.

Changes

  • Changed intent(in) to intent(inout) on w_c (Chem_Bundle) arguments in Aero, CFC, CH4, CO, CO2, and Rn GridComps, as sub-components temporarily modify registry indices during execution
  • Initialize eCO_bioburn_ to 0.0 in CO_GridCompMod.F90 to prevent use of uninitialized data when diurnal_bb is false
  • Guard DEALLOCATE of ier in CO_GridCompMod.F90 with an ALLOCATED check
  • Add local ios variable in CO_Emission to prevent host-association aliasing under optimization

Testing

All tests with v12 show this is zero-diff for Ops runs.


More info from Claude:

Root Cause

The real bug was intent(in) declared on w_c (type Chem_Bundle) in the outer public-facing routines (Initialize, Run, Finalize) across multiple species GridComps, while the *_SingleInstance_ wrapper routines declared it intent(inout) and actually modified w_c%reg%{n,i,j}_CO (and equivalent fields for other species).

This is a Fortran aliasing violation: passing an intent(in) actual argument to an intent(inout) dummy argument. ifx at optimization level is legally allowed to assume intent(in) variables cannot change across a call, so it cached w_c%reg%i_CO, w_c%reg%j_CO etc. in registers. The SingleInstance_ wrapper modifies these fields temporarily (saves, sets to single-instance values, calls method, restores), but the inner routine CO_GridCompInitialize1_ (etc.) read the stale cached values — causing nbeg /= nendrc=1 → propagated up as rc=3001.

Failure trace decoded

  • GOCART_GridCompMod.F90:1006 → Aero_GridCompInitialize → status=3001
  • 3001 = 2000 (CO offset in Aero) + 1000 (instance wrapper offset) + 1 (nbeg /= nend check in CO_GridCompInitialize1_)

Why prints made it work

I/O flushes force register spills to memory, incidentally making the stale-cache issue disappear.

@mathomp4 mathomp4 added the 0 diff The changes in this pull request have verified to be zero-diff with the target branch. label Mar 23, 2026
@mathomp4 mathomp4 linked an issue Mar 23, 2026 that may be closed by this pull request
@mathomp4 mathomp4 marked this pull request as ready for review March 23, 2026 18:12
@mathomp4 mathomp4 requested a review from a team as a code owner March 23, 2026 18:12
@mathomp4 mathomp4 changed the title Fix ifx compilation errors in legacy GOCART GridComps (Ops emissions) Fix ifx errors in legacy GOCART GridComps (Ops emissions) Mar 30, 2026
@mathomp4 mathomp4 requested a review from acollow May 11, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 diff The changes in this pull request have verified to be zero-diff with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with GEOSgcm v12 + ifx 2025.3 + GOCART with OPS Emissions

1 participant