Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into cray_null_workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Lentz committed Oct 25, 2024
2 parents eb10e18 + bd9cbeb commit 8b11ca4
Show file tree
Hide file tree
Showing 89 changed files with 2,367 additions and 981 deletions.
18 changes: 9 additions & 9 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# These owners will be the default owners for all the files in the
# repository. Unless a later match is found, these owners
# will be requested for a review when a PR is opened.
* @thomas-robinson @bensonr @rem1776
* @uramirez8707 @bensonr @rem1776

# GNU autotools files
Makefile.am @uramirez8707 @rem1776
Expand All @@ -41,7 +41,7 @@ cmake @mlee03
/.github/ @rem1776

# Testing files
/test_fms/ @uramirez8707 @mlee03 @bensonr @thomas-robinson @rem1776
/test_fms/ @uramirez8707 @mlee03 @bensonr @rem1776

# Specific component directories
/affinity/ @bensonr
Expand All @@ -53,15 +53,15 @@ cmake @mlee03
#/data_override/ Currently no code owner
/test_fms/data_override/ @rem1776

/diag_manager @thomas-robinson
/test_fms/diag_manager/ @thomas-robinson
/diag_manager @uramirez8707
/test_fms/diag_manager/ @uramirez8707

/fms/ @thomas-robinson @rem1776
/test_fms/fms/ @thomas-robinson @rem1776
/fms/ @uramirez8707 @rem1776
/test_fms/fms/ @uramirez8707 @rem1776
/fms2/ @uramirez8707
/test_fms/fms2/ @uramirez8707

/libFMS/ @thomas-robinson @rem1776
/libFMS/ @uramirez8707 @rem1776

/mpp/ @thomas-robinson @bensonr
/test_fms/mpp/ @thomas-robinson @bensonr @rem1776
/mpp/ @uramirez8707 @bensonr
/test_fms/mpp/ @uramirez8707 @bensonr @rem1776
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ 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.03] - 2024-08-22

### 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.
- INTEL: The `-check uninit` flag for the Intel Oneapi Fortran compiler (ifx) is unsupported due to a bug causing false positives when using external libraries. If using the `-check all` flag, `-check all,nouninit` should be used instead.

### Added
- DATA_OVERRIDE: Adds a namelist flag `use_center_grid_points` which, if true, enables reading the centroid values from the grid spec for ocean and ice models. This fixes issues with grid files that have longitudes ranges from 0:180 and then -180:0, but will cause answer changes if enabled. (#1566)
- DATA_OVERRIDE: Adds support for reading external weight files. Currently only supported for fregrid generated files while using the bilinear interpolation method. Documentation for this feature can be found in `data_override/README.md`. (#1556)
- PLATFORM: Adds two constants `FMS_PATH_LEN` and `FMS_FILE_LEN` and uses it across the code for any file path or file name character strings. They default to 1024 and 255 but can also be set by the `FMS_MAX_PATH_LEN` and `FMS_MAX_FILE_LEN` CPP macros. (#1567)
- CMAKE: Adds Cmake option to support building shared libraries (#1559)

### Changed
- DIAG_MANAGER: Simplifies the diag_table.yaml format by allowing `module`, `reduction`, and `kind` to be set on a file level, with the ability to override for a specific field. (#1545)
- FIELD_MANAGER: Updated and refactored the `fm_yaml_mod` module for a new table format to remove the `subparams` key. (#1547)
- DATA_OVERRIDE: Updates the yaml format to be improve readablity and to be more consistent in key names. Additional documentation for the new format can be found in `data_override/README.md`. (#1556)

### Fixed
- PARSER: Adds error code checks to the yaml parser to prevent code from hanging on invalid yamls (#1563)
- PARSER: Adds ability to read in generic blocks to support `field_manager` updates. (#1519)
- CRAY COMPILER SUPPORT: Updated any multi-line string literals to be compatible with the cray compiler. (#1554)

### Removed
- DIAG_MANAGER: Removed diag_table schemas from FMS and moved them to the `gfdl_msd_schemas` repository, and updates the `diag_manager` documentation markdowns. (#1543)

### Tag Commit Hashes
- 2024.03-beta1 a5de6a54abeb00be2443db4cf07aa267b7faa724

## [2024.02] - 2024-07-11

### Known Issues
Expand Down
12 changes: 7 additions & 5 deletions CMAKE_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,23 @@ make install
```

### User configurable options:
By default, FMS is built without `OpenMP` and in `single precision (r4)`
By default, FMS is built without `OpenMP`, in `single precision (r4)` and delivered in static library files.

The 64BIT and 32BIT precision options will build distinct libraries when enabled with the given default
real size, libfms_r4 or libfms_r8.

The following build options are available:
```
-DOPENMP "Build FMS with OpenMP support" DEFAULT: OFF
-D32BIT "Build 32-bit (r4) FMS library" DEFAULT: ON
-D64BIT "Build 64-bit (r8) FMS library" DEFAULT: OFF
-DFPIC "Build with position independent code" DEFAULT: OFF
-DOPENMP "Build FMS with OpenMP support" DEFAULT: OFF
-D32BIT "Build 32-bit (r4) FMS library" DEFAULT: ON
-D64BIT "Build 64-bit (r8) FMS library" DEFAULT: OFF
-DFPIC "Build with position independent code" DEFAULT: OFF
-DSHARED_LIBS "Build shared/dynamic libraries" DEFAULT: OFF
-DCONSTANTS "Build with <X> constants parameter definitions" DEFAULT:GFDL OPTIONS:GFS|GEOS|GFDL
-DINTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" DEFAULT: ON
-DENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" DEFAULT: ON
-DPORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS" DEFAULT:OFF
-DGFS_PHYS "Enable compiler definition -DGFS_PHYS" DEFAULT:OFF
-DLARGEFILE "Enable compiler definition -Duse_LARGEFILE" DEFAULT:OFF
-DWITH_YAML "Enable compiler definition -Duse_yaml" DEFAULT:OFF
Expand Down
38 changes: 26 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

# Define the CMake project
project(FMS
VERSION 2024.02.0
VERSION 2024.03.0
DESCRIPTION "GFDL FMS Library"
HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms"
LANGUAGES C Fortran)
Expand Down Expand Up @@ -52,14 +52,16 @@ endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# Build options
option(OPENMP "Build FMS with OpenMP support" OFF)
option(32BIT "Build 32-bit (r4) FMS library" ON)
option(64BIT "Build 64-bit (r8) FMS library" OFF)
option(FPIC "Build with position independent code" OFF)
option(OPENMP "Build FMS with OpenMP support" OFF)
option(32BIT "Build 32-bit (r4) FMS library" ON)
option(64BIT "Build 64-bit (r8) FMS library" OFF)
option(FPIC "Build with position independent code" OFF)
option(SHARED_LIBS "Build shared/dynamic libraries" OFF)

# Options for compiler definitions
option(INTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" ON)
option(ENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" ON)
option(PORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS" OFF)
option(GFS_PHYS "Enable compiler definition -DGFS_PHYS" OFF)
option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE" OFF)
option(WITH_YAML "Enable compiler definition -Duse_yaml" OFF)
Expand Down Expand Up @@ -266,6 +268,10 @@ if(ENABLE_QUAD_PRECISION)
list(APPEND fms_defs ENABLE_QUAD_PRECISION)
endif()

if(PORTABLE_KINDS)
list(APPEND fms_defs PORTABLE_KINDS)
endif()

if(LARGEFILE)
list(APPEND fms_defs use_LARGEFILE)
endif()
Expand Down Expand Up @@ -360,8 +366,15 @@ foreach(kind ${kinds})
endif()

# FMS (C + Fortran)
add_library(${libTgt} STATIC $<TARGET_OBJECTS:${libTgt}_c>
$<TARGET_OBJECTS:${libTgt}_f>)
if (SHARED_LIBS)
message(STATUS "Shared library target: ${libTgt}")
add_library(${libTgt} SHARED $<TARGET_OBJECTS:${libTgt}_c>
$<TARGET_OBJECTS:${libTgt}_f>)
else ()
message(STATUS "Static library target: ${libTgt}")
add_library(${libTgt} STATIC $<TARGET_OBJECTS:${libTgt}_c>
$<TARGET_OBJECTS:${libTgt}_f>)
endif ()

target_include_directories(${libTgt} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down Expand Up @@ -397,7 +410,8 @@ foreach(kind ${kinds})
target_compile_definitions(${libTgt} PRIVATE "${fms_defs}")
target_compile_definitions(${libTgt} PRIVATE "${${kind}_defs}")

target_link_libraries(${libTgt} PUBLIC NetCDF::NetCDF_Fortran
target_link_libraries(${libTgt} PUBLIC NetCDF::NetCDF_C
NetCDF::NetCDF_Fortran
MPI::MPI_Fortran)

if(OpenMP_Fortran_FOUND)
Expand All @@ -415,13 +429,13 @@ endforeach()
install(
TARGETS ${LIB_TARGETS}
EXPORT FMSExports
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

### Package config
include(CMakePackageConfigHelpers)
set(CONFIG_INSTALL_DESTINATION lib/cmake/fms)
set(CONFIG_INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fms)

export(EXPORT FMSExports
NAMESPACE FMS::
Expand Down
6 changes: 3 additions & 3 deletions amip_interp/amip_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ module amip_interp_mod
NOTE, mpp_error, fms_error_handler

use constants_mod, only: TFREEZE, pi
use platform_mod, only: r4_kind, r8_kind, i2_kind
use platform_mod, only: r4_kind, r8_kind, i2_kind, FMS_FILE_LEN
use mpp_mod, only: input_nml_file
use fms2_io_mod, only: FmsNetcdfFile_t, fms2_io_file_exists=>file_exists, open_file, close_file, &
get_dimension_size, fms2_io_read_data=>read_data
use netcdf, only: NF90_MAX_NAME

implicit none
private
Expand Down Expand Up @@ -302,9 +303,8 @@ module amip_interp_mod

! ---- global unit & date ----

integer, parameter :: maxc = 128
integer :: iunit
character(len=maxc) :: file_name_sst, file_name_ice
character(len=FMS_FILE_LEN) :: file_name_sst, file_name_ice
type(FmsNetcdfFile_t), target :: fileobj_sst, fileobj_ice

type (date_type) :: Curr_date = date_type( -99, -99, -99 )
Expand Down
5 changes: 3 additions & 2 deletions amip_interp/include/amip_interp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ subroutine GET_AMIP_SST_ (Time, Interp, sst, err_msg, lon_model, lat_model)
integer, dimension(:), allocatable :: ryr, rmo, rdy
character(len=30) :: time_unit
real(FMS_AMIP_INTERP_KIND_), dimension(:), allocatable :: timeval
character(len=maxc) :: ncfilename
character(len=FMS_FILE_LEN) :: ncfilename
type(FmsNetcdfFile_t) :: fileobj
logical :: the_file_exists
! end add by JHC
Expand Down Expand Up @@ -652,7 +652,8 @@ endif
integer(I2_KIND) :: idat(mobs,nobs)
integer :: nrecords, yr, mo, dy, ierr, k
integer, dimension(:), allocatable :: ryr, rmo, rdy
character(len=maxc) :: ncfilename, ncfieldname
character(len=FMS_FILE_LEN) :: ncfilename
character(len=NF90_MAX_NAME) :: ncfieldname
type(FmsNetcdfFile_t), pointer :: fileobj
integer, parameter :: lkind = FMS_AMIP_INTERP_KIND_

Expand Down
2 changes: 1 addition & 1 deletion column_diagnostics/column_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module column_diagnostics_mod
get_date, time_type
use constants_mod, only: constants_init, PI, RADIAN
use mpp_mod, only: input_nml_file
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_FILE_LEN
!-------------------------------------------------------------------

implicit none
Expand Down
2 changes: 1 addition & 1 deletion column_diagnostics/include/column_diagnostics.inc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ integer, dimension(:), intent(out) :: diag_units !< unit number for
real(FMS_CD_KIND_) :: ref_lat
real(FMS_CD_KIND_) :: current_distance
character(len=8) :: char !< character string for diaganostic column index
character(len=32) :: filename !< filename for output file for diagnostic column
character(len=FMS_FILE_LEN) :: filename !< filename for output file for diagnostic column
logical :: allow_ij_input
logical :: open_file
integer :: io
Expand Down
21 changes: 20 additions & 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.02-dev],
[2024.03-dev],
[gfdl.climate.model.info@noaa.gov],
[FMS],
[https://www.github.com/NOAA-GFDL/FMS])
Expand Down Expand Up @@ -112,6 +112,13 @@ AS_IF([test ${enable_r8_default:-yes} = yes],
[enable_r8_default=yes],
[enable_r8_default=no])

AC_ARG_ENABLE([portable-kinds],
[AS_HELP_STRING([--enable-portable-kinds],
[Enables compilation with -DPORTABLE_KINDS with iso_c_binding KIND type parameters])])
AS_IF([test ${enable_portable_kinds:-no} = yes],
[enable_portable_kinds=yes],
[enable_portable_kinds=no])

# user enabled testing with input files
AC_MSG_CHECKING([whether to enable tests with input files])
AC_ARG_ENABLE([test-input],
Expand Down Expand Up @@ -273,6 +280,13 @@ if test $hdf5_fpe_bug = yes; then
NetCDF must be built with a HDF5 version other than 1.14.3 to support floating point exception traps.])
fi

rm -f test.nc

# Check if we need a flag to not capitalize module output (needed with cray compiler)
GX_FC_MOD_CASE_FLAG([FCFLAGS="$FCFLAGS $FC_MOD_CASE_FLAG"])

# Check if new unit is supported
GX_FC_08_OPEN_NEWUNIT([], [AC_MSG_ERROR([Compiler support for use of newunit argument is required to build FMS])])

# Check if Fortran compiler has the Class, Character array assign bug
GX_FC_CLASS_CHAR_ARRAY_BUG_CHECK()
Expand Down Expand Up @@ -342,6 +356,11 @@ if test $enable_setting_flags = yes; then
AC_DEFINE([no_8byte_integers], [1], [Set to disable 8 byte integer Fortran routines])
fi

# Builds with C data types
if test $enable_portable_kinds = yes; then
AC_DEFINE([PORTABLE_KINDS], [1], [Set to define KIND parameters to iso_c_binding KIND parameters])
fi

# Add Cray Pointer support flag
if test ! -z "$FC_CRAY_POINTER_FLAG"; then
FCFLAGS="$FCFLAGS $FC_CRAY_POINTER_FLAG"
Expand Down
8 changes: 4 additions & 4 deletions coupler/atmos_ocean_fluxes.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module atmos_ocean_fluxes_mod
use coupler_types_mod, only: ind_runoff
use coupler_types_mod, only: ind_flux, ind_deltap, ind_kw, ind_flux0

use field_manager_mod, only: fm_path_name_len, fm_string_len, fm_exists, fm_get_index
use field_manager_mod, only: fm_string_len, fm_exists, fm_get_index
use field_manager_mod, only: fm_new_list, fm_get_current_list, fm_change_list
use field_manager_mod, only: fm_field_name_len, fm_type_name_len, fm_dump_list
use field_manager_mod, only: fm_loop_over_list
Expand All @@ -63,7 +63,7 @@ module atmos_ocean_fluxes_mod
use fm_util_mod, only: fm_util_get_real_array, fm_util_get_real, fm_util_get_integer
use fm_util_mod, only: fm_util_get_logical, fm_util_get_logical_array
use fms_io_utils_mod, only: get_data_type_string
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_PATH_LEN

implicit none
private
Expand Down Expand Up @@ -135,8 +135,8 @@ function aof_set_coupler_flux(name, flux_type, implementation, atm_tr_index, par
integer :: length
integer :: num_parameters
integer :: outunit
character(len=fm_path_name_len) :: coupler_list
character(len=fm_path_name_len) :: current_list
character(len=FMS_PATH_LEN) :: coupler_list
character(len=FMS_PATH_LEN) :: current_list
character(len=fm_string_len) :: flux_type_test
character(len=fm_string_len) :: implementation_test
character(len=256) :: error_header
Expand Down
Loading

0 comments on commit 8b11ca4

Please sign in to comment.