Skip to content

Commit

Permalink
Merge remote-tracking branch 'uramirez8707/generic_parser' into field…
Browse files Browse the repository at this point in the history
…_table_update
  • Loading branch information
Jesse Lentz committed Jul 23, 2024
2 parents 0208543 + 3381556 commit c83b331
Show file tree
Hide file tree
Showing 46 changed files with 890 additions and 328 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/github_autotools_intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
CC: mpiicc
FC: mpiifort
CFLAGS: "-I/libs/include"
FCFLAGS: "-I/libs/include -g -traceback ${{ matrix.io-flag }}"
FCFLAGS: "-I/libs/include -g -traceback"
LDFLAGS: "-L/libs/lib"
TEST_VERBOSE: 1
I_MPI_FABRICS: "shm" # needed for mpi in image
Expand Down Expand Up @@ -55,7 +55,10 @@ jobs:
- name: checkout
uses: actions/checkout@v4
- name: Configure
run: autoreconf -if ./configure.ac && ./configure --with-yaml
run: |
autoreconf -if ./configure.ac
export LD_LIBRARY_PATH="/libs/lib:$LD_LIBRARY_PATH"
./configure --with-yaml ${{ matrix.io-flag }}
- name: Compile
run: make -j || make
- name: Run test suite
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/github_cmake_gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ jobs:
omp-flags: [ -DOPENMP=on, -DOPENMP=off ]
libyaml-flag: [ "", -DWITH_YAML=on ]
io-flag: [ "", -DUSE_DEPRECATED_IO=on ]
build-type: [ "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_BUILD_TYPE=Debug" ]
container:
image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0
env:
CMAKE_FLAGS: "${{ matrix.omp-flags }} ${{ matrix.io-flag }} ${{ matrix.libyaml-flag }} -D64BIT=on"
CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.io-flag }} ${{ matrix.libyaml-flag }} -D64BIT=on"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
86 changes: 84 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,87 @@ and this project uses `yyyy.rr[.pp]`, where `yyyy` is the year a patch is releas
`rr` is a sequential release number (starting from `01`), and an optional two-digit
sequential patch number (starting from `01`).

## [2024.02] - 2024-07-11

### Known Issues
- Diag Manager Rewrite: See [below](#20240102---2024-06-14) for known output file differences regarding the new diag manager. The new diag_manager is disabled by default, so this differences will only be present if `use_modern_diag` is set to true in the `diag_manager_nml`.
- BUILD(HDF5): HDF5 version 1.14.3 generates floating point exceptions, and will cause errors if FMS is built with FPE traps enabled. FPE traps are turned on when using the debug target in mkmf.
- GCC: version 14.1.0 is unsupported due to a bug with strings that has come up previously in earlier versions. This will be caught by the configure script, but will cause compilation errors if using other build systems.

### Added
- TIME_INTERP: Enables use of `verbose` option in `time_interp_external2` calls from `data_override`. The option is enabled in `data_override_nml` by setting `debug_data_override` to true. (#1516)
- COUPLER: Adds optional argument to `coupler_types_send_data` routine that contains the return statuses for any calls made to the diag_manager's `send_data` routine. (#1530)
- MPP: Adds a separate error log file `warnfile.<root pe num>.out` that only holds output from any `mpp_error` calls made during a run (#1544)
### Changed
- DIAG_MANAGER: The `diag_field_log.out` output file of all registered fields will now include the PE number of the root PE at the time of writing (ie. diag_field_log.out.0). This is to prevent overwritting the file in cases where the root PE may change. (#1497)

### Fixed
- CMAKE: Fixes real kind flags being overwritten when using the Debug release type (#1532)
- HORIZ_INTERP: Fixes allocation issues when using method-specific horiz_interp_new routines (such as `horiz_interp_bilinear_new`) by setting `is_allocated` and the `method_type` during initialization for each method. (#1538)


### Tag Commit Hashes
- 2024.02-alpha1 5757c7813f1170efd28f5a4206395534894095b4
- 2024.02-alpha2 5757c7813f1170efd28f5a4206395534894095b4
- 2024.02-beta1 ca592ef8f47c246f4dc56d348d62235bd0ceaa9d
- 2024.02-beta2 ca592ef8f47c246f4dc56d348d62235bd0ceaa9d

## [2024.01.02] - 2024-06-14

### Known Issues
- Diag Manager Rewrite:
- Expected output file changes:
- If the model run time is less than the output frequency, old diag_manager would write a specific value (9.96921e+36). The new diag_manager will not, so only fill values will be present.
- A `scalar_axis` dimension will not be added to scalar variables
- The `average_*` variables will no longer be added as they are non-standard conventions
- Attributes added via `diag_field_add_attributes` in the old code were saved as `NF90_FLOAT` regardless of precision, but will now be written as the precision that is passed in
- Subregional output will have a global attribute `is_subregional = True` set for non-global history files.
- The `grid_type` and `grid_tile` global attributes will no longer be added for all files, and some differences may be seen in the exact order of the `associated_files` attribute

- DIAG_MANAGER: When using the `do_diag_field_log` nml option, the output log file may be ovewritten if using a multiple root pe's
- BUILD(HDF5): HDF5 version 1.14.3 generates floating point exceptions, and will cause errors if FMS is built with FPE traps enabled.
- GCC: version 14.1.0 is unsupported due to a bug with strings that has come up previously in earlier versions. This will be caught by the configure script, but will cause compilation errors if using other build systems.

### Fixed
- DIAG_MANAGER: Fixes incorrect dates being appended to static file names

## [2024.01.01] - 2024-05-30

### Known Issues
- Diag Manager Rewrite:
- Expected output file changes:
- If the model run time is less than the output frequency, old diag_manager would write a specific value (9.96921e+36). The new diag_manager will not, so only fill values will be present.
- A `scalar_axis` dimension will not be added to scalar variables
- The `average_*` variables will no longer be added as they are non-standard conventions
- Attributes added via `diag_field_add_attributes` in the old code were saved as `NF90_FLOAT` regardless of precision, but will now be written as the precision that is passed in
- Subregional output will have a global attribute `is_subregional = True` set for non-global history files.
- The `grid_type` and `grid_tile` global attributes will no longer be added for all files, and some differences may be seen in the exact order of the `associated_files` attribute

- DIAG_MANAGER: When using the `do_diag_field_log` nml option, the output log file may be ovewritten if using a multiple root pe's
- BUILD(HDF5): HDF5 version 1.14.3 generates floating point exceptions, and will cause errors if FMS is built with FPE traps enabled.
- GCC: version 14.1.0 is unsupported due to a bug with strings that has come up previously in earlier versions. This will be caught by the configure script, but will cause compilation errors if using other build systems.

### Added
- DIAG_MANAGER: Implements `flush_nc_files` functionality from legacy diag_manager.

### Changed
- FMS2_IO: Changed `register_unlimited_compressed_axis` to use a collective gather rather than send and recieves to improve efficiency when reading in iceberg restarts.

### Fixed
- DIAG_MANAGER: Fixes 0 day output frequencies causing error stating a time_step was skipped. Also adds checks to crash if averaged fields have -1 or 0 day frequencies or if mixing averaged and non-averaged fields in the same file.
- DIAG_MANAGER: Fixes issue with the weight argument not getting passed through to reduction methods.
- DIAG_MANAGER: Allocation errors when using two empty files.
- DIAG_MANAGER: `time` and `time_bnds` being larger than expected when running for 1 day and using daily data.
- DIAG_MANAGER: Allows for mixing static and non-static fields when frequency is 0 days.
- TESTS: Fixes compile failure with ifort 2024.01 from test_mpp_gatscat.F90.

### Removed
- DIAG_MANAGER: The `mix_snapshot_average_fields` option is deprecated for the rewritten diag_manager only.

### Tag Commit Hashes
- 2024.01.01-beta2 c00367fa810960e87610162f0f012c5da724c5a9
- 2024.01.01-beta1 42f8506512e1b5b43982320f5b9d4ca1ca9cbebd

## [2024.01] - 2024-05-03

### Known Issues
Expand All @@ -32,9 +113,10 @@ sequential patch number (starting from `01`).
- Support defining subregions with indices
- More flexibility when adding metadata and defining output frequency
- FMS2_IO: Adds support for collective parallel reads to improve model startup time. The collective reads are disabled by default and enabled via the `use_collective` flag in `netcdf_io_mod`.
- DATA_OVERRIDE: Adds multifile support for using 3 input netcdf files instead of one. Three keys have been added to the data_table: `is_multi_file` to be set to true to enable the feature, as well as `prev_file_name` and `next_file_name` to set to the names of the additional files.
- DATA_OVERRIDE: Adds option to use multiple data files for one field within data_override in order to use annual data files in yearly runs without having to append/prepend timesteps from previous and next year. With the legacy data_table, filenames can be set in order and separated with `:` ie. `prev_year.nc:curr_year.nc:next_year.nc`. With the data_table.yaml format, the key `is_multi_file` enables the functionality and `prev_file_name` and `next_file_name` sets the file paths.

- INTERPOLATOR: Adds support for yearly/annual data
- DATA_OVERRIDE: Adds support for monotonically increasing/decreasing arrays
- DATA_OVERRIDE: Adds support for monotonically decreasing arrays for `nearest_index`, `axis_edges`, `horiz_interp`(bilinear), and `data_override` (#1388)
- DOCS: Add documentation for the exchange grid (xgrid_mod) and update the contribution guide to add a section on code reviews
- MPP: MPI sub-communicators for domains are now accessible via `mpp_get_domain_tile_commid` and `mpp_get_domain_commid` in `mpp_domains_mod`

Expand Down
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

# add build type for debug, overrides default flags (set with $FCFLAGS, $CFLAGS)
set(CMAKE_Fortran_FLAGS_DEBUG)

# Define the CMake project
project(FMS
VERSION 2024.01.0
VERSION 2024.02.0
DESCRIPTION "GFDL FMS Library"
HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms"
LANGUAGES C Fortran)
Expand Down Expand Up @@ -339,11 +336,8 @@ foreach(kind ${kinds})
target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}")
target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}")

string(TOLOWER ${CMAKE_BUILD_TYPE} build_type)
if (NOT build_type STREQUAL debug)
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS
"${${kind}_flags}")
endif()
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS "${${kind}_flags}")

set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY
${moduleDir})

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AC_PREREQ([2.69])

# Initialize with name, version, and support email address.
AC_INIT([GFDL FMS Library],
[2024.01.00-dev],
[2024.02-dev],
[[email protected]],
[FMS],
[https://www.github.com/NOAA-GFDL/FMS])
Expand Down
41 changes: 37 additions & 4 deletions coupler/coupler_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2944,10 +2944,12 @@ end subroutine CT_set_diags_3d


!> @brief Write out all diagnostics of elements of a coupler_2d_bc_type
!! TODO this should really be a function in order to return the status of send_data call
subroutine CT_send_data_2d(var, Time)
subroutine CT_send_data_2d(var, Time, return_statuses)
type(coupler_2d_bc_type), intent(in) :: var !< BC_type structure with the diagnostics to write
type(time_type), intent(in) :: time !< The current model time
logical, allocatable, optional, intent(out) :: return_statuses(:,:) !< Return status of send data calls
!! first index is index of boundary condition
!! second index is field/value within that boundary condition

integer :: m, n
logical :: used
Expand All @@ -2966,18 +2968,33 @@ subroutine CT_send_data_2d(var, Time)

! num_bcs .lt. 1 -> loop doesn't run but shouldn't error out
if(associated(var%bc) .or. var%num_bcs .lt. 1) then

! allocate array for returned send data statuses
if( present(return_statuses) .and. var%num_bcs .gt. 0) then
allocate(return_statuses(var%num_bcs, var%bc(1)%num_fields))
endif

do n = 1, var%num_bcs
do m = 1, var%bc(n)%num_fields
if (var%bc(n)%field(m)%id_diag > 0) then
used = send_data(var%bc(n)%field(m)%id_diag, var%bc(n)%field(m)%values, Time)
if(allocated(return_statuses)) return_statuses(n,m) = used
endif
enddo
enddo

else if(associated(var%bc_r4)) then

! allocate array for returned send data statuses
if( present(return_statuses) .and. var%num_bcs .gt. 0) then
allocate(return_statuses(var%num_bcs, var%bc_r4(1)%num_fields))
endif

do n = 1, var%num_bcs
do m = 1, var%bc_r4(n)%num_fields
if (var%bc_r4(n)%field(m)%id_diag > 0) then
used = send_data(var%bc_r4(n)%field(m)%id_diag, var%bc_r4(n)%field(m)%values, Time)
if(allocated(return_statuses)) return_statuses(n,m) = used
endif
enddo
enddo
Expand All @@ -2988,10 +3005,12 @@ subroutine CT_send_data_2d(var, Time)
end subroutine CT_send_data_2d

!> @brief Write out all diagnostics of elements of a coupler_3d_bc_type
!! TODO this should really be a function in order to return the status of send_data call
subroutine CT_send_data_3d(var, Time)
subroutine CT_send_data_3d(var, Time, return_statuses)
type(coupler_3d_bc_type), intent(in) :: var !< BC_type structure with the diagnostics to write
type(time_type), intent(in) :: time !< The current model time
logical, allocatable, optional, intent(out) :: return_statuses(:,:) !< Return status of send data calls
!! first index is index of boundary condition
!! second index is field/value within that boundary condition

integer :: m, n
logical :: used
Expand All @@ -3010,18 +3029,32 @@ subroutine CT_send_data_3d(var, Time)

! num_bcs .lt. 1 -> loop doesn't run but shouldn't error out
if(associated(var%bc) .or. var%num_bcs .lt. 1) then

! allocate array for returned send data statuses
if( present(return_statuses) .and. var%num_bcs .gt. 0) then
allocate(return_statuses(var%num_bcs, var%bc(1)%num_fields))
endif

do n = 1, var%num_bcs
do m = 1, var%bc(n)%num_fields
if (var%bc(n)%field(m)%id_diag > 0) then
used = send_data(var%bc(n)%field(m)%id_diag, var%bc(n)%field(m)%values, Time)
if(allocated(return_statuses)) return_statuses(n,m) = used
endif
enddo
enddo
else if(associated(var%bc_r4)) then

! allocate array for returned send data statuses
if( present(return_statuses) .and. var%num_bcs .gt. 0) then
allocate(return_statuses(var%num_bcs, var%bc_r4(1)%num_fields))
endif

do n = 1, var%num_bcs
do m = 1, var%bc_r4(n)%num_fields
if (var%bc_r4(n)%field(m)%id_diag > 0) then
used = send_data(var%bc_r4(n)%field(m)%id_diag, var%bc_r4(n)%field(m)%values, Time)
if(allocated(return_statuses)) return_statuses(n,m) = used
endif
enddo
enddo
Expand Down
Loading

0 comments on commit c83b331

Please sign in to comment.