Skip to content

Fixes for ifx compiler#393

Merged
billsacks merged 2 commits intoESCOMP:mainfrom
billsacks:fixes_for_ifx
Feb 27, 2026
Merged

Fixes for ifx compiler#393
billsacks merged 2 commits intoESCOMP:mainfrom
billsacks:fixes_for_ifx

Conversation

@billsacks
Copy link
Member

@billsacks billsacks commented Feb 19, 2026

Description of changes

The ifx compiler seems not to do short-circuit evaluation of conditionals. This was leading to failures in some debug tests when there were NaN values on an input file: checks like if (.not. isnan(x) .and. x /= fillval) were okay if short-circuit evaluation was being done, but are failing now.

This PR refactors some conditionals to effectively do this short-circuit evaluation via splitting the conditionals.

Specific notes

Contributors other than yourself, if any:

CDEPS Issues Fixed (include github issue #):

Are there dependencies on other component PRs (if so list): no

Are changes expected to change answers (bfb, different to roundoff, more substantial): bfb

Any User Interface Changes (namelist or namelist defaults changes): no

Testing performed (e.g. aux_cdeps, CESM prealpha, etc):

Ran aux_cdeps plus the following tests in the context of cesm3_0_alpha08e:

SMS_D_Ld1.ne30pg3_t232.I1850Clm50BgcSpinup.derecho_intel.clm-cplhist
SMS_D.TL319_t232.G_JRA_RYF.derecho_intel
SMS_D_Ld3.f10_f10_mg37.I1850Clm50BgcCrop.derecho_intel.clm-default
ERP_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq9s
SMS_D_Ld1_PS.f09_g17.I2000Clm50BgcCru.derecho_intel.clm-datm_bias_correct_cruv7
SMS_D_Ld5.f10_f10_mg37.ISSP245Clm60BgcCropCrujra.derecho_intel.clm-datm_rcp45_anom_forc

All tests passed and were bfb except for one expected failure from the aux_cdeps suite (which also failed in alpha08e: FAIL SMS_Ld3.f19_g17_rx1.2000_SATM_SLND_SICE_SOCN_DROF%NYF_SGLC_SWAV.derecho_intel CREATE_NEWCASE)

Also ran SMS_D_Ld3_PS.f09_t232.I1850Clm60SpCrujraNoAnthro.derecho_intel.clm-decStart1851_noinitial--clm-nofireemis with updated ccs_config that switches to ifx; that test failed before these changes and passes with these changes.

Hashes used for testing:
cesm3_0_alpha08e

When there were NaN values on the dataset, these checks were generating
"floating invalid". At least part of the reason this is probably
appearing with ifx is because ifx apparently doesn't do short-circuit
conditional evaluation: in these cases, stream%mapalgo is *not* 'none',
so many other compilers probably were never actually evaluating the
comparison between the data and the fillvalue, but ifx is. So I'm fixing
this by effectively doing the short-circuit evaluation manually - i.e.,
only doing the data comparison if stream%mapalgo is 'none'.
Before this change,
SMS_D_Ld3_PS.f09_t232.I1850Clm60SpCrujraNoAnthro.derecho_intel.clm-decStart1851_noinitial--clm-nofireemis
was failing on one of these changed lines, presumably because ifx
doesn't do short-circuit evaluation of conditions, so it was failing
when trying to do a comparison on a NaN.

This commit refactors conditionals to avoid doing comparisons if we have
found that the value is NaN.
@billsacks billsacks requested a review from jedwards4b February 19, 2026 15:53
@billsacks
Copy link
Member Author

I want to run some more testing on this; I'll update this PR when that's done. For now marking it as a draft to denote that it's not ready to merge.

@billsacks billsacks marked this pull request as draft February 19, 2026 15:54
@billsacks billsacks marked this pull request as ready for review February 20, 2026 00:16
@billsacks
Copy link
Member Author

I have now run aux_cdeps plus some additional testing; all looks good. I have updated the top-level description to note the testing I ran.

@ekluzek ekluzek added enhancement New feature or request answers are bfb labels Feb 27, 2026
Copy link
Collaborator

@ekluzek ekluzek left a comment

Choose a reason for hiding this comment

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

This all looks correct to me. And it's a straight-forward breaking up of logic from if statements with '.and.'. And that change makes the code more readable. So I think this is good to go.

@ekluzek
Copy link
Collaborator

ekluzek commented Feb 27, 2026

@billsacks can this be merged? It looks like your testing went fine. And I used it in CTSM for all of the test suites there and it was good to go (in ESCOMP/CTSM#3769).

@billsacks billsacks merged commit 3f7f22d into ESCOMP:main Feb 27, 2026
1 check passed
@billsacks billsacks deleted the fixes_for_ifx branch February 27, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

answers are bfb enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants