Skip to content

Commit

Permalink
Merge branch 'dmUpdate' of github.com:NOAA-GFDL/FMS into min_max_none
Browse files Browse the repository at this point in the history
  • Loading branch information
uramirez8707 committed Aug 11, 2023
2 parents 91a249a + 8458bfd commit 305dac8
Show file tree
Hide file tree
Showing 29 changed files with 373 additions and 75 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/Dockerfile.gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#***********************************************************************
#* GNU Lesser General Public License
#*
#* This file is part of the GFDL Flexible Modeling System (FMS).
#*
#* FMS is free software: you can redistribute it and/or modify it under
#* the terms of the GNU Lesser General Public License as published by
#* the Free Software Foundation, either version 3 of the License, or (at
#* your option) any later version.
#*
#* FMS is distributed in the hope that it will be useful, but WITHOUT
#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
#* for more details.
#*
#* You should have received a copy of the GNU Lesser General Public
#* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
#***********************************************************************
# FMS CI image recipefile for GNU
# Runs on centos stream (builder has same base from redhat registry)
#
# arguments to specify versions to build can be given to docker or changed here (--build-arg name=val)
FROM spack/rockylinux9:latest as builder

ARG gcc_version=12.3.0
ARG netcdfc_version=4.9.0
ARG netcdff_version=4.6.0
ARG libyaml_version=0.2.5
ARG mpich_version=4.0.2

COPY spack.env /opt/deps/spack.env

# perl's download kept timing out
RUN sed -i 's/connect_timeout: 10/connect_timeout: 600/' /opt/spack/etc/spack/defaults/config.yaml && \
spack install gcc@${gcc_version} && \
source /opt/spack/share/spack/setup-env.sh && \
spack load gcc@${gcc_version} && \
spack compiler find && \
sed "s/COMPILER/gcc@$gcc_version/" /opt/deps/spack.env > spack.yaml && \
sed -i "s/NETCDF_C_VERSION/$netcdfc_version/" spack.yaml && \
sed -i "s/NETCDF_F_VERSION/$netcdff_version/" spack.yaml && \
sed -i "s/LIBYAML_VERSION/$libyaml_version/" spack.yaml && \
sed -i "s/MPI_LIB/mpich@$mpich_version/" spack.yaml && \
spack env activate -d . && \
spack -e . concretize -f > /opt/deps/deps.log && \
spack install --fail-fast

# copy built software to base from first image
FROM rockylinux:9

COPY --from=builder /opt/view/ /opt/view/
COPY --from=builder /opt/deps/ /opt/deps/

# input files used with --enable-input-tests
# need to be on the dev boxes if building
COPY ./fms_test_input /home/unit_tests_input

RUN dnf install -y autoconf make automake m4 libtool pkg-config zip

ENV FC="mpifort"
ENV CC="mpicc"
ENV MPICH_FC="/opt/view/bin/gfortran"
ENV MPICH_CC="/opt/view/bin/gcc"
ENV FCFLAGS="-I/opt/view/include"
ENV CFLAGS="-I/opt/view/include"
ENV LDFLAGS="-L/opt/view/lib"
ENV LD_LIBRARY_PATH="/opt/view/lib:/opt/view/lib64:/usr/local/lib:/usr/local/lib64"
ENV PATH="/opt/view/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin"
37 changes: 0 additions & 37 deletions .github/workflows/build_ubuntu_gnu.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/github_autotools_gnu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 'main' required ci, does a distcheck (builds, tests, check install)
# image created off dockerfile in repo, compile/link flags are set there
name: Build libFMS test with autotools

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
conf-flag: [ --disable-openmp, --enable-mixed-mode, --disable-setting-flags, --with-mpi=no]
input-flag: [--with-yaml, --enable-test-input=/home/unit_tests_input]
exclude:
- conf-flag: --with-mpi=no
input-flag: --enable-test-input=/home/unit_tests_input
container:
image: noaagfdl/fms-ci-rocky-gnu:12.3.0
env:
TEST_VERBOSE: 1
DISTCHECK_CONFIGURE_FLAGS: "${{ matrix.conf-flag }} ${{ matrix.input-flag }} ${{ matrix.io-flag }}"
SKIP_TESTS: "test_mpp_domains2.14 test_horiz_interp2.9 test_horiz_interp2.10 test_yaml_parser.5" # temporary till fixes are in
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Prepare GNU autoconf for build
run: autoreconf -if
- name: Configure the build
if: ${{ matrix.conf-flag != '--disable-setting-flags' }}
run: ./configure ${DISTCHECK_CONFIGURE_FLAGS} || cat config.log
- name: Configure the build with compiler flags
if: ${{ matrix.conf-flag == '--disable-setting-flags' }}
run: ./configure ${DISTCHECK_CONFIGURE_FLAGS} FCFLAGS="-fdefault-real-8 -fdefault-double-8 -fcray-pointer -ffree-line-length-none -I/usr/include $FCFLAGS" || cat config.log
- name: Build the library
run: make distcheck
if: ${{ matrix.conf-flag != '--with-mpi=no' }}
- name: Build the library (without test suite for serial build)
run: make
if: ${{ matrix.conf-flag == '--with-mpi=no' }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions .github/workflows/spack.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# template for spack environment yaml
# uppercase words get replaced before activating
spack:
specs:
- COMPILER
- MPI_LIB
- netcdf-c@NETCDF_C_VERSION ^MPI_LIB
- netcdf-fortran@NETCDF_F_VERSION
- libyaml@LIBYAML_VERSION
concretizer:
unify: true
packages:
all:
compiler: [ COMPILER ]
config:
install_tree: /opt/deps
view: /opt/view
4 changes: 3 additions & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# appends -dev to the version upon release and opens pr
# CI won't run on generated PR, easiest workaround is to close + reopen
on:
release:
types: [published]
Expand All @@ -16,4 +18,4 @@ jobs:
branch-suffix: timestamp # add a timestamp to branch name
delete-branch: true # delete afer merge
title: Append dev to version number post-release
body: automated change, adds '-dev' to the version number upon releases
body: automated change, adds '-dev' to the version number upon releases. This PR will need to be closed and reopened to run CI testing.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,45 @@ 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`).

## [2023.02] - 2023-07-27
### Known Issues
- GCC 11.1.0 is unsupported due to compilation issues with select type. The issue is resolved in later GCC releases.
- When outputting sub-region diagnostics, the current diag_manager does not add "tileX" to the filename when using a cube sphere. This leads to trouble when trying to combine the files and regrid them (if the region is in two different tiles)
- GCC 10 and greater causing io issues when compiled using O2 optimization flags
- GNU compilers prior to the GCC 9.0 release are unsupported for this release due to lack of support for the findloc intrinsic function. This will result in an error saying 'findloc' has no IMPLICIT type and can be resolved by compiling with gcc version 9.0 or greater.

### Added
- MPP/EXCHANGE: Adds association checks before pointer deallocations in mpp includes and xgrid

### Changed
- LIBFMS: The libFMS.F90 file (module name `fms`) meant to provide global access has been updated to include 'fms' and it's module/subdirectory name as prefixes for all names. This will only affect external codes that are already using the global module (via `use fms`) and not individual modules.
- MIXED PRECISION: Updates the axis_utils2, horiz_interp, sat_vapor_pressure, and axis_utils subdirectories to support mixed precision real values.
- FMS2_IO: Added in mpp_scatter and mpp_gather performance changes from the 2023.01.01 patch. See below for more details.
- FMS2_IO: Improved error messages to give more debugging information
- FMS_MOD: Changed fms_init to include a system call to set the stack size to unlimited, removed previously added stack size fixes
- MONIN_OBUKHOV: Restructures the subroutines in `stable_mix` interface so that 1d calls the underlying implementation, and 2 and 3d call it on 1d slices of the data as opposed to passing in mismatched arrays.
- MPP: Updates from JEDI for ajoint version the mpp halo filling (mpp_do_update_ad.fh), adds checkpoint for forward buffer information.

### Fixed
- MPP: mpp_broadcast causing an unintended error message due to checking the wrong pe value
- MPP: Added workaround for GCC 12 issues causing errors with string lengths in fms2_io
- FMS2_IO: Fixed support for 'packed' data when using NF_SHORT variables. Scale_factor and add_offset attributes will now be applied if present.
- DOCS: Improved doxygen comments for tranlon, updated deployment action for site
- TESTS: Workaround added for ICE coming from mpp_alltoall test with intel 2022.3, and fixes for any test scripts missing input.nml creation. Fixes for mpp/test_global_array failures.
- TIME_INTERP: Fixes crashes when calling with a non-existant field
- DIAG_MANAGER: Fixes a module dependency issue causing failures during parallel builds
- AXIS_UTILS2: Fixes an out of bounds memory index

### Removed
- FMS_IO/MPP_IO: The two older io modules, fms_io_mod and mpp_io_mod, have been deprecated and will not be compiled by default. If you wish to compile these modules, you must use the -Duse_deprecated_io CPP flag or the --enable-deprecated-io configure option if building with autotools.

### Tag Commit Hashes
- 2023.02-beta1 2be8aa452ad3e5f43e92c38a64f12d1ae6c43fb8
- 2023.02-alpha3 8c73bd18dc1d580f2ee524c37cf903ff54d40501
- 2023.02-alpha2 783019fdec89a8db2b26247c2f63d4782e1495c0
- 2023.02-alpga1 419c66be31f82ebb13a91ea5e837c707eb54473b


## [2023.01.01] - 2023-06-06
### Changed
- FMS2_IO: Performance changes for domain_reads_2d and domain_reads_3d:
Expand Down
22 changes: 14 additions & 8 deletions CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,30 @@ Required CI for pull requests are listed first.
## Pull Request CI and checks

### Build libFMS with autotools

Required GNU build test for all pull requests/pushes.
Runs `make distcheck` after configuring via GNU autotools.

Runs on a container image with spack installed dependencies, on top a rocky linux base.

Dockerfile for image is stored at .github/workflows/Dockerfile.gnu for more specific information on the CI environment.

Container environment:
gcc v7.3.0
mpich v3.3a2
netcdf v4.6.0
netcdf-fortran v4.4.4
gcc v12.3.0
mpich v4.0.2
netcdf v4.9.0
netcdf-fortran v4.6.0
autoconf v2.69
libyaml v0.2.5

container hosted at [noaagfdl/ubuntu_libfms_gnu:latest](https://hub.docker.com/r/noaagfdl/ubuntu_libfms_gnu)

`./configure` flags:
- `--enable-openmp`
`./configure` flags tested:
- `--disable-openmp`
- `--enable-mixed-mode`
- `--with-mpi=no` (disables unit testing)
- `--disable-setting-flags`
- `--with-yaml`
- `--enable-test-input=/home/unit_tests_input`


### Build libfms with cmake
Required GNU build test for all pull requests/pushes.
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(CMAKE_Fortran_FLAGS_DEBUG)

# Define the CMake project
project(FMS
VERSION 2023.01.0
VERSION 2023.02.0
DESCRIPTION "GFDL FMS Library"
HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms"
LANGUAGES C Fortran)
Expand Down Expand Up @@ -206,6 +206,7 @@ list(APPEND fms_fortran_src_files
# Collect FMS C source files
list(APPEND fms_c_src_files
affinity/affinity.c
fms/fms_stacksize.c
mosaic/create_xgrid.c
mosaic/gradient_c2l.c
mosaic/interp.c
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],
[2023.01.00-dev],
[2023.02.00-dev],
[[email protected]],
[FMS],
[https://www.github.com/NOAA-GFDL/FMS])
Expand Down
2 changes: 1 addition & 1 deletion diag_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ diag_manager_mod.$(FC_MODEXT): diag_axis_mod.$(FC_MODEXT) diag_data_mod.$(FC_MOD
fms_diag_object_container_mod.$(FC_MODEXT) fms_diag_axis_object_mod.$(FC_MODEXT) \
fms_diag_time_reduction_mod.$(FC_MODEXT) fms_diag_outfield_mod.$(FC_MODEXT) \
fms_diag_fieldbuff_update_mod.$(FC_MODEXT)
fms_diag_output_buffer_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT)
fms_diag_output_buffer_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_yaml_mod.$(FC_MODEXT)
fms_diag_reduction_methods_mod.$(FC_MODEXT): fms_diag_bbox_mod.$(FC_MODEXT) fms_diag_output_buffer_mod.$(FC_MODEXT) \
diag_data_mod.$(FC_MODEXT)

Expand Down
38 changes: 37 additions & 1 deletion diag_manager/fms_diag_file_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module fms_diag_file_object_mod
fmsDiagFullAxis_type, define_subaxis, define_diurnal_axis, &
fmsDiagDiurnalAxis_type, create_new_z_subaxis
use fms_diag_field_object_mod, only: fmsDiagField_type
use fms_diag_output_buffer_mod, only: fmsDiagOutputBufferContainer_type
use fms_diag_output_buffer_mod, only: fmsDiagOutputBufferContainer_type, fmsDiagOutputBuffer_class
use mpp_mod, only: mpp_get_current_pelist, mpp_npes, mpp_root_pe, mpp_pe, mpp_error, FATAL, stdout, &
uppercase, lowercase

Expand Down Expand Up @@ -161,6 +161,7 @@ module fms_diag_file_object_mod
procedure :: open_diag_file
procedure :: write_global_metadata
procedure :: write_time_metadata
procedure :: write_field_data
procedure :: write_axis_metadata
procedure :: write_field_metadata
procedure :: write_axis_data
Expand Down Expand Up @@ -1119,6 +1120,41 @@ subroutine write_time_metadata(this)

end subroutine write_time_metadata

!> \brief Write out the field data to the file
subroutine write_field_data(this, field_obj, buffer_obj)
class(fmsDiagFileContainer_type), intent(in), target :: this !< The diag file object to write to
type(fmsDiagField_type), intent(in), target :: field_obj(:) !< The field object to write from
type(fmsDiagOutputBufferContainer_type), intent(in), target :: buffer_obj(:) !< The buffer object with the data

class(fmsDiagFile_type), pointer :: diag_file !< Diag_file object to open
class(FmsNetcdfFile_t), pointer :: fileobj !< Fileobj to write to
integer :: i !< For do loops
integer :: field_id !< The id of the field writing the data from

diag_file => this%FMS_diag_file
fileobj => diag_file%fileobj

!TODO This may be offloaded in the future
if (diag_file%is_static) then
!< Here the file is static so there is no need for the unlimited dimension
!! as a variables are static
do i = 1, diag_file%number_of_buffers
call buffer_obj(diag_file%buffer_ids(i))%write_buffer(fileobj)
enddo
else
do i = 1, diag_file%number_of_buffers
field_id = buffer_obj(diag_file%buffer_ids(i))%get_field_id()
if (field_obj(field_id)%is_static()) then
!< If the variable is static, only write it the first time
if (diag_file%unlim_dimension_level .eq. 1) call buffer_obj(diag_file%buffer_ids(i))%write_buffer(fileobj)
else
call buffer_obj(diag_file%buffer_ids(i))%write_buffer(fileobj, unlim_dim_level=diag_file%unlim_dimension_level)
endif
enddo
endif

end subroutine write_field_data

!> \brief Determine if it is time to close the file
!! \return .True. if it is time to close the file
logical function is_time_to_close_file (this, time_step)
Expand Down
4 changes: 2 additions & 2 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ integer function fms_register_diag_field_obj &
fieldptr%buffer_ids = get_diag_field_ids(diag_field_indices)
do i = 1, size(fieldptr%buffer_ids)
call this%FMS_diag_output_buffers(fieldptr%buffer_ids(i))%set_field_id(this%registered_variables)
call this%FMS_diag_output_buffers(fieldptr%buffer_ids(i))%set_yaml_id(diag_field_indices(i))
call this%FMS_diag_output_buffers(fieldptr%buffer_ids(i))%set_yaml_id(fieldptr%buffer_ids(i))
enddo

!> Allocate and initialize member buffer_allocated of this field
Expand Down Expand Up @@ -701,7 +701,7 @@ subroutine fms_diag_do_io(this, is_end_of_run)
if (diag_file%is_time_to_write(model_time)) then
call diag_file%increase_unlim_dimension_level()
call diag_file%write_time_data()
!TODO call diag_file%add_variable_data()
call diag_file%write_field_data(this%FMS_diag_fields, this%FMS_diag_output_buffers)
call diag_file%update_next_write(model_time)
call diag_file%update_current_new_file_freq_index(model_time)
if (diag_file%is_time_to_close_file(model_time)) call diag_file%close_diag_file()
Expand Down
Loading

0 comments on commit 305dac8

Please sign in to comment.