Skip to content

Commit b35f615

Browse files
authored
Merge pull request #1490 from cacraigucar/cam_ifx
Fixes to CAM for the ifx compiler
2 parents ed82616 + dc7ca9e commit b35f615

4 files changed

Lines changed: 95 additions & 10 deletions

File tree

doc/ChangeLog

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
===============================================================
2+
3+
Tag name: cam6_4_155
4+
Originator(s): cacraig, jimmielin
5+
Date: Feb 24, 2026
6+
One-line Summary: Fixes to CAM for the ifx compiler
7+
Github PR URL: https://github.com/ESCOMP/CAM/pull/1490
8+
9+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
10+
- Closes #1484 Changing to the ifx compiler - prealpha tests are failing
11+
12+
Describe any changes made to build system: N/A
13+
14+
Describe any changes made to the namelist: N/A
15+
16+
List any changes to the defaults for the boundary datasets: N/A
17+
18+
Describe any substantial timing or memory changes: N/A
19+
20+
Code reviewed by: cacraig, jimmielin, fvitt (reviewed edyn_mpi.F90 changes via email)
21+
22+
List all files eliminated: N/A
23+
24+
List all files added and what they do: N/A
25+
26+
List all existing files that have been modified, and describe the changes:
27+
M src/dynamics/se/dyn_comp.F90
28+
M src/physics/rrtmgp/rrtmgp_inputs_cam.F90
29+
- short-circuiting is not permitted in Fortran standard leading to comparisons against NaN
30+
- resolves #1484 (FHISTC_LTso, rrtmgp regression test failures)
31+
32+
M src/ionosphere/waccmx/edyn_mpi.F90
33+
- ifx enforces maximum MPI tag size
34+
- resolves #1484 (WACCM-X regression test failure)
35+
36+
If there were any failures reported from running test_driver.sh on any test
37+
platform, and checkin with these failures has been OK'd by the gatekeeper,
38+
then copy the lines from the td.*.status files for the failed tests to the
39+
appropriate machine below. All failed tests must be justified.
40+
41+
derecho/intel/aux_cam:
42+
ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri (Overall: FAIL) details:
43+
- pre-existing failure
44+
ERI bug in CICE -- See: https://github.com/ESCOMP/CESM_CICE/issues/34
45+
46+
derecho/nvhpc/aux_cam: All PASS
47+
48+
izumi/nag/aux_cam: All PASS
49+
50+
izumi/gnu/aux_cam: All PASS
51+
52+
===============================================================
53+
154
Tag name: cam6_4_154
255
Originator(s): pel, cacraig
356
Date: Feb 24, 2026

src/dynamics/se/dyn_comp.F90

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,18 @@ subroutine read_dyn_field_2d(fieldname, fh, dimname, buffer)
22172217
! to NaN. In that case infld can return NaNs where the element GLL points
22182218
! are not "unique columns"
22192219
! Set NaNs or fillvalue points to zero
2220-
where (isnan(buffer) .or. (buffer==fillvalue)) buffer = 0.0_r8
2220+
where (isnan(buffer))
2221+
! check for NaN first, as comparing NaN to fillvalue raises floating invalid.
2222+
buffer = 0.0_r8
2223+
end where
2224+
2225+
if (.not. isnan(fillvalue)) then
2226+
! only compare against fillvalue if fillvalue is not NaN, otherwise the comparison
2227+
! will raise floating invalid.
2228+
where (buffer == fillvalue)
2229+
buffer = 0.0_r8
2230+
end where
2231+
end if
22212232

22222233
end subroutine read_dyn_field_2d
22232234

@@ -2247,7 +2258,18 @@ subroutine read_dyn_field_3d(fieldname, fh, dimname, buffer)
22472258
! to NaN. In that case infld can return NaNs where the element GLL points
22482259
! are not "unique columns"
22492260
! Set NaNs or fillvalue points to zero
2250-
where (isnan(buffer) .or. (buffer == fillvalue)) buffer = 0.0_r8
2261+
where (isnan(buffer))
2262+
! check for NaN first, as comparing NaN to fillvalue raises floating invalid.
2263+
buffer = 0.0_r8
2264+
end where
2265+
2266+
if (.not. isnan(fillvalue)) then
2267+
! only compare against fillvalue if fillvalue is not NaN, otherwise the comparison
2268+
! will raise floating invalid.
2269+
where (buffer == fillvalue)
2270+
buffer = 0.0_r8
2271+
end where
2272+
end if
22512273

22522274
end subroutine read_dyn_field_3d
22532275

src/ionosphere/waccmx/edyn_mpi.F90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@ subroutine mp_mag_jslot(fin,mlon00,mlon11,mlat00,mlat11, &
16841684
integer :: ier,njneed,i,j,n,nj,idest, &
16851685
icount,len,nlons,isrc,msgid,ifld,sndbuf_cntr
16861686
integer :: tij ! rank in cols_comm (0 to nmagtaskj-1)
1687-
integer :: jhave(mxneed),njhave,wid
1687+
integer :: jhave(mxneed),njhave
16881688
integer :: peersneed(mxneed,0:nmagtaskj-1)
16891689
integer :: jneedall (mxneed,0:nmagtaskj-1)
16901690
real(r8) :: sndbuf(mxmaglon+2,mxneed,nf,sndbuf_cntr_max)
@@ -1730,7 +1730,6 @@ subroutine mp_mag_jslot(fin,mlon00,mlon11,mlat00,mlat11, &
17301730
njhave = njhave+1
17311731
jhave(njhave) = peersneed(j,n)
17321732
idest = n
1733-
wid = itask_table_geo(mytidi,idest)
17341733
endif
17351734
enddo
17361735
if (njhave > 0) then
@@ -1749,7 +1748,9 @@ subroutine mp_mag_jslot(fin,mlon00,mlon11,mlat00,mlat11, &
17491748
enddo
17501749
enddo
17511750
len = nlons*njhave*nf
1752-
msgid = mytid+wid*10000
1751+
! sending tag uniquely identifies sender - tij is comm. rank
1752+
! within this communicator only.
1753+
msgid = tij
17531754
call mpi_ibsend(sndbuf(1:nlons,1:njhave,:,sndbuf_cntr),len,MPI_REAL8, &
17541755
idest,msgid,cols_comm,ibsend_requests(sndbuf_cntr),ier)
17551756
if (ier /= 0) &
@@ -1783,7 +1784,8 @@ subroutine mp_mag_jslot(fin,mlon00,mlon11,mlat00,mlat11, &
17831784
isrc = tasks(n)%magtidj ! task id in cols_comm to recv from
17841785
nlons = mlon11-mlon00+1
17851786
len = nlons*njhave*nf
1786-
msgid = mytid*10000+n
1787+
! receive tag is sender rank (tij from sender == magtidj)
1788+
msgid = isrc
17871789
rcvbuf = 0._r8
17881790
call mpi_recv(rcvbuf(1:nlons,1:njhave,:),len,MPI_REAL8, &
17891791
isrc,msgid,cols_comm,irstat,ier)

src/physics/rrtmgp/rrtmgp_inputs_cam.F90

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,19 @@ subroutine rrtmgp_set_aer_sw( &
198198
! set aerosol optical depth, clip to zero
199199
aer_sw%optical_props%tau(i,ktoprad:,:) = max(aer_tau(idxday(i),ktopcam:,:), 0._r8)
200200
! set value of single scattering albedo
201-
aer_sw%optical_props%ssa(i,ktoprad:,:) = merge(aer_tau_w(idxday(i),ktopcam:,:)/aer_tau(idxday(i),ktopcam:,:), &
202-
1._r8, aer_tau(idxday(i),ktopcam:,:) > 0._r8)
201+
where (aer_tau(idxday(i),ktopcam:,:) > 0._r8)
202+
aer_sw%optical_props%ssa(i,ktoprad:,:) = aer_tau_w(idxday(i),ktopcam:,:) &
203+
/ aer_tau(idxday(i),ktopcam:,:)
204+
elsewhere
205+
aer_sw%optical_props%ssa(i,ktoprad:,:) = 1._r8
206+
end where
203207
! set value of asymmetry
204-
aer_sw%optical_props%g(i,ktoprad:,:) = merge(aer_tau_w_g(idxday(i),ktopcam:,:)/aer_tau_w(idxday(i),ktopcam:,:), &
205-
0._r8, aer_tau_w(idxday(i),ktopcam:,:) > tiny)
208+
where (aer_tau_w(idxday(i),ktopcam:,:) > tiny)
209+
aer_sw%optical_props%g(i,ktoprad:,:) = aer_tau_w_g(idxday(i),ktopcam:,:) &
210+
/ aer_tau_w(idxday(i),ktopcam:,:)
211+
elsewhere
212+
aer_sw%optical_props%g(i,ktoprad:,:) = 0._r8
213+
end where
206214
end do
207215

208216
! impose limits on the components

0 commit comments

Comments
 (0)