Skip to content

Commit 1717ead

Browse files
Add patch commits to the main (#1846)
1 parent 957b7c9 commit 1717ead

13 files changed

Lines changed: 107 additions & 73 deletions

.github/workflows/github_cmake_gnu.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
omp-flags: [ -DOPENMP=on, -DOPENMP=off ]
1615
libyaml-flag: [ "", -DWITH_YAML=on ]
1716
build-type: [ "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_BUILD_TYPE=Debug" ]
1817
container:
1918
image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0
2019
env:
21-
CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }}"
20+
CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.libyaml-flag }}"
21+
EXCLUDE_TESTS: "test_mpp_nesting|test_bc_restart|test_collective_io|test_fms2_io|test_io_with_mask"
2222
PKG_CONFIG_PATH: "/opt/views/view/lib64/pkgconfig:/opt/views/view/lib/pkgconfig:/opt/views/view/share/pkgconfig"
2323
steps:
2424
- name: Checkout code
@@ -27,21 +27,23 @@ jobs:
2727
run: |
2828
mkdir build
2929
cd build
30-
cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view ..
30+
cmake $CMAKE_FLAGS -DOPENMP=on -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view ..
3131
- name: Build the library
3232
run: make -C build
33+
- name: Run the unit tests
34+
run: cd build && ctest -E "${EXCLUDE_TESTS}" --output-on-failure
3335

3436
build_arm:
3537
runs-on: ubuntu-24.04-arm
3638
strategy:
3739
matrix:
38-
omp-flags: [ -DOPENMP=on, -DOPENMP=off ]
3940
libyaml-flag: [ "", -DWITH_YAML=on ]
4041
build-type: [ "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_BUILD_TYPE=Debug" ]
4142
container:
4243
image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0-arm
4344
env:
44-
CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }}"
45+
CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.libyaml-flag }}"
46+
EXCLUDE_TESTS: "test_mpp_nesting|test_bc_restart|test_collective_io|test_fms2_io|test_io_with_mask|test_sat_vapor_pres"
4547
PKG_CONFIG_PATH: "/opt/views/view/lib64/pkgconfig:/opt/views/view/lib/pkgconfig:/opt/views/view/share/pkgconfig"
4648
steps:
4749
- name: Checkout code
@@ -50,6 +52,8 @@ jobs:
5052
run: |
5153
mkdir build
5254
cd build
53-
cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view ..
55+
cmake $CMAKE_FLAGS -DOPENMP=on -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view ..
5456
- name: Build the library
5557
run: make -C build
58+
- name: Run the unit tests
59+
run: cd build && ctest -E "${EXCLUDE_TESTS}" --output-on-failure

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project uses `yyyy.rr[.pp]`, where `yyyy` is the year a patch is releas
66
`rr` is a sequential release number (starting from `01`), and an optional two-digit
77
sequential patch number (starting from `01`).
88

9+
## [2026.01.01] - 2026-03-03
10+
11+
### Fixed
12+
- Fix: modern diag manager cell measures and associated files (#1837)
13+
- Avoid integer overflow in mpp_define_unstruct_domain (#1841)
14+
- Fixes for cmake 32/64bit builds and enable CI testing via ctest (#1787)
15+
916
## [2026.01] - 2026-01-26
1017

1118
### Known Issues

CMakeLists.txt

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
2222

2323
# Define the CMake project
2424
project(FMS
25-
VERSION 2026.01.0
25+
VERSION 2026.01.01
2626
DESCRIPTION "GFDL FMS Library"
2727
HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms"
2828
LANGUAGES C Fortran)
@@ -65,18 +65,17 @@ option(PORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS"
6565
option(GFS_PHYS "Enable compiler definition -DGFS_PHYS" OFF)
6666
option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE" OFF)
6767
option(WITH_YAML "Enable compiler definition -Duse_yaml" OFF)
68-
option(USE_DEPRECATED_IO "THIS OPTION HAS NO EFFECT AND WILL BE REMOVED IN A FUTURE RELEASE" OFF)
6968

7069
if(32BIT)
7170
list(APPEND kinds "r4")
71+
message(STATUS "Building library with 4-byte real defaults (with mixed precision real support for most modules).")
7272
endif()
7373
if(64BIT)
7474
list(APPEND kinds "r8")
75+
message(STATUS "Building library with 8-byte real defaults (with mixed precision real support for most modules).")
7576
endif()
7677
if(NOT kinds)
77-
message(STATUS "Single Precision 32BIT: ${32BIT}")
78-
message(STATUS "Double Precision 64BIT: ${64BIT}")
79-
message(STATUS "No kind specified, building default double precision (with mixed precision support). Real size will not be included in built library name.")
78+
message(STATUS "Building library with 8-byte real defaults (with mixed precision 4-byte real support for most modules). Real size will not be included in built library name.")
8079
endif()
8180

8281
# Find dependencies
@@ -181,6 +180,8 @@ list(APPEND fms_fortran_src_files
181180
mpp/mpp_memutils.F90
182181
mpp/mpp_parameter.F90
183182
mpp/mpp_utilities.F90
183+
offloading/offloading_io.F90
184+
offloading/metadata_transfer.F90
184185
parser/yaml_parser.F90
185186
parser/fms_yaml_output.F90
186187
platform/platform.F90
@@ -276,11 +277,6 @@ if(LARGEFILE)
276277
list(APPEND fms_defs use_LARGEFILE)
277278
endif()
278279

279-
# Precision-based compiler definitions
280-
if(32BIT)
281-
list(APPEND r4_defs OVERLOAD_R4 OVERLOAD_R8)
282-
endif()
283-
284280
# Add platform specific compiler definitions
285281
if(APPLE)
286282
list(APPEND fms_defs __APPLE__)
@@ -291,7 +287,7 @@ include(fms_compiler_flags)
291287

292288
# If netCDF was not built with HDF5 parallel I/O features, set up the macro -DNO_NC_PARALLEL4
293289
IF(NOT NetCDF_PARALLEL)
294-
MESSAGE(WARNING "netCDF was not build with HDF5 parallel I/O features, so collective netcdf io is not allowed")
290+
MESSAGE(WARNING "netCDF was not build with HDF5 parallel I/O features, so parallel netcdf io is not allowed")
295291
list(APPEND fms_defs NO_NC_PARALLEL4)
296292
ENDIF()
297293

@@ -347,7 +343,7 @@ foreach(kind ${kinds})
347343
amip_interp/include)
348344
target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}")
349345
target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}")
350-
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags})
346+
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS "${${kind}_flags}")
351347
set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY
352348
${moduleDir})
353349
target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran
@@ -594,6 +590,14 @@ include(CTest)
594590
set(MPI_LAUNCHER "mpirun")
595591
# used in the test-lib.sh.in to make it behave differently when parsed by cmake
596592
set(USING_CMAKE "true")
593+
# set the fms library to link tests with based on whats built
594+
if(NOT kinds)
595+
set(fmsLibraryName FMS::fms)
596+
elseif(64BIT)
597+
set(fmsLibraryName FMS::fms_r8)
598+
elseif(32BIT)
599+
set(fmsLibraryName FMS::fms_r4)
600+
endif()
597601

598602
# parse and add build info to test script util file
599603
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_fms/test-lib.sh.in ${CMAKE_CURRENT_SOURCE_DIR}/test-lib.sh
@@ -617,7 +621,7 @@ list(APPEND TEST_MODS_SRC
617621
test_fms/mpp/test_system_clock.F90)
618622

619623
add_library(testLibs "${TEST_MODS_SRC}")
620-
target_link_libraries(testLibs FMS::fms)
624+
target_link_libraries(testLibs ${fmsLibraryName})
621625
target_compile_definitions(testLibs PRIVATE TEST_MOS_KIND_=r8_kind)
622626
target_include_directories(testLibs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
623627
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/common/include
@@ -701,6 +705,7 @@ list(APPEND TEST_SRC_SINGLE_TARGET
701705
test_fms/fms2_io/test_domain_io.F90
702706
test_fms/fms2_io/test_collective_io.F90
703707
test_fms/fms2_io/test_generalized_indices.F90
708+
test_fms/fms2_io/test_parallel_writes.F90
704709
test_fms/fms/test_fms.F90
705710
test_fms/interpolator/test_interpolator.F90
706711
test_fms/mpp/test_clock_init.F90
@@ -754,6 +759,8 @@ list(APPEND TEST_SRC_SINGLE_TARGET
754759
test_fms/parser/generic_blocks.F90
755760
test_fms/string_utils/test_string_utils.F90
756761
test_fms/time_manager/test_time_manager.F90
762+
test_fms/offloading/test_metadata_transfer.F90
763+
test_fms/offloading/test_io_offloading.F90
757764
)
758765
# list any test sources that are used for two executables (r4 and r8)
759766
list(APPEND TEST_SRC_TWO_TARGETS
@@ -778,6 +785,7 @@ list(APPEND TEST_SRC_TWO_TARGETS
778785
test_fms/sat_vapor_pres/test_sat_vapor_pres.F90
779786
test_fms/time_interp/test_time_interp.F90
780787
test_fms/time_interp/test_time_interp_external.F90
788+
test_fms/time_interp/test_time_interp_conservative_hi.F90
781789
test_fms/topography/test_topography.F90
782790
test_fms/tracer_manager/test_tracer_manager.F90
783791
test_fms/tridiagonal/test_tridiagonal.F90
@@ -789,14 +797,17 @@ list(APPEND TEST_SRC_FOUR_TARGETS
789797

790798
# add all the test executables and set up linking + compile flags
791799
foreach (testFile ${TEST_SRC_SINGLE_TARGET})
792-
get_filename_component (TName ${testFile} NAME_WE)
793800

801+
get_filename_component (TName ${testFile} NAME_WE)
794802
add_executable(${TName} ${testFile})
795-
target_compile_definitions(${TName} PRIVATE "${r8_defs}")
796-
set_target_properties(${TName} PROPERTIES COMPILE_FLAGS ${r8_flags})
797-
target_link_libraries(${TName} PUBLIC FMS::fms
798-
PRIVATE testLibs
799-
)
803+
target_link_libraries(${TName} PUBLIC ${fmsLibraryName}
804+
PRIVATE testLibs)
805+
if(32BIT)
806+
target_compile_definitions(${TName} PRIVATE "${r4_defs} ${fms_defs}")
807+
else()
808+
target_compile_definitions(${TName} PRIVATE "${r8_defs} ${fms_defs} ")
809+
set_target_properties(${TName} PROPERTIES COMPILE_FLAGS ${r8_flags})
810+
endif()
800811

801812
if(WITH_YAML)
802813
target_link_libraries(${TName} PRIVATE PkgConfig::YAML)
@@ -820,18 +831,16 @@ foreach (testFile ${TEST_SRC_TWO_TARGETS})
820831
get_filename_component (TName ${testFile} NAME_WE)
821832

822833
add_executable(${TName}_r8 ${testFile})
823-
target_compile_definitions(${TName}_r8 PRIVATE "${r8_defs}")
834+
target_compile_definitions(${TName}_r8 PRIVATE "${r8_defs} ${fms_defs}")
824835
set_target_properties(${TName}_r8 PROPERTIES COMPILE_FLAGS ${r8_flags})
825-
target_link_libraries(${TName}_r8 PUBLIC FMS::fms
826-
PRIVATE testLibs
827-
)
828-
836+
target_link_libraries(${TName}_r8 PUBLIC ${fmsLibraryName}
837+
PRIVATE testLibs)
829838
add_executable(${TName}_r4 ${testFile})
830-
target_compile_definitions(${TName}_r4 PRIVATE "${r4_defs}")
839+
target_compile_definitions(${TName}_r4 PRIVATE "${r4_defs} ${fms_defs}")
831840
# seems counterintuitive but r4 tests use r8 default
832841
# they specify kind values explicitly with the preprocessor where needed (TEST_FMS_KIND_)
833842
set_target_properties(${TName}_r4 PROPERTIES COMPILE_FLAGS ${r8_flags})
834-
target_link_libraries(${TName}_r4 PUBLIC FMS::fms
843+
target_link_libraries(${TName}_r4 PUBLIC ${fmsLibraryName}
835844
PRIVATE testLibs
836845
)
837846

@@ -984,8 +993,16 @@ foreach (testScript ${TEST_SCRIPTS})
984993
ENVIRONMENT "parser_skip=skip"
985994
)
986995
endif()
996+
987997
endforeach()
988998

999+
# skip parallel netcdf tests if its not enabled in given install
1000+
IF(NOT NetCDF_PARALLEL)
1001+
set_tests_properties(test_collective_io PROPERTIES
1002+
ENVIRONMENT "parallel_skip=skip"
1003+
)
1004+
endif()
1005+
9891006
set(CMAKE_CTEST_ARGUMENTS "--output-on-failure")
9901007

9911008
### Package config

cmake/compiler_flags_GNU_Fortran.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Precision-based Fortran compiler flags
22
set(r8_flags "-fdefault-real-8 -fdefault-double-8") # Fortran flags for 64BIT precision
3-
set(r4_flags "-fdefault-real-4") # Fortran flags for 32BIT precision
3+
set(r4_flags "") # 4 byte reals is default for gfortran
44

55
# GNU Fortran
66
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fallow-argument-mismatch -ffree-line-length-none")

configure.ac

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ AC_PREREQ([2.69])
2424

2525
# Initialize with name, version, and support email address.
2626
AC_INIT([GFDL FMS Library],
27-
[2026.01-dev],
27+
[2026.01.01],
2828
[gfdl.climate.model.info@noaa.gov],
2929
[FMS],
3030
[https://www.github.com/NOAA-GFDL/FMS])
@@ -97,17 +97,6 @@ AS_IF([test ${enable_8byte_int:-no} = yes],
9797
[enable_8byte_int=yes],
9898
[enable_8byte_int=no])
9999

100-
AC_ARG_ENABLE([deprecated-io],
101-
[AS_HELP_STRING([--enable-deprecated-io],
102-
[THIS OPTION HAS BEEN DEPRECATED!!!])])
103-
AS_IF([test ${enable_deprecated_io:-no} = yes],
104-
[enable_deprecated_io=yes],
105-
[enable_deprecated_io=no])
106-
107-
if test $enable_deprecated_io = yes; then
108-
AC_MSG_ERROR(FMS_IO HAS BEEN REMOVED! PLEASE UPDATE TO USE FMS2_IO AND REMOVE --enable-deprecated-io FROM YOUR CONFIGURE OPTIONS OR REVERT TO VERSION 2025.02)
109-
fi
110-
111100
AC_ARG_ENABLE([r8-default],
112101
[AS_HELP_STRING([--disable-r8-default],
113102
[Disables the build from adding the 8 byte default real kind flag during compilation (default no)])])

diag_manager/fms_diag_field_object.F90

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,10 +2001,13 @@ function get_field_file_name(this) &
20012001
end function get_field_file_name
20022002

20032003
!> @brief Generate the associated files attribute
2004-
subroutine generate_associated_files_att(this, att, start_time)
2005-
class(fmsDiagField_type) , intent(in) :: this !< diag_field_object for the area/volume field
2006-
character(len=*), intent(inout) :: att !< associated_files_att
2007-
type(time_type), intent(in) :: start_time !< The start_time for the field's file
2004+
subroutine generate_associated_files_att(this, att, start_time, var_output_name)
2005+
class(fmsDiagField_type) , intent(in) :: this !< diag_field_object for the
2006+
!! area/volume field
2007+
character(len=*), intent(inout) :: att !< associated_files_att
2008+
type(time_type), intent(in) :: start_time !< The start_time for the field's file
2009+
character(len=*), intent(out) :: var_output_name !< output name of the area/volume field
2010+
20082011

20092012
character(len=:), allocatable :: field_name !< Name of the area/volume field
20102013
character(len=FMS_FILE_LEN) :: file_name !< Name of the file the area/volume field is in!
@@ -2026,6 +2029,9 @@ subroutine generate_associated_files_att(this, att, start_time)
20262029
endif
20272030

20282031
att = trim(att)//" "//trim(field_name)//": "//trim(file_name)//".nc"
2032+
2033+
! Save the outputname of the area/volume so it can be added correctly to the cell_measures attribute
2034+
var_output_name = field_name
20292035
end subroutine generate_associated_files_att
20302036

20312037
!> @brief Determines if the compute domain has been divide further into slices (i.e openmp blocks)

diag_manager/fms_diag_file_object.F90

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,7 @@ subroutine write_field_metadata(this, diag_field, diag_axis)
18271827
character(len=255) :: cell_measures !< cell_measures attributes for the field
18281828
logical :: need_associated_files !< .True. if the 'associated_files' global attribute is needed
18291829
character(len=FMS_FILE_LEN) :: associated_files !< Associated files attribute to add
1830+
character(len=FMS_FILE_LEN) :: field_outputname !< Output name of the area/volume field
18301831

18311832
is_regional = this%is_regional()
18321833

@@ -1841,26 +1842,30 @@ subroutine write_field_metadata(this, diag_field, diag_axis)
18411842

18421843
cell_measures = ""
18431844
if (field_ptr%has_area()) then
1844-
cell_measures = "area: "//diag_field(field_ptr%get_area())%get_varname(to_write=.true., &
1845-
filename=diag_file%get_file_fname())
1846-
18471845
!! Determine if the area field is already in the file. If it is not create the "associated_files" attribute
18481846
!! which contains the file name of the file the area field is in. This is needed for PP/fregrid.
18491847
if (.not. diag_field(field_ptr%get_area())%is_variable_in_file(diag_file%id)) then
18501848
need_associated_files = .true.
1851-
call diag_field(field_ptr%get_area())%generate_associated_files_att(associated_files, diag_file%start_time)
1849+
call diag_field(field_ptr%get_area())%generate_associated_files_att(associated_files, diag_file%start_time, &
1850+
field_outputname)
1851+
cell_measures = "area: "//trim(field_outputname)
1852+
else
1853+
cell_measures = "area: "//diag_field(field_ptr%get_area())%get_varname(to_write=.true., &
1854+
filename=diag_file%get_file_fname())
18521855
endif
18531856
endif
18541857

18551858
if (field_ptr%has_volume()) then
1856-
cell_measures = trim(cell_measures)//" volume: "//diag_field(field_ptr%get_volume())%get_varname(&
1857-
to_write=.true., filename=diag_file%get_file_fname())
1858-
18591859
!! Determine if the volume field is already in the file. If it is not create the "associated_files" attribute
18601860
!! which contains the file name of the file the volume field is in. This is needed for PP/fregrid.
18611861
if (.not. diag_field(field_ptr%get_volume())%is_variable_in_file(diag_file%id)) then
18621862
need_associated_files = .true.
1863-
call diag_field(field_ptr%get_volume())%generate_associated_files_att(associated_files, diag_file%start_time)
1863+
call diag_field(field_ptr%get_volume())%generate_associated_files_att(associated_files, diag_file%start_time, &
1864+
field_outputname)
1865+
cell_measures = trim(cell_measures)//" volume: "//trim(field_outputname)
1866+
else
1867+
cell_measures = trim(cell_measures)//" volume: "//diag_field(field_ptr%get_volume())%get_varname(&
1868+
to_write=.true., filename=diag_file%get_file_fname())
18641869
endif
18651870
endif
18661871

fms/fms.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ subroutine maximize_system_stacksize_limit() bind(C)
320320
call mpp_domains_init()
321321
call fms2_io_init()
322322
#ifdef use_deprecated_io
323-
call mpp_error(NOTE, "fms_io_init: fms_io HAS BEEN DEPRECATED! "//&
323+
call mpp_error(ERROR, "fms_io_init: fms_io/mpp_io was removed in the 2025.03 release of FMS! "//&
324324
"PLEASE REMOVE -Duse_deprecated_io FROM YOUR COMPILE FLAGS "// &
325-
"AND MOVE TO FMS2_IO. CONTACT YOUR MODEL LIASISON IF YOU NEED "// &
325+
"AND MOVE TO FMS2_IO. CONTACT YOUR GFDL MODEL LIAISON IF YOU NEED "// &
326326
"ASSISTANCE")
327327
#endif
328328
logunitnum = stdlog()

libFMS/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ lib_LTLIBRARIES = libFMS.la
2727
# These linker flags specify libtool version info.
2828
# See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
2929
# for information regarding incrementing `-version-info`.
30-
libFMS_la_LDFLAGS = -version-info 26:0:0
30+
libFMS_la_LDFLAGS = -version-info 27:0:0
3131

3232
# Add the convenience libraries to the FMS library.
3333
libFMS_la_LIBADD = $(top_builddir)/platform/libplatform.la

0 commit comments

Comments
 (0)