diff --git a/.github/common/fortran_format_check.py b/.github/common/fortran_format_check.py index 8452e5a69c6..9495e7d7d89 100644 --- a/.github/common/fortran_format_check.py +++ b/.github/common/fortran_format_check.py @@ -20,6 +20,7 @@ # Exclude these files from checks excludefiles = ["src/Utilities/InputOutput.f90"] # excluded until refactored + class FortranFormatCheck: """ Verify MODFLOW 6 fortran source code format @@ -99,6 +100,7 @@ def _excluded(self, path: Path) -> bool: return False + if __name__ == "__main__": parser = argparse.ArgumentParser( "MODFLOW 6 fortran format source code verification" @@ -106,9 +108,7 @@ def _excluded(self, path: Path) -> bool: parser.add_argument( "-r", "--root", help="path to MODFLOW 6 repository root directory" ) - parser.add_argument( - "-v", "--verbose", action="store_true", help="verbose" - ) + parser.add_argument("-v", "--verbose", action="store_true", help="verbose") args = parser.parse_args() # set MODFLOW 6 repository root diff --git a/.github/common/update_compat_tables.py b/.github/common/update_compat_tables.py new file mode 100644 index 00000000000..59255741806 --- /dev/null +++ b/.github/common/update_compat_tables.py @@ -0,0 +1,35 @@ +""" +Inserts Markdown compatibility tables +between tags in target Markdown file. +""" + +import re +import sys +from pathlib import Path + +name = sys.argv[1] # name of the table, e.g. "compile", "test" +compat_path = Path(sys.argv[2]) # compatibility table path +update_path = Path(sys.argv[3]) # path to file to update + +assert compat_path.is_file() +assert update_path.is_file() + +with open(compat_path, "r") as compat: + table = "".join(compat.readlines()) + r = re.compile( + r".*", + re.DOTALL, + ) + ct = ( + "{}" + ) + readme = update_path.open().read() + update_path.open("w").write(r.sub(ct, readme)) diff --git a/.github/common/wide_compat_reports.py b/.github/common/wide_compat_reports.py new file mode 100644 index 00000000000..f2ffb531ba1 --- /dev/null +++ b/.github/common/wide_compat_reports.py @@ -0,0 +1,39 @@ +""" +Converts compatibility reports from long to wide format +and makes a markdown table from the wide format report. +""" + +from pathlib import Path +import pandas as pd +import sys + +ip = Path(sys.argv[1]) # input file path +op = Path(sys.argv[2]) # output file path +assert ip.is_file() +assert ip.suffix == ".csv" +assert op.suffix == ".csv" + +# read long CSV +df = pd.read_csv(ip) + +# pivot and sort +df = pd.pivot( + df, + index="runner", + columns=["compiler", "version"], + values="support", +).sort_values(by=["runner"]) + +# write wide CSV +df.to_csv(op) + +# write wide markdown table +with open(op.with_suffix(".md"), "w") as file: + file.write( + df.to_markdown() + .replace("nan", "") + .replace("(", "") + .replace(")", "") + .replace(",", "") + .replace("'", "") + ) diff --git a/.github/compat/comp.csv b/.github/compat/comp.csv new file mode 100644 index 00000000000..2c8d36ab576 --- /dev/null +++ b/.github/compat/comp.csv @@ -0,0 +1,9 @@ +compiler,gcc,gcc,gcc,gcc,gcc,gcc,gcc,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel +version,10,11,12,13,7,8,9,2021.1,2021.10,2021.2,2021.3,2021.4,2021.5,2021.6,2021.7,2021.8,2021.9,2021.1,2021.2,2021.4,2022.0,2022.1,2022.2.1,2022.2,2023.0,2023.1,2023.2 +runner,,,,,,,,,,,,,,,,,,,,,,,,,,, +macos-11,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,, +macos-12,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,, +ubuntu-20.04,✓,✓,,,✓,✓,✓,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? +ubuntu-22.04,✓,✓,✓,✓,,,✓,,✓,,,,,✓,✓,✓,✓,,,,,,✓,✓,,,✓ +windows-2019,✓,✓,✓,✓,,,✓,,✓,,,,,,✓,✓,✓,,,,,,,✓,,,✓ +windows-2022,✓,✓,✓,✓,,,✓,,✓,,,,,✓,✓,✓,✓,,,,,,,✓,,,✓ diff --git a/.github/compat/test.csv b/.github/compat/test.csv new file mode 100644 index 00000000000..5326ca671b0 --- /dev/null +++ b/.github/compat/test.csv @@ -0,0 +1,9 @@ +compiler,gcc,gcc,gcc,gcc,gcc,gcc,gcc,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel-classic,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel +version,10,11,12,13,7,8,9,2021.1,2021.10,2021.2,2021.3,2021.4,2021.5,2021.6,2021.7,2021.8,2021.9,2021.1,2021.2,2021.4,2022.0,2022.1,2022.2.1,2022.2,2023.0,2023.1,2023.2 +runner,,,,,,,,,,,,,,,,,,,,,,,,,,, +macos-11,✓,✓,✓,✓,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,,,,,,,,,,,, +macos-12,✓,✓,✓,✓,,,,✓,,✓,✓,✓,✓,✓,✓,,,,,,,,,,,, +ubuntu-20.04,✓,✓,,,✓,✓,✓,,,,,,,,,,,,,,,,,,,, +ubuntu-22.04,✓,✓,✓,✓,,,✓,,,,,,,✓,✓,,,,,,,,,,,, +windows-2019,✓,✓,✓,✓,,,,,,,,,,,✓,,,,,,,,,,,, +windows-2022,✓,✓,✓,✓,,,✓,,,,,,,✓,✓,,,,,,,,,,,, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7a78c2f91d..86edea78f9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: uses: actions/checkout@v4 - name: Setup gfortran ${{ env.GCC_V }} - uses: awvwgk/setup-fortran@main + uses: fortran-lang/setup-fortran@v1 with: compiler: gcc version: ${{ env.GCC_V }} @@ -108,7 +108,7 @@ jobs: shell: bash -l {0} env: FC: gfortran - GCC_V: 13 + GCC: 13 steps: - name: Checkout modflow6 uses: actions/checkout@v4 @@ -121,11 +121,11 @@ jobs: repository: fortran-lang/test-drive path: test-drive - - name: Setup GNU Fortran ${{ env.GCC_V }} - uses: awvwgk/setup-fortran@main + - name: Setup GNU Fortran ${{ env.GCC }} + uses: fortran-lang/setup-fortran@v1 with: compiler: gcc - version: ${{ env.GCC_V }} + version: ${{ env.GCC }} - name: Setup Micromamba uses: mamba-org/setup-micromamba@v1 @@ -176,7 +176,7 @@ jobs: fi test_gfortran: - name: Test (gfortran) + name: Test gnu fortran needs: - lint - build @@ -185,33 +185,13 @@ jobs: strategy: fail-fast: false matrix: - # compatible combinations from https://github.com/awvwgk/setup-fortran#runner-compatibility - include: - - {os: ubuntu-20.04, gcc_v: 7, test: false} - - {os: ubuntu-20.04, gcc_v: 8, test: false} - - {os: ubuntu-20.04, gcc_v: 9, test: false} - - {os: ubuntu-20.04, gcc_v: 10, test: false} - - {os: ubuntu-20.04, gcc_v: 11, test: false} - - {os: ubuntu-22.04, gcc_v: 12, test: false} - # only run autotests on latest version on each platform - - {os: ubuntu-22.04, gcc_v: 13, test: true} - - {os: macos-12, gcc_v: 7, test: false} - - {os: macos-12, gcc_v: 8, test: false} - - {os: macos-12, gcc_v: 9, test: false} - - {os: macos-12, gcc_v: 10, test: false} - - {os: macos-12, gcc_v: 11, test: false} - - {os: macos-12, gcc_v: 12, test: false} - - {os: macos-12, gcc_v: 13, test: true} - - {os: windows-2022, gcc_v: 9, test: false} - - {os: windows-2022, gcc_v: 10, test: false} - - {os: windows-2022, gcc_v: 11, test: false} - - {os: windows-2022, gcc_v: 12, test: true} - + os: [ ubuntu-22.04, macos-12, windows-2022 ] defaults: run: shell: bash -l {0} env: FC: gfortran + GCC: 13 steps: - name: Checkout modflow6 uses: actions/checkout@v4 @@ -230,11 +210,11 @@ jobs: repository: MODFLOW-USGS/modflow6-examples path: modflow6-examples - - name: Setup GNU Fortran ${{ matrix.gcc_v }} - uses: awvwgk/setup-fortran@main + - name: Setup GNU Fortran ${{ env.GCC }} + uses: fortran-lang/setup-fortran@v1 with: compiler: gcc - version: ${{ matrix.gcc_v }} + version: ${{ env.GCC }} - name: Setup Micromamba uses: mamba-org/setup-micromamba@v1 @@ -262,12 +242,10 @@ jobs: run: meson test --verbose --no-rebuild -C builddir - name: Update flopy - if: matrix.test working-directory: modflow6/autotest run: python update_flopy.py - name: Get executables - if: matrix.test working-directory: modflow6/autotest env: GITHUB_TOKEN: ${{ github.token }} @@ -275,7 +253,6 @@ jobs: pytest -v --durations 0 get_exes.py - name: Test modflow6 - if: matrix.test working-directory: modflow6/autotest env: REPOS_PATH: ${{ github.workspace }} @@ -287,14 +264,14 @@ jobs: fi - name: Checkout usgslatex - if: matrix.test && runner.os == 'Linux' + if: runner.os == 'Linux' uses: actions/checkout@v4 with: repository: MODFLOW-USGS/usgslatex path: usgslatex - name: Install TeX Live - if: matrix.test && runner.os == 'Linux' + if: runner.os == 'Linux' run: | sudo apt-get update sudo apt install texlive-science \ @@ -304,19 +281,18 @@ jobs: texlive-fonts-extra - name: Install USGS LaTeX style files and Univers font - if: matrix.test && runner.os == 'Linux' + if: runner.os == 'Linux' working-directory: usgslatex/usgsLaTeX run: sudo ./install.sh --all-users - name: Test distribution scripts - if: matrix.test working-directory: modflow6/distribution env: GITHUB_TOKEN: ${{ github.token }} run: pytest -v --durations 0 test_intel_fortran: - name: Test (Intel) + name: Test intel fortran needs: - lint - build @@ -326,45 +302,9 @@ jobs: fail-fast: false matrix: include: - ### ifx - ## 2022.2.x autotests disabled - # - mf5to6 test_evt: failure to converge - # - mf6 Keating_[disu_]dev: bad head comparison - - {os: ubuntu-22.04, compiler: intel, version: 2022.2.1, test: false} - - {os: ubuntu-22.04, compiler: intel, version: 2022.2, test: false} - ## 2021.1 segfault in meson serial sim test - # - {os: ubuntu-22.04, compiler: intel, version: 2022.1, test: false} - ## 2022.0 & 2021.[1,2,4] segfault at compile time - # - {os: ubuntu-22.04, compiler: intel, version: "2022.0", test: false} - # - {os: ubuntu-22.04, compiler: intel, version: 2021.4, test: false} - # - {os: ubuntu-22.04, compiler: intel, version: 2021.2, test: false} - # - {os: ubuntu-22.04, compiler: intel, version: 2021.1, test: false} - ## ifx not yet supported on macOS - # - {os: macos-12, compiler: intel, version: 2023.2, test: true} - ## 2023.[0,1] fail to compile - # - {os: windows-2022, compiler: intel, version: 2023.1, test: false} - # - {os: windows-2022, compiler: intel, version: "2023.0", test: false} - - {os: windows-2022, compiler: intel, version: 2022.2, test: false} - ## 2022.1 fail to link - # - {os: windows-2022, compiler: intel, version: 2022.1, test: false} - - ### ifort - ## only autotest latest on each platform - - {os: ubuntu-22.04, compiler: intel-classic, version: "2021.10", test: false} - - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.9, test: false} - - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.8, test: false} - - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.7, test: true} - - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.6, test: false} - - {os: macos-12, compiler: intel-classic, version: "2021.10", test: false} - - {os: macos-12, compiler: intel-classic, version: 2021.9, test: false} - - {os: macos-12, compiler: intel-classic, version: 2021.8, test: false} - - {os: macos-12, compiler: intel-classic, version: 2021.7, test: true} - - {os: macos-12, compiler: intel-classic, version: 2021.6, test: false} - - {os: windows-2022, compiler: intel-classic, version: "2021.10", test: false} - - {os: windows-2022, compiler: intel-classic, version: 2021.9, test: false} - - {os: windows-2022, compiler: intel-classic, version: 2021.8, test: false} - - {os: windows-2022, compiler: intel-classic, version: 2021.7, test: true} - - {os: windows-2022, compiler: intel-classic, version: 2021.6, test: false} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.7} + - {os: macos-12, compiler: intel-classic, version: 2021.7} + - {os: windows-2022, compiler: intel-classic, version: 2021.7} defaults: run: @@ -393,7 +333,7 @@ jobs: cache-downloads: true - name: Setup Intel Fortran - uses: awvwgk/setup-fortran@main + uses: fortran-lang/setup-fortran@v1 with: compiler: ${{ matrix.compiler }} version: ${{ matrix.version }} @@ -418,19 +358,16 @@ jobs: run: meson test --verbose --no-rebuild -C builddir - name: Update flopy - if: matrix.test working-directory: modflow6/autotest run: python update_flopy.py - name: Get executables - if: matrix.test working-directory: modflow6/autotest env: GITHUB_TOKEN: ${{ github.token }} run: pytest -v --durations 0 get_exes.py - name: Test programs - if: matrix.test working-directory: modflow6/autotest env: REPOS_PATH: ${{ github.workspace }} @@ -442,7 +379,6 @@ jobs: fi - name: Test scripts - if: matrix.test working-directory: modflow6/distribution env: GITHUB_TOKEN: ${{ github.token }} @@ -492,7 +428,7 @@ jobs: mpi: msmpi - name: Setup GNU Fortran ${{ env.GCC_V }} - uses: awvwgk/setup-fortran@main + uses: fortran-lang/setup-fortran@v1 with: compiler: gcc version: ${{ env.GCC_V }} diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml new file mode 100644 index 00000000000..b91e33dac92 --- /dev/null +++ b/.github/workflows/compilers.yml @@ -0,0 +1,364 @@ +name: MODFLOW 6 compiler checks +on: + push: + branches: + - v[0-9]+.[0-9]+.[0-9]+* + - master + pull_request: + branches: + - master + schedule: + - cron: 0 0 * * 0 # 12am utc every sunday + # workflow_dispatch trigger to start release via GitHub UI or CLI, see + # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow + workflow_dispatch: +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # combinations from https://github.com/fortran-lang/setup-fortran#runner-compatibility + include: + # gfortran + - {os: ubuntu-20.04, compiler: gcc, version: 7} + - {os: ubuntu-20.04, compiler: gcc, version: 8} + - {os: ubuntu-20.04, compiler: gcc, version: 9} + - {os: ubuntu-20.04, compiler: gcc, version: 10} + - {os: ubuntu-20.04, compiler: gcc, version: 11} + - {os: ubuntu-22.04, compiler: gcc, version: 9} + - {os: ubuntu-22.04, compiler: gcc, version: 10} + - {os: ubuntu-22.04, compiler: gcc, version: 11} + - {os: ubuntu-22.04, compiler: gcc, version: 12} + - {os: ubuntu-22.04, compiler: gcc, version: 13} + - {os: macos-11, compiler: gcc, version: 7} + - {os: macos-11, compiler: gcc, version: 8} + - {os: macos-11, compiler: gcc, version: 9} + - {os: macos-11, compiler: gcc, version: 10} + - {os: macos-11, compiler: gcc, version: 11} + - {os: macos-11, compiler: gcc, version: 12} + - {os: macos-11, compiler: gcc, version: 13} + - {os: macos-12, compiler: gcc, version: 7} + - {os: macos-12, compiler: gcc, version: 8} + - {os: macos-12, compiler: gcc, version: 9} + - {os: macos-12, compiler: gcc, version: 10} + - {os: macos-12, compiler: gcc, version: 11} + - {os: macos-12, compiler: gcc, version: 12} + - {os: macos-12, compiler: gcc, version: 13} + - {os: windows-2019, compiler: gcc, version: 9} + - {os: windows-2019, compiler: gcc, version: 10} + - {os: windows-2019, compiler: gcc, version: 11} + - {os: windows-2019, compiler: gcc, version: 12} + - {os: windows-2019, compiler: gcc, version: 13} + - {os: windows-2022, compiler: gcc, version: 9} + - {os: windows-2022, compiler: gcc, version: 10} + - {os: windows-2022, compiler: gcc, version: 11} + - {os: windows-2022, compiler: gcc, version: 12} + - {os: windows-2022, compiler: gcc, version: 13} + # ifx + - {os: ubuntu-20.04, compiler: intel, version: 2023.2} + - {os: ubuntu-20.04, compiler: intel, version: 2023.1} + - {os: ubuntu-20.04, compiler: intel, version: "2023.0"} + - {os: ubuntu-20.04, compiler: intel, version: 2022.2.1} + - {os: ubuntu-20.04, compiler: intel, version: 2022.2} + - {os: ubuntu-20.04, compiler: intel, version: 2022.1} + - {os: ubuntu-20.04, compiler: intel, version: "2022.0"} + - {os: ubuntu-20.04, compiler: intel, version: 2021.4} + - {os: ubuntu-20.04, compiler: intel, version: 2021.2} + - {os: ubuntu-20.04, compiler: intel, version: 2021.1} + - {os: ubuntu-22.04, compiler: intel, version: 2023.2} + - {os: ubuntu-22.04, compiler: intel, version: 2023.1} + - {os: ubuntu-22.04, compiler: intel, version: "2023.0"} + - {os: ubuntu-22.04, compiler: intel, version: 2022.2.1} + - {os: ubuntu-22.04, compiler: intel, version: 2022.2} + - {os: ubuntu-22.04, compiler: intel, version: 2022.1} + - {os: ubuntu-22.04, compiler: intel, version: "2022.0"} + - {os: ubuntu-22.04, compiler: intel, version: 2021.4} + - {os: ubuntu-22.04, compiler: intel, version: 2021.2} + - {os: ubuntu-22.04, compiler: intel, version: 2021.1} + # no ifx on mac + - {os: windows-2019, compiler: intel, version: 2023.2} + - {os: windows-2019, compiler: intel, version: 2023.1} + - {os: windows-2019, compiler: intel, version: "2023.0"} + - {os: windows-2019, compiler: intel, version: 2022.2} + - {os: windows-2019, compiler: intel, version: 2022.1} + - {os: windows-2022, compiler: intel, version: 2023.2} + - {os: windows-2022, compiler: intel, version: 2023.1} + - {os: windows-2022, compiler: intel, version: "2023.0"} + - {os: windows-2022, compiler: intel, version: 2022.2} + - {os: windows-2022, compiler: intel, version: 2022.1} + # ifort + - {os: ubuntu-20.04, compiler: intel-classic, version: "2021.10"} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.9} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.8} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.7} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.6} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.5} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.4} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.3} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.2} + - {os: ubuntu-20.04, compiler: intel-classic, version: 2021.1} + - {os: ubuntu-22.04, compiler: intel-classic, version: "2021.10"} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.9} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.8} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.7} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.6} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.5} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.4} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.3} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.2} + - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.1} + - {os: macos-11, compiler: intel-classic, version: "2021.10"} + - {os: macos-11, compiler: intel-classic, version: 2021.9} + - {os: macos-11, compiler: intel-classic, version: 2021.8} + - {os: macos-11, compiler: intel-classic, version: 2021.7} + - {os: macos-11, compiler: intel-classic, version: 2021.6} + - {os: macos-11, compiler: intel-classic, version: 2021.5} + - {os: macos-11, compiler: intel-classic, version: 2021.4} + - {os: macos-11, compiler: intel-classic, version: 2021.3} + - {os: macos-11, compiler: intel-classic, version: 2021.2} + - {os: macos-11, compiler: intel-classic, version: 2021.1} + - {os: macos-12, compiler: intel-classic, version: "2021.10"} + - {os: macos-12, compiler: intel-classic, version: 2021.9} + - {os: macos-12, compiler: intel-classic, version: 2021.8} + - {os: macos-12, compiler: intel-classic, version: 2021.7} + - {os: macos-12, compiler: intel-classic, version: 2021.6} + - {os: macos-12, compiler: intel-classic, version: 2021.5} + - {os: macos-12, compiler: intel-classic, version: 2021.4} + - {os: macos-12, compiler: intel-classic, version: 2021.3} + - {os: macos-12, compiler: intel-classic, version: 2021.2} + - {os: macos-12, compiler: intel-classic, version: 2021.1} + - {os: windows-2019, compiler: intel-classic, version: "2021.10"} + - {os: windows-2019, compiler: intel-classic, version: 2021.9} + - {os: windows-2019, compiler: intel-classic, version: 2021.8} + - {os: windows-2019, compiler: intel-classic, version: 2021.7} + - {os: windows-2019, compiler: intel-classic, version: 2021.6} + - {os: windows-2022, compiler: intel-classic, version: "2021.10"} + - {os: windows-2022, compiler: intel-classic, version: 2021.9} + - {os: windows-2022, compiler: intel-classic, version: 2021.8} + - {os: windows-2022, compiler: intel-classic, version: 2021.7} + - {os: windows-2022, compiler: intel-classic, version: 2021.6} + defaults: + run: + shell: bash -l {0} + steps: + - name: Checkout modflow6 + uses: actions/checkout@v4 + with: + path: modflow6 + + - name: Checkout modflow6-testmodels + uses: actions/checkout@v4 + with: + repository: MODFLOW-USGS/modflow6-testmodels + path: modflow6-testmodels + + - name: Checkout modflow6-examples + uses: actions/checkout@v4 + with: + repository: MODFLOW-USGS/modflow6-examples + path: modflow6-examples + + - name: Setup ${{ matrix.compiler }} ${{ matrix.version }} + uses: fortran-lang/setup-fortran@v1 + with: + compiler: ${{ matrix.compiler}} + version: ${{ matrix.version }} + + - name: Setup Micromamba + uses: mamba-org/setup-micromamba@v1 + with: + environment-file: modflow6/environment.yml + init-shell: >- + bash + powershell + cache-environment: true + cache-downloads: true + + - name: Build modflow6 + working-directory: modflow6 + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir + + - name: Show build log + if: failure() + working-directory: modflow6 + run: cat builddir/meson-logs/meson-log.txt + + - name: Upload build log + if: failure() + uses: actions/upload-artifact@v3 + with: + name: meson-log.txt + path: modflow6/builddir/meson-logs/meson-log.txt + + - name: Unit test programs + if: success() + working-directory: modflow6 + run: meson test --verbose --no-rebuild -C builddir + + - name: Create compile report + if: success() || failure() + shell: bash + run: | + if [[ "${{ job.status }}" == "success" ]]; then + support="✓" + else + support="" + fi + + mkdir -p compat + prefix="${{ matrix.os }},${{ matrix.compiler }},${{ matrix.version }}" + echo "$prefix,$support" >> "compat/comp_${prefix//,/_}.csv" + + - name: Update flopy + if: success() + working-directory: modflow6/autotest + run: python update_flopy.py + + - name: Get executables + if: success() + working-directory: modflow6/autotest + env: + GITHUB_TOKEN: ${{ github.token }} + run: pytest -v --durations 0 get_exes.py + + - name: Test modflow6 + if: success() + working-directory: modflow6/autotest + env: + REPOS_PATH: ${{ github.workspace }} + run: pytest -v -n auto --durations 0 + + - name: Create test report + if: success() || failure() + shell: bash + run: | + if [[ "${{ job.status }}" == "success" ]]; then + support="✓" + else + support="" + fi + + mkdir -p compat + prefix="${{ matrix.os }},${{ matrix.compiler }},${{ matrix.version }}" + echo "$prefix,$support" >> "compat/test_${prefix//,/_}.csv" + + - name: Upload reports + if: success() || failure() + uses: actions/upload-artifact@v3 + with: + name: compat + path: compat/*.csv + + report: + name: Make compatibility report + if: success() || failure() + needs: test + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install packages + run: pip install tabulate pandas + + - name: Download reports + uses: actions/download-artifact@v3 + with: + name: compat + path: .github/compat/new + + - name: Concatenate reports + working-directory: .github/compat + run: | + cols="runner,compiler,version,support" + echo "$cols" > long_comp.csv + echo "$cols" > long_test.csv + cat new/comp*.csv >> long_comp.csv + cat new/test*.csv >> long_test.csv + + - name: Make wide CSV and MD tables + working-directory: .github/compat + id: merge-reports + run: | + python ../common/wide_compat_reports.py "long_comp.csv" "comp.csv" + python ../common/wide_compat_reports.py "long_test.csv" "test.csv" + + # only upload wide CSVs and Markdown tables + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: compat + path: | + .github/compat/comp.* + .github/compat/test.* + + # update DEVELOPER.md if this is not a push event and there are any changes + - name: Check for changes + working-directory: .github/compat + if: github.event_name != 'pull_request' + id: diff + run: | + if ! [ -f comp.csv ]; then + echo "diff=false" >> $GITHUB_OUTPUT + exit 0 + fi + + diff_comp=$(git diff comp.csv) + diff_test=$(git diff test.csv) + if [[ ( $diff_comp == "" ) && ( $diff_test == "" ) ]]; then + echo "No changes found" + echo "diff=false" >> $GITHUB_OUTPUT + else + echo "comp.csv diff:" + echo "$diff_comp" + echo "test.csv diff:" + echo "$diff_test" + echo "diff=true" >> $GITHUB_OUTPUT + fi + + - name: Update DEVELOPER.md + if: ${{ steps.diff.outputs.diff == 'true' && github.event_name != 'pull_request' }} + run: | + python .github/common/update_compat_tables.py "compile" ".github/compat/comp.md" "DEVELOPER.md" + python .github/common/update_compat_tables.py "test" ".github/compat/test.md" "DEVELOPER.md" + + - name: Print DEVELOPER.md diff + if: ${{ steps.diff.outputs.diff == 'true' && github.event_name != 'pull_request' }} + run: git diff DEVELOPER.md + + - name: Create pull request + if: ${{ steps.diff.outputs.diff == 'true' && github.event_name != 'pull_request' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # setup bot user + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + # create new branch + now=$(date +'%Y-%m-%dT%H-%M-%S') + updated_branch="compat_$now" + default_branch="${{ github.event.repository.default_branch }}" + git switch -c "$updated_branch" + + # commit wide CSVs and Markdown tables and push branch + git add DEVELOPER.md .github/compat/comp.csv .github/compat/test.csv + git commit -m "Update compatibility tables" + git push -u origin "$updated_branch" + + # open PR + cat <(echo '### Compile') <(echo) .github/compat/comp.md <(echo) <(echo '### Test') <(echo) .github/compat/test.md > compat.md + gh pr create -B "$default_branch" -H "$updated_branch" --title "Update compile/test compatibility tables" --body-file compat.md \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b6613fbc19a..71cc4e279ac 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -67,7 +67,7 @@ jobs: run: pytest -v build_mfio_tex.py - name: Setup GNU Fortran ${{ env.GCC_V }} - uses: awvwgk/setup-fortran@main + uses: fortran-lang/setup-fortran@v1 with: compiler: gcc version: ${{ env.GCC_V }} diff --git a/.github/workflows/large.yml b/.github/workflows/large.yml index 39af5c2b21e..c0687e1a573 100644 --- a/.github/workflows/large.yml +++ b/.github/workflows/large.yml @@ -21,7 +21,7 @@ jobs: - {os: windows-2022, compiler: intel-classic, version: 2021.6} steps: - name: Setup ${{ matrix.compiler }} ${{ matrix.version }} - uses: awvwgk/setup-fortran@main + uses: fortran-lang/setup-fortran@v1 with: compiler: ${{ matrix.compiler }} version: ${{ matrix.version }} @@ -62,7 +62,7 @@ jobs: cache-environment: true - name: Setup compilers (${{ matrix.compiler }} ${{ matrix.version }}) - uses: awvwgk/setup-fortran@main + uses: fortran-lang/setup-fortran@v1 with: compiler: ${{ matrix.compiler }} version: ${{ matrix.version }} diff --git a/.gitignore b/.gitignore index 56b28c72ec8..ec2abadcb65 100644 --- a/.gitignore +++ b/.gitignore @@ -133,3 +133,6 @@ unittests/ **/__pycache__ **/.benchmarks + +# compiler compatibility markdown tables +.github/compat/*.md \ No newline at end of file diff --git a/DEVELOPER.md b/DEVELOPER.md index 839db2d9cfb..25eaa483503 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -17,6 +17,9 @@ To build and test a parallel version of the program, first read the instructions - [Windows](#windows) - [Intel Fortran](#intel-fortran) - [Windows](#windows-1) + - [Compiler compatibility](#compiler-compatibility) + - [Compile](#compile) + - [Test](#test) - [Python](#python) - [Dependencies](#dependencies) - [`meson`](#meson) @@ -115,22 +118,7 @@ Intel Fortran can also be used to compile MODFLOW 6 and associated utilities. Th A number of environment variables must be set before using Intel Fortran. General information can be found [here](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup.html), with specific instructions to configure a shell session for `ifort` [here](https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/compiler-setup/use-the-command-line/specifying-the-location-of-compiler-components.html). -While the current development version of MODFLOW 6 is broadly compatible with `ifort`, `ifx` compatibility is still limited. The following table documents whether MODFLOW 6 can be succesfully built with particular platform/compiler combinations, and info on relevant errors if not. - -**Note**: this table is not exhaustive and only details the currently tested subset of combinations. - -| Platform | Compiler | Version | Compatible? | Notes | -|:---------|:---------|:--------|:------------|:------| -| Ubuntu 22.04 | ifort | 2021.[6-10] | ✓ | | -| Ubuntu 22.04 | ifx | 2022.2.[0-1] | ✓ | some autotests fail (convergence failure, bad head comparison) | -| Ubuntu 22.04 | ifx | 2022.1 | ✗ | segfault in meson serial simulation test | -| Ubuntu 22.04 | ifx | 2022.0, 2021.[1,2,4] | ✗ | compilation failure (segfault) | -| macOS 12 (Monterey) | ifort | 2021.[6-10] | ✓ | | -| macOS N | ifx | all | ✗ | ifx support for macOS [is not planned](https://community.intel.com/t5/Blogs/Tech-Innovation/Tools/Deprecation-of-Intel-Fortran-Compiler-Classic-for-macOS/post/1472697) | -| Windows 10 (Server 2022) | ifort | 2021.[6-10] | ✓ | | -| Windows 10 (Server 2022) | ifx | 2023.[0-1] | ✗ | compilation failure | -| Windows 10 (Server 2022) | ifx | 2022.2 | ✓ | | -| Windows 10 (Server 2022) | ifx | 2022.1 | ✗ | linking failure | +While the current development version of MODFLOW 6 is broadly compatible with `ifort`, `ifx` compatibility is still limited on Ubuntu and Windows, and `ifx` is not supported on macOS. ##### Windows @@ -142,6 +130,36 @@ On Windows, [Visual Studio](https://visualstudio.microsoft.com) and a number of cmd.exe "/K" '"C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" && "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat" && powershell' ``` +#### Compiler compatibility + +The following tables are automatically generated by [a CI workflow](.github/workflows/compilers.yml). + +##### Compile + + +| runner | gcc 10 | gcc 11 | gcc 12 | gcc 13 | gcc 7 | gcc 8 | gcc 9 | intel-classic 2021.1 | intel-classic 2021.10 | intel-classic 2021.2 | intel-classic 2021.3 | intel-classic 2021.4 | intel-classic 2021.5 | intel-classic 2021.6 | intel-classic 2021.7 | intel-classic 2021.8 | intel-classic 2021.9 | intel 2021.1 | intel 2021.2 | intel 2021.4 | intel 2022.0 | intel 2022.1 | intel 2022.2.1 | intel 2022.2 | intel 2023.0 | intel 2023.1 | intel 2023.2 | +|:-------------|:----------------|:----------------|:----------------|:----------------|:---------------|:---------------|:---------------|:------------------------------|:-------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|----------------------:|----------------------:|----------------------:|----------------------:|----------------------:|:------------------------|:----------------------|----------------------:|----------------------:|:----------------------| +| macos-11 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | +| macos-12 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | +| ubuntu-20.04 | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | ✓ | ✓ | | | ✓ | +| ubuntu-22.04 | ✓ | ✓ | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | ✓ | ✓ | | | ✓ | +| windows-2019 | ✓ | ✓ | ✓ | ✓ | | | | | ✓ | | | | | | ✓ | ✓ | ✓ | | | | | | | ✓ | | | ✓ | +| windows-2022 | ✓ | ✓ | ✓ | ✓ | | | ✓ | | ✓ | | | | | ✓ | ✓ | ✓ | ✓ | | | | | | | ✓ | | | ✓ | + + +##### Test + + +| runner | gcc 10 | gcc 11 | gcc 12 | gcc 13 | gcc 7 | gcc 8 | gcc 9 | intel-classic 2021.1 | intel-classic 2021.10 | intel-classic 2021.2 | intel-classic 2021.3 | intel-classic 2021.4 | intel-classic 2021.5 | intel-classic 2021.6 | intel-classic 2021.7 | intel-classic 2021.8 | intel-classic 2021.9 | intel 2021.1 | intel 2021.2 | intel 2021.4 | intel 2022.0 | intel 2022.1 | intel 2022.2.1 | intel 2022.2 | intel 2023.0 | intel 2023.1 | intel 2023.2 | +|:-------------|:----------------|:----------------|:----------------|:----------------|:---------------|:---------------|:---------------|:------------------------------|-------------------------------:|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|------------------------------:|------------------------------:|----------------------:|----------------------:|----------------------:|----------------------:|----------------------:|------------------------:|----------------------:|----------------------:|----------------------:|----------------------:| +| macos-11 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | +| macos-12 | ✓ | ✓ | ✓ | ✓ | | | | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | +| ubuntu-20.04 | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | | ✓ | | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | +| ubuntu-22.04 | ✓ | ✓ | ✓ | ✓ | | | ✓ | ✓ | | ✓ | | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | +| windows-2019 | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | ✓ | | | | | | | | | | | | | +| windows-2022 | ✓ | ✓ | ✓ | ✓ | | | ✓ | | | | | | | ✓ | ✓ | | | | | | | | | | | | | + + ### Python Python 3.8+ is required to run MODFLOW 6 tests. A Conda distribution (e.g. [miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/products/individual) is recommended. Python dependencies are specified in `environment.yml`. To create an environment, run from the project root: