From 754531f106adb3b35151f1ccdb9f9ba560729eef Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Wed, 6 Dec 2023 12:34:34 -0800 Subject: [PATCH 01/46] get 'uppercase' from mpp_mod in io/module_wrt_grid_comp.F90 --- io/module_wrt_grid_comp.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index b59fe5e45..5ca68f0da 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -29,7 +29,7 @@ module module_wrt_grid_comp use mpi use esmf use fms - use mpp_mod, only : mpp_init ! needed for fms 2023.02 + use mpp_mod, only : mpp_init, uppercase ! needed for fms 2023.02 use write_internal_state use module_fv3_io_def, only : num_pes_fcst, & From 8d3927c3c9539c246f08ec79cf018df8fc06e511 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Wed, 6 Dec 2023 12:34:13 -0800 Subject: [PATCH 02/46] Add GCC-based CI build --- .github/workflows/GCC.yml | 90 +++++++++++++++++++ CMakeLists.txt | 8 +- ci/CMakeLists.txt | 63 +++++++++++++ ci/spack.yaml | 18 ++++ .../stochastic_physics_wrapper.F90 | 0 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/GCC.yml create mode 100644 ci/CMakeLists.txt create mode 100644 ci/spack.yaml rename {stochastic_physics => stochastic_physics_wrapper}/stochastic_physics_wrapper.F90 (100%) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml new file mode 100644 index 000000000..670c10adc --- /dev/null +++ b/.github/workflows/GCC.yml @@ -0,0 +1,90 @@ +# This is a CI workflow for the fv3atm project. +# +# This workflow builds and tests the fv3atm library using GCC, and it tests +# different CMake build options. +# +# Alex Richert, 6 Dec 2023 + +name: GCC +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +jobs: + GCC: + runs-on: ubuntu-latest + + strategy: + matrix: + cmake_opts: ["-D32BIT=ON", "-D32BIT=OFF"] + gcc_ver: ["11"] + mpi: ["mpich"] + + steps: + + - name: install-mpi + run: | + sudo apt-get install lib${{ matrix.mpi }}-dev + + - name: checkout-fv3atm + uses: actions/checkout@v3 + with: + path: ${{ github.workspace }}/fv3atm + submodules: recursive + + - name: cache-spack + id: cache-spack + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-1 + + - name: spack-install + if: steps.cache-spack.outputs.cache-hit != 'true' + run: | + wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip + unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out + # temporary fix (https://github.com/spack/spack/pull/41475) + wget https://raw.githubusercontent.com/AlexanderRichert-NOAA/spack/e9b6ada157a65a486eb1e039fdbfe66c9eebb842/var/spack/repos/builtin/packages/fms/package.py + mv package.py ${GITHUB_WORKSPACE}/spack-develop/var/spack/repos/builtin/packages/fms/package.py + # + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env create gcc${{ matrix.gcc_ver }} ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml + spack env activate gcc${{ matrix.gcc_ver }} + spack compiler find | grep gcc@${{ matrix.gcc_ver }} + spack external find gmake cmake git git-lfs perl python ${{ matrix.mpi }} + spack config add "packages:all:require:['%gcc@${{ matrix.gcc_ver }}']" + spack config add "packages:mpi:require:'${{ matrix.mpi }}'" + spack concretize |& tee ${SPACK_ENV}/log.concretize + spack install -j2 --fail-fast + + - name: cache-save + uses: actions/cache/save@v3 + if: ${{ always() }} + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-1 + + - name: build-fv3atm + run: | + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env activate gcc${{ matrix.gcc_ver }} + spack load $(spack find --format "{name}") + cd ${GITHUB_WORKSPACE}/fv3atm + git clone https://github.com/NOAA-EMC/CMakeModules + git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics + mkdir ${GITHUB_WORKSPACE}/build + cd ${GITHUB_WORKSPACE}/build + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} + make -j2 + + - name: debug-artifacts + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: ccpp_prebuild_logs + path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.* diff --git a/CMakeLists.txt b/CMakeLists.txt index 549738794..f5d86663b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +# Enable CI build & unit testing: +if(BUILD_TESTING) + cmake_minimum_required(VERSION 3.19) + project(fv3atm VERSION 1.0 LANGUAGES C CXX Fortran) + include(ci/CMakeLists.txt) +endif() ############################################################################### ### CCPP @@ -81,7 +87,7 @@ add_library(fv3atm fv3_cap.F90 module_fv3_config.F90 module_fcst_grid_comp.F90 - stochastic_physics/stochastic_physics_wrapper.F90 + stochastic_physics_wrapper/stochastic_physics_wrapper.F90 cpl/module_block_data.F90 cpl/module_cplfields.F90 cpl/module_cap_cpl.F90 diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt new file mode 100644 index 000000000..0bfe7680e --- /dev/null +++ b/ci/CMakeLists.txt @@ -0,0 +1,63 @@ +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/Modules) + +if(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0.0) + message(FATAL_ERROR "GNU Compiler >= 9 is required") + endif() + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ggdb -fbacktrace -cpp -fcray-pointer -ffree-line-length-none -fno-range-check") + + if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") + endif() + + if(NOT 32BIT) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8") + endif() +elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte -qno-opt-dynamic-align") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qno-opt-dynamic-align -sox -fp-model source") + set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -qoverride-limits") + set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fp-model consistent") + set(CMAKE_C_FLAGS_RELEASE "-O2 -debug minimal") + + if(NOT 32BIT) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -real-size 64") + endif() +endif() + +set(32BIT OFF CACHE BOOL "Enable 32BIT (single precision arithmetic in dycore and fast physics)") +set(CCPP_32BIT OFF CACHE BOOL "Enable CCPP_32BIT (single precision arithmetic in slow physics)") +set(INLINE_POST ON CACHE BOOL "Enable inline post") +set(MULTI_GASES OFF CACHE BOOL "Enable MULTI_GASES") +set(MOVING_NEST OFF CACHE BOOL "Enable moving nest code") +set(OPENMP ON CACHE BOOL "Enable OpenMP threading") +set(PARALLEL_NETCDF OFF CACHE BOOL "Enable parallel NetCDF") + +message("32BIT ............ ${32BIT}") +message("CCPP_32BIT ....... ${CCPP_32BIT}") +message("INLINE_POST ...... ${INLINE_POST}") +message("MULTI_GASES ...... ${MULTI_GASES}") +message("MOVING_NEST ...... ${MOVING_NEST}") +message("OPENMP ........... ${OPENMP}") +message("PARALLEL_NETCDF .. ${PARALLEL_NETCDF}") + +find_package(MPI REQUIRED) +if(OPENMP) + find_package(OpenMP REQUIRED) +endif() + +find_package(NetCDF 4.7.4 REQUIRED C Fortran) +find_package(ESMF 8.3.0 MODULE REQUIRED) +find_package(FMS 2022.04 REQUIRED COMPONENTS R4 R8) +if(32BIT) + add_library(fms ALIAS FMS::fms_r4) +else() + add_library(fms ALIAS FMS::fms_r8) +endif() +find_package(bacio 2.4.0 REQUIRED) +find_package(sp 2.3.3 REQUIRED) +find_package(w3emc 2.9.2 REQUIRED) + +find_package(Python 3.6 REQUIRED COMPONENTS Interpreter) + +add_subdirectory(stochastic_physics) diff --git a/ci/spack.yaml b/ci/spack.yaml new file mode 100644 index 000000000..4c183f80e --- /dev/null +++ b/ci/spack.yaml @@ -0,0 +1,18 @@ +spack: + specs: + - w3emc@2.10.0 precision=4,d,8 + - ip@develop precision=4,d,8 + - sp@2.4.0 precision=4,d,8 + - bacio@2.4.1 + - upp@develop + - esmf@8.4.2 + - fms@2023.04 +gfs_phys +openmp +pic +quad_precision +deprecated_io constants=GFS precision=32,64 + - netcdf-c ~blosc + view: false + concretizer: + unify: true + packages: + mpich: + require: ['~libxml2 ~hwloc ~pci'] + yaksa: + buildable: false diff --git a/stochastic_physics/stochastic_physics_wrapper.F90 b/stochastic_physics_wrapper/stochastic_physics_wrapper.F90 similarity index 100% rename from stochastic_physics/stochastic_physics_wrapper.F90 rename to stochastic_physics_wrapper/stochastic_physics_wrapper.F90 From 8c1fac884c86a487956cff80bde3e51b979f378d Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Wed, 6 Dec 2023 18:53:02 -0800 Subject: [PATCH 03/46] note dep build time in GCC CI --- .github/workflows/GCC.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 670c10adc..2ecb122b7 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -43,6 +43,7 @@ jobs: path: ${{ github.workspace }}/spack-develop key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-1 + # Building dependencies takes 40+ min - name: spack-install if: steps.cache-spack.outputs.cache-hit != 'true' run: | From 435bccde9f65085ac3a1f2146907357cc221790f Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:28:50 -0800 Subject: [PATCH 04/46] Update CMakeLists.txt --- ci/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index 0bfe7680e..48b356914 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -1,3 +1,8 @@ +# This file is used by fv3atm's root CMakeLists.txt when BUILD_TESTING=ON. It is +# used for CI runs and is based on the ufs-weather-model root CMakeLists.txt. It +# cannot be built directly, and should not be used for compiling for general R&D +# or operations. + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/Modules) if(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") From ca53742ce1588ce908f28bd2ccd4bb321ad33e9d Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:41:52 -0800 Subject: [PATCH 05/46] Update spack.yaml --- ci/spack.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ci/spack.yaml b/ci/spack.yaml index 4c183f80e..3009df05a 100644 --- a/ci/spack.yaml +++ b/ci/spack.yaml @@ -1,3 +1,12 @@ +# This file is used in the CI to define the libraries needed to build fv3atm. It +# is used by the 'spack env create' command to generate a Spack environment. It +# is generally preferred to avoid defining settings here that are not shared +# across CI workflows, such as requiring the use of a specific compiler. Any +# such modifications should be done in the appropriate CI workflow using the +# 'spack config add' command, or with search-and-replace. +# WARNING: Changing this file will automatically cause the cached Spack builds +# in GitHub Actions to be regenerated, which takes a considerable amount of +# time. spack: specs: - w3emc@2.10.0 precision=4,d,8 @@ -7,12 +16,12 @@ spack: - upp@develop - esmf@8.4.2 - fms@2023.04 +gfs_phys +openmp +pic +quad_precision +deprecated_io constants=GFS precision=32,64 - - netcdf-c ~blosc + - netcdf-c@4.9.2 ~blosc view: false concretizer: unify: true packages: mpich: - require: ['~libxml2 ~hwloc ~pci'] + require: ['~libxml2 ~hwloc ~pci'] # minimize unneeded dependencies yaksa: - buildable: false + buildable: false # minimize unneeded dependencies From 08d8e10a1d3c58249c1671ec133b560ba62651ff Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:54:00 -0800 Subject: [PATCH 06/46] Update CMakeLists.txt --- ci/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index 48b356914..f64bceb8a 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -2,6 +2,8 @@ # used for CI runs and is based on the ufs-weather-model root CMakeLists.txt. It # cannot be built directly, and should not be used for compiling for general R&D # or operations. +# +# Alex Richert, 6 Dec 2023 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/Modules) From 06d17f720234adefa05b4ae96bd173d280ff03cd Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:54:20 -0800 Subject: [PATCH 07/46] Update spack.yaml --- ci/spack.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/spack.yaml b/ci/spack.yaml index 3009df05a..400b7e06b 100644 --- a/ci/spack.yaml +++ b/ci/spack.yaml @@ -7,6 +7,8 @@ # WARNING: Changing this file will automatically cause the cached Spack builds # in GitHub Actions to be regenerated, which takes a considerable amount of # time. +# +# Alex Richert, 6 Dec 2023 spack: specs: - w3emc@2.10.0 precision=4,d,8 From ca9476729456a854081c78b90586220df8e8ab7f Mon Sep 17 00:00:00 2001 From: Brian Curtis Date: Mon, 11 Dec 2023 19:11:26 +0000 Subject: [PATCH 08/46] switch to use fms implementation of mpp --- io/module_wrt_grid_comp.F90 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index b59fe5e45..10df8b51d 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -29,7 +29,6 @@ module module_wrt_grid_comp use mpi use esmf use fms - use mpp_mod, only : mpp_init ! needed for fms 2023.02 use write_internal_state use module_fv3_io_def, only : num_pes_fcst, & @@ -254,7 +253,6 @@ subroutine wrt_initialize_p1(wrt_comp, imp_state_write, exp_state_write, clock, lprnt = lead_write_task == wrt_int_state%mype call fms_init(wrt_mpi_comm) - call mpp_init() ! print *,'in wrt, lead_write_task=', & ! lead_write_task,'last_write_task=',last_write_task, & @@ -1337,7 +1335,7 @@ subroutine wrt_initialize_p1(wrt_comp, imp_state_write, exp_state_write, clock, ! save calendar_type (as integer) for use in 'coupler.res' if (index(trim(attNameList(i)),'time:calendar') > 0) then - select case( uppercase(trim(valueS)) ) + select case( fms_mpp_uppercase(trim(valueS)) ) case( 'JULIAN' ) calendar_type = JULIAN case( 'GREGORIAN' ) @@ -1349,7 +1347,7 @@ subroutine wrt_initialize_p1(wrt_comp, imp_state_write, exp_state_write, clock, case( 'NO_CALENDAR' ) calendar_type = NO_CALENDAR case default - call mpp_error ( FATAL, 'fcst_initialize: calendar must be one of '// & + call fms_mpp_error ( FATAL, 'fcst_initialize: calendar must be one of '// & 'JULIAN|GREGORIAN|NOLEAP|THIRTY_DAY|NO_CALENDAR.' ) end select endif From 01bb3e28eca97bd43c66c82d513c10b993803bb3 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 4 Jan 2024 08:36:37 -0800 Subject: [PATCH 09/46] revert stoch phys name change --- CMakeLists.txt | 2 +- .../stochastic_physics_wrapper.F90 | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {stochastic_physics_wrapper => stochastic_physics}/stochastic_physics_wrapper.F90 (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5d86663b..bd40d09df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ add_library(fv3atm fv3_cap.F90 module_fv3_config.F90 module_fcst_grid_comp.F90 - stochastic_physics_wrapper/stochastic_physics_wrapper.F90 + stochastic_physics/stochastic_physics_wrapper.F90 cpl/module_block_data.F90 cpl/module_cplfields.F90 cpl/module_cap_cpl.F90 diff --git a/stochastic_physics_wrapper/stochastic_physics_wrapper.F90 b/stochastic_physics/stochastic_physics_wrapper.F90 similarity index 100% rename from stochastic_physics_wrapper/stochastic_physics_wrapper.F90 rename to stochastic_physics/stochastic_physics_wrapper.F90 From d0a7c24ed3d88eaa448712eeaee92230bdce5b88 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:25:47 -0800 Subject: [PATCH 10/46] Update GCC.yml (remove fms recipe workaround) --- .github/workflows/GCC.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 2ecb122b7..c44711a1d 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -49,10 +49,6 @@ jobs: run: | wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out - # temporary fix (https://github.com/spack/spack/pull/41475) - wget https://raw.githubusercontent.com/AlexanderRichert-NOAA/spack/e9b6ada157a65a486eb1e039fdbfe66c9eebb842/var/spack/repos/builtin/packages/fms/package.py - mv package.py ${GITHUB_WORKSPACE}/spack-develop/var/spack/repos/builtin/packages/fms/package.py - # . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh spack env create gcc${{ matrix.gcc_ver }} ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml spack env activate gcc${{ matrix.gcc_ver }} From b73d8046bd744f1d897096c27184451ad047f53d Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 4 Jan 2024 12:18:46 -0800 Subject: [PATCH 11/46] rename stochastic_physics repo dir->stochastic_physics_repo --- .github/workflows/GCC.yml | 2 +- ci/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index c44711a1d..a5f058340 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -73,7 +73,7 @@ jobs: spack load $(spack find --format "{name}") cd ${GITHUB_WORKSPACE}/fv3atm git clone https://github.com/NOAA-EMC/CMakeModules - git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics + git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo mkdir ${GITHUB_WORKSPACE}/build cd ${GITHUB_WORKSPACE}/build cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index f64bceb8a..71412b3af 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -67,4 +67,4 @@ find_package(w3emc 2.9.2 REQUIRED) find_package(Python 3.6 REQUIRED COMPONENTS Interpreter) -add_subdirectory(stochastic_physics) +add_subdirectory(stochastic_physics_repo) From 435f4d08f2017e4a44251a907b5d5052519487b0 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 4 Jan 2024 12:53:18 -0800 Subject: [PATCH 12/46] remove apt mpi installation --- .github/workflows/GCC.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index a5f058340..a5f126e49 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -26,10 +26,6 @@ jobs: steps: - - name: install-mpi - run: | - sudo apt-get install lib${{ matrix.mpi }}-dev - - name: checkout-fv3atm uses: actions/checkout@v3 with: From e993d1596395a37987d2f644d3f2c03a03862fe8 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 4 Jan 2024 13:02:29 -0800 Subject: [PATCH 13/46] increment cache key --- .github/workflows/GCC.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index a5f126e49..3fb022bae 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -37,7 +37,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ github.workspace }}/spack-develop - key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-1 + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-2 # Building dependencies takes 40+ min - name: spack-install @@ -60,7 +60,7 @@ jobs: if: ${{ always() }} with: path: ${{ github.workspace }}/spack-develop - key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-1 + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-2 - name: build-fv3atm run: | From 7d520aa3a66b427abd1a5e0ecadb0978b86e52fc Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 11 Jan 2024 11:13:32 -0800 Subject: [PATCH 14/46] Add CI testing w/CTest & gcovr, + initial unit tests Create separate developer.yml CI workflow --- .github/workflows/GCC.yml | 13 ++-- .github/workflows/developer.yml | 99 ++++++++++++++++++++++++++++++ CMakeLists.txt | 5 ++ ci/CMakeLists.txt | 1 + tests/CMakeLists.txt | 29 +++++++++ tests/data/post_namelist.nml | 20 ++++++ tests/data/post_namelist_empty.nml | 4 ++ tests/test_fv3_io_def.F90 | 48 +++++++++++++++ tests/test_post_nems_routines.F90 | 54 ++++++++++++++++ 9 files changed, 269 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/developer.yml create mode 100644 tests/CMakeLists.txt create mode 100644 tests/data/post_namelist.nml create mode 100644 tests/data/post_namelist_empty.nml create mode 100644 tests/test_fv3_io_def.F90 create mode 100644 tests/test_post_nems_routines.F90 diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 3fb022bae..e884117b8 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -70,14 +70,19 @@ jobs: cd ${GITHUB_WORKSPACE}/fv3atm git clone https://github.com/NOAA-EMC/CMakeModules git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo - mkdir ${GITHUB_WORKSPACE}/build - cd ${GITHUB_WORKSPACE}/build + mkdir ${GITHUB_WORKSPACE}/fv3atm/build + cd ${GITHUB_WORKSPACE}/fv3atm/build cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} make -j2 + - name: run-tests + run: | + cd $GITHUB_WORKSPACE/build + ctest -j2 --output-on-failure --rerun-failed + - name: debug-artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ failure() }} with: name: ccpp_prebuild_logs - path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.* + path: ${{ github.workspace }}/fv3atm/build/ccpp/ccpp_prebuild.* diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml new file mode 100644 index 000000000..d9c93bfdb --- /dev/null +++ b/.github/workflows/developer.yml @@ -0,0 +1,99 @@ +# This is a CI workflow for the fv3atm project. +# +# This workflow checks code coverage and will build documentation. +# +# Alex Richert, 11 Jan 2024 + +name: developer +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +jobs: + developer: + runs-on: ubuntu-latest + + steps: + + - name: apt-install + run: | + sudo apt install gcovr + + - name: checkout-fv3atm + uses: actions/checkout@v3 + with: + path: ${{ github.workspace }}/fv3atm + submodules: recursive + + - name: cache-spack + id: cache-spack + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 + + # Building dependencies takes 40+ min + - name: spack-install + if: steps.cache-spack.outputs.cache-hit != 'true' + run: | + wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip + unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env create gcc11 ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml + spack env activate gcc11 + spack compiler find | grep gcc@11 + spack external find gmake cmake git git-lfs perl python mpich + spack config add "packages:all:require:['%gcc@11']" + spack config add "packages:mpi:require:'mpich'" + spack concretize |& tee ${SPACK_ENV}/log.concretize + spack install -j2 --fail-fast + + - name: cache-save + uses: actions/cache/save@v3 + if: ${{ always() }} + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 + + - name: build-fv3atm + run: | + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env activate gcc11 + spack load $(spack find --format "{name}") + cd ${GITHUB_WORKSPACE}/fv3atm + git clone https://github.com/NOAA-EMC/CMakeModules + git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo + mkdir ${GITHUB_WORKSPACE}/fv3atm/build + cd ${GITHUB_WORKSPACE}/fv3atm/build + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON -DCMAKE_Fortran_FLAGS="-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0" + make -j2 + + - name: run-tests + run: | + cd $GITHUB_WORKSPACE/fv3atm/build + ctest -j2 --output-on-failure --rerun-failed + + - name: get-test-coverage + run: | + f=${GITHUB_WORKSPACE}/fv3atm + cd $f/build + gcovr -r .. -v --html-details --exclude ${f}/tests --exclude $f/stochastic_physics_repo --exclude $f/build/ccpp --exclude $f/ccpp/physics --exclude $f/ccpp/framework --exclude $f/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html + + - name: upload-test-coverage + uses: actions/upload-artifact@v4 + with: + name: test-coverage-fv3atm-${{ github.sha }} + path: | + ${{ github.workspace }}/fv3atm/build/*.html + ${{ github.workspace }}/fv3atm/build/*.css + + - name: debug-artifacts + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: ccpp_prebuild_logs + path: ${{ github.workspace }}/fv3atm/build/ccpp/ccpp_prebuild.* diff --git a/CMakeLists.txt b/CMakeLists.txt index bd40d09df..731a8b403 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,11 @@ if(OPENMP) target_link_libraries(fv3atm PUBLIC OpenMP::OpenMP_Fortran) endif() +if(BUILD_TESTING) + include(CTest) + add_subdirectory(tests) +endif() + ############################################################################### ### Install ############################################################################### diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index 71412b3af..b85fead2d 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -64,6 +64,7 @@ endif() find_package(bacio 2.4.0 REQUIRED) find_package(sp 2.3.3 REQUIRED) find_package(w3emc 2.9.2 REQUIRED) +find_package(PIO REQUIRED) find_package(Python 3.6 REQUIRED COMPONENTS Interpreter) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000..95177fdc8 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,29 @@ +# This file sets up CTest unit tests for fv3atm. +# +# Alex Richert, Jan 2024 + +# Stage test data +execute_process(COMMAND cmake -E create_symlink + "${CMAKE_CURRENT_SOURCE_DIR}/data" + "${CMAKE_CURRENT_BINARY_DIR}/data" + ) + +function(add_fv3atm_mpi_test TESTNAME) + add_executable(${TESTNAME} ${TESTNAME}.F90) + target_link_libraries(${TESTNAME} PRIVATE fv3atm MPI::MPI_Fortran PIO::PIO_Fortran) + add_test(${TESTNAME} ${MPIEXEC_EXECUTABLE} -n 2 ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}) +endfunction() + +function(add_fv3atm_serial_test TESTNAME) + add_executable(${TESTNAME} ${TESTNAME}.F90) + target_link_libraries(${TESTNAME} PRIVATE fv3atm MPI::MPI_Fortran PIO::PIO_Fortran) + add_test(${TESTNAME} ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}) +endfunction() + +#foreach(testname test_write_netcdf) +# add_fv3atm_mpi_test(${testname}) +#endforeach() + +foreach(testname test_fv3_io_def test_post_nems_routines) + add_fv3atm_serial_test(${testname}) +endforeach() diff --git a/tests/data/post_namelist.nml b/tests/data/post_namelist.nml new file mode 100644 index 000000000..30425600a --- /dev/null +++ b/tests/data/post_namelist.nml @@ -0,0 +1,20 @@ +&model_inputs + modelname = "DMMY" + submodelname = "SUBM" +/ +&nampgb + kpo = 5 + kth = 7 + kpv = 9 + po = 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 + th = 1.0 2.0 3.0 4.0 5.0 6.0 7.0 + pv = 11. 12. 13. 14. 15. 16. 17. 18. 19. + hyb_sigp = F + d3d_on = T + gocart_on = T + popascal = T + rdaod = T + nasa_on = T + gccpp_on = T + d2d_chem = T +/ diff --git a/tests/data/post_namelist_empty.nml b/tests/data/post_namelist_empty.nml new file mode 100644 index 000000000..4efa4ecd5 --- /dev/null +++ b/tests/data/post_namelist_empty.nml @@ -0,0 +1,4 @@ +&model_inputs +/ +&nampgb +/ diff --git a/tests/test_fv3_io_def.F90 b/tests/test_fv3_io_def.F90 new file mode 100644 index 000000000..ff9ea6f67 --- /dev/null +++ b/tests/test_fv3_io_def.F90 @@ -0,0 +1,48 @@ +! This program provides a unit test to verify that the variables in +! module_fv3_io_def.F90 are accessible. + +program test_fv3_io_def + + use module_fv3_io_def + + implicit none + + integer myint + + num_pes_fcst = 2 + if (num_pes_fcst .ne. 2) stop 1 + wrttasks_per_group = 4 + if (wrttasks_per_group .ne. 4) stop 1 + write_groups = 8 + if (write_groups .ne. 8) stop 1 + n_group = 16 + if (n_group .ne. 16) stop 1 + num_files = 32 + if (num_files .ne. 32) stop 1 + nbdlphys = 64 + if (nbdlphys .ne. 64) stop 1 + iau_offset = 128 + if (iau_offset .ne. 128) stop 1 + + lflname_fulltime = .true. + if (.not. lflname_fulltime) stop 2 + time_unlimited = .true. + if (.not. time_unlimited) stop 2 + + allocate(filename_base(1)) + filename_base(1)="abc" +! output_file="abc" + +! integer,dimension(:),allocatable :: lead_wrttask, last_wrttask +! +! character(len=esmf_maxstr),dimension(:),allocatable :: output_grid +! integer,dimension(:),allocatable :: imo,jmo +! real,dimension(:),allocatable :: cen_lon, cen_lat +! real,dimension(:),allocatable :: lon1, lat1, lon2, lat2, dlon, dlat +! real,dimension(:),allocatable :: stdlat1, stdlat2, dx, dy +! integer,dimension(:),allocatable :: ideflate, quantize_nsd, zstandard_level +! character(len=esmf_maxstr),dimension(:),allocatable :: quantize_mode +! integer,dimension(:),allocatable :: ichunk2d, jchunk2d, ichunk3d, jchunk3d, kchunk3d + + +end program test_fv3_io_def diff --git a/tests/test_post_nems_routines.F90 b/tests/test_post_nems_routines.F90 new file mode 100644 index 000000000..95dcbf577 --- /dev/null +++ b/tests/test_post_nems_routines.F90 @@ -0,0 +1,54 @@ +! This program provides unit testing for the subroutines in io/post_nems_routines.F90 +! +! Alex Richert, 11 Jan 2024 +program test_post_nems_routines + + use ctlblk_mod, only : komax,hyb_sigp,d3d_on,gocart_on, & + rdaod,nasa_on,gccpp_on,d2d_chem,modelname,submodelname, lsm + + implicit none + + character (len=*), parameter :: post_namelist_empty="data/post_namelist_empty.nml" + character (len=*), parameter :: post_namelist="data/post_namelist.nml" + integer :: kpo,kth,kpv + real(4),dimension(komax) :: po,th,pv + logical :: popascal + real, parameter :: tini=tiny(1.0) + + ! Verify default settings by using empty nml file + call read_postnmlt(kpo,kth,kpv,po,th,pv,trim(post_namelist_empty)) + if (kpo.ne.0) stop 1 + if (kth.ne.6) stop 2 + if (kpv.ne.8) stop 3 + if (.not.all(po.eq.0.0)) stop 4 + if (any(abs(th(1:6)-(/310.,320.,350.,450.,550.,650./)).gt.tini)) stop 5 + if (any(abs(pv(1:8)-(/0.5,-0.5,1.0,-1.0,1.5,-1.5,2.0,-2.0/)).gt.tini)) stop 6 + if (.not.hyb_sigp) stop 7 + if (d3d_on) stop 8 + if (gocart_on) stop 9 + if (lsm.ne.46) stop 10 ! 'lsm' is determined by 'popascal' + if (rdaod) stop 11 + if (nasa_on) stop 12 + if (gccpp_on) stop 13 + if (d2d_chem) stop 14 + + ! Now use fully populated nml file + call read_postnmlt(kpo,kth,kpv,po,th,pv,trim(post_namelist)) + if (kpo.ne.5) stop 101 + if (kth.ne.7) stop 102 + if (kpv.ne.9) stop 103 + if (.not.all(po.eq.1.0)) stop 104 + if (any(abs(th(1:7)-(/1.,2.,3.,4.,5.,6.,7./)).gt.tini)) stop 105 + if (any(abs(pv(1:9)-(/11.,12.,13.,14.,15.,16.,17.,18.,19./)).gt.tini)) stop 106 + if (hyb_sigp) stop 107 + if (.not.d3d_on) stop 108 + if (.not.gocart_on) stop 109 + if (lsm.ne.5) stop 110 ! 'lsm' is determined by 'popascal' + if (.not.rdaod) stop 111 + if (.not.nasa_on) stop 112 + if (.not.gccpp_on) stop 113 + if (.not.d2d_chem) stop 114 + if (trim(modelname).ne."DMMY") stop 115 + if (trim(submodelname).ne."SUBM") stop 116 + +end program test_post_nems_routines From f4434a288efbe9260b8ae259f9724c1dd75fe0cd Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 11 Jan 2024 13:39:10 -0800 Subject: [PATCH 15/46] Update PR template --- .github/pull_request_template.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e4d67029f..bdedc0ffc 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -35,3 +35,8 @@ Do PRs in upstream repositories need to be merged first? If so add the "waiting for other repos" label and list the upstream PRs - waiting on noaa-emc/nems/pull/ - waiting on noaa-emc/fv3atm/pull/ + +# Requirements +- [ ] Any and all new code in this PR is tested by at least one unit test +- [ ] Any and all new code in this PR includes Doxygen documentation +- [ ] Any and all new code in this PR does not add new compilation warnings (check CI output) From f6cca88135245fa5cb73939b812be353172c7683 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 12 Jan 2024 16:17:12 -0800 Subject: [PATCH 16/46] complete test_fv3_io_def.F90 --- tests/test_fv3_io_def.F90 | 125 +++++++++++++++++++++++++++++++------- 1 file changed, 103 insertions(+), 22 deletions(-) diff --git a/tests/test_fv3_io_def.F90 b/tests/test_fv3_io_def.F90 index ff9ea6f67..0dc494fa8 100644 --- a/tests/test_fv3_io_def.F90 +++ b/tests/test_fv3_io_def.F90 @@ -7,42 +7,123 @@ program test_fv3_io_def implicit none - integer myint - num_pes_fcst = 2 if (num_pes_fcst .ne. 2) stop 1 wrttasks_per_group = 4 - if (wrttasks_per_group .ne. 4) stop 1 + if (wrttasks_per_group .ne. 4) stop 2 write_groups = 8 - if (write_groups .ne. 8) stop 1 + if (write_groups .ne. 8) stop 3 n_group = 16 - if (n_group .ne. 16) stop 1 + if (n_group .ne. 16) stop 4 num_files = 32 - if (num_files .ne. 32) stop 1 + if (num_files .ne. 32) stop 5 nbdlphys = 64 - if (nbdlphys .ne. 64) stop 1 + if (nbdlphys .ne. 64) stop 6 iau_offset = 128 - if (iau_offset .ne. 128) stop 1 + if (iau_offset .ne. 128) stop 7 lflname_fulltime = .true. - if (.not. lflname_fulltime) stop 2 + if (.not. lflname_fulltime) stop 8 time_unlimited = .true. - if (.not. time_unlimited) stop 2 + if (.not. time_unlimited) stop 9 allocate(filename_base(1)) filename_base(1)="abc" -! output_file="abc" - -! integer,dimension(:),allocatable :: lead_wrttask, last_wrttask -! -! character(len=esmf_maxstr),dimension(:),allocatable :: output_grid -! integer,dimension(:),allocatable :: imo,jmo -! real,dimension(:),allocatable :: cen_lon, cen_lat -! real,dimension(:),allocatable :: lon1, lat1, lon2, lat2, dlon, dlat -! real,dimension(:),allocatable :: stdlat1, stdlat2, dx, dy -! integer,dimension(:),allocatable :: ideflate, quantize_nsd, zstandard_level -! character(len=esmf_maxstr),dimension(:),allocatable :: quantize_mode -! integer,dimension(:),allocatable :: ichunk2d, jchunk2d, ichunk3d, jchunk3d, kchunk3d + if (trim(filename_base(1)).ne."abc") stop 10 + allocate(output_file(1)) + output_file(1)="def" + if (trim(output_file(1)).ne."def") stop 11 + + allocate(lead_wrttask(10)) + lead_wrttask = 42 + if (.not.all(lead_wrttask(1:10).eq.42)) stop 12 + allocate(last_wrttask(12)) + last_wrttask = 43 + if (.not.all(last_wrttask(1:12).eq.43)) stop 13 + + allocate(output_grid(2)) + output_grid(1) = "ABC" + output_grid(2) = "DEF" + if (trim(output_grid(1)).ne."ABC") stop 14 + if (trim(output_grid(2)).ne."DEF") stop 15 + + allocate(imo(6)) + imo(1:6) = 17 + if (.not.all(imo.eq.17)) stop 16 + allocate(jmo(6)) + jmo(1:6) = 18 + if (.not.all(jmo.eq.18)) stop 17 + + allocate(cen_lon(8)) + cen_lon(1:8) = 2.1 + if(.not.all(cen_lon.eq.2.1)) stop 18 + allocate(cen_lat(8)) + cen_lat(1:8) = 3.2 + if(.not.all(cen_lat.eq.3.2)) stop 19 + + allocate(lon1(10)) + lon1(1:10) = 4.3 + if(.not.all(lon1.eq.4.3)) stop 20 + allocate(lat1(10)) + lat1(1:10) = 5.4 + if(.not.all(lat1.eq.5.4)) stop 21 + + allocate(lon2(12)) + lon2(1:12) = 6.5 + if(.not.all(lon2.eq.6.5)) stop 22 + allocate(lat2(12)) + lat2(1:12) = 7.6 + if(.not.all(lat2.eq.7.6)) stop 23 + + allocate(dlon(15)) + dlon(1:15) = 8.7 + if(.not.all(dlon.eq.8.7)) stop 24 + allocate(dlat(15)) + dlat(1:15) = 9.8 + if(.not.all(dlat.eq.9.8)) stop 25 + + allocate(stdlat1(18)) + stdlat1(1:18) = 10.9 + if(.not.all(stdlat1.eq.10.9)) stop 26 + allocate(stdlat2(18)) + stdlat2(1:18) = 11.0 + if(.not.all(stdlat2.eq.11.0)) stop 27 + + allocate(dx(20)) + dx(1:20) = 12.1 + if(.not.all(dx.eq.12.1)) stop 28 + allocate(dy(20)) + dy(1:20) = 13.2 + if(.not.all(dy.eq.13.2)) stop 29 + + allocate(ideflate(25)) + ideflate(1:25) = 123 + if(.not.all(ideflate.eq.123)) stop 30 + allocate(quantize_nsd(25)) + quantize_nsd(1:25) = 123 + if(.not.all(quantize_nsd.eq.123)) stop 31 + allocate(zstandard_level(25)) + zstandard_level(1:25) = 123 + if(.not.all(zstandard_level.eq.123)) stop 32 + + allocate(quantize_mode(5)) + quantize_mode(1:5) = "xyz" + if(.not.trim(quantize_mode(5)).eq."xyz") stop 33 + allocate(ichunk2d(30)) + ichunk2d(1:30) = 50 + if(.not.all(ichunk2d.eq.50)) stop 34 + allocate(jchunk2d(30)) + jchunk2d(1:30) = 51 + if(.not.all(jchunk2d.eq.51)) stop 35 + allocate(ichunk3d(30)) + ichunk3d(1:30) = 52 + if(.not.all(ichunk3d.eq.52)) stop 36 + allocate(jchunk3d(30)) + jchunk3d(1:30) = 53 + if(.not.all(jchunk3d.eq.53)) stop 37 + allocate(kchunk3d(30)) + kchunk3d(1:30) = 54 + if(.not.all(kchunk3d.eq.54)) stop 38 end program test_fv3_io_def From bb31535cf1818de9fbabf3f33b887d2a8bb75d7e Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:24:44 -0800 Subject: [PATCH 17/46] Update pull_request_template.md --- .github/pull_request_template.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bdedc0ffc..b6220c6e3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -36,7 +36,7 @@ If so add the "waiting for other repos" label and list the upstream PRs - waiting on noaa-emc/nems/pull/ - waiting on noaa-emc/fv3atm/pull/ -# Requirements -- [ ] Any and all new code in this PR is tested by at least one unit test -- [ ] Any and all new code in this PR includes Doxygen documentation -- [ ] Any and all new code in this PR does not add new compilation warnings (check CI output) +# Requirements before merging +- [ ] All new code in this PR is tested by at least one unit test +- [ ] All new code in this PR includes Doxygen documentation +- [ ] All new code in this PR does not add new compilation warnings (check CI output) From aaf587b97c17ff45da3bf65d3a960c60cc576219 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 12 Jan 2024 16:41:50 -0800 Subject: [PATCH 18/46] fix testrun build path in GCC.yml --- .github/workflows/GCC.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index e884117b8..1994d3daa 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -77,7 +77,7 @@ jobs: - name: run-tests run: | - cd $GITHUB_WORKSPACE/build + cd $GITHUB_WORKSPACE/fv3atm/build ctest -j2 --output-on-failure --rerun-failed - name: debug-artifacts From a309fb82fb688c3a4bbc61cf6cc01b3758939c56 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 12 Jan 2024 16:43:46 -0800 Subject: [PATCH 19/46] catch one more case in post_nems_routine unit test --- tests/data/post_namelist.nml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data/post_namelist.nml b/tests/data/post_namelist.nml index 30425600a..262d229c7 100644 --- a/tests/data/post_namelist.nml +++ b/tests/data/post_namelist.nml @@ -6,7 +6,7 @@ kpo = 5 kth = 7 kpv = 9 - po = 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 + po = 0.5 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 th = 1.0 2.0 3.0 4.0 5.0 6.0 7.0 pv = 11. 12. 13. 14. 15. 16. 17. 18. 19. hyb_sigp = F From 4360aeef96de687f85ffd57b92c031a749b237fc Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 12 Jan 2024 16:58:19 -0800 Subject: [PATCH 20/46] fix test_post_nems_routines.F90 --- tests/test_post_nems_routines.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_post_nems_routines.F90 b/tests/test_post_nems_routines.F90 index 95dcbf577..371c3bc8d 100644 --- a/tests/test_post_nems_routines.F90 +++ b/tests/test_post_nems_routines.F90 @@ -20,7 +20,7 @@ program test_post_nems_routines if (kpo.ne.0) stop 1 if (kth.ne.6) stop 2 if (kpv.ne.8) stop 3 - if (.not.all(po.eq.0.0)) stop 4 + if (any(po.ne.0.0)) stop 4 if (any(abs(th(1:6)-(/310.,320.,350.,450.,550.,650./)).gt.tini)) stop 5 if (any(abs(pv(1:8)-(/0.5,-0.5,1.0,-1.0,1.5,-1.5,2.0,-2.0/)).gt.tini)) stop 6 if (.not.hyb_sigp) stop 7 @@ -37,7 +37,8 @@ program test_post_nems_routines if (kpo.ne.5) stop 101 if (kth.ne.7) stop 102 if (kpv.ne.9) stop 103 - if (.not.all(po.eq.1.0)) stop 104 + if (po(1).ne.0.5) stop 104 + if (any(po(2:komax).ne.1.0)) stop 104 if (any(abs(th(1:7)-(/1.,2.,3.,4.,5.,6.,7./)).gt.tini)) stop 105 if (any(abs(pv(1:9)-(/11.,12.,13.,14.,15.,16.,17.,18.,19./)).gt.tini)) stop 106 if (hyb_sigp) stop 107 From ba5f71df326165ee1288cf1829fc3a5819869905 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Fri, 12 Jan 2024 17:12:52 -0800 Subject: [PATCH 21/46] Update CMakeLists.txt --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 95177fdc8..0b2f29cf8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,7 +16,7 @@ endfunction() function(add_fv3atm_serial_test TESTNAME) add_executable(${TESTNAME} ${TESTNAME}.F90) - target_link_libraries(${TESTNAME} PRIVATE fv3atm MPI::MPI_Fortran PIO::PIO_Fortran) + target_link_libraries(${TESTNAME} PRIVATE fv3atm) add_test(${TESTNAME} ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}) endfunction() From a4f5a269e50b5644ecdd913968444bf2da45c62c Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 12 Jan 2024 17:17:14 -0800 Subject: [PATCH 22/46] simplify test_fv3_io_def.F90 --- tests/test_fv3_io_def.F90 | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/test_fv3_io_def.F90 b/tests/test_fv3_io_def.F90 index 0dc494fa8..6ee34a7fc 100644 --- a/tests/test_fv3_io_def.F90 +++ b/tests/test_fv3_io_def.F90 @@ -36,10 +36,10 @@ program test_fv3_io_def allocate(lead_wrttask(10)) lead_wrttask = 42 - if (.not.all(lead_wrttask(1:10).eq.42)) stop 12 + if (any(lead_wrttask(1:10).ne.42)) stop 12 allocate(last_wrttask(12)) last_wrttask = 43 - if (.not.all(last_wrttask(1:12).eq.43)) stop 13 + if (any(last_wrttask(1:12).ne.43)) stop 13 allocate(output_grid(2)) output_grid(1) = "ABC" @@ -49,62 +49,62 @@ program test_fv3_io_def allocate(imo(6)) imo(1:6) = 17 - if (.not.all(imo.eq.17)) stop 16 + if (any(imo.ne.17)) stop 16 allocate(jmo(6)) jmo(1:6) = 18 - if (.not.all(jmo.eq.18)) stop 17 + if (any(jmo.ne.18)) stop 17 allocate(cen_lon(8)) cen_lon(1:8) = 2.1 - if(.not.all(cen_lon.eq.2.1)) stop 18 + if(any(cen_lon.ne.2.1)) stop 18 allocate(cen_lat(8)) cen_lat(1:8) = 3.2 - if(.not.all(cen_lat.eq.3.2)) stop 19 + if(any(cen_lat.ne.3.2)) stop 19 allocate(lon1(10)) lon1(1:10) = 4.3 - if(.not.all(lon1.eq.4.3)) stop 20 + if(any(lon1.ne.4.3)) stop 20 allocate(lat1(10)) lat1(1:10) = 5.4 - if(.not.all(lat1.eq.5.4)) stop 21 + if(any(lat1.ne.5.4)) stop 21 allocate(lon2(12)) lon2(1:12) = 6.5 - if(.not.all(lon2.eq.6.5)) stop 22 + if(any(lon2.ne.6.5)) stop 22 allocate(lat2(12)) lat2(1:12) = 7.6 - if(.not.all(lat2.eq.7.6)) stop 23 + if(any(lat2.ne.7.6)) stop 23 allocate(dlon(15)) dlon(1:15) = 8.7 - if(.not.all(dlon.eq.8.7)) stop 24 + if(any(dlon.ne.8.7)) stop 24 allocate(dlat(15)) dlat(1:15) = 9.8 - if(.not.all(dlat.eq.9.8)) stop 25 + if(any(dlat.ne.9.8)) stop 25 allocate(stdlat1(18)) stdlat1(1:18) = 10.9 - if(.not.all(stdlat1.eq.10.9)) stop 26 + if(any(stdlat1.ne.10.9)) stop 26 allocate(stdlat2(18)) stdlat2(1:18) = 11.0 - if(.not.all(stdlat2.eq.11.0)) stop 27 + if(any(stdlat2.ne.11.0)) stop 27 allocate(dx(20)) dx(1:20) = 12.1 - if(.not.all(dx.eq.12.1)) stop 28 + if(any(dx.ne.12.1)) stop 28 allocate(dy(20)) dy(1:20) = 13.2 - if(.not.all(dy.eq.13.2)) stop 29 + if(any(dy.ne.13.2)) stop 29 allocate(ideflate(25)) ideflate(1:25) = 123 - if(.not.all(ideflate.eq.123)) stop 30 + if(any(ideflate.ne.123)) stop 30 allocate(quantize_nsd(25)) quantize_nsd(1:25) = 123 - if(.not.all(quantize_nsd.eq.123)) stop 31 + if(any(quantize_nsd.ne.123)) stop 31 allocate(zstandard_level(25)) zstandard_level(1:25) = 123 - if(.not.all(zstandard_level.eq.123)) stop 32 + if(any(zstandard_level.ne.123)) stop 32 allocate(quantize_mode(5)) quantize_mode(1:5) = "xyz" @@ -112,18 +112,18 @@ program test_fv3_io_def allocate(ichunk2d(30)) ichunk2d(1:30) = 50 - if(.not.all(ichunk2d.eq.50)) stop 34 + if(any(ichunk2d.ne.50)) stop 34 allocate(jchunk2d(30)) jchunk2d(1:30) = 51 - if(.not.all(jchunk2d.eq.51)) stop 35 + if(any(jchunk2d.ne.51)) stop 35 allocate(ichunk3d(30)) ichunk3d(1:30) = 52 - if(.not.all(ichunk3d.eq.52)) stop 36 + if(any(ichunk3d.ne.52)) stop 36 allocate(jchunk3d(30)) jchunk3d(1:30) = 53 - if(.not.all(jchunk3d.eq.53)) stop 37 + if(any(jchunk3d.ne.53)) stop 37 allocate(kchunk3d(30)) kchunk3d(1:30) = 54 - if(.not.all(kchunk3d.eq.54)) stop 38 + if(any(kchunk3d.ne.54)) stop 38 end program test_fv3_io_def From 99c197f429dec37067ec153076ff8acc8807691a Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 09:24:17 -0800 Subject: [PATCH 23/46] Re-integrate developer.yml into GCC.yml --- .github/workflows/GCC.yml | 27 ++++++++- .github/workflows/developer.yml | 99 --------------------------------- 2 files changed, 24 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/developer.yml diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index f56f68400..32578fc30 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -26,9 +26,9 @@ jobs: steps: - - name: install-doxygen + - name: apt-install run: | - sudo apt-get install doxygen graphviz + sudo apt-get install gcovr doxygen graphviz - name: checkout-fv3atm uses: actions/checkout@v3 @@ -59,6 +59,13 @@ jobs: spack concretize |& tee ${SPACK_ENV}/log.concretize spack install -j2 --fail-fast + - name: cache-save + uses: actions/cache/save@v3 + if: ${{ always() }} + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 + - name: build-fv3atm run: | . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh @@ -79,7 +86,21 @@ jobs: cd $GITHUB_WORKSPACE/fv3atm/build ctest -j2 --output-on-failure --rerun-failed - - uses: actions/upload-artifact@v3 + - name: get-test-coverage + run: | + f=${GITHUB_WORKSPACE}/fv3atm + cd $f/build + gcovr -r .. -v --html-details --exclude ${f}/tests --exclude $f/stochastic_physics_repo --exclude $f/build/ccpp --exclude $f/ccpp/physics --exclude $f/ccpp/framework --exclude $f/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html + + - name: upload-test-coverage + uses: actions/upload-artifact@v4 + with: + name: test-coverage-fv3atm-${{ github.sha }} + path: | + ${{ github.workspace }}/fv3atm/build/*.html + ${{ github.workspace }}/fv3atm/build/*.css + + - uses: actions/upload-artifact@v4 with: name: docs path: | diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml deleted file mode 100644 index d9c93bfdb..000000000 --- a/.github/workflows/developer.yml +++ /dev/null @@ -1,99 +0,0 @@ -# This is a CI workflow for the fv3atm project. -# -# This workflow checks code coverage and will build documentation. -# -# Alex Richert, 11 Jan 2024 - -name: developer -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -jobs: - developer: - runs-on: ubuntu-latest - - steps: - - - name: apt-install - run: | - sudo apt install gcovr - - - name: checkout-fv3atm - uses: actions/checkout@v3 - with: - path: ${{ github.workspace }}/fv3atm - submodules: recursive - - - name: cache-spack - id: cache-spack - uses: actions/cache@v3 - with: - path: ${{ github.workspace }}/spack-develop - key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 - - # Building dependencies takes 40+ min - - name: spack-install - if: steps.cache-spack.outputs.cache-hit != 'true' - run: | - wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip - unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out - . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh - spack env create gcc11 ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml - spack env activate gcc11 - spack compiler find | grep gcc@11 - spack external find gmake cmake git git-lfs perl python mpich - spack config add "packages:all:require:['%gcc@11']" - spack config add "packages:mpi:require:'mpich'" - spack concretize |& tee ${SPACK_ENV}/log.concretize - spack install -j2 --fail-fast - - - name: cache-save - uses: actions/cache/save@v3 - if: ${{ always() }} - with: - path: ${{ github.workspace }}/spack-develop - key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 - - - name: build-fv3atm - run: | - . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh - spack env activate gcc11 - spack load $(spack find --format "{name}") - cd ${GITHUB_WORKSPACE}/fv3atm - git clone https://github.com/NOAA-EMC/CMakeModules - git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo - mkdir ${GITHUB_WORKSPACE}/fv3atm/build - cd ${GITHUB_WORKSPACE}/fv3atm/build - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON -DCMAKE_Fortran_FLAGS="-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0" - make -j2 - - - name: run-tests - run: | - cd $GITHUB_WORKSPACE/fv3atm/build - ctest -j2 --output-on-failure --rerun-failed - - - name: get-test-coverage - run: | - f=${GITHUB_WORKSPACE}/fv3atm - cd $f/build - gcovr -r .. -v --html-details --exclude ${f}/tests --exclude $f/stochastic_physics_repo --exclude $f/build/ccpp --exclude $f/ccpp/physics --exclude $f/ccpp/framework --exclude $f/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html - - - name: upload-test-coverage - uses: actions/upload-artifact@v4 - with: - name: test-coverage-fv3atm-${{ github.sha }} - path: | - ${{ github.workspace }}/fv3atm/build/*.html - ${{ github.workspace }}/fv3atm/build/*.css - - - name: debug-artifacts - uses: actions/upload-artifact@v4 - if: ${{ failure() }} - with: - name: ccpp_prebuild_logs - path: ${{ github.workspace }}/fv3atm/build/ccpp/ccpp_prebuild.* From e6c41db9ce232852f12f3fb332ecc6a4692cb438 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 09:28:43 -0800 Subject: [PATCH 24/46] refine cache condition in GCC.yml --- .github/workflows/GCC.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 32578fc30..7153759a9 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -58,10 +58,11 @@ jobs: spack config add "packages:mpi:require:'${{ matrix.mpi }}'" spack concretize |& tee ${SPACK_ENV}/log.concretize spack install -j2 --fail-fast + echo "spackrc=$?" >> ${GITHUB_ENV} - name: cache-save uses: actions/cache/save@v3 - if: ${{ always() }} + if: ${{ ${{ env.spackrc }} == 0 }} with: path: ${{ github.workspace }}/spack-develop key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 From 1b57dcc1077044b492805f5a19c57304a8b7b949 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 09:46:01 -0800 Subject: [PATCH 25/46] fix up GCC.yml --- .github/workflows/GCC.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 7153759a9..d611237fe 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -26,6 +26,12 @@ jobs: steps: + - name: decide-doc-build + run: | + if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 11 && "${{ matrix.mpi }}" == mpich ]]; then + echo 'builddocs=ON' >> ${GITHUB_ENV} + fi + - name: apt-install run: | sudo apt-get install gcovr doxygen graphviz @@ -62,7 +68,7 @@ jobs: - name: cache-save uses: actions/cache/save@v3 - if: ${{ ${{ env.spackrc }} == 0 }} + if: ${{ (env.spackrc) == 0 }} with: path: ${{ github.workspace }}/spack-develop key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 @@ -78,7 +84,7 @@ jobs: sed -i 's/doc /upp_doc /' upp/docs/CMakeLists.txt mkdir ${GITHUB_WORKSPACE}/fv3atm/build cd ${GITHUB_WORKSPACE}/fv3atm/build - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=${{ env.builddocs }} make -j2 ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io @@ -102,6 +108,7 @@ jobs: ${{ github.workspace }}/fv3atm/build/*.css - uses: actions/upload-artifact@v4 + if: ${{ env.builddocs == 'ON' }} with: name: docs path: | From 87238889d97ebcd564955687c900c2f13bf6ead7 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 10:11:21 -0800 Subject: [PATCH 26/46] update doc artifact path --- .github/workflows/GCC.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index d611237fe..1a8d09561 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -29,7 +29,7 @@ jobs: - name: decide-doc-build run: | if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 11 && "${{ matrix.mpi }}" == mpich ]]; then - echo 'builddocs=ON' >> ${GITHUB_ENV} + echo 'builddocs=ON' | tee -a ${GITHUB_ENV} fi - name: apt-install @@ -112,7 +112,7 @@ jobs: with: name: docs path: | - build/docs/html + ${{ github.workspace }}/fv3atm/build/docs/html - name: debug-artifacts uses: actions/upload-artifact@v4 From 30a9f1b2f2e84c9bd67932475e34684fa02c79c3 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 10:14:04 -0800 Subject: [PATCH 27/46] Only build gcovr report in one job --- .github/workflows/GCC.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 1a8d09561..bfab8c2c4 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -26,10 +26,11 @@ jobs: steps: - - name: decide-doc-build + # Only do Doxygen and gcovr build for one job + - name: decide-doc-gcovr-build run: | if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 11 && "${{ matrix.mpi }}" == mpich ]]; then - echo 'builddocs=ON' | tee -a ${GITHUB_ENV} + echo 'devbuild=ON' | tee -a ${GITHUB_ENV} fi - name: apt-install @@ -84,7 +85,7 @@ jobs: sed -i 's/doc /upp_doc /' upp/docs/CMakeLists.txt mkdir ${GITHUB_WORKSPACE}/fv3atm/build cd ${GITHUB_WORKSPACE}/fv3atm/build - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=${{ env.builddocs }} + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=${{ env.devbuild }} make -j2 ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io @@ -94,6 +95,7 @@ jobs: ctest -j2 --output-on-failure --rerun-failed - name: get-test-coverage + if: ${{ env.devbuild == 'ON' }} run: | f=${GITHUB_WORKSPACE}/fv3atm cd $f/build @@ -101,6 +103,7 @@ jobs: - name: upload-test-coverage uses: actions/upload-artifact@v4 + if: ${{ env.devbuild == 'ON' }} with: name: test-coverage-fv3atm-${{ github.sha }} path: | @@ -108,7 +111,7 @@ jobs: ${{ github.workspace }}/fv3atm/build/*.css - uses: actions/upload-artifact@v4 - if: ${{ env.builddocs == 'ON' }} + if: ${{ env.devbuild == 'ON' }} with: name: docs path: | From 0e875fe61d38ba93dcbc1a5cfef3c145ae084699 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 10:42:36 -0800 Subject: [PATCH 28/46] restore gcov cmake flags --- .github/workflows/developer.yml | 99 +++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/developer.yml diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml new file mode 100644 index 000000000..d9c93bfdb --- /dev/null +++ b/.github/workflows/developer.yml @@ -0,0 +1,99 @@ +# This is a CI workflow for the fv3atm project. +# +# This workflow checks code coverage and will build documentation. +# +# Alex Richert, 11 Jan 2024 + +name: developer +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +jobs: + developer: + runs-on: ubuntu-latest + + steps: + + - name: apt-install + run: | + sudo apt install gcovr + + - name: checkout-fv3atm + uses: actions/checkout@v3 + with: + path: ${{ github.workspace }}/fv3atm + submodules: recursive + + - name: cache-spack + id: cache-spack + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 + + # Building dependencies takes 40+ min + - name: spack-install + if: steps.cache-spack.outputs.cache-hit != 'true' + run: | + wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip + unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env create gcc11 ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml + spack env activate gcc11 + spack compiler find | grep gcc@11 + spack external find gmake cmake git git-lfs perl python mpich + spack config add "packages:all:require:['%gcc@11']" + spack config add "packages:mpi:require:'mpich'" + spack concretize |& tee ${SPACK_ENV}/log.concretize + spack install -j2 --fail-fast + + - name: cache-save + uses: actions/cache/save@v3 + if: ${{ always() }} + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 + + - name: build-fv3atm + run: | + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env activate gcc11 + spack load $(spack find --format "{name}") + cd ${GITHUB_WORKSPACE}/fv3atm + git clone https://github.com/NOAA-EMC/CMakeModules + git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo + mkdir ${GITHUB_WORKSPACE}/fv3atm/build + cd ${GITHUB_WORKSPACE}/fv3atm/build + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON -DCMAKE_Fortran_FLAGS="-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0" + make -j2 + + - name: run-tests + run: | + cd $GITHUB_WORKSPACE/fv3atm/build + ctest -j2 --output-on-failure --rerun-failed + + - name: get-test-coverage + run: | + f=${GITHUB_WORKSPACE}/fv3atm + cd $f/build + gcovr -r .. -v --html-details --exclude ${f}/tests --exclude $f/stochastic_physics_repo --exclude $f/build/ccpp --exclude $f/ccpp/physics --exclude $f/ccpp/framework --exclude $f/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html + + - name: upload-test-coverage + uses: actions/upload-artifact@v4 + with: + name: test-coverage-fv3atm-${{ github.sha }} + path: | + ${{ github.workspace }}/fv3atm/build/*.html + ${{ github.workspace }}/fv3atm/build/*.css + + - name: debug-artifacts + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: ccpp_prebuild_logs + path: ${{ github.workspace }}/fv3atm/build/ccpp/ccpp_prebuild.* From e14f32c0841bf1a4090be225e81962cabbec8165 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 10:43:28 -0800 Subject: [PATCH 29/46] rm developer.yml --- .github/workflows/developer.yml | 99 --------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 .github/workflows/developer.yml diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml deleted file mode 100644 index d9c93bfdb..000000000 --- a/.github/workflows/developer.yml +++ /dev/null @@ -1,99 +0,0 @@ -# This is a CI workflow for the fv3atm project. -# -# This workflow checks code coverage and will build documentation. -# -# Alex Richert, 11 Jan 2024 - -name: developer -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -jobs: - developer: - runs-on: ubuntu-latest - - steps: - - - name: apt-install - run: | - sudo apt install gcovr - - - name: checkout-fv3atm - uses: actions/checkout@v3 - with: - path: ${{ github.workspace }}/fv3atm - submodules: recursive - - - name: cache-spack - id: cache-spack - uses: actions/cache@v3 - with: - path: ${{ github.workspace }}/spack-develop - key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 - - # Building dependencies takes 40+ min - - name: spack-install - if: steps.cache-spack.outputs.cache-hit != 'true' - run: | - wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip - unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out - . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh - spack env create gcc11 ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml - spack env activate gcc11 - spack compiler find | grep gcc@11 - spack external find gmake cmake git git-lfs perl python mpich - spack config add "packages:all:require:['%gcc@11']" - spack config add "packages:mpi:require:'mpich'" - spack concretize |& tee ${SPACK_ENV}/log.concretize - spack install -j2 --fail-fast - - - name: cache-save - uses: actions/cache/save@v3 - if: ${{ always() }} - with: - path: ${{ github.workspace }}/spack-develop - key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc11-2 - - - name: build-fv3atm - run: | - . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh - spack env activate gcc11 - spack load $(spack find --format "{name}") - cd ${GITHUB_WORKSPACE}/fv3atm - git clone https://github.com/NOAA-EMC/CMakeModules - git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo - mkdir ${GITHUB_WORKSPACE}/fv3atm/build - cd ${GITHUB_WORKSPACE}/fv3atm/build - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON -DCMAKE_Fortran_FLAGS="-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0" - make -j2 - - - name: run-tests - run: | - cd $GITHUB_WORKSPACE/fv3atm/build - ctest -j2 --output-on-failure --rerun-failed - - - name: get-test-coverage - run: | - f=${GITHUB_WORKSPACE}/fv3atm - cd $f/build - gcovr -r .. -v --html-details --exclude ${f}/tests --exclude $f/stochastic_physics_repo --exclude $f/build/ccpp --exclude $f/ccpp/physics --exclude $f/ccpp/framework --exclude $f/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html - - - name: upload-test-coverage - uses: actions/upload-artifact@v4 - with: - name: test-coverage-fv3atm-${{ github.sha }} - path: | - ${{ github.workspace }}/fv3atm/build/*.html - ${{ github.workspace }}/fv3atm/build/*.css - - - name: debug-artifacts - uses: actions/upload-artifact@v4 - if: ${{ failure() }} - with: - name: ccpp_prebuild_logs - path: ${{ github.workspace }}/fv3atm/build/ccpp/ccpp_prebuild.* From 22abc64fc1b9a3557754026a3603849d73fb19b7 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 10:57:49 -0800 Subject: [PATCH 30/46] Fix gcov cmake flags GCC.yml --- .github/workflows/GCC.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index bfab8c2c4..e218b91dd 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -31,6 +31,9 @@ jobs: run: | if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 11 && "${{ matrix.mpi }}" == mpich ]]; then echo 'devbuild=ON' | tee -a ${GITHUB_ENV} + echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV} + else + echo 'devbuild=OFF' | tee -a ${GITHUB_ENV} fi - name: apt-install @@ -85,7 +88,7 @@ jobs: sed -i 's/doc /upp_doc /' upp/docs/CMakeLists.txt mkdir ${GITHUB_WORKSPACE}/fv3atm/build cd ${GITHUB_WORKSPACE}/fv3atm/build - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=${{ env.devbuild }} + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=${{ env.devbuild }} ${{ env.gcov_cmake }} make -j2 ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io From 80e78bce9c7051a4bb901c98a66e2dadd4e43662 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Fri, 19 Jan 2024 11:21:54 -0800 Subject: [PATCH 31/46] Update test_fv3_io_def.F90 --- tests/test_fv3_io_def.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_fv3_io_def.F90 b/tests/test_fv3_io_def.F90 index 6ee34a7fc..7865fc999 100644 --- a/tests/test_fv3_io_def.F90 +++ b/tests/test_fv3_io_def.F90 @@ -1,5 +1,6 @@ ! This program provides a unit test to verify that the variables in ! module_fv3_io_def.F90 are accessible. +! Alex Richert, 11 Jan 2024 program test_fv3_io_def From c6f749e191bd6bb00f29c1939caa8502294c6467 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Fri, 19 Jan 2024 12:39:10 -0800 Subject: [PATCH 32/46] remove test_fv3_io_def.F90 --- tests/CMakeLists.txt | 2 +- tests/test_fv3_io_def.F90 | 130 -------------------------------------- 2 files changed, 1 insertion(+), 131 deletions(-) delete mode 100644 tests/test_fv3_io_def.F90 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0b2f29cf8..5667d3d61 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -24,6 +24,6 @@ endfunction() # add_fv3atm_mpi_test(${testname}) #endforeach() -foreach(testname test_fv3_io_def test_post_nems_routines) +foreach(testname test_post_nems_routines) add_fv3atm_serial_test(${testname}) endforeach() diff --git a/tests/test_fv3_io_def.F90 b/tests/test_fv3_io_def.F90 deleted file mode 100644 index 7865fc999..000000000 --- a/tests/test_fv3_io_def.F90 +++ /dev/null @@ -1,130 +0,0 @@ -! This program provides a unit test to verify that the variables in -! module_fv3_io_def.F90 are accessible. -! Alex Richert, 11 Jan 2024 - -program test_fv3_io_def - - use module_fv3_io_def - - implicit none - - num_pes_fcst = 2 - if (num_pes_fcst .ne. 2) stop 1 - wrttasks_per_group = 4 - if (wrttasks_per_group .ne. 4) stop 2 - write_groups = 8 - if (write_groups .ne. 8) stop 3 - n_group = 16 - if (n_group .ne. 16) stop 4 - num_files = 32 - if (num_files .ne. 32) stop 5 - nbdlphys = 64 - if (nbdlphys .ne. 64) stop 6 - iau_offset = 128 - if (iau_offset .ne. 128) stop 7 - - lflname_fulltime = .true. - if (.not. lflname_fulltime) stop 8 - time_unlimited = .true. - if (.not. time_unlimited) stop 9 - - allocate(filename_base(1)) - filename_base(1)="abc" - if (trim(filename_base(1)).ne."abc") stop 10 - allocate(output_file(1)) - output_file(1)="def" - if (trim(output_file(1)).ne."def") stop 11 - - allocate(lead_wrttask(10)) - lead_wrttask = 42 - if (any(lead_wrttask(1:10).ne.42)) stop 12 - allocate(last_wrttask(12)) - last_wrttask = 43 - if (any(last_wrttask(1:12).ne.43)) stop 13 - - allocate(output_grid(2)) - output_grid(1) = "ABC" - output_grid(2) = "DEF" - if (trim(output_grid(1)).ne."ABC") stop 14 - if (trim(output_grid(2)).ne."DEF") stop 15 - - allocate(imo(6)) - imo(1:6) = 17 - if (any(imo.ne.17)) stop 16 - allocate(jmo(6)) - jmo(1:6) = 18 - if (any(jmo.ne.18)) stop 17 - - allocate(cen_lon(8)) - cen_lon(1:8) = 2.1 - if(any(cen_lon.ne.2.1)) stop 18 - allocate(cen_lat(8)) - cen_lat(1:8) = 3.2 - if(any(cen_lat.ne.3.2)) stop 19 - - allocate(lon1(10)) - lon1(1:10) = 4.3 - if(any(lon1.ne.4.3)) stop 20 - allocate(lat1(10)) - lat1(1:10) = 5.4 - if(any(lat1.ne.5.4)) stop 21 - - allocate(lon2(12)) - lon2(1:12) = 6.5 - if(any(lon2.ne.6.5)) stop 22 - allocate(lat2(12)) - lat2(1:12) = 7.6 - if(any(lat2.ne.7.6)) stop 23 - - allocate(dlon(15)) - dlon(1:15) = 8.7 - if(any(dlon.ne.8.7)) stop 24 - allocate(dlat(15)) - dlat(1:15) = 9.8 - if(any(dlat.ne.9.8)) stop 25 - - allocate(stdlat1(18)) - stdlat1(1:18) = 10.9 - if(any(stdlat1.ne.10.9)) stop 26 - allocate(stdlat2(18)) - stdlat2(1:18) = 11.0 - if(any(stdlat2.ne.11.0)) stop 27 - - allocate(dx(20)) - dx(1:20) = 12.1 - if(any(dx.ne.12.1)) stop 28 - allocate(dy(20)) - dy(1:20) = 13.2 - if(any(dy.ne.13.2)) stop 29 - - allocate(ideflate(25)) - ideflate(1:25) = 123 - if(any(ideflate.ne.123)) stop 30 - allocate(quantize_nsd(25)) - quantize_nsd(1:25) = 123 - if(any(quantize_nsd.ne.123)) stop 31 - allocate(zstandard_level(25)) - zstandard_level(1:25) = 123 - if(any(zstandard_level.ne.123)) stop 32 - - allocate(quantize_mode(5)) - quantize_mode(1:5) = "xyz" - if(.not.trim(quantize_mode(5)).eq."xyz") stop 33 - - allocate(ichunk2d(30)) - ichunk2d(1:30) = 50 - if(any(ichunk2d.ne.50)) stop 34 - allocate(jchunk2d(30)) - jchunk2d(1:30) = 51 - if(any(jchunk2d.ne.51)) stop 35 - allocate(ichunk3d(30)) - ichunk3d(1:30) = 52 - if(any(ichunk3d.ne.52)) stop 36 - allocate(jchunk3d(30)) - jchunk3d(1:30) = 53 - if(any(jchunk3d.ne.53)) stop 37 - allocate(kchunk3d(30)) - kchunk3d(1:30) = 54 - if(any(kchunk3d.ne.54)) stop 38 - -end program test_fv3_io_def From eed40d31a52ef2e6710cfbf267701f8243144920 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:08:14 -0800 Subject: [PATCH 33/46] test re-removing PIO dep in ci CMake --- ci/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index b85fead2d..b989d9fbb 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -64,7 +64,7 @@ endif() find_package(bacio 2.4.0 REQUIRED) find_package(sp 2.3.3 REQUIRED) find_package(w3emc 2.9.2 REQUIRED) -find_package(PIO REQUIRED) +#find_package(PIO REQUIRED) find_package(Python 3.6 REQUIRED COMPONENTS Interpreter) From 5841f806379821fb7fc61251f6b311242c4ac18c Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:23:00 -0800 Subject: [PATCH 34/46] Update CMakeLists.txt --- ci/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index b989d9fbb..71412b3af 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -64,7 +64,6 @@ endif() find_package(bacio 2.4.0 REQUIRED) find_package(sp 2.3.3 REQUIRED) find_package(w3emc 2.9.2 REQUIRED) -#find_package(PIO REQUIRED) find_package(Python 3.6 REQUIRED COMPONENTS Interpreter) From 6a8d95df410b560cf40f16f82a8c31d052662aa8 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 11:06:20 -0700 Subject: [PATCH 35/46] GCC.yml: fix devbuild condition --- .github/workflows/GCC.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index e249345af..884277b99 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -28,7 +28,7 @@ jobs: # Only do Doxygen and gcovr build for one job - name: decide-doc-gcovr-build run: | - if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 11 && "${{ matrix.mpi }}" == mpich ]]; then + if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then echo 'devbuild=ON' | tee -a ${GITHUB_ENV} echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV} else @@ -163,4 +163,4 @@ jobs: if: ${{ failure() }} with: name: ccpp_prebuild_logs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }} - path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.* \ No newline at end of file + path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.* From 2074d8db579a1c39805f9b820f09fd23c864d75c Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 11:06:46 -0700 Subject: [PATCH 36/46] GCC.yml: fix devbuild condition pt 2 --- .github/workflows/GCC.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 884277b99..c2dd22a14 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -28,7 +28,7 @@ jobs: # Only do Doxygen and gcovr build for one job - name: decide-doc-gcovr-build run: | - if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then + if [[ "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then echo 'devbuild=ON' | tee -a ${GITHUB_ENV} echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV} else From 48426bfb112112a1b0138db303b8828ef03223b7 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 11:26:42 -0700 Subject: [PATCH 37/46] rearrange GCC.yml --- .github/workflows/GCC.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index c2dd22a14..a1dcca346 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -24,21 +24,6 @@ jobs: mpi: ["mpich", "openmpi"] steps: - - # Only do Doxygen and gcovr build for one job - - name: decide-doc-gcovr-build - run: | - if [[ "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then - echo 'devbuild=ON' | tee -a ${GITHUB_ENV} - echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV} - else - echo 'devbuild=OFF' | tee -a ${GITHUB_ENV} - fi - - - name: apt-install - if: ${{ env.devbuild == 'ON' }} - run: | - sudo apt-get install gcovr doxygen graphviz - name: checkout-fv3atm uses: actions/checkout@v4 @@ -89,6 +74,21 @@ jobs: steps: + # Only do Doxygen and gcovr build for one job + - name: decide-doc-gcovr-build + run: | + if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then + echo 'devbuild=ON' | tee -a ${GITHUB_ENV} + echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV} + else + echo 'devbuild=OFF' | tee -a ${GITHUB_ENV} + fi + + - name: apt-install + if: ${{ env.devbuild == 'ON' }} + run: | + sudo apt-get install gcovr doxygen graphviz + - name: install-doxygen run: | sudo apt-get install doxygen graphviz From 10cd572518489bbdf76030ffacd1d7170c8bd757 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 12:01:50 -0700 Subject: [PATCH 38/46] Update GCC.yml --- .github/workflows/GCC.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index a1dcca346..868c3113d 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -148,13 +148,14 @@ jobs: with: name: test-coverage-fv3atm-${{ github.sha }} path: | - ${{ github.workspace }}/fv3atm/build/*.html - ${{ github.workspace }}/fv3atm/build/*.css + ${{ github.workspace }}/build/*.html + ${{ github.workspace }}/build/*.css - - uses: actions/upload-artifact@v4 + - name: upload-docs + uses: actions/upload-artifact@v4 if: ${{ env.devbuild == 'ON' }} with: - name: docs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }} + name: docs-fv3atm path: | build/docs/html From 415986df3a0c31d26ecccdb7b61be49a73557f85 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 13:32:45 -0700 Subject: [PATCH 39/46] fix gcovr --- .github/workflows/GCC.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 868c3113d..a83ae1e21 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -126,7 +126,7 @@ jobs: export CXX=mpicxx export FC=mpif90 cat /home/runner/work/fv3atm/fv3atm/spack-develop/opt/spack/linux-ubuntu22.04-zen2/gcc-12.3.0/fms-2023.04-*/lib/cmake/fms/fms-config.cmake - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }} make -j2 ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io @@ -138,9 +138,8 @@ jobs: - name: get-test-coverage if: ${{ env.devbuild == 'ON' }} run: | - f=${GITHUB_WORKSPACE} - cd $f/build - gcovr -r .. -v --html-details --exclude ${f}/tests --exclude $f/stochastic_physics_repo --exclude $f/build/ccpp --exclude $f/ccpp/physics --exclude $f/ccpp/framework --exclude $f/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html + cd $GITHUB_WORKSPACE/build + gcovr -r .. -v --html-details --exclude $GITHUB_WORKSPACE/tests --exclude $GITHUB_WORKSPACE/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/build/ccpp --exclude $GITHUB_WORKSPACE/ccpp/physics --exclude $GITHUB_WORKSPACE/ccpp/framework --exclude $GITHUB_WORKSPACE/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html - name: upload-test-coverage uses: actions/upload-artifact@v4 From 657e1a32be6e612c7994ace88a559805615fee65 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 14:29:51 -0700 Subject: [PATCH 40/46] Update GCC.yml --- .github/workflows/GCC.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index a83ae1e21..1f8842a38 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -84,14 +84,11 @@ jobs: echo 'devbuild=OFF' | tee -a ${GITHUB_ENV} fi - - name: apt-install + - name: install-utilities if: ${{ env.devbuild == 'ON' }} - run: | - sudo apt-get install gcovr doxygen graphviz - - - name: install-doxygen run: | sudo apt-get install doxygen graphviz + python3 -m pip install gcovr - name: install-cmake run: | From 7582ab7e3e82c2e11538ada0e7374a8b6a1e7d6b Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 14:34:38 -0700 Subject: [PATCH 41/46] Update GCC.yml --- .github/workflows/GCC.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 1f8842a38..d8f4dfbcf 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -85,7 +85,6 @@ jobs: fi - name: install-utilities - if: ${{ env.devbuild == 'ON' }} run: | sudo apt-get install doxygen graphviz python3 -m pip install gcovr @@ -122,10 +121,8 @@ jobs: export CC=mpicc export CXX=mpicxx export FC=mpif90 - cat /home/runner/work/fv3atm/fv3atm/spack-develop/opt/spack/linux-ubuntu22.04-zen2/gcc-12.3.0/fms-2023.04-*/lib/cmake/fms/fms-config.cmake cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }} make -j2 - ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io - name: run-tests run: | From edf94e6517e15f604f096a699d0c9e13a977901f Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 15:14:00 -0700 Subject: [PATCH 42/46] Update GCC.yml --- .github/workflows/GCC.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index d8f4dfbcf..6d0294c37 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -87,7 +87,7 @@ jobs: - name: install-utilities run: | sudo apt-get install doxygen graphviz - python3 -m pip install gcovr + python3 -m pip install gcovr==5.2 - name: install-cmake run: | From b51b1a39ef61bc377b78bb20a30b2b460d1c7dc2 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 16:06:57 -0700 Subject: [PATCH 43/46] Update GCC.yml --- .github/workflows/GCC.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 6d0294c37..7affe92eb 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -87,7 +87,7 @@ jobs: - name: install-utilities run: | sudo apt-get install doxygen graphviz - python3 -m pip install gcovr==5.2 + python3 -m pip install gcovr==7.0 - name: install-cmake run: | @@ -133,7 +133,7 @@ jobs: if: ${{ env.devbuild == 'ON' }} run: | cd $GITHUB_WORKSPACE/build - gcovr -r .. -v --html-details --exclude $GITHUB_WORKSPACE/tests --exclude $GITHUB_WORKSPACE/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/build/ccpp --exclude $GITHUB_WORKSPACE/ccpp/physics --exclude $GITHUB_WORKSPACE/ccpp/framework --exclude $GITHUB_WORKSPACE/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html + gcovr -r .. -v --html-details --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html - name: upload-test-coverage uses: actions/upload-artifact@v4 From 369bf890f2580780a0f28ea618c2027a71ae5087 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 16:39:15 -0700 Subject: [PATCH 44/46] debug --- .github/workflows/GCC.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 7affe92eb..293aab365 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -133,7 +133,9 @@ jobs: if: ${{ env.devbuild == 'ON' }} run: | cd $GITHUB_WORKSPACE/build - gcovr -r .. -v --html-details --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html + which gcov || true + which gcov-12 || true + gcovr -r .. -v --html-details --gcov-executable gcov-12 --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html - name: upload-test-coverage uses: actions/upload-artifact@v4 From 3f633e265d8b19efcb6fb5f219665b41bf734f84 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 17:11:00 -0700 Subject: [PATCH 45/46] Update GCC.yml --- .github/workflows/GCC.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 293aab365..625191b37 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -133,8 +133,6 @@ jobs: if: ${{ env.devbuild == 'ON' }} run: | cd $GITHUB_WORKSPACE/build - which gcov || true - which gcov-12 || true gcovr -r .. -v --html-details --gcov-executable gcov-12 --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html - name: upload-test-coverage From cc98607d92d12fed97d9c37bc373f2b4b25eb790 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 13 May 2024 17:15:10 -0700 Subject: [PATCH 46/46] Update GCC.yml --- .github/workflows/GCC.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 625191b37..86d0bf668 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -87,7 +87,7 @@ jobs: - name: install-utilities run: | sudo apt-get install doxygen graphviz - python3 -m pip install gcovr==7.0 + python3 -m pip install gcovr - name: install-cmake run: |