geoschem / HEMCO

The Harmonized Emissions Component (HEMCO), developed by the GEOS-Chem Support Team.
https://hemco.readthedocs.io
Other
17 stars 33 forks source link

changes for NAG compiler #212

Closed fvitt closed 1 year ago

fvitt commented 1 year ago

Name and Institution (Required)

Name: Francis Vitt Institution: NCAR

Confirm you have reviewed the following documentation

Describe the update

Changes needed to compile with NAG compiler

Expected changes

Please provide details on how this update will impact model output and include plots or tables as needed.

Reference(s)

If this is a science update, please provide a literature citation.

Related Github Issue(s)

Please link to the corresponding Github issue here. If fixing a bug, there should be an issue describing it with steps to reproduce.

jimmielin commented 1 year ago

Build fails due to HCO_ERROR_LOG not being available when compiling NcdfUtil. I'll use HCO_PRECISION_MOD instead and rerun integration tests.

After pushing fixes code builds correctly within CESM with Intel compilers.

Side note: Changes to NcdfUtil and others may have to be propagated to geos-chem as well for eventual NAG-compiler compatibility. @lizziel is working on integrating GEOS-Chem into CESM and I suppose compatibility with the NAG compiler might be one of the requirements for passing unit tests at CAM.

jimmielin commented 1 year ago

Hi GCST,

I've verified that the CESM model output after fixes appears to differ only in numerical noise, and HEMCO computed fluxes are bit-for-bit match. On the CESM end we can use this PR once tagged and additional validation for use in GEOS-Chem & other models can be deferred to a future release if necessary.

Thanks!

yantosca commented 1 year ago

@jimmielin @fvitt @lizziel: For the precision updates, could we use the ISO fortran module kind parameters instead of selected_real_kind? I think that would be more straightforward and portable.

PROGRAM Test_Prec

  USE ISO_Fortran_Env, ONLY : INT32, REAL32, REAL64

  INTEGER, PARAMETER :: ip1 = SELECTED_INT_KIND( 5 )

  INTEGER, PARAMETER :: sp1 = SELECTED_REAL_KIND( 6 )
  INTEGER, PARAMETER :: sp2 = KIND( 0.0e0 )
  INTEGER, PARAMETER :: sp3 = REAL32

  INTEGER, PARAMETER :: dp1 = SELECTED_REAL_KIND( 12 )
  INTEGER, PARAMETER :: dp2 = KIND( 0.0d0 )
  INTEGER, PARAMETER :: dp3 = REAL64

  print*, 'selected_int_kind(5)  : ', ip1
  print*, 'selected_real_kind(6) : ', sp1
  print*, 'kind(0.0e0)           : ', sp2
  print*, 'ISO REAL32            : ', sp3
  print*, 'selected_real_kind(12): ', dp1
  print*, 'kind(0.0d0)           : ', dp2
  print*, 'ISO REAL64            : ', dp3

END PROGRAM Test_Prec

Which gives the following output:

 selected_int_kind(5)  :            4
 selected_real_kind(6) :            4
 kind(0.0e0)           :            4
 ISO REAL32            :            4
 selected_real_kind(12):            8
 kind(0.0d0)           :            8
 ISO REAL64            :            8
fvitt commented 1 year ago

@yantosca Thanks for the suggestion on using ISO_Fortran_Env kinds. I have pushed the change.

yantosca commented 1 year ago

Thanks @fvitt!

jimmielin commented 1 year ago

Thanks, I also updated the MODEL_CESM pre-processor flag that was used to block out Flush(6) to CPRNAG which is set when the NAG compiler is used in CESM.

Waiting for HEMCO integration tests to pass.

Build and run using CESM matches bit-for-bit in HEMCO output and for species concentrations after the fix to use ISO_Fortran_Env.

jimmielin commented 1 year ago

Hi @yantosca, @msulprizio, the changes look good on my end. May I ask if it is possible to tag this as 3.6.2-cesm or similar, so we could use this downstream in HEMCO-CESM before it is merged into the more permanent mainline releases?

Thank you!

msulprizio commented 1 year ago

@jimmielin @fvitt These updates have been merged into the dev/3.7.0 branch and will be included in the 3.7.0 release. In the meantime, I have pushed the 3.6.2-cesm tag as requested above.

I will close out this issue, though it won't be labeled as merged until pushed to main. (I forgot to change the base branch before merging.)