Fix ifx errors in legacy GOCART GridComps (Ops emissions)#399
Open
Fix ifx errors in legacy GOCART GridComps (Ops emissions)#399
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ofintent(in)on arguments that are temporarily modified internally.Changes
intent(in)tointent(inout)onw_c(Chem_Bundle) arguments inAero,CFC,CH4,CO,CO2, andRnGridComps, as sub-components temporarily modify registry indices during executioneCO_bioburn_to0.0inCO_GridCompMod.F90to prevent use of uninitialized data whendiurnal_bbis falseDEALLOCATEofierinCO_GridCompMod.F90with anALLOCATEDcheckiosvariable inCO_Emissionto prevent host-association aliasing under optimizationTesting
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 onw_c(typeChem_Bundle) in the outer public-facing routines (Initialize,Run,Finalize) across multiple species GridComps, while the*_SingleInstance_wrapper routines declared itintent(inout)and actually modifiedw_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 anintent(inout)dummy argument.ifxat optimization level is legally allowed to assumeintent(in)variables cannot change across a call, so it cachedw_c%reg%i_CO,w_c%reg%j_COetc. in registers. TheSingleInstance_wrapper modifies these fields temporarily (saves, sets to single-instance values, calls method, restores), but the inner routineCO_GridCompInitialize1_(etc.) read the stale cached values — causingnbeg /= nend→rc=1→ propagated up asrc=3001.Failure trace decoded
Why prints made it work
I/O flushes force register spills to memory, incidentally making the stale-cache issue disappear.