Skip to content

v5: Updates for FMS 2026.01.01, macOS and LLVM Flang fixes

Choose a tag to compare

@mathomp4 mathomp4 released this 04 Sep 14:47
· 39 commits to main since this release
32eec48

This release updates ESMA_cmake to support FMS 2026.01.01 and includes major fixes and enhancements for macOS Darwin and LLVM Flang compilers.

NOTE: This MUST be used with ESMA-Baselibs v9.13.0 or higher

Key highlights:

  • FMS 2026.01.01 CMake Integration: ConfigureBaselibs.cmake now uses FMS's installed CMake config package (find_package(fms)) rather than manually constructing targets, allowing modern transitive dependencies (such as YAML) to propagate to consumers automatically. Manual libyaml discovery and compile probes have been removed as FMS exports them directly. Support was also added for Baselibs directory layouts that install FMS CMake files to lib/cmake/fms rather than lib64/cmake/fms (common on Darwin). Legacy NETCDF_LIBRARIES is preserved for downstream tools like f2py.
  • Fortran Quad-Precision Detection: Centralized compiler probing (quad_precision.F90) now tests whether the Fortran compiler supports 128-bit quad precision (selected_real_kind(33, 4931)). If unsupported (e.g. LLVM Flang on Darwin/Linux), NO_R16 (used by CICE) and NO_QUAD_PRECISION (used by FVdycore) are defined globally so components fall back to 64-bit precision cleanly.
  • macOS & LLVM Flang Support: Defaults BLA_VENDOR to Generic on Apple platforms when unset to link against macOS SDK BLAS/LAPACK stubs directly, avoiding unsupported framework flags with LLVM Flang and silencing case-mismatch warnings with NVPL on APFS. On Apple Silicon, LLVMFlang_Fortran.cmake now passes -mcpu=apple-m1 rather than -march=apple-m1. Furthermore, -fstack-arrays is omitted from GEOS_Fortran_Release_Flags so Flang uses its default heap allocation for array temporaries, avoiding stack overflows on platforms with restricted stack sizes.
  • Regression Testing: compare_results() in esma_regression_run_helpers.cmake now leverages nccmp -dmfgsB (with --nans-are-equal and --tolerance) when available.

From CHANGELOG.md

Added

  • In compiler/checks/check_fortran_support.cmake, test for Fortran quad-precision floating point support (FORTRAN_COMPILER_SUPPORTS_QUAD_PRECISION). If unsupported (such as with LLVM Flang), globally define -DNO_R16 -DNO_QUAD_PRECISION so components like CICE and FVdycore automatically fall back to 64-bit precision.

Changed

  • ConfigureBaselibs.cmake now uses FMS's installed CMake config package instead of constructing FMS::fms manually, allowing its exported dependencies, including YAML, to propagate to consumers.
  • In esma_regression_run_helpers.cmake, compare_results() now uses nccmp -dmfgsB (with optional --nans-are-equal and --tolerance) if nccmp is available, falling back to cmp.

Removed

  • Removed the FMS YAML compile probe, Findlibyaml.cmake, and manual libyaml linkage; FMS 2026.01 and newer export YAML transitively through their CMake package.

Fixed

  • Preserve Baselibs' legacy NETCDF_LIBRARIES after finding FMS so f2py and f2py3 modules continue to link NetCDF-Fortran and its static dependencies.
  • In ConfigureBaselibs.cmake, support Baselibs installations on platforms like macOS (Darwin) that install FMS CMake configuration files into lib/cmake/fms in addition to lib64/cmake/fms.
  • In math_libraries.cmake, default BLA_VENDOR to Generic on Apple platforms if unset, using the system SDK's libblas/liblapack to avoid unsupported framework compiler flags with LLVM Flang and prevent CMake from querying NVPL and triggering case-mismatch author warnings on case-insensitive filesystems.
  • In compiler/flags/LLVMFlang_Fortran.cmake, use -mcpu=apple-m1 instead of -march=apple-m1 for Apple M processors, since LLVM Flang on AArch64 requires CPU names to be passed via -mcpu= rather than -march=.
  • In compiler/flags/LLVMFlang_Fortran.cmake, omit -fstack-arrays from GEOS_Fortran_Release_Flags to allow Flang's default heap allocation for array temporaries, preventing stack overflows in routines with large automatic arrays (especially on platforms like macOS with fixed stack size limits).

What's Changed

  • v5: Support nccmp in compare_results with tolerance and nans-are-equal options by @mathomp4 in #569
  • Pass Fortran compiler ID into regression test run_case.cmake scripts by @pchakraborty in #571
  • v5: Updates for FMS 2026.01.01 and macOS/Flang fixes by @mathomp4 in #574
  • GitFlow: Merge develop into main for 9.13.0 release by @mathomp4 in #576

Full Changelog: v5.16.0...v5.17.0