From 0e4a6754db0f3bbbcf8c76f003d0df974928c30f Mon Sep 17 00:00:00 2001 From: Jesse Lentz <42011922+J-Lentz@users.noreply.github.com> Date: Thu, 27 Jul 2023 13:21:57 -0400 Subject: [PATCH 1/9] fix: add fms_stacksize.c to fms_c_src_files in CMakeLists.txt (#1285) --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 270539cd4d..b2db09eace 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,6 +196,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 From c7a70e7de670962a6cc2ee1d0b667966c32bab8d Mon Sep 17 00:00:00 2001 From: Ryan Mulhall <35538242+rem1776@users.noreply.github.com> Date: Fri, 28 Jul 2023 08:35:41 -0400 Subject: [PATCH 2/9] chore: update changelog for 2023.02 release (#1306) --- CHANGELOG.md | 39 +++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 2 +- configure.ac | 2 +- libFMS/Makefile.am | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc9802f8f..32cc50cd27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/CMakeLists.txt b/CMakeLists.txt index b2db09eace..ff75d3cf90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/configure.ac b/configure.ac index 82588b6c84..f7f0fea4aa 100644 --- a/configure.ac +++ b/configure.ac @@ -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], [gfdl.climate.model.info@noaa.gov], [FMS], [https://www.github.com/NOAA-GFDL/FMS]) diff --git a/libFMS/Makefile.am b/libFMS/Makefile.am index e56820e701..db57f86562 100644 --- a/libFMS/Makefile.am +++ b/libFMS/Makefile.am @@ -28,7 +28,7 @@ lib_LTLIBRARIES = libFMS.la # These linker flags specify libtool version info. # See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning # for information regarding incrementing `-version-info`. -libFMS_la_LDFLAGS = -version-info 15:0:0 +libFMS_la_LDFLAGS = -version-info 16:0:0 # Add the convenience libraries to the FMS library. libFMS_la_LIBADD = $(top_builddir)/platform/libplatform.la From c9824565cef3dfa298fb12305f0f317ed60b5169 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:51:08 -0400 Subject: [PATCH 3/9] chore: append dev to version number post-release (#1308) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f7f0fea4aa..74aac31cde 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_PREREQ([2.69]) # Initialize with name, version, and support email address. AC_INIT([GFDL FMS Library], - [2023.02.00], + [2023.02.00-dev], [gfdl.climate.model.info@noaa.gov], [FMS], [https://www.github.com/NOAA-GFDL/FMS]) From 0efc2e5c57d080d16fb3e076e9edc21a860992fa Mon Sep 17 00:00:00 2001 From: Ryan Mulhall <35538242+rem1776@users.noreply.github.com> Date: Fri, 28 Jul 2023 11:58:26 -0400 Subject: [PATCH 4/9] CI: update gnu image and add dockerfile (#1206) --- .github/workflows/Dockerfile.gnu | 68 +++++++++++++++++++ .github/workflows/build_ubuntu_gnu.yml | 37 ---------- .github/workflows/github_autotools_gnu.yml | 39 +++++++++++ ...ntel_pr.yml => github_autotools_intel.yml} | 0 ...ild_cmake_gnu.yml => github_cmake_gnu.yml} | 0 .../{coupler.yml => github_coupler_gnu.yml} | 0 .../{update_docs.yml => github_doc_site.yml} | 0 .../{lint_fms.yml => github_linter.yml} | 0 ...el_tag.yml => parallelworks_am4_intel.yml} | 0 .github/workflows/spack.env | 17 +++++ .github/workflows/version.yml | 4 +- CI.md | 22 +++--- 12 files changed, 141 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/Dockerfile.gnu delete mode 100644 .github/workflows/build_ubuntu_gnu.yml create mode 100644 .github/workflows/github_autotools_gnu.yml rename .github/workflows/{intel_pr.yml => github_autotools_intel.yml} (100%) rename .github/workflows/{build_cmake_gnu.yml => github_cmake_gnu.yml} (100%) rename .github/workflows/{coupler.yml => github_coupler_gnu.yml} (100%) rename .github/workflows/{update_docs.yml => github_doc_site.yml} (100%) rename .github/workflows/{lint_fms.yml => github_linter.yml} (100%) rename .github/workflows/{am4_regression_parallelWorks_intel_tag.yml => parallelworks_am4_intel.yml} (100%) create mode 100644 .github/workflows/spack.env diff --git a/.github/workflows/Dockerfile.gnu b/.github/workflows/Dockerfile.gnu new file mode 100644 index 0000000000..3506c2b9ee --- /dev/null +++ b/.github/workflows/Dockerfile.gnu @@ -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 . +#*********************************************************************** +# 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" diff --git a/.github/workflows/build_ubuntu_gnu.yml b/.github/workflows/build_ubuntu_gnu.yml deleted file mode 100644 index 7c53895b15..0000000000 --- a/.github/workflows/build_ubuntu_gnu.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build libFMS test with autotools - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - defaults: - run: - shell: bash - strategy: - matrix: - conf-flags: [--disable-openmp, --enable-mixed-mode, --disable-setting-flags, --with-mpi=no] - input-flag: [--with-yaml, --enable-test-input=/home/unit_tests_input] - io-flag: [ --enable-deprecated-io, --disable-deprecated-io] - container: - image: noaagfdl/hpc-me.ubuntu-minimal:gnu-input - env: - TEST_VERBOSE: 1 - DISTCHECK_CONFIGURE_FLAGS: "${{ matrix.conf-flags }} ${{ matrix.input-flag }} ${{ matrix.io-flag }}" - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Prepare GNU autoconf for build - run: autoreconf -if - - name: Configure the build - if: ${{ matrix.conf-flags != '--disable-setting-flags' }} - run: ./configure ${DISTCHECK_CONFIGURE_FLAGS} || cat config.log - - name: Configure the build with compiler flags - if: ${{ matrix.conf-flags == '--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-flags != '--with-mpi=no' }} - - name: Build the library (without test suite for serial build) - run: make - if: ${{ matrix.conf-flags == '--with-mpi=no' }} diff --git a/.github/workflows/github_autotools_gnu.yml b/.github/workflows/github_autotools_gnu.yml new file mode 100644 index 0000000000..d25f440959 --- /dev/null +++ b/.github/workflows/github_autotools_gnu.yml @@ -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' }} diff --git a/.github/workflows/intel_pr.yml b/.github/workflows/github_autotools_intel.yml similarity index 100% rename from .github/workflows/intel_pr.yml rename to .github/workflows/github_autotools_intel.yml diff --git a/.github/workflows/build_cmake_gnu.yml b/.github/workflows/github_cmake_gnu.yml similarity index 100% rename from .github/workflows/build_cmake_gnu.yml rename to .github/workflows/github_cmake_gnu.yml diff --git a/.github/workflows/coupler.yml b/.github/workflows/github_coupler_gnu.yml similarity index 100% rename from .github/workflows/coupler.yml rename to .github/workflows/github_coupler_gnu.yml diff --git a/.github/workflows/update_docs.yml b/.github/workflows/github_doc_site.yml similarity index 100% rename from .github/workflows/update_docs.yml rename to .github/workflows/github_doc_site.yml diff --git a/.github/workflows/lint_fms.yml b/.github/workflows/github_linter.yml similarity index 100% rename from .github/workflows/lint_fms.yml rename to .github/workflows/github_linter.yml diff --git a/.github/workflows/am4_regression_parallelWorks_intel_tag.yml b/.github/workflows/parallelworks_am4_intel.yml similarity index 100% rename from .github/workflows/am4_regression_parallelWorks_intel_tag.yml rename to .github/workflows/parallelworks_am4_intel.yml diff --git a/.github/workflows/spack.env b/.github/workflows/spack.env new file mode 100644 index 0000000000..69a3bdcbd0 --- /dev/null +++ b/.github/workflows/spack.env @@ -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 diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 1e71236386..31641aea69 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -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] @@ -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. diff --git a/CI.md b/CI.md index 225b25129b..89b4db256e 100644 --- a/CI.md +++ b/CI.md @@ -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. From 6b699a1526e696c4327fab8a39df584bd6b5c723 Mon Sep 17 00:00:00 2001 From: Lauren Chilutti <60401591+laurenchilutti@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:11:46 -0400 Subject: [PATCH 5/9] fix: test_read_input_nml2 failure and test_diag_update_buffer.F90 seg fault with Cray (#1302) --- test_fms/diag_manager/test_diag_manager2.sh | 4 +++- test_fms/diag_manager/test_diag_update_buffer.F90 | 8 ++++---- test_fms/mpp/test_read_input_nml.F90 | 2 +- test_fms/mpp/test_read_input_nml2.sh | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/test_fms/diag_manager/test_diag_manager2.sh b/test_fms/diag_manager/test_diag_manager2.sh index 747be8e691..a625db4d1e 100755 --- a/test_fms/diag_manager/test_diag_manager2.sh +++ b/test_fms/diag_manager/test_diag_manager2.sh @@ -460,6 +460,7 @@ test_expect_success "Unstructured grid (test $my_test_count)" ' mpirun -n 1 ../test_diag_manager ' +my_test_count=24 # test_diag_manager_time cat <<_EOF > diag_table test_diag_manager @@ -478,6 +479,7 @@ test_diag_manager "test_diag_manager_mod", "sst", "sst", "ocn_end%4yr%2mo%2dy%2hr", "all", .true., "none", 2 _EOF +my_test_count=25 rm -f input.nml && touch input.nml test_expect_success "wildcard filenames (test $my_test_count)" ' mpirun -n 1 ../test_diag_manager_time @@ -501,7 +503,7 @@ test_expect_success "diurnal test (test $my_test_count)" ' mpirun -n 1 ../test_diag_manager_time ' setup_test -my_test_count=`expr $my_test_count + 1` +my_test_count=26 test_expect_success "Test the diag update_buffer (test $my_test_count)" ' mpirun -n 1 ../test_diag_update_buffer ' diff --git a/test_fms/diag_manager/test_diag_update_buffer.F90 b/test_fms/diag_manager/test_diag_update_buffer.F90 index 67de3ec665..9ca4f93198 100644 --- a/test_fms/diag_manager/test_diag_update_buffer.F90 +++ b/test_fms/diag_manager/test_diag_update_buffer.F90 @@ -282,12 +282,12 @@ SUBROUTINE init_field_values (field) DO k = 1, NZ DO j = 1, NY DO i = 1, NX + itemp = get_array_index_from_4D(i,j,k,l,NX,NY,NZ) SELECT TYPE ( field) TYPE IS (real(kind=r4_kind)) - itemp = get_array_index_from_4D(i,j,k,l,NX,NY,NZ) - field(i,j,k,l) = get_array_index_from_4D(i,j,k,l,NX,NY,NZ) -1 TYPE IS (integer(kind=i8_kind)) - field(i,j,k,l) = get_array_index_from_4D(i,j,k,l,NX,NY,NZ) + field(i,j,k,l) = real(itemp, kind=r4_kind) + TYPE IS (integer(kind=i8_kind)) + field(i,j,k,l) = int(itemp, kind=i8_kind) END SELECT END DO END DO diff --git a/test_fms/mpp/test_read_input_nml.F90 b/test_fms/mpp/test_read_input_nml.F90 index 15e6e4697b..9a28e601fe 100644 --- a/test_fms/mpp/test_read_input_nml.F90 +++ b/test_fms/mpp/test_read_input_nml.F90 @@ -68,7 +68,7 @@ program test_read_input_nml n = 1 do read(1, '(A)', iostat=stat) line - if (stat.eq.-1) then + if (is_iostat_end(stat)) then exit end if if (input_nml_file(n).ne.line) then diff --git a/test_fms/mpp/test_read_input_nml2.sh b/test_fms/mpp/test_read_input_nml2.sh index 5750f641b9..5eb411429b 100755 --- a/test_fms/mpp/test_read_input_nml2.sh +++ b/test_fms/mpp/test_read_input_nml2.sh @@ -31,11 +31,11 @@ # create and enter directory for in/output output_dir -touch input.nml touch test_numb_base.nml echo "&test_read_input_nml_nml" > test_numb_base.nml echo "test_numb = 0" >> test_numb_base.nml echo "/" >> test_numb_base.nml +cp test_numb_base.nml input.nml # Test 1 sed "s/test_numb = [0-9]/test_numb = 1/" test_numb_base.nml > test_numb.nml @@ -45,7 +45,7 @@ test_expect_success "read input nml" ' # Test 2 sed "s/test_numb = [0-9]/test_numb = 2/" test_numb_base.nml > test_numb.nml -sed "s/1/2/" $top_srcdir/test_fms/mpp/input_base.nml > input_alternative.nml +cp input.nml input_alternative.nml test_expect_success "read input nml with file name" ' mpirun -n 1 ../test_read_input_nml ' From db92c30d0987fc6e618ed39e25d9d87ca9c44cf4 Mon Sep 17 00:00:00 2001 From: Lauren Chilutti <60401591+laurenchilutti@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:13:06 -0400 Subject: [PATCH 6/9] fix: initialize nest_level pointer in the nest_domain_type declaration to null (#1294) --- mpp/mpp_domains.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpp/mpp_domains.F90 b/mpp/mpp_domains.F90 index b2ccf3540f..02db652bc3 100644 --- a/mpp/mpp_domains.F90 +++ b/mpp/mpp_domains.F90 @@ -452,7 +452,7 @@ module mpp_domains_mod type :: nest_domain_type character(len=NAME_LENGTH) :: name integer :: num_level - integer, pointer :: nest_level(:) !< Added for moving nest functionality + integer, pointer :: nest_level(:) => NULL() !< Added for moving nest functionality type(nest_level_type), pointer :: nest(:) => NULL() integer :: num_nest integer, pointer :: tile_fine(:), tile_coarse(:) From a0e2128f7f54fdff3f8b4d988b6e1ad672c1f442 Mon Sep 17 00:00:00 2001 From: Jesse Lentz <42011922+J-Lentz@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:14:21 -0400 Subject: [PATCH 7/9] fix: sat_vapor_pres test failure with Cray (#1299) --- test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 b/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 index a05fc9811c..7d3ae2d834 100644 --- a/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 +++ b/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 @@ -52,8 +52,8 @@ program test_sat_vap_pressure real(r8_kind), dimension(:), allocatable :: TABLE, DTABLE, TABLE2, DTABLE2, TABLE3, DTABLE3 integer :: io, N -integer, parameter :: nml_unit_var=100 -character(100) :: nml_file +integer :: nml_unit_var +character(*), parameter :: nml_file = 'test_sat_vapor_pres.nml' logical :: test1, test2, test3, test4, test5 NAMELIST / test_sat_vapor_pres_nml/ test1, test2, test3, test4, test5 @@ -64,8 +64,7 @@ program test_sat_vap_pressure call sat_vapor_pres_init() !> compute tables to be used for testing call compute_tables() !> compute tables to generate answers/reference values -nml_file='test_sat_vapor_pres.nml' -open(unit=nml_unit_var, file=trim(nml_file), action='read') +open(newunit=nml_unit_var, file=nml_file, action='read') read(unit=nml_unit_var, nml=test_sat_vapor_pres_nml,iostat=io) close(nml_unit_var) From a13de5b2da49d8ceb8ab2005f61ce43f44ad745b Mon Sep 17 00:00:00 2001 From: Ryan Mulhall <35538242+rem1776@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:15:22 -0400 Subject: [PATCH 8/9] fix: initialize logicals in horiz_interp_type declaration (#1283) --- horiz_interp/horiz_interp_type.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/horiz_interp/horiz_interp_type.F90 b/horiz_interp/horiz_interp_type.F90 index ec2773f860..7f8b300a99 100644 --- a/horiz_interp/horiz_interp_type.F90 +++ b/horiz_interp/horiz_interp_type.F90 @@ -81,7 +81,7 @@ module horiz_interp_type_mod real(kind=r8_kind), dimension(:), allocatable :: area_frac_dst !< area fraction in destination grid. real(kind=r8_kind), dimension(:,:), allocatable :: mask_in real(kind=r8_kind) :: max_src_dist - logical :: is_allocated !< set to true upon field allocation + logical :: is_allocated = .false. !< set to true upon field allocation end type horizInterpReals8_type @@ -108,7 +108,7 @@ module horiz_interp_type_mod real(kind=r4_kind), dimension(:), allocatable :: area_frac_dst !< area fraction in destination grid. real(kind=r4_kind), dimension(:,:), allocatable :: mask_in real(kind=r4_kind) :: max_src_dist - logical :: is_allocated !< set to true upon field allocation + logical :: is_allocated = .false. !< set to true upon field allocation end type horizInterpReals4_type From 01d73fb33e2931679186a782276a483cb5da9328 Mon Sep 17 00:00:00 2001 From: Lauren Chilutti <60401591+laurenchilutti@users.noreply.github.com> Date: Tue, 8 Aug 2023 11:23:09 -0400 Subject: [PATCH 9/9] fix: mpp_check_field fix for test_mpp_domains2 (#1292) --- mpp/include/mpp_domains_misc.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mpp/include/mpp_domains_misc.inc b/mpp/include/mpp_domains_misc.inc index 683ffd18a2..2c8de69237 100644 --- a/mpp/include/mpp_domains_misc.inc +++ b/mpp/include/mpp_domains_misc.inc @@ -419,6 +419,13 @@ end subroutine init_nonblock_type field2(isd:ied, jsd:jed) = field_in(:,:) endif +! allocate field1 on pelist1 +! if field1 is left unallocated, the code will try to access unallocated memory +! when field1 is set to 0 in mpp_redistribute + if(any(pelist1 == pe)) then + allocate(field1(1,1)) + endif + ! broadcast domain call mpp_broadcast_domain(domain1) call mpp_broadcast_domain(domain2) @@ -443,6 +450,8 @@ end subroutine init_nonblock_type if(any(pelist2 == pe)) deallocate(field1, field2) + if(any(pelist1 == pe)) deallocate(field1) + call mpp_sync() return