From dc7476755e65e8d594f2cc8913c6b8b23b69a80b Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Mon, 11 Jan 2021 21:58:42 -0500 Subject: [PATCH 1/4] Adds targets check_mom6_api_nuopc, check_mom6_api_coupled - Allows us to check that we have not broken the ability to compile with the NUOPC, MCT or coupled_driver modules. - This is not a complete compile but only upto the last module that does not need anything other than MOM6 objects. --- .testing/Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.testing/Makefile b/.testing/Makefile index 33d3ea4c4e..a780f19323 100644 --- a/.testing/Makefile +++ b/.testing/Makefile @@ -328,6 +328,40 @@ $(DEPS)/Makefile: ../ac/deps/Makefile mkdir -p $(@D) cp $< $@ +#--- +# The following block does a non-library build of a coupled driver interface to MOM, along with everything below it. +# This simply checks that we have not broken the ability to compile. This is not a means to build a complete coupled executable. +# Todo: +# - avoid re-building FMS and MOM6 src by re-using existing object/mod files +# - use autoconf rather than mkmf templates +MK_TEMPLATE ?= ../../$(DEPS)/mkmf/templates/ncrc-gnu.mk +# NUOPC driver +build/nuopc/Makefile: ../config_src/nuopc_driver $(MOM_SOURCE) + mkdir -p $(@D) + cd $(@D) \ + && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/nuopc_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \ + && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names +build/nuopc/mom_ocean_model_nuopc.o: build/nuopc/Makefile + cd $(@D) && make $(@F) +check_mom6_api_nuopc: build/nuopc/mom_ocean_model_nuopc.o +# GFDL coupled driver +build/coupled/Makefile: ../config_src/coupled_driver $(MOM_SOURCE) + mkdir -p $(@D) + cd $(@D) \ + && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/coupled_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \ + && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names +build/coupled/ocean_model_MOM.o: build/coupled/Makefile + cd $(@D) && make $(@F) +check_mom6_api_coupled: build/coupled/ocean_model_MOM.o +# MCT driver +build/mct/Makefile: ../config_src/mct_driver $(MOM_SOURCE) + mkdir -p $(@D) + cd $(@D) \ + && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/mct_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \ + && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names +build/mct/mom_ocean_model_mct.o: build/mct/Makefile + cd $(@D) && make $(@F) +check_mom6_api_mct: build/mct/mom_ocean_model_mct.o #--- # Python preprocessing From 43ae9ae7d6340db6a2500acdaf0d7410de2c3462 Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Wed, 13 Jan 2021 18:29:16 -0500 Subject: [PATCH 2/4] Adds --with-driver option to configure - Following suggestion from @marshallward I've implemented an option to select the driver code at the configure stage (changes to configure.ac) - This allows the target build/coupled/ocean_model_MOM.o to be built using the .testing ac tools. --- .testing/Makefile | 23 ++++++----------------- ac/configure.ac | 10 ++++++++-- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.testing/Makefile b/.testing/Makefile index a780f19323..2806d54130 100644 --- a/.testing/Makefile +++ b/.testing/Makefile @@ -226,7 +226,9 @@ build/asymmetric/Makefile: MOM_ENV=$(PATH_FMS) $(ASYMMETRIC_FCFLAGS) $(MOM_LDFLA build/repro/Makefile: MOM_ENV=$(PATH_FMS) $(REPRO_FCFLAGS) $(MOM_LDFLAGS) build/openmp/Makefile: MOM_ENV=$(PATH_FMS) $(OPENMP_FCFLAGS) $(MOM_LDFLAGS) build/target/Makefile: MOM_ENV=$(PATH_FMS) $(TARGET_FCFLAGS) $(MOM_LDFLAGS) - +build/coupled/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(SYMMETRIC_LDFLAGS) +build/nuopc/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(SYMMETRIC_LDFLAGS) +build/mct/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(SYMMETRIC_LDFLAGS) # Configure script flags build/symmetric/Makefile: MOM_ACFLAGS= @@ -234,7 +236,9 @@ build/asymmetric/Makefile: MOM_ACFLAGS=--enable-asymmetric build/repro/Makefile: MOM_ACFLAGS= build/openmp/Makefile: MOM_ACFLAGS=--enable-openmp build/target/Makefile: MOM_ACFLAGS= - +build/coupled/Makefile: MOM_ACFLAGS=--with-driver=coupled_driver +build/nuopc/Makefile: MOM_ACFLAGS=--with-driver=nuopc_driver +build/mct/Makefile: MOM_ACFLAGS=--with-driver=mct_driver # Fetch regression target source code build/target/Makefile: | $(TARGET_CODEBASE) @@ -336,29 +340,14 @@ $(DEPS)/Makefile: ../ac/deps/Makefile # - use autoconf rather than mkmf templates MK_TEMPLATE ?= ../../$(DEPS)/mkmf/templates/ncrc-gnu.mk # NUOPC driver -build/nuopc/Makefile: ../config_src/nuopc_driver $(MOM_SOURCE) - mkdir -p $(@D) - cd $(@D) \ - && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/nuopc_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \ - && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names build/nuopc/mom_ocean_model_nuopc.o: build/nuopc/Makefile cd $(@D) && make $(@F) check_mom6_api_nuopc: build/nuopc/mom_ocean_model_nuopc.o # GFDL coupled driver -build/coupled/Makefile: ../config_src/coupled_driver $(MOM_SOURCE) - mkdir -p $(@D) - cd $(@D) \ - && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/coupled_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \ - && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names build/coupled/ocean_model_MOM.o: build/coupled/Makefile cd $(@D) && make $(@F) check_mom6_api_coupled: build/coupled/ocean_model_MOM.o # MCT driver -build/mct/Makefile: ../config_src/mct_driver $(MOM_SOURCE) - mkdir -p $(@D) - cd $(@D) \ - && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/mct_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \ - && $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names build/mct/mom_ocean_model_mct.o: build/mct/Makefile cd $(@D) && make $(@F) check_mom6_api_mct: build/mct/mom_ocean_model_mct.o diff --git a/ac/configure.ac b/ac/configure.ac index ad8ed83603..487230beb8 100644 --- a/ac/configure.ac +++ b/ac/configure.ac @@ -48,6 +48,12 @@ AC_ARG_ENABLE([asymmetric], AS_IF([test "$enable_asymmetric" = yes], [MEM_LAYOUT=${srcdir}/config_src/dynamic]) +# Default to solo_driver +DRIVER_DIR=${srcdir}/config_src/solo_driver +AC_ARG_WITH([driver], + AS_HELP_STRING([--with-driver=coupled_driver|solo_driver], [Select directory for driver source code])) +AS_IF([test "x$with_driver" != "x"], + [DRIVER_DIR=${srcdir}/config_src/${with_driver}]) # TODO: Rather than point to a pre-configured header file, autoconf could be # used to configure a header based on a template. @@ -210,10 +216,10 @@ AS_IF([test -z "$MKMF"], [ AC_CONFIG_COMMANDS([path_names], [list_paths -l \ ${srcdir}/src \ - ${srcdir}/config_src/solo_driver \ ${srcdir}/config_src/ext* \ + ${DRIVER_DIR} \ ${MEM_LAYOUT} -], [MEM_LAYOUT=$MEM_LAYOUT]) +], [MEM_LAYOUT=$MEM_LAYOUT DRIVER_DIR=$DRIVER_DIR]) AC_CONFIG_COMMANDS([Makefile.mkmf], From e29a12b80a5fbcded3ee50ffa26f2ec1dd0d9ff2 Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Fri, 15 Jan 2021 15:19:19 -0500 Subject: [PATCH 3/4] Adds a GH workflow to check driver APIs - Checks that MOM6 can be compiled with the various coupled drivers. --- .github/workflows/coupled-api.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/coupled-api.yml diff --git a/.github/workflows/coupled-api.yml b/.github/workflows/coupled-api.yml new file mode 100644 index 0000000000..4380f102ea --- /dev/null +++ b/.github/workflows/coupled-api.yml @@ -0,0 +1,30 @@ +name: API for coupled drivers + +on: [push, pull_request] + +jobs: + test-top-api: + + runs-on: ubuntu-latest + defaults: + run: + working-directory: .testing + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: ./.github/actions/testing-setup + + - name: Compile MOM6 for the GFDL coupled driver + shell: bash + run: make check_mom6_api_coupled -j + + - name: Compile MOM6 for the NUOPC driver + shell: bash + run: make check_mom6_api_nuopc -j + + - name: Compile MOM6 for the MCT driver + shell: bash + run: make check_mom6_api_mct -j From eb0c03a3dd80c04f69a6b685ffb1553f20ed04e0 Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Fri, 15 Jan 2021 16:09:55 -0500 Subject: [PATCH 4/4] Avoid unnecessary steps in actions/testing_setup - We spent 1 minute build symmetric unnecessarily when checking the coupled APIs --- .github/actions/testing-setup/action.yml | 13 +++++++++++-- .github/workflows/coupled-api.yml | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/actions/testing-setup/action.yml b/.github/actions/testing-setup/action.yml index c6fae4ad58..c47270af0d 100644 --- a/.github/actions/testing-setup/action.yml +++ b/.github/actions/testing-setup/action.yml @@ -1,5 +1,14 @@ name: 'Build-.testing-prerequisites' description: 'Build pre-requisites for .testing including FMS and a symmetric MOM6 executable' +inputs: + build_symmetric: + description: 'If true, will build the symmetric MOM6 executable' + required: false + default: 'true' + install_python: + description: 'If true, will install the local python env needed for .testing' + required: false + default: 'true' runs: using: 'composite' steps: @@ -51,7 +60,7 @@ runs: run: | echo "::group::Compile MOM6 in symmetric memory mode" cd .testing - make build/symmetric/MOM6 -j + test ${{ inputs.build_symmetric }} == true && make build/symmetric/MOM6 -j echo "::endgroup::" - name: Install local python venv for generating input data @@ -59,7 +68,7 @@ runs: run: | echo "::group::Create local python env for input data generation" cd .testing - make work/local-env + test ${{ inputs.install_python }} == true && make work/local-env echo "::endgroup::" - name: Set flags diff --git a/.github/workflows/coupled-api.yml b/.github/workflows/coupled-api.yml index 4380f102ea..86d7262548 100644 --- a/.github/workflows/coupled-api.yml +++ b/.github/workflows/coupled-api.yml @@ -16,6 +16,9 @@ jobs: submodules: recursive - uses: ./.github/actions/testing-setup + with: + build_symmetric: 'false' + install_python: 'false' - name: Compile MOM6 for the GFDL coupled driver shell: bash