diff --git a/.github/actions/testing-setup/action.yml b/.github/actions/testing-setup/action.yml deleted file mode 100644 index 60499d4be1..0000000000 --- a/.github/actions/testing-setup/action.yml +++ /dev/null @@ -1,45 +0,0 @@ -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' -runs: - using: 'composite' - steps: - - name: Git info - shell: bash - run: | - echo "::group::Git commit info" - echo "git log:" - git log | head -60 - echo "::endgroup::" - - - name: Env - shell: bash - run: | - echo "::group::Environment" - env - echo "::endgroup::" - - - name: Compile FMS library - shell: bash - run: | - echo "::group::Compile FMS library" - cd .testing - REPORT_ERROR_LOGS=true make build/deps/lib/libFMS.a -s -j - echo "::endgroup::" - - - name: Compile MOM6 in symmetric memory mode - shell: bash - run: | - echo "::group::Compile MOM6 in symmetric memory mode" - cd .testing - test ${{ inputs.build_symmetric }} == true && make build/symmetric/MOM6 -j - echo "::endgroup::" - - - name: Set flags - shell: bash - run: | - echo "TIMEFORMAT=... completed in %lR (user: %lU, sys: %lS)" >> $GITHUB_ENV diff --git a/.github/workflows/verify-linux.yml b/.github/workflows/verify-linux.yml index 146b4e6ab7..4c2817f4ee 100644 --- a/.github/workflows/verify-linux.yml +++ b/.github/workflows/verify-linux.yml @@ -2,8 +2,13 @@ name: Linux verification on: [push, pull_request] +env: + MOM_TARGET_SLUG: ${{ github.repository }} + MOM_TARGET_LOCAL_BRANCH: ${{ github.base_ref }} + jobs: # Documentation + check-style-and-docstrings: runs-on: ubuntu-latest @@ -38,34 +43,10 @@ jobs: cat all_errors test ! -s all_errors - # Dependencies - - build-fms: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: ./.github/actions/ubuntu-setup/ - - - name: Build libFMS.a - run: make -C .testing build/deps/lib/libFMS.a -j - - - name: Upload libFMS.a and dependencies - uses: actions/upload-artifact@v4 - with: - name: fms-artifact - path: | - .testing/build/deps/include/ - .testing/build/deps/lib/libFMS.a - retention-days: 1 - # Executables build-symmetric: runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -74,25 +55,23 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - name: Compile MOM6 with symmetric indexing - run: | - make -C .testing build/symmetric/MOM6 -j \ - -o build/deps/lib/libFMS.a + run: make -C .testing -j build/symmetric/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-symmetric.tar .testing/build/symmetric/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/MOM6 + path: mom6-symmetric.tar retention-days: 1 build-asymmetric: runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -101,25 +80,23 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - name: Compile MOM6 with asymmetric indexing - run: | - make -C .testing build/asymmetric/MOM6 -j \ - -o build/deps/lib/libFMS.a + run: make -C .testing -j build/asymmetric/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-asymmetric.tar .testing/build/asymmetric/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-asymmetric-artifact - path: .testing/build/asymmetric/MOM6 + path: mom6-asymmetric.tar retention-days: 1 build-repro: runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -128,25 +105,23 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - - name: Compile repro - run: | - make -C .testing build/repro/MOM6 -j \ - -o build/deps/lib/libFMS.a + - name: Compile MOM6 with bit-reproducible optimization + run: make -C .testing -j build/repro/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-repro.tar .testing/build/repro/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-repro-artifact - path: .testing/build/repro/MOM6 + path: mom6-repro.tar retention-days: 1 build-openmp: runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -155,24 +130,24 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - name: Compile MOM6 supporting OpenMP - run: make -C .testing build/openmp/MOM6 -j -o build/deps/lib/libFMS.a + run: make -C .testing -j build/openmp/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-openmp.tar .testing/build/openmp/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-openmp-artifact - path: .testing/build/openmp/MOM6 + path: mom6-openmp.tar retention-days: 1 build-target: if: github.event_name == 'pull_request' runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -181,28 +156,31 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile target FMS + run: | + make -C .testing \ + DO_REGRESSION_TESTS=1 \ + build/target_codebase + make -C .testing/build/target_codebase/.testing -j \ + build/deps/lib/libFMS.a - name: Compile target MOM6 run: | - make -C .testing build/target/MOM6 -j \ - -o build/deps/lib/libFMS.a \ - MOM_TARGET_SLUG=$GITHUB_REPOSITORY \ - MOM_TARGET_LOCAL_BRANCH=$GITHUB_BASE_REF \ - DO_REGRESSION_TESTS=True + make -C .testing -j \ + DO_REGRESSION_TESTS=1 \ + build/target/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-target.tar .testing/build/target/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-target-artifact - path: .testing/build/target/MOM6 + path: mom6-target.tar retention-days: 1 build-opt: runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -211,39 +189,31 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - - name: Compile optimized model - run: | - make -C .testing build/opt/MOM6 -j \ - -o build/deps/lib/libFMS.a - - - uses: actions/upload-artifact@v4 - with: - name: mom6-opt-artifact - path: .testing/build/opt/MOM6 - retention-days: 1 + - name: Compile MOM6 with aggressive optimization + run: make -C .testing -j build/opt/MOM6 - name: Compile timing tests + run: make -C .testing build.timing + + - name: Prepare artifact run: | - make -C .testing build.timing -j \ - -o build/deps/lib/libFMS.a + tar -cf mom6-opt.tar \ + --exclude='.testing/build/timing/time_*.o' \ + .testing/build/opt/MOM6 \ + .testing/build/timing/time_* - uses: actions/upload-artifact@v4 with: - name: mom6-timing-artifact - path: | - .testing/build/timing/time_* - !.testing/build/timing/time_*.o + name: mom6-opt-artifact + path: mom6-opt.tar retention-days: 1 build-opt-target: if: github.event_name == 'pull_request' runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -252,44 +222,41 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile target FMS + run: | + make -C .testing \ + DO_REGRESSION_TESTS=1 \ + build/target_codebase + make -C .testing/build/target_codebase/.testing -j \ + build/deps/lib/libFMS.a - name: Compile target MOM6 run: | - make -C .testing build/opt_target/MOM6 -j \ - -o build/deps/lib/libFMS.a \ - MOM_TARGET_SLUG=$GITHUB_REPOSITORY \ - MOM_TARGET_LOCAL_BRANCH=$GITHUB_BASE_REF \ - DO_REGRESSION_TESTS=True - - - uses: actions/upload-artifact@v4 - with: - name: mom6-opt-target-artifact - path: .testing/build/opt_target/MOM6 - retention-days: 1 + make -C .testing -j \ + DO_REGRESSION_TESTS=1 \ + build/opt_target/MOM6 - name: Compile target timing tests run: | - make -C .testing/build/target_codebase/.testing build.timing -j \ - -o build/deps/lib/libFMS.a - MOM_TARGET_SLUG=$GITHUB_REPOSITORY \ - MOM_TARGET_LOCAL_BRANCH=$GITHUB_BASE_REF \ - DO_REGRESSION_TESTS=true + make -C .testing/build/target_codebase/.testing \ + DO_REGRESSION_TESTS=1 \ + build.timing + + - name: Prepare artifact + run: | + tar -cf mom6-opt-target.tar \ + --exclude='.testing/build/target_codebase/.testing/build/timing/time_*.o' \ + .testing/build/opt_target/MOM6 \ + .testing/build/target_codebase/.testing/build/timing/time_* - uses: actions/upload-artifact@v4 with: - name: mom6-timing-target-artifact - path: | - .testing/build/target_codebase/.testing/build/timing/time_* - !.testing/build/target_codebase/.testing/build/timing/time_*.o + name: mom6-opt-target-artifact + path: mom6-opt-target.tar retention-days: 1 build-coverage: runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -298,35 +265,34 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - name: Compile MOM6 with code coverage - run: make -C .testing build/cov/MOM6 -j -o build/deps/lib/libFMS.a + run: make -C .testing -j build/cov/MOM6 - name: Compile MOM6 unit tests run: | - make -C .testing build/unit/test_MOM_file_parser -j \ - -o build/deps/lib/libFMS.a - make -C .testing build.unit -j \ - -o build/deps/lib/libFMS.a + make -C .testing -j build/unit/test_MOM_file_parser + make -C .testing -j build.unit + + - name: Prepare artifact + run: | + tar -cf mom6-coverage.tar \ + --exclude='.testing/build/unit/test_*.o' \ + .testing/build/cov/MOM6 \ + .testing/build/cov/*.gcno \ + .testing/build/unit/test_* \ + .testing/build/unit/*.gcno - uses: actions/upload-artifact@v4 with: name: mom6-coverage-artifact - path: | - .testing/build/cov/MOM6 - .testing/build/cov/*.gcno - .testing/build/unit/test_* - .testing/build/unit/*.gcno - !.testing/build/unit/test_*.o + path: mom6-coverage.tar retention-days: 1 build-coupled-api: runs-on: ubuntu-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -335,17 +301,13 @@ jobs: - uses: ./.github/actions/ubuntu-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - name: Compile MOM6 for the GFDL coupled driver - run: | - make -C .testing check_mom6_api_coupled -j \ - -o build/deps/lib/libFMS.a + run: make -C .testing -j check_mom6_api_coupled - #--- + # Tests test-grid: runs-on: ubuntu-latest @@ -364,19 +326,23 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download asymmetric MOM6 uses: actions/download-artifact@v4 with: name: mom6-asymmetric-artifact - path: .testing/build/asymmetric/ - - name: Verify symmetric-asymmetric grid invariance + - name: Unpack artifacts run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/asymmetric/MOM6 - make -C .testing test.grid -o build/symmetric/MOM6 -o build/asymmetric/MOM6 + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-asymmetric.tar + + - name: Run grid verification test + run: | + make -C .testing -j \ + -o build/symmetric/MOM6 \ + -o build/asymmetric/MOM6 \ + test.grid test-layout: runs-on: ubuntu-latest @@ -393,12 +359,15 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - name: Verify processor domain layout + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar + + - name: Run layout test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.layout -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.layout test-rotate: runs-on: ubuntu-latest @@ -415,12 +384,15 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - name: Verify rotational invariance + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar + + - name: Run rotation test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.rotate -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.rotate test-restart: runs-on: ubuntu-latest @@ -437,58 +409,17 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify restart invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.restart -o build/symmetric/MOM6 - test-nan: - runs-on: ubuntu-latest - needs: build-symmetric - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar - - uses: ./.github/actions/ubuntu-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify aggressive initialization + - name: Run restart test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.nan -o build/symmetric/MOM6 - - test-dim-t: - runs-on: ubuntu-latest - needs: build-symmetric - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/ubuntu-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify time dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.t -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.restart - test-dim-l: + test-nan: runs-on: ubuntu-latest needs: build-symmetric @@ -503,60 +434,29 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify horizontal length dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.l -o build/symmetric/MOM6 - test-dim-h: - runs-on: ubuntu-latest - needs: build-symmetric + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/ubuntu-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify vertical thickness dimensional invariance + - name: Run NaN initialization test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.h -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.nan - test-dim-z: + test-dim: runs-on: ubuntu-latest needs: build-symmetric - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/ubuntu-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify vertical coordinate dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.z -o build/symmetric/MOM6 - - test-dim-q: - runs-on: ubuntu-latest - needs: build-symmetric + strategy: + matrix: + dim: + - {id: t, desc: "time"} + - {id: l, desc: "horizontal length"} + - {id: h, desc: "vertical thickness"} + - {id: z, desc: "vertical coordinate"} + - {id: q, desc: "enthalpy"} + - {id: r, desc: "density"} steps: - uses: actions/checkout@v4 @@ -565,38 +465,19 @@ jobs: - uses: ./.github/actions/ubuntu-setup - - name: Download Artifacts + - name: Download symmetric MOM6 uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - name: Verify heat dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.z -o build/symmetric/MOM6 + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar - test-dim-r: - runs-on: ubuntu-latest - needs: build-symmetric - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/ubuntu-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify density dimensional invariance + - name: Run ${{ matrix.dim.desc }} dimension test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.r -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.dim.${{ matrix.dim.id }} test-openmp: runs-on: ubuntu-latest @@ -615,19 +496,23 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download OpenMP MOM6 uses: actions/download-artifact@v4 with: name: mom6-openmp-artifact - path: .testing/build/openmp/ - - name: Verify OpenMP invariance + - name: Unpack artifacts run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/openmp/MOM6 - make -C .testing test.openmp -o build/symmetric/MOM6 -o build/openmp/MOM6 + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-openmp.tar + + - name: Run OpenMP test + run: | + make -C .testing -j \ + -o build/symmetric/MOM6 \ + -o build/openmp/MOM6 \ + test.openmp test-repro: runs-on: ubuntu-latest @@ -646,21 +531,23 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download REPRO MOM6 uses: actions/download-artifact@v4 with: name: mom6-repro-artifact - path: .testing/build/repro/ + + - name: Unpack artifacts + run: | + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-repro.tar - name: Verify REPRO equivalence run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/repro/MOM6 - make -C .testing test.repro \ + make -C .testing -j \ -o build/symmetric/MOM6 \ - -o build/repro/MOM6 + -o build/repro/MOM6 \ + test.repro test-regression: if: github.event_name == 'pull_request' @@ -680,22 +567,24 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download target MOM6 uses: actions/download-artifact@v4 with: name: mom6-target-artifact - path: .testing/build/target/ + + - name: Unpack artifacts + run: | + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-target.tar - name: Check for regressions run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/target/MOM6 - make -C .testing test.regression \ + make -C .testing -j \ -o build/symmetric/MOM6 \ -o build/target/MOM6 \ - DO_REGRESSION_TESTS=true + DO_REGRESSION_TESTS=1 \ + test.regression run-coverage: runs-on: ubuntu-latest @@ -712,29 +601,31 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-coverage-artifact - path: .testing/build/ + + - name: Unpack artifacts + run: | + tar -xpvf mom6-coverage.tar + find .testing/build/cov -name "*.gcno" -exec touch {} \; + find .testing/build/unit -name "*.gcno" -exec touch {} \; - name: Generate MOM6 coverage run: | - chmod u+rx .testing/build/cov/MOM6 - make -C .testing -j run.cov \ - -o build/cov/MOM6 + make -C .testing -j \ + -o build/cov/MOM6 \ + run.cov - name: Generate unit test coverage run: | - EXECS=`find .testing/build/unit -regextype sed -regex ".*/test_[A-Za-z0-9_]*"` - chmod u+rx $EXECS - EXECS=`find .testing/build/unit -regextype sed -regex ".*/test_[A-Za-z0-9_]*" | sed 's:.testing/::'` - make -C .testing -j run.cov.unit \ - $( for f in $EXECS; do echo "-o $f" ; done ) + cd .testing && make -j \ + $(for f in build/unit/test_*; do echo "-o $f"; done) \ + run.cov.unit - name: Report coverage to CI run: | - make -C .testing report.cov \ - -o build/cov/MOM6 - EXECS=`find .testing/build/unit -regextype sed -regex ".*/test_[A-Za-z0-9_]*" | sed 's:.testing/::'` - make -C .testing report.cov.unit \ - $( for f in $EXECS; do echo "-o $f" ; done ) + cd .testing && make \ + -o build/cov/MOM6 \ + $(for f in build/unit/test_*; do echo "-o $f"; done) \ + report.cov report.cov.unit env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} @@ -755,20 +646,19 @@ jobs: - name: Download timing tests uses: actions/download-artifact@v4 with: - name: mom6-timing-artifact - path: .testing/build/timing/ + name: mom6-opt-artifact + + - name: Unpack artifacts + run: tar -xpvf mom6-opt.tar - name: Run unit test timings run: | - chmod u+rx .testing/build/timing/time_* - EXECS=`cd .testing ; find build/timing -regextype sed -regex ".*/time_[A-Za-z0-9_]*"` - make -C .testing run.timing -j \ - $( for f in $EXECS; do echo "-o $f" ; done ) + cd .testing && make -j \ + $(for f in build/timing/time_*; do echo "-o $f"; done) \ + run.timing - name: Show timing results - run: | - make -C .testing show.timing \ - DO_REGRESSION_TESTS=true + run: make -C .testing show.timing # These are most likely nonsense on a GitHub node, but someday it could work. compare-timings: @@ -785,81 +675,71 @@ jobs: - uses: ./.github/actions/ubuntu-setup + # NOTE: This needs to occur before the artifacts are unpacked, because + # our rule for setting up `target_codebase` depends on its presence, + # rather than its contents. + # If we can improve this rule, then this can be moved after unpacking. + - name: Re-clone target directory + run: | + make -C .testing \ + DO_REGRESSION_TESTS=1 \ + build/target_codebase + - name: Download optimized MOM6 uses: actions/download-artifact@v4 with: name: mom6-opt-artifact - path: .testing/build/opt/ - name: Download optimized target MOM6 uses: actions/download-artifact@v4 with: name: mom6-opt-target-artifact - path: .testing/build/opt_target/ - # TODO: Move f90nml and chmod setup to another step? + - name: Unpack artifacts + run: | + tar -xpvf mom6-opt.tar + tar -xpvf mom6-opt-target.tar + + - name: Install preprocessor dependency + run: pip install f90nml + - name: Profile with FMS clocks run: | - pip install f90nml - chmod u+rx .testing/build/opt/MOM6 - chmod u+rx .testing/build/opt_target/MOM6 - make -C .testing profile -j \ + make -C .testing -j \ -o build/opt/MOM6 \ -o build/opt_target/MOM6 \ - DO_REGRESSION_TESTS=true + profile - name: Profile with perf run: | sudo sysctl -w kernel.perf_event_paranoid=2 - make -C .testing perf -j \ + make -C .testing -j \ -o build/opt/MOM6 \ -o build/opt_target/MOM6 \ - DO_REGRESSION_TESTS=true - - # Collapse run.timing run.timing_target and show.timing into one rule - # TODO: Should this be a separate thing? - - - name: Download timing tests - uses: actions/download-artifact@v4 - with: - name: mom6-timing-artifact - path: .testing/build/timing/ + perf - - name: Run timing tests + - name: Run unit test timings run: | - chmod u+rx .testing/build/timing/time_* - EXECS=`cd .testing ; find build/timing -regextype sed -regex ".*/time_[A-Za-z0-9_]*"` - make -C .testing run.timing -j \ - $( for f in $EXECS; do echo "-o $f" ; done ) + cd .testing && make -j \ + $(for f in build/timing/time_*; do echo "-o $f"; done) \ + run.timing - name: Show timing results - run: | - make -C .testing show.timing \ - DO_REGRESSION_TESTS=true - - - name: Re-clone target directory - run: | - make -C .testing build/target_codebase \ - DO_REGRESSION_TESTS=True - - - name: Download target timing tests - uses: actions/download-artifact@v4 - with: - name: mom6-timing-target-artifact - path: .testing/build/target_codebase/.testing/build/timing/ + run: make -C .testing DO_REGRESSION_TESTS=1 show.timing - name: Run target timing tests run: | - cd .testing/build/target_codebase/ - chmod u+rx .testing/build/timing/time_* - EXECS=`cd .testing ; find build/timing -regextype sed -regex ".*/time_[A-Za-z0-9_]*"` - make -C .testing run.timing -j \ - $( for f in $EXECS; do echo "-o $f" ; done ) + cd .testing/build/target_codebase/.testing && make -j \ + $(for f in build/timing/time_*; do echo "-o $f"; done) \ + run.timing - name: Compare unit test timings run: | - make -C .testing compare.timing \ - DO_REGRESSION_TESTS=true + make -C .testing \ + DO_REGRESSION_TESTS=1 \ + compare.timing + + # Cleanup cleanup-common: runs-on: ubuntu-latest @@ -875,7 +755,6 @@ jobs: - uses: geekyeggo/delete-artifact@v5 with: name: | - fms-artifact mom6-asymmetric-artifact mom6-openmp-artifact mom6-repro-artifact @@ -894,12 +773,7 @@ jobs: - test-rotate - test-restart - test-nan - - test-dim-t - - test-dim-l - - test-dim-h - - test-dim-z - - test-dim-q - - test-dim-r + - test-dim - test-grid - test-openmp - test-repro @@ -910,7 +784,7 @@ jobs: with: name: | mom6-symmetric-artifact - mom6-timing-artifact + mom6-opt-artifact cleanup-pr: if: github.event_name == 'pull_request' @@ -922,12 +796,7 @@ jobs: - test-rotate - test-restart - test-nan - - test-dim-t - - test-dim-l - - test-dim-h - - test-dim-z - - test-dim-q - - test-dim-r + - test-dim - test-grid - test-openmp - test-repro @@ -942,5 +811,3 @@ jobs: mom6-target-artifact mom6-opt-artifact mom6-opt-target-artifact - mom6-timing-artifact - mom6-timing-target-artifact diff --git a/.github/workflows/verify-macos.yml b/.github/workflows/verify-macos.yml index 790cac3e52..d058336053 100644 --- a/.github/workflows/verify-macos.yml +++ b/.github/workflows/verify-macos.yml @@ -5,33 +5,14 @@ on: [push, pull_request] env: CC: gcc FC: gfortran + MOM_TARGET_SLUG: ${{ github.repository }} + MOM_TARGET_LOCAL_BRANCH: ${{ github.base_ref }} jobs: - # Dependencies - build-fms: - runs-on: macOS-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: ./.github/actions/macos-setup/ - - - name: Build libFMS.a - run: make -C .testing build/deps/lib/libFMS.a -j - - - name: Upload libFMS.a and dependencies - uses: actions/upload-artifact@v4 - with: - name: fms-artifact - path: | - .testing/build/deps/include/ - .testing/build/deps/lib/libFMS.a - retention-days: 1 + # Executables build-symmetric: runs-on: macOS-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -40,24 +21,23 @@ jobs: - uses: ./.github/actions/macos-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - - name: Compile symmetric index layout - run: | - make -C .testing build/symmetric/MOM6 -j -o build/deps/lib/libFMS.a + - name: Compile MOM6 with symmetric indexing + run: make -C .testing -j build/symmetric/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-symmetric.tar .testing/build/symmetric/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/MOM6 + path: mom6-symmetric.tar retention-days: 1 build-asymmetric: runs-on: macOS-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -66,24 +46,23 @@ jobs: - uses: ./.github/actions/macos-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - - name: Compile asymmetric index layout - run: | - make -C .testing build/asymmetric/MOM6 -j -o build/deps/lib/libFMS.a + - name: Compile MOM6 with asymmetric indexing + run: make -C .testing -j build/asymmetric/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-asymmetric.tar .testing/build/asymmetric/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-asymmetric-artifact - path: .testing/build/asymmetric/MOM6 + path: mom6-asymmetric.tar retention-days: 1 build-repro: runs-on: macOS-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -92,23 +71,23 @@ jobs: - uses: ./.github/actions/macos-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a + + - name: Compile MOM6 with bit-reproducible optimization + run: make -C .testing -j build/repro/MOM6 - - name: Compile repro - run: make -C .testing build/repro/MOM6 -j -o build/deps/lib/libFMS.a + - name: Prepare artifact + run: tar -cf mom6-repro.tar .testing/build/repro/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-repro-artifact - path: .testing/build/repro/MOM6 + path: mom6-repro.tar retention-days: 1 build-openmp: runs-on: macOS-latest - needs: build-fms steps: - uses: actions/checkout@v4 @@ -117,24 +96,24 @@ jobs: - uses: ./.github/actions/macos-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile FMS + run: make -C .testing -j build/deps/lib/libFMS.a - name: Compile MOM6 supporting OpenMP - run: make -C .testing build/openmp/MOM6 -j -o build/symmetric/Makefile + run: make -C .testing -j build/openmp/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-openmp.tar .testing/build/openmp/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-openmp-artifact - path: .testing/build/openmp/MOM6 + path: mom6-openmp.tar retention-days: 1 build-target: if: github.event_name == 'pull_request' - runs-on: macos-latest - needs: build-fms + runs-on: macOS-latest steps: - uses: actions/checkout@v4 @@ -143,26 +122,30 @@ jobs: - uses: ./.github/actions/macos-setup/ - - uses: actions/download-artifact@v4 - with: - name: fms-artifact - path: .testing/build/deps/ + - name: Compile target FMS + run: | + make -C .testing \ + DO_REGRESSION_TESTS=1 \ + build/target_codebase + make -C .testing/build/target_codebase/.testing -j \ + build/deps/lib/libFMS.a - name: Compile target MOM6 run: | - make -C .testing build/target/MOM6 -j \ - -o build/deps/lib/libFMS.a \ - MOM_TARGET_SLUG=$GITHUB_REPOSITORY \ - MOM_TARGET_LOCAL_BRANCH=$GITHUB_BASE_REF \ - DO_REGRESSION_TESTS=True + make -C .testing -j \ + DO_REGRESSION_TESTS=1 \ + build/target/MOM6 + + - name: Prepare artifact + run: tar -cf mom6-target.tar .testing/build/target/MOM6 - uses: actions/upload-artifact@v4 with: name: mom6-target-artifact - path: .testing/build/target/MOM6 + path: mom6-target.tar retention-days: 1 - #--- + # Tests test-grid: runs-on: macOS-latest @@ -181,21 +164,23 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download asymmetric MOM6 uses: actions/download-artifact@v4 with: name: mom6-asymmetric-artifact - path: .testing/build/asymmetric/ - - name: Verify symmetric-asymmetric grid invariance + - name: Unpack artifacts + run: | + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-asymmetric.tar + + - name: Run grid verification test run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/asymmetric/MOM6 - make -C .testing -k test.grid \ + make -C .testing -j \ -o build/symmetric/MOM6 \ - -o build/asymmetric/MOM6 + -o build/asymmetric/MOM6 \ + test.grid test-layout: runs-on: macOS-latest @@ -212,13 +197,15 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - name: Verify processor domain layout + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar + + - name: Run layout test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing -k test.layout \ - -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.layout test-rotate: runs-on: macOS-latest @@ -235,12 +222,15 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - name: Verify rotational invariance + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar + + - name: Run rotation test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing -k test.rotate -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.rotate test-restart: runs-on: macOS-latest @@ -257,12 +247,15 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - name: Verify restart invariance + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar + + - name: Run restart test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing -k test.restart -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.restart test-nan: runs-on: macOS-latest @@ -279,104 +272,29 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify aggressive initialization - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing -k test.nan -o build/symmetric/MOM6 - - test-dim-t: - runs-on: macos-latest - needs: build-symmetric - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/macos-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify time dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.t -o build/symmetric/MOM6 - test-dim-l: - runs-on: macos-latest - needs: build-symmetric - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/macos-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify horizontal length dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.l -o build/symmetric/MOM6 - - test-dim-h: - runs-on: macos-latest - needs: build-symmetric - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/macos-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar - - name: Verify vertical thickness dimensional invariance + - name: Run NaN initialization test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.h -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.nan - test-dim-z: - runs-on: macos-latest + test-dim: + runs-on: macOS-latest needs: build-symmetric - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/macos-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify vertical coordinate dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.z -o build/symmetric/MOM6 - - test-dim-q: - runs-on: macos-latest - needs: build-symmetric + strategy: + matrix: + dim: + - {id: t, desc: "time"} + - {id: l, desc: "horizontal length"} + - {id: h, desc: "vertical thickness"} + - {id: z, desc: "vertical coordinate"} + - {id: q, desc: "enthalpy"} + - {id: r, desc: "density"} steps: - uses: actions/checkout@v4 @@ -385,38 +303,19 @@ jobs: - uses: ./.github/actions/macos-setup - - name: Download Artifacts + - name: Download symmetric MOM6 uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - name: Verify heat dimensional invariance - run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.z -o build/symmetric/MOM6 + - name: Unpack artifacts + run: tar -xpvf mom6-symmetric.tar - test-dim-r: - runs-on: macos-latest - needs: build-symmetric - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: ./.github/actions/macos-setup - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - - - name: Verify density dimensional invariance + - name: Run ${{ matrix.dim.desc }} dimension test run: | - chmod u+rx .testing/build/symmetric/MOM6 - make -C .testing test.dim.r -o build/symmetric/MOM6 + make -C .testing -j \ + -o build/symmetric/MOM6 \ + test.dim.${{ matrix.dim.id }} test-openmp: runs-on: macOS-latest @@ -435,19 +334,23 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download OpenMP MOM6 uses: actions/download-artifact@v4 with: name: mom6-openmp-artifact - path: .testing/build/openmp/ - - name: Verify OpenMP invariance + - name: Unpack artifacts run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/openmp/MOM6 - make -C .testing -k test.openmp -k -o build/symmetric/MOM6 -o build/openmp/MOM6 + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-openmp.tar + + - name: Run OpenMP test + run: | + make -C .testing -j \ + -o build/symmetric/MOM6 \ + -o build/openmp/MOM6 \ + test.openmp test-repro: runs-on: macOS-latest @@ -466,19 +369,23 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download REPRO MOM6 uses: actions/download-artifact@v4 with: name: mom6-repro-artifact - path: .testing/build/repro/ - - name: Verify optimized equivalence + - name: Unpack artifacts run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/repro/MOM6 - make -C .testing -k test.repro -o build/symmetric/MOM6 -o build/repro/MOM6 + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-repro.tar + + - name: Verify REPRO equivalence + run: | + make -C .testing -j \ + -o build/symmetric/MOM6 \ + -o build/repro/MOM6 \ + test.repro test-regression: if: github.event_name == 'pull_request' @@ -498,45 +405,91 @@ jobs: uses: actions/download-artifact@v4 with: name: mom6-symmetric-artifact - path: .testing/build/symmetric/ - name: Download target MOM6 uses: actions/download-artifact@v4 with: name: mom6-target-artifact - path: .testing/build/target/ + + - name: Unpack artifacts + run: | + tar -xpvf mom6-symmetric.tar + tar -xpvf mom6-target.tar - name: Check for regressions run: | - chmod u+rx .testing/build/symmetric/MOM6 - chmod u+rx .testing/build/target/MOM6 - make -C .testing test.regression \ + make -C .testing -j \ -o build/symmetric/MOM6 \ -o build/target/MOM6 \ - DO_REGRESSION_TESTS=true + DO_REGRESSION_TESTS=1 \ + test.regression + + # Cleanup + + cleanup-common: + runs-on: macOS-latest + permissions: + id-token: write + needs: + - test-grid + - test-openmp + - test-repro + + steps: + - uses: geekyeggo/delete-artifact@v5 + with: + name: | + mom6-asymmetric-artifact + mom6-openmp-artifact + mom6-repro-artifact + mom6-coverage-artifact + + # NOTE: There is no way to conditionally define the elements in `needs`. + # For now, we must create separate rules for each case. - cleanup: - runs-on: macos-latest + cleanup-push: + if: github.event_name != 'pull_request' + runs-on: macOS-latest permissions: id-token: write needs: + - test-layout + - test-rotate + - test-restart + - test-nan + - test-dim - test-grid + - test-openmp + - test-repro + + steps: + - uses: geekyeggo/delete-artifact@v5 + with: + name: | + mom6-symmetric-artifact + mom6-opt-artifact + + cleanup-pr: + if: github.event_name == 'pull_request' + runs-on: macOS-latest + permissions: + id-token: write + needs: - test-layout - test-rotate - test-restart - test-nan - - test-dim-t - - test-dim-l - - test-dim-h - - test-dim-z - - test-dim-q - - test-dim-r + - test-dim + - test-grid - test-openmp - test-repro + - test-regression steps: - uses: geekyeggo/delete-artifact@v5 with: name: | - fms-artifact - mom6-*-artifact + mom6-symmetric-artifact + mom6-target-artifact + mom6-opt-artifact + mom6-opt-target-artifact diff --git a/.testing/Makefile b/.testing/Makefile index ec6e5d1075..f5f6e9b1cd 100644 --- a/.testing/Makefile +++ b/.testing/Makefile @@ -213,10 +213,8 @@ endif ## Rules -.PHONY: all build.regressions build.prof +.PHONY: all all: $(foreach b,$(EXECS),$(BUILD)/$(b)) -build.regressions: $(foreach b,symmetric target,$(BUILD)/$(b)/MOM6) -build.prof: $(foreach b,opt opt_target,$(BUILD)/$(b)/MOM6) # Executable .PRECIOUS: $(foreach b,$(EXECS),$(BUILD)/$(b)) @@ -230,7 +228,7 @@ LDFLAGS_DEPS = -L$(abspath $(DEPS)/lib) PATH_DEPS = PATH="${PATH}:$(abspath $(DEPS)/bin)" -# Define the build targets in terms of the traditional DEBUG/REPRO/etc labels +# Compiler flags SYMMETRIC_FCFLAGS := FCFLAGS="$(FCFLAGS_DEBUG) $(FCFLAGS_INIT) $(FCFLAGS_DEPS)" ASYMMETRIC_FCFLAGS := FCFLAGS="$(FCFLAGS_DEBUG) $(FCFLAGS_INIT) $(FCFLAGS_DEPS)" REPRO_FCFLAGS := FCFLAGS="$(FCFLAGS_REPRO) $(FCFLAGS_DEPS)" @@ -239,10 +237,10 @@ OPENMP_FCFLAGS := FCFLAGS="$(FCFLAGS_DEBUG) $(FCFLAGS_INIT) $(FCFLAGS_DEPS)" TARGET_FCFLAGS := FCFLAGS="$(FCFLAGS_DEBUG) $(FCFLAGS_INIT) $(FCFLAGS_DEPS)" COV_FCFLAGS := FCFLAGS="$(FCFLAGS_COVERAGE) $(FCFLAGS_DEPS)" +# Linker flags MOM_LDFLAGS := LDFLAGS="$(LDFLAGS_DEPS) $(LDFLAGS_USER)" COV_LDFLAGS := LDFLAGS="$(LDFLAGS_COVERAGE) $(LDFLAGS_DEPS) $(LDFLAGS_USER)" - # Environment variable configuration MOM_ENV := $(PATH_FMS) $(BUILD)/symmetric/Makefile: MOM_ENV += $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS) @@ -271,12 +269,16 @@ $(BUILD)/timing/Makefile: MOM_ACFLAGS += --with-driver=timing_tests .NOTPARALLEL:$(foreach e,$(UNIT_EXECS),$(BUILD)/unit/$(e)) $(BUILD)/unit/test_%: $(BUILD)/unit/Makefile FORCE cd $(@D) && $(TIME) $(MAKE) $(@F) -$(BUILD)/unit/Makefile: $(foreach e,$(UNIT_EXECS),../config_src/drivers/unit_tests/$(e).F90) + +$(BUILD)/unit/Makefile: \ + $(foreach e,$(UNIT_EXECS),../config_src/drivers/unit_tests/$(e).F90) .NOTPARALLEL:$(foreach e,$(TIMING_EXECS),$(BUILD)/timing/$(e)) $(BUILD)/timing/time_%: $(BUILD)/timing/Makefile FORCE cd $(@D) && $(TIME) $(MAKE) $(@F) -$(BUILD)/timing/Makefile: $(foreach e,$(TIMING_EXECS),../config_src/drivers/timing_tests/$(e).F90) + +$(BUILD)/timing/Makefile: \ + $(foreach e,$(TIMING_EXECS),../config_src/drivers/timing_tests/$(e).F90) $(BUILD)/%/MOM6: $(BUILD)/%/Makefile FORCE cd $(@D) && $(TIME) $(MAKE) $(@F) @@ -294,7 +296,7 @@ $(BUILD)/opt_target/MOM6: $(BUILD)/opt_target FORCE | $(TARGET_CODEBASE) $(BUILD)/opt_target: | $(TARGET_CODEBASE) ln -s $(abspath $(TARGET_CODEBASE))/.testing/build/opt $@ -FORCE: +.PHONY: FORCE ## Use autoconf to construct the Makefile for each target @@ -330,10 +332,12 @@ ALL_EXECS = symmetric asymmetric repro openmp opt opt_target coupled nuopc \ $(foreach b,$(ALL_EXECS),$(BUILD)/$(b)/): mkdir -p $@ +ifdef DO_REGRESSION_TESTS # Fetch the regression target codebase $(TARGET_CODEBASE): git clone --recursive $(MOM_TARGET_URL) $@ cd $@ && git checkout --recurse-submodules $(MOM_TARGET_BRANCH) +endif ## FMS @@ -362,6 +366,7 @@ $(DEPS)/m4: ../ac/deps/m4 | $(DEPS) $(DEPS): mkdir -p $(DEPS) + #--- # Verify that the coupled model drivers can be compiled. This does not verify # that they can be run, since it would require external submodels. @@ -608,7 +613,6 @@ $(eval $(call STAT_RULE,dim.h,symmetric,,H_RESCALE_POWER=11,,1)) $(eval $(call STAT_RULE,dim.z,symmetric,,Z_RESCALE_POWER=11,,1)) $(eval $(call STAT_RULE,dim.q,symmetric,,Q_RESCALE_POWER=11,,1)) $(eval $(call STAT_RULE,dim.r,symmetric,,R_RESCALE_POWER=11,,1)) - $(eval $(call STAT_RULE,cov,cov,true,,,1)) # Generate the half-period input namelist as follows: @@ -667,33 +671,50 @@ test.summary: run.cov.unit: $(foreach t,$(UNIT_EXECS),$(BUILD)/unit/$(t).F90.gcov) .PHONY: build.unit +.NOTPARALLEL: build.unit build.unit: $(foreach f, $(UNIT_EXECS), $(BUILD)/unit/$(f)) + .PHONY: run.unit run.unit: $(foreach f, $(UNIT_EXECS), work/unit/$(f).out) + .PHONY: build.timing +.NOTPARALLEL: build.timing build.timing: $(foreach f, $(TIMING_EXECS), $(BUILD)/timing/$(f)) + .PHONY: run.timing run.timing: $(foreach f, $(TIMING_EXECS), work/timing/$(f).out) + .PHONY: show.timing show.timing: $(foreach f, $(TIMING_EXECS), work/timing/$(f).show) + $(WORK)/timing/%.show: ./tools/disp_timing.py $(@:.show=.out) -# Invoke the above unit/timing rules for a "target" code -# Invoke with appropriate macros defines, i.e. -# make build.timing_target MOM_TARGET_URL=... MOM_TARGET_BRANCH=... TARGET_CODEBASE=$(BUILD)/target_codebase -# make run.timing_target TARGET_CODEBASE=$(BUILD)/target_codebase +# Invoke the above unit/timing rules for a "target" code, e.g. +# make \ +# MOM_TARGET_URL=... \ +# MOM_TARGET_BRANCH=... \ +# TARGET_CODEBASE=$(BUILD)/target_codebase \ +# build.timing_target +# make TARGET_CODEBASE=$(BUILD)/target_codebase run.timing_target -TIMING_TARGET_EXECS ?= $(basename $(notdir $(wildcard $(TARGET_CODEBASE)/config_src/drivers/timing_tests/*.F90) ) ) +TIMING_TARGET_EXECS ?= \ + $(basename $(notdir $(wildcard $(TARGET_CODEBASE)/config_src/drivers/timing_tests/*.F90))) .PHONY: build.timing_target -build.timing_target: $(foreach f, $(TIMING_TARGET_EXECS), $(TARGET_CODEBASE)/.testing/$(BUILD)/timing/$(f)) +build.timing_target: \ + $(foreach f, $(TIMING_TARGET_EXECS), $(TARGET_CODEBASE)/.testing/$(BUILD)/timing/$(f)) + .PHONY: run.timing_target -run.timing_target: $(foreach f, $(TIMING_TARGET_EXECS), $(TARGET_CODEBASE)/.testing/work/timing/$(f).out) +run.timing_target: \ + $(foreach f, $(TIMING_TARGET_EXECS), $(TARGET_CODEBASE)/.testing/work/timing/$(f).out) + .PHONY: compare.timing -compare.timing: $(foreach f, $(filter $(TIMING_EXECS),$(TIMING_TARGET_EXECS)), work/timing/$(f).compare) -$(WORK)/timing/%.compare: $(TARGET_CODEBASE) +compare.timing: \ + $(foreach f, $(filter $(TIMING_EXECS),$(TIMING_TARGET_EXECS)), work/timing/$(f).compare) +$(WORK)/timing/%.compare: \ + $(TARGET_CODEBASE) ./tools/disp_timing.py -r $(TARGET_CODEBASE)/.testing/$(@:.compare=.out) $(@:.compare=.out) $(TARGET_CODEBASE)/.testing/%: | $(TARGET_CODEBASE) cd $(TARGET_CODEBASE)/.testing && make $*