From 56010a62cc9c86c2e49a68c1affc9c2416124e0e Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Thu, 22 Feb 2024 15:29:56 -0500 Subject: [PATCH] feat: support gcc on macos-14 (#60) * macos-11 is deprecated, stop testing and drop support * macos-13/gcc7-9 workaround no longer works, drop support * mark macos-12/gcc 13 and macos-12/ifort 2021.7 supported * installing nvidia 22.1 maxes out runner storage, drop support --- .github/actions/test-fc/action.yml | 11 ----------- .github/compat/compat.csv | 21 +++++++++++---------- .github/compat/long_compat.csv | 13 ++++++++----- .github/compat/matrix.yml | 16 +++++++++++++--- .github/workflows/test.yml | 4 ++++ README.md | 19 ++++++++++--------- setup-fortran.sh | 30 ++++++++++++++++++++++++------ 7 files changed, 70 insertions(+), 44 deletions(-) diff --git a/.github/actions/test-fc/action.yml b/.github/actions/test-fc/action.yml index 6c1a5969..477bbc11 100644 --- a/.github/actions/test-fc/action.yml +++ b/.github/actions/test-fc/action.yml @@ -33,17 +33,6 @@ runs: working-directory: test shell: bash run: | - # macos-13/gfortran 7-9 compatibility workaround - args="" - if [ "$RUNNER_OS" == "macOS" ]; then - if [[ $(sw_vers -productVersion) == 13* ]] && \ - [[ ${{ inputs.compiler }} == "gcc" ]] && \ - [[ ${{ inputs.version }} =~ ^(7|8|9)$ ]] - then - args="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" - fi - fi - # hello world program ${{ env.FC }} $args -o hw hw.f90 output=$(./hw '2>&1') diff --git a/.github/compat/compat.csv b/.github/compat/compat.csv index a04edb67..62c9e3dd 100644 --- a/.github/compat/compat.csv +++ b/.github/compat/compat.csv @@ -1,10 +1,11 @@ -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-classic,intel-classic,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc -version,10,11,12,13,7,8,9,2021.1,2021.10,2021.2,2021.3,2021.4,2021.5,2021.6,2021.7.1,2021.7,2021.8,2021.9,2021.1.2,2021.1.2,2021.1,2021.2,2021.4,2022.0,2022.1,2022.2.1,2022.2,2023.0,2023.1,2023.2,20.11,21.11,22.1,22.11,23.11,23.3,23.5,23.7,23.9 -runner,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -macos-11,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,,, -macos-12,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,,, -macos-13,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,,, -ubuntu-20.04,✓,✓,,✓,✓,✓,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓ -ubuntu-22.04,✓,✓,✓,✓,,,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓ -windows-2019,✓,✓,✓,✓,,✓,✓,,✓,,,,,✓,,✓,✓,✓,,,,,,,✓,,✓,✓,✓,✓,,,,,,,,, -windows-2022,✓,✓,✓,✓,,✓,✓,,✓,,,,,✓,,✓,✓,✓,,,,,,,✓,,✓,✓,✓,✓,,,,,,,,, +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-classic,intel-classic,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc +version,10,11,12,13,7,8,9,2021.1,2021.10,2021.2,2021.3,2021.4,2021.5,2021.6,2021.7.1,2021.7,2021.8,2021.9,2021.1.2,2021.1.2,2021.1,2021.2,2021.4,2022.0,2022.1,2022.2.1,2022.2,2023.0,2023.1,2023.2,20.11,21.11,22.11,23.11,23.3,23.5,23.7,23.9 +runner,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +macos-11,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,, +macos-12,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,, +macos-13,✓,✓,✓,✓,,,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,, +macos-14,,✓,✓,✓,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +ubuntu-20.04,✓,✓,,✓,✓,✓,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓ +ubuntu-22.04,✓,✓,✓,✓,,,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓ +windows-2019,✓,✓,✓,✓,,✓,✓,,✓,,,,,✓,,✓,✓,✓,,,,,,,✓,,✓,✓,✓,✓,,,,,,,, +windows-2022,✓,✓,✓,✓,,✓,✓,,✓,,,,,✓,,✓,✓,✓,,,,,,,✓,,✓,✓,✓,✓,,,,,,,, diff --git a/.github/compat/long_compat.csv b/.github/compat/long_compat.csv index 93113538..38dcbac9 100644 --- a/.github/compat/long_compat.csv +++ b/.github/compat/long_compat.csv @@ -44,9 +44,9 @@ macos-13,gcc,11,✓ macos-13,gcc,12,✓ macos-13,gcc,13,✓ macos-13,gcc,6, -macos-13,gcc,7,✓ -macos-13,gcc,8,✓ -macos-13,gcc,9,✓ +macos-13,gcc,7, +macos-13,gcc,8, +macos-13,gcc,9, macos-13,intel-classic,2021.1.2, macos-13,intel-classic,2021.1,✓ macos-13,intel-classic,2021.10,✓ @@ -67,6 +67,9 @@ ubuntu-20.04,gcc,6, ubuntu-20.04,gcc,7,✓ ubuntu-20.04,gcc,8,✓ ubuntu-20.04,gcc,9,✓ +macos-14,gcc,11,✓ +macos-14,gcc,12,✓ +macos-14,gcc,13,✓ ubuntu-20.04,intel-classic,2021.1.2,✓ ubuntu-20.04,intel-classic,2021.1,✓ ubuntu-20.04,intel-classic,2021.10,✓ @@ -95,7 +98,7 @@ ubuntu-20.04,nvidia-hpc,20.7, ubuntu-20.04,nvidia-hpc,20.9, ubuntu-20.04,nvidia-hpc,21.1, ubuntu-20.04,nvidia-hpc,21.11,✓ -ubuntu-20.04,nvidia-hpc,22.1,✓ +ubuntu-20.04,nvidia-hpc,22.1, ubuntu-20.04,nvidia-hpc,22.11,✓ ubuntu-20.04,nvidia-hpc,23.11,✓ ubuntu-20.04,nvidia-hpc,23.3,✓ @@ -138,7 +141,7 @@ ubuntu-22.04,nvidia-hpc,20.7, ubuntu-22.04,nvidia-hpc,20.9, ubuntu-22.04,nvidia-hpc,21.1, ubuntu-22.04,nvidia-hpc,21.11,✓ -ubuntu-22.04,nvidia-hpc,22.1,✓ +ubuntu-22.04,nvidia-hpc,22.1, ubuntu-22.04,nvidia-hpc,22.11,✓ ubuntu-22.04,nvidia-hpc,23.11,✓ ubuntu-22.04,nvidia-hpc,23.3,✓ diff --git a/.github/compat/matrix.yml b/.github/compat/matrix.yml index 63fdf1bc..6c6dcdfd 100644 --- a/.github/compat/matrix.yml +++ b/.github/compat/matrix.yml @@ -1,9 +1,9 @@ os: - ubuntu-22.04 - ubuntu-20.04 + - macos-14 - macos-13 - macos-12 - - macos-11 - windows-2022 - windows-2019 toolchain: @@ -14,7 +14,6 @@ toolchain: - {compiler: gcc, version: 9} - {compiler: gcc, version: 8} - {compiler: gcc, version: 7} - - {compiler: gcc, version: 6} - {compiler: intel, version: '2023.2'} - {compiler: intel, version: '2023.1'} - {compiler: intel, version: '2023.0'} @@ -63,6 +62,8 @@ toolchain: - {compiler: nvidia-hpc, version: '20.7'} exclude: # ifx not available for mac + - os: macos-14 + toolchain: {compiler: intel} - os: macos-13 toolchain: {compiler: intel} - os: macos-12 @@ -70,6 +71,8 @@ exclude: - os: macos-11 toolchain: {compiler: intel} # nvidia-hpc not available for mac + - os: macos-14 + toolchain: {compiler: nvidia-hpc} - os: macos-13 toolchain: {compiler: nvidia-hpc} - os: macos-12 @@ -80,4 +83,11 @@ exclude: - os: windows-2022 toolchain: {compiler: nvidia-hpc} - os: windows-2019 - toolchain: {compiler: nvidia-hpc} \ No newline at end of file + toolchain: {compiler: nvidia-hpc} + # gcc<=10 not available for ARM mac + - os: macos-14 + toolchain: {compiler: gcc, version: 8} + - os: macos-14 + toolchain: {compiler: gcc, version: 9} + - os: macos-14 + toolchain: {compiler: gcc, version: 10} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24d806a8..c9a60c63 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,7 @@ jobs: - name: Set mode id: mode run: | + trigger=${{ github.event_name }} if [[ "$trigger" == "schedule" ]] || [[ "$trigger" == "workflow_dispatch" ]]; then echo "mode=report" >> "$GITHUB_OUTPUT" else @@ -72,6 +73,9 @@ jobs: compiler: ${{ matrix.toolchain.compiler }} version: ${{ matrix.toolchain.version }} + # - name: Debug with tmate + # uses: mxschmitt/action-tmate@v3 + - name: Test Fortran compiler if: steps.setup-fortran.outcome == 'success' uses: ./.github/actions/test-fc diff --git a/README.md b/README.md index afbb2e61..171a8ffc 100644 --- a/README.md +++ b/README.md @@ -97,15 +97,16 @@ These are made available to subsequent workflow steps via the [`GITHUB_ENV` envi Toolchain support varies across GitHub-hosted runner images. -| 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.1 | intel-classic 2021.7 | intel-classic 2021.8 | intel-classic 2021.9 | intel-classic 2021.1.2 | intel 2021.1.2 | 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 | nvidia-hpc 20.11 | nvidia-hpc 21.11 | nvidia-hpc 22.1 | nvidia-hpc 22.11 | nvidia-hpc 23.11 | nvidia-hpc 23.3 | nvidia-hpc 23.5 | nvidia-hpc 23.7 | nvidia-hpc 23.9 | -|:-------------|:----------------|:----------------|:----------------|:----------------|:---------------|:---------------|:---------------|:------------------------------|:-------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:--------------------------------|:------------------------------|:------------------------------|:------------------------------|:--------------------------------|:------------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:------------------------|:----------------------|:----------------------|:----------------------|:----------------------|:--------------------------|:--------------------------|:-------------------------|:--------------------------|:--------------------------|:-------------------------|:-------------------------|:-------------------------|:-------------------------| -| macos-11 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | | | | | | | | -| macos-12 | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | | | | | | | | | | | | | | | | | | | | | -| macos-13 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | | | | | | | | -| ubuntu-20.04 | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| ubuntu-22.04 | ✓ | ✓ | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| windows-2019 | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | | | | ✓ | | ✓ | ✓ | ✓ | | | | | | | ✓ | | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | -| windows-2022 | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | | | | ✓ | | ✓ | ✓ | ✓ | | | | | | | ✓ | | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | +| 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.1 | intel-classic 2021.7 | intel-classic 2021.8 | intel-classic 2021.9 | intel-classic 2021.1.2 | intel 2021.1.2 | 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 | nvidia-hpc 20.11 | nvidia-hpc 21.11 | nvidia-hpc 22.11 | nvidia-hpc 23.11 | nvidia-hpc 23.3 | nvidia-hpc 23.5 | nvidia-hpc 23.7 | nvidia-hpc 23.9 | +|:-------------|:----------------|:----------------|:----------------|:----------------|:---------------|:---------------|:---------------|:------------------------------|:-------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:--------------------------------|:------------------------------|:------------------------------|:------------------------------|:--------------------------------|:------------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:------------------------|:----------------------|:----------------------|:----------------------|:----------------------|:--------------------------|:--------------------------|:--------------------------|:--------------------------|:-------------------------|:-------------------------|:-------------------------|:-------------------------| +| macos-11 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | | | | | | | +| macos-12 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | | | | | | | +| macos-13 | ✓ | ✓ | ✓ | ✓ | | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | | | | | | | +| macos-14 | | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +| ubuntu-20.04 | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| ubuntu-22.04 | ✓ | ✓ | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| windows-2019 | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | | | | ✓ | | ✓ | ✓ | ✓ | | | | | | | ✓ | | ✓ | ✓ | ✓ | ✓ | | | | | | | | | +| windows-2022 | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | | | | ✓ | | ✓ | ✓ | ✓ | | | | | | | ✓ | | ✓ | ✓ | ✓ | ✓ | | | | | | | | | **Note:** on `macos-13`, `gfortran` 7-9 require flag `-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib`. diff --git a/setup-fortran.sh b/setup-fortran.sh index 6a6a5ff6..2ff0a1c8 100755 --- a/setup-fortran.sh +++ b/setup-fortran.sh @@ -28,19 +28,37 @@ install_environment_modules_apt() { install_gcc_brew() { # check if gcc preinstalled via brew - cur=$(brew list --versions gcc | cut -d' ' -f2) - maj=$(echo $cur | cut -d'.' -f1) + current=$(brew list --versions gcc | cut -d' ' -f2) + current_major=$(echo $current | cut -d'.' -f1) # if already installed, nothing to do - if [ "$maj" == "$version" ]; then + if [ "$current_major" == "$version" ]; then echo "GCC $version already installed" else # otherwise install selected version brew install gcc@${version} fi - ln -fs /usr/local/bin/gfortran-${version} /usr/local/bin/gfortran - ln -fs /usr/local/bin/gcc-${version} /usr/local/bin/gcc - ln -fs /usr/local/bin/g++-${version} /usr/local/bin/g++ + # link the selected version, but first try unlinking both + # without and with specified version (cover case in which + # multiple versions are already installed and/or linked) + brew unlink gcc + brew unlink gcc@${version} + brew link gcc@${version} + + os_ver=$(sw_vers -productVersion | cut -d'.' -f1) + # brew link doesn't create aliases without version numbers before gcc 13 + if (( "$version" < 13 )); then + # default homebrew bin dir changed with macos 14 + if (( "$os_ver" > 13 )); then + ln -fs /opt/homebrew/bin/gfortran-${version} /usr/local/bin/gfortran + ln -fs /opt/homebrew/bin/gcc-${version} /usr/local/bin/gcc + ln -fs /opt/homebrew/bin/g++-${version} /usr/local/bin/g++ + else + ln -fs /usr/local/bin/gfortran-${version} /usr/local/bin/gfortran + ln -fs /usr/local/bin/gcc-${version} /usr/local/bin/gcc + ln -fs /usr/local/bin/g++-${version} /usr/local/bin/g++ + fi + fi # link lib dir for previous GCC versions to avoid missing .dylib issues for (( i=13; i>4; i-- ))