├── .github ├── actions │ ├── test-cc │ │ └── action.yml │ ├── test-cxx │ │ └── action.yml │ └── test-fc │ │ └── action.yml ├── compat │ ├── compat.csv │ ├── long_compat.csv │ ├── matrix.yml │ ├── matrix_json_from_csv.py │ ├── update_compat_table.py │ └── wide_compat_reports.py └── workflows │ └── test.yml ├── .gitignore ├── LICENSE ├── README.md ├── action.yml ├── install-intel-windows.bat ├── main.sh ├── requirements.txt ├── setup-fortran.sh └── test ├── hw.c ├── hw.cpp └── hw.f90 /.github/actions/test-cc/action.yml: -------------------------------------------------------------------------------- 1 | name: Test CC 2 | description: Test C compiler compatibility 3 | inputs: 4 | compiler: 5 | description: "Toolchain or compiler to install" 6 | required: true 7 | version: 8 | description: "Version of toolchain or compiler" 9 | required: true 10 | runs: 11 | using: "composite" 12 | steps: 13 | 14 | - name: Check compiler version 15 | shell: bash 16 | run: | 17 | # check $CC == $FPM_CC 18 | [[ "${{ env.CC }}" == "${{ env.FPM_CC }}" ]] && (echo "CC and FPM_CC match") || (echo "CC and FPM_CC don't match: ${{ env.CC }} != ${{ env.FPM_CC}}"; exit 1) 19 | 20 | # check compiler version 21 | if ([ "$RUNNER_OS" == "Windows" ] && [[ "${{ inputs.compiler }}" =~ "intel" ]]); then 22 | # only last line of output captured by command substitution, write to temp file instead 23 | ${{ env.CC }} //QV > "$RUNNER_TEMP/${{ env.CC }}.ver" 2>&1 24 | ccv=$(cat "$RUNNER_TEMP/${{ env.CC }}.ver" | head -n 1) 25 | ccv=${ccv#*Version } 26 | ccv=${ccv%% Build*} 27 | elif ([ "$RUNNER_OS" == "Linux" ] && [[ "${{ inputs.compiler }}" == "nvidia-hpc" ]]); then 28 | # Get the compiler version and extract the version number 29 | ccv=$(${{ env.CC }} --version 2>&1 | awk '/nvc/ {print $2}' | cut -d'-' -f1) 30 | elif ([[ "${{ inputs.compiler }}" == "lfortran" ]]); then 31 | exit 0 # uses preinstalled gcc, skip version check 32 | elif ([[ "${{ inputs.compiler }}" != "nvidia-hpc" ]]); then 33 | ccv=$(${{ env.CC }} --version | head -n 1) 34 | ccv=$(echo "$ccv" | grep -woE '[0123456789.]+' | head -n 1) 35 | fi 36 | [[ "$ccv" == ${{ inputs.version }}* ]] && (echo "found ${{ env.CC }} version: $ccv") || (echo "unexpected ${{ env.CC }} version: $ccv"; exit 1) 37 | 38 | - name: Test compile (bash) 39 | working-directory: test 40 | shell: bash 41 | run: | 42 | ${{ env.CC }} -o hw hw.c 43 | output=$(./hw '2>&1') 44 | [[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected C program output: $output"; exit 1) 45 | rm hw 46 | -------------------------------------------------------------------------------- /.github/actions/test-cxx/action.yml: -------------------------------------------------------------------------------- 1 | name: Test CXX 2 | description: Test CXX compiler compatibility 3 | inputs: 4 | compiler: 5 | description: "Toolchain or compiler to install" 6 | required: true 7 | version: 8 | description: "Version of toolchain or compiler" 9 | required: true 10 | runs: 11 | using: "composite" 12 | steps: 13 | 14 | - name: Check compiler version 15 | shell: bash 16 | run: | 17 | # check $CXX == $FPM_CXX 18 | [[ "${{ env.CXX }}" == "${{ env.FPM_CXX }}" ]] && (echo "CXX and FPM_CXX match") || (echo "CXX and FPM_CXX don't match: ${{ env.CXX }} != ${{ env.FPM_CXX}}"; exit 1) 19 | 20 | # check compiler version 21 | if ([ "$RUNNER_OS" == "Windows" ] && [[ "${{ matrix.toolchain.compiler }}" =~ "intel" ]]); then 22 | # only last line of output captured by command substitution, write to temp file instead 23 | ${{ env.CXX }} //QV > "$RUNNER_TEMP/${{ env.CXX }}.ver" 2>&1 24 | cxxv=$(cat "$RUNNER_TEMP/${{ env.CXX }}.ver" | head -n 1) 25 | cxxv=${cxxv#*Version } 26 | cxxv=${cxxv%% Build*} 27 | elif ([ "$RUNNER_OS" == "Linux" ] && [[ "${{ matrix.toolchain.compiler}}" == "nvidia-hpc" ]]); then 28 | # Get the compiler version and extract the version number 29 | cxxv=$(${{ env.CXX }} --version 2>&1 | awk '/nvc++/ {print $2}' | cut -d'-' -f1) 30 | elif ([[ "${{ inputs.compiler }}" == "lfortran" ]]); then 31 | exit 0 # uses preinstalled gcc, skip version check 32 | elif ([[ "${{ matrix.toolchain.compiler}}" != "nvidia-hpc" ]]); then 33 | cxxv=$(${{ env.CXX }} --version | head -n 1) 34 | cxxv=$(echo "$cxxv" | grep -woE '[0123456789.]+' | head -n 1) 35 | fi 36 | [[ "$cxxv" == ${{ matrix.toolchain.version }}* ]] && (echo "found ${{ env.CXX }} version: $cxxv") || (echo "unexpected ${{ env.CXX }} version: $cxxv"; exit 1) 37 | 38 | - name: Test compile (bash) 39 | working-directory: test 40 | shell: bash 41 | run: | 42 | ${{ env.CXX }} -o hw hw.cpp 43 | output=$(./hw '2>&1') 44 | [[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected C++ program output: $output"; exit 1) 45 | rm hw 46 | -------------------------------------------------------------------------------- /.github/actions/test-fc/action.yml: -------------------------------------------------------------------------------- 1 | name: Test FC 2 | description: Test Fortran compiler compatibility 3 | inputs: 4 | compiler: 5 | description: "Toolchain or compiler to install" 6 | required: true 7 | version: 8 | description: "Version of toolchain or compiler" 9 | required: true 10 | runs: 11 | using: "composite" 12 | steps: 13 | 14 | - name: Check compiler version 15 | shell: bash 16 | run: | 17 | # check $FC == $FPM_FC 18 | [[ "${{ env.FC }}" == "${{ env.FPM_FC }}" ]] && (echo "FC and FPM_FC match") || (echo "FC and FPM_FC don't match: ${{ env.FC }} != ${{ env.FPM_FC}}"; exit 1) 19 | 20 | # check compiler version 21 | if ([ "$RUNNER_OS" == "Windows" ] && [[ "${{ inputs.compiler }}" =~ "intel" ]]); then 22 | # only last line of output captured by command substitution, write to temp file instead 23 | ${{ env.FC }} //QV > "$RUNNER_TEMP/${{ env.FC }}.ver" 2>&1 24 | fcv=$(cat "$RUNNER_TEMP/${{ env.FC }}.ver" | head -n 1) 25 | fcv=${fcv#*Version } 26 | fcv=${fcv%% Build*} 27 | elif ([ "$RUNNER_OS" == "Linux" ] && [[ "${{ inputs.compiler }}" == "nvidia-hpc" ]]); then 28 | # Get the compiler version and extract the version number 29 | fcv=$(${{ env.FC }} --version 2>&1 | awk '/nvfortran/ {print $2}' | cut -d'-' -f1) 30 | elif ([[ "${{ inputs.compiler }}" == "lfortran" ]]); then 31 | fcv=$(${{ env.FC }} --version | head -n 1 | grep -woE '[0123456789.]+') 32 | elif ([[ "${{ inputs.compiler }}" != "nvidia-hpc" ]]); then 33 | fcv=$(${{ env.FC }} --version | head -n 1) 34 | fcv=$(echo "$fcv" | grep -woE '[0123456789.]+' | head -n 1) 35 | fi 36 | [[ "$fcv" == ${{ inputs.version }}* ]] && (echo "found ${{ env.FC }} version: $fcv") || (echo "unexpected ${{ env.FC }} version: $fcv"; exit 1) 37 | 38 | - name: Test compile (bash) 39 | working-directory: test 40 | shell: bash 41 | run: | 42 | # hello world program 43 | ${{ env.FC }} -o hw hw.f90 44 | output=$(./hw '2>&1') 45 | [[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected Fortran program 'hw' output: $output"; exit 1) 46 | rm hw 47 | 48 | - name: Test compile Fortran (pwsh) 49 | working-directory: test 50 | # todo: debug lfortran discovery issues (same for powershell and cmd below) 51 | if: ${{ (success() || failure()) && runner.os == 'Windows' && inputs.compiler != 'lfortran' }} 52 | shell: pwsh 53 | run: | 54 | ${{ env.FC }} -o hw.exe hw.f90 55 | $output=$(& ".\hw.exe") 56 | if ($output -match "hello world") { 57 | write-output $output 58 | } else { 59 | write-output "unexpected output: $output" 60 | exit 1 61 | } 62 | rm hw.exe 63 | 64 | - name: Test compile Fortran (powershell) 65 | working-directory: test 66 | if: ${{ (success() || failure()) && runner.os == 'Windows' && inputs.compiler != 'lfortran' }} 67 | shell: powershell 68 | run: | 69 | ${{ env.FC }} -o hw.exe hw.f90 70 | $output=$(& ".\hw.exe") 71 | if ($output -match "hello world") { 72 | write-output $output 73 | } else { 74 | write-output "unexpected output: $output" 75 | exit 1 76 | } 77 | rm hw.exe 78 | 79 | - name: Test compile Fortran (cmd) 80 | working-directory: test 81 | if: ${{ (success() || failure()) && runner.os == 'Windows' && inputs.compiler != 'lfortran' }} 82 | shell: cmd 83 | run: | 84 | ${{ env.FC }} -o hw.exe hw.f90 85 | for /f "tokens=* usebackq" %%f in (`.\hw.exe`) do @set "OUTPUT=%%f" 86 | if "%OUTPUT%"=="hello world" ( 87 | echo %OUTPUT% 88 | ) else ( 89 | echo unexpected output: %OUTPUT% 90 | exit 1 91 | ) 92 | del hw.exe 93 | -------------------------------------------------------------------------------- /.github/compat/compat.csv: -------------------------------------------------------------------------------- 1 | compiler,gcc,gcc,gcc,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,intel,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-classic,intel-classic,lfortran,lfortran,lfortran,lfortran,lfortran,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc,nvidia-hpc 2 | version,12,13,14,2021.1,2021.1.2,2021.2,2021.4,2022.0,2022.1,2022.2,2022.2.1,2023.0,2023.1,2023.2,2024.0,2024.1,2025.0,2021.1,2021.1.2,2021.2,2021.3,2021.4,2021.5,2021.6,2021.7,2021.7.1,2021.8,2021.9,2021.10,2021.11,2021.12,0.41.0,0.42.0,0.43.0,0.44.0,0.45.0,20.11,21.11,22.11,23.3,23.5,23.7,23.9,23.11,24.1,24.3,24.5,25.1 3 | runner,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 4 | macos-13,✓,✓,✓,,,,,,,,,,,,,,,✓,,✓,✓,✓,✓,✓,✓,,✓,✓,✓,,,✓,✓,✓,✓,✓,,,,,,,,,,,, 5 | macos-14,✓,✓,✓,,,,,,,,,,,,,,,✓,,✓,✓,✓,✓,✓,✓,,✓,✓,✓,,,✓,✓,✓,✓,✓,,,,,,,,,,,, 6 | ubuntu-22.04,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓ 7 | ubuntu-24.04,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,✓,✓ 8 | windows-2019,✓,✓,,,,,,,✓,✓,,,✓,✓,✓,✓,✓,,,,,,,✓,✓,,,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,, 9 | windows-2022,✓,✓,,,,,,,✓,✓,,,✓,✓,✓,✓,✓,,,,,,,✓,✓,,,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,, 10 | -------------------------------------------------------------------------------- /.github/compat/long_compat.csv: -------------------------------------------------------------------------------- 1 | runner,compiler,version,support 2 | macos-13,gcc,12,✓ 3 | macos-13,gcc,13,✓ 4 | macos-13,gcc,14,✓ 5 | macos-13,intel-classic,2021.1.2, 6 | macos-13,intel-classic,2021.1,✓ 7 | macos-13,intel-classic,2021.10,✓ 8 | macos-13,intel-classic,2021.11, 9 | macos-13,intel-classic,2021.12, 10 | macos-13,intel-classic,2021.2,✓ 11 | macos-13,intel-classic,2021.3,✓ 12 | macos-13,intel-classic,2021.4,✓ 13 | macos-13,intel-classic,2021.5,✓ 14 | macos-13,intel-classic,2021.6,✓ 15 | macos-13,intel-classic,2021.7.1, 16 | macos-13,intel-classic,2021.7,✓ 17 | macos-13,intel-classic,2021.8,✓ 18 | macos-13,intel-classic,2021.9,✓ 19 | macos-13,lfortran,0.41.0,✓ 20 | macos-13,lfortran,0.42.0,✓ 21 | macos-13,lfortran,0.43.0,✓ 22 | macos-13,lfortran,0.44.0,✓ 23 | macos-13,lfortran,0.45.0,✓ 24 | macos-14,gcc,12,✓ 25 | macos-14,gcc,13,✓ 26 | macos-14,gcc,14,✓ 27 | macos-14,intel-classic,2021.1.2, 28 | macos-14,intel-classic,2021.1,✓ 29 | macos-14,intel-classic,2021.10,✓ 30 | macos-14,intel-classic,2021.11, 31 | macos-14,intel-classic,2021.12, 32 | macos-14,intel-classic,2021.2,✓ 33 | macos-14,intel-classic,2021.3,✓ 34 | macos-14,intel-classic,2021.4,✓ 35 | macos-14,intel-classic,2021.5,✓ 36 | macos-14,intel-classic,2021.6,✓ 37 | macos-14,intel-classic,2021.7.1, 38 | macos-14,intel-classic,2021.7,✓ 39 | macos-14,intel-classic,2021.8,✓ 40 | macos-14,intel-classic,2021.9,✓ 41 | macos-14,lfortran,0.41.0,✓ 42 | macos-14,lfortran,0.42.0,✓ 43 | macos-14,lfortran,0.43.0,✓ 44 | macos-14,lfortran,0.44.0,✓ 45 | macos-14,lfortran,0.45.0,✓ 46 | ubuntu-22.04,gcc,12,✓ 47 | ubuntu-22.04,gcc,13,✓ 48 | ubuntu-22.04,gcc,14, 49 | ubuntu-22.04,intel-classic,2021.1.2,✓ 50 | ubuntu-22.04,intel-classic,2021.1,✓ 51 | ubuntu-22.04,intel-classic,2021.10,✓ 52 | ubuntu-22.04,intel-classic,2021.11,✓ 53 | ubuntu-22.04,intel-classic,2021.12,✓ 54 | ubuntu-22.04,intel-classic,2021.2,✓ 55 | ubuntu-22.04,intel-classic,2021.3, 56 | ubuntu-22.04,intel-classic,2021.4,✓ 57 | ubuntu-22.04,intel-classic,2021.5,✓ 58 | ubuntu-22.04,intel-classic,2021.6,✓ 59 | ubuntu-22.04,intel-classic,2021.7.1,✓ 60 | ubuntu-22.04,intel-classic,2021.7,✓ 61 | ubuntu-22.04,intel-classic,2021.8,✓ 62 | ubuntu-22.04,intel-classic,2021.9,✓ 63 | ubuntu-22.04,intel,2021.1.2,✓ 64 | ubuntu-22.04,intel,2021.1,✓ 65 | ubuntu-22.04,intel,2021.2,✓ 66 | ubuntu-22.04,intel,2021.4,✓ 67 | ubuntu-22.04,intel,2022.0,✓ 68 | ubuntu-22.04,intel,2022.1,✓ 69 | ubuntu-22.04,intel,2022.2.1,✓ 70 | ubuntu-22.04,intel,2022.2,✓ 71 | ubuntu-22.04,intel,2023.0,✓ 72 | ubuntu-22.04,intel,2023.1,✓ 73 | ubuntu-22.04,intel,2023.2,✓ 74 | ubuntu-22.04,intel,2024.0,✓ 75 | ubuntu-22.04,intel,2024.1,✓ 76 | ubuntu-22.04,intel,2025.0,✓ 77 | ubuntu-22.04,lfortran,0.41.0,✓ 78 | ubuntu-22.04,lfortran,0.42.0,✓ 79 | ubuntu-22.04,lfortran,0.43.0,✓ 80 | ubuntu-22.04,lfortran,0.44.0,✓ 81 | ubuntu-22.04,lfortran,0.45.0,✓ 82 | ubuntu-22.04,nvidia-hpc,20.11,✓ 83 | ubuntu-22.04,nvidia-hpc,20.7, 84 | ubuntu-22.04,nvidia-hpc,20.9, 85 | ubuntu-22.04,nvidia-hpc,21.1, 86 | ubuntu-22.04,nvidia-hpc,21.11,✓ 87 | ubuntu-22.04,nvidia-hpc,21.7, 88 | ubuntu-22.04,nvidia-hpc,21.9, 89 | ubuntu-22.04,nvidia-hpc,22.11,✓ 90 | ubuntu-22.04,nvidia-hpc,22.2, 91 | ubuntu-22.04,nvidia-hpc,22.5, 92 | ubuntu-22.04,nvidia-hpc,22.7, 93 | ubuntu-22.04,nvidia-hpc,22.9, 94 | ubuntu-22.04,nvidia-hpc,23.1, 95 | ubuntu-22.04,nvidia-hpc,23.11,✓ 96 | ubuntu-22.04,nvidia-hpc,23.3,✓ 97 | ubuntu-22.04,nvidia-hpc,23.5,✓ 98 | ubuntu-22.04,nvidia-hpc,23.7,✓ 99 | ubuntu-22.04,nvidia-hpc,23.9,✓ 100 | ubuntu-22.04,nvidia-hpc,24.1,✓ 101 | ubuntu-22.04,nvidia-hpc,24.3,✓ 102 | ubuntu-22.04,nvidia-hpc,24.5,✓ 103 | ubuntu-22.04,nvidia-hpc,25.1,✓ 104 | ubuntu-24.04,gcc,12,✓ 105 | ubuntu-24.04,gcc,13,✓ 106 | ubuntu-24.04,gcc,14,✓ 107 | ubuntu-24.04,intel-classic,2021.1.2,✓ 108 | ubuntu-24.04,intel-classic,2021.1,✓ 109 | ubuntu-24.04,intel-classic,2021.10,✓ 110 | ubuntu-24.04,intel-classic,2021.11,✓ 111 | ubuntu-24.04,intel-classic,2021.12,✓ 112 | ubuntu-24.04,intel-classic,2021.2,✓ 113 | ubuntu-24.04,intel-classic,2021.3, 114 | ubuntu-24.04,intel-classic,2021.4,✓ 115 | ubuntu-24.04,intel-classic,2021.5,✓ 116 | ubuntu-24.04,intel-classic,2021.6,✓ 117 | ubuntu-24.04,intel-classic,2021.7.1,✓ 118 | ubuntu-24.04,intel-classic,2021.7,✓ 119 | ubuntu-24.04,intel-classic,2021.8,✓ 120 | ubuntu-24.04,intel-classic,2021.9,✓ 121 | ubuntu-24.04,intel,2021.1.2,✓ 122 | ubuntu-24.04,intel,2021.1,✓ 123 | ubuntu-24.04,intel,2021.2,✓ 124 | ubuntu-24.04,intel,2021.4,✓ 125 | ubuntu-24.04,intel,2022.0,✓ 126 | ubuntu-24.04,intel,2022.1,✓ 127 | ubuntu-24.04,intel,2022.2.1,✓ 128 | ubuntu-24.04,intel,2022.2,✓ 129 | ubuntu-24.04,intel,2023.0,✓ 130 | ubuntu-24.04,intel,2023.1,✓ 131 | ubuntu-24.04,intel,2023.2,✓ 132 | ubuntu-24.04,intel,2024.0,✓ 133 | ubuntu-24.04,intel,2024.1,✓ 134 | ubuntu-24.04,intel,2025.0,✓ 135 | ubuntu-24.04,lfortran,0.41.0,✓ 136 | ubuntu-24.04,lfortran,0.42.0,✓ 137 | ubuntu-24.04,lfortran,0.43.0,✓ 138 | ubuntu-24.04,lfortran,0.44.0,✓ 139 | ubuntu-24.04,lfortran,0.45.0,✓ 140 | ubuntu-24.04,nvidia-hpc,20.11,✓ 141 | ubuntu-24.04,nvidia-hpc,20.7, 142 | ubuntu-24.04,nvidia-hpc,20.9, 143 | ubuntu-24.04,nvidia-hpc,21.1, 144 | ubuntu-24.04,nvidia-hpc,21.11, 145 | ubuntu-24.04,nvidia-hpc,21.2, 146 | ubuntu-24.04,nvidia-hpc,21.3, 147 | ubuntu-24.04,nvidia-hpc,21.5, 148 | ubuntu-24.04,nvidia-hpc,21.7, 149 | ubuntu-24.04,nvidia-hpc,21.9, 150 | ubuntu-24.04,nvidia-hpc,22.1, 151 | ubuntu-24.04,nvidia-hpc,22.11, 152 | ubuntu-24.04,nvidia-hpc,22.2, 153 | ubuntu-24.04,nvidia-hpc,22.3, 154 | ubuntu-24.04,nvidia-hpc,22.5, 155 | ubuntu-24.04,nvidia-hpc,22.7, 156 | ubuntu-24.04,nvidia-hpc,22.9, 157 | ubuntu-24.04,nvidia-hpc,23.1, 158 | ubuntu-24.04,nvidia-hpc,23.11, 159 | ubuntu-24.04,nvidia-hpc,23.3, 160 | ubuntu-24.04,nvidia-hpc,23.5, 161 | ubuntu-24.04,nvidia-hpc,23.7, 162 | ubuntu-24.04,nvidia-hpc,23.9, 163 | ubuntu-24.04,nvidia-hpc,24.1, 164 | ubuntu-24.04,nvidia-hpc,24.3, 165 | ubuntu-24.04,nvidia-hpc,24.5,✓ 166 | ubuntu-24.04,nvidia-hpc,25.1,✓ 167 | windows-2019,gcc,12,✓ 168 | windows-2019,gcc,13,✓ 169 | windows-2019,gcc,14, 170 | windows-2019,intel-classic,2021.1.2, 171 | windows-2019,intel-classic,2021.1, 172 | windows-2019,intel-classic,2021.10,✓ 173 | windows-2019,intel-classic,2021.11,✓ 174 | windows-2019,intel-classic,2021.12,✓ 175 | windows-2019,intel-classic,2021.2, 176 | windows-2019,intel-classic,2021.3, 177 | windows-2019,intel-classic,2021.4, 178 | windows-2019,intel-classic,2021.5, 179 | windows-2019,intel-classic,2021.6,✓ 180 | windows-2019,intel-classic,2021.7.1, 181 | windows-2019,intel-classic,2021.7,✓ 182 | windows-2019,intel-classic,2021.8, 183 | windows-2019,intel-classic,2021.9,✓ 184 | windows-2019,intel,2021.1.2, 185 | windows-2019,intel,2021.1, 186 | windows-2019,intel,2021.2, 187 | windows-2019,intel,2021.4, 188 | windows-2019,intel,2022.0, 189 | windows-2019,intel,2022.1,✓ 190 | windows-2019,intel,2022.2.1, 191 | windows-2019,intel,2022.2,✓ 192 | windows-2019,intel,2023.0, 193 | windows-2019,intel,2023.1,✓ 194 | windows-2019,intel,2023.2,✓ 195 | windows-2019,intel,2024.0,✓ 196 | windows-2019,intel,2024.1,✓ 197 | windows-2019,intel,2025.0,✓ 198 | windows-2019,lfortran,0.41.0,✓ 199 | windows-2019,lfortran,0.42.0,✓ 200 | windows-2019,lfortran,0.43.0,✓ 201 | windows-2019,lfortran,0.44.0,✓ 202 | windows-2019,lfortran,0.45.0,✓ 203 | windows-2022,gcc,12,✓ 204 | windows-2022,gcc,13,✓ 205 | windows-2022,gcc,14, 206 | windows-2022,intel-classic,2021.1.2, 207 | windows-2022,intel-classic,2021.1, 208 | windows-2022,intel-classic,2021.10,✓ 209 | windows-2022,intel-classic,2021.11,✓ 210 | windows-2022,intel-classic,2021.12,✓ 211 | windows-2022,intel-classic,2021.2, 212 | windows-2022,intel-classic,2021.3, 213 | windows-2022,intel-classic,2021.4, 214 | windows-2022,intel-classic,2021.5, 215 | windows-2022,intel-classic,2021.6,✓ 216 | windows-2022,intel-classic,2021.7.1, 217 | windows-2022,intel-classic,2021.7,✓ 218 | windows-2022,intel-classic,2021.8, 219 | windows-2022,intel-classic,2021.9,✓ 220 | windows-2022,intel,2021.1.2, 221 | windows-2022,intel,2021.1, 222 | windows-2022,intel,2021.2, 223 | windows-2022,intel,2021.4, 224 | windows-2022,intel,2022.0, 225 | windows-2022,intel,2022.1,✓ 226 | windows-2022,intel,2022.2.1, 227 | windows-2022,intel,2022.2,✓ 228 | windows-2022,intel,2023.0, 229 | windows-2022,intel,2023.1,✓ 230 | windows-2022,intel,2023.2,✓ 231 | windows-2022,intel,2024.0,✓ 232 | windows-2022,intel,2024.1,✓ 233 | windows-2022,intel,2025.0,✓ 234 | windows-2022,lfortran,0.41.0,✓ 235 | windows-2022,lfortran,0.42.0,✓ 236 | windows-2022,lfortran,0.43.0,✓ 237 | windows-2022,lfortran,0.44.0,✓ 238 | windows-2022,lfortran,0.45.0,✓ 239 | -------------------------------------------------------------------------------- /.github/compat/matrix.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - ubuntu-24.04 3 | - ubuntu-22.04 4 | - macos-14 5 | - macos-13 6 | - windows-2022 7 | - windows-2019 8 | toolchain: 9 | - {compiler: gcc, version: 14} 10 | - {compiler: gcc, version: 13} 11 | - {compiler: gcc, version: 12} 12 | - {compiler: intel, version: '2025.0'} 13 | - {compiler: intel, version: '2024.1'} 14 | - {compiler: intel, version: '2024.0'} 15 | - {compiler: intel, version: '2023.2'} 16 | - {compiler: intel, version: '2023.1'} 17 | - {compiler: intel, version: '2023.0'} 18 | - {compiler: intel, version: '2022.2.1'} 19 | - {compiler: intel, version: '2022.2'} 20 | - {compiler: intel, version: '2022.1'} 21 | - {compiler: intel, version: '2022.0'} 22 | - {compiler: intel, version: '2021.4'} 23 | - {compiler: intel, version: '2021.2'} 24 | - {compiler: intel, version: '2021.1.2'} 25 | - {compiler: intel, version: '2021.1'} 26 | - {compiler: intel-classic, version: '2021.12'} 27 | - {compiler: intel-classic, version: '2021.11'} 28 | - {compiler: intel-classic, version: '2021.10'} 29 | - {compiler: intel-classic, version: '2021.9'} 30 | - {compiler: intel-classic, version: '2021.8'} 31 | - {compiler: intel-classic, version: '2021.7.1'} 32 | - {compiler: intel-classic, version: '2021.7'} 33 | - {compiler: intel-classic, version: '2021.6'} 34 | - {compiler: intel-classic, version: '2021.5'} 35 | - {compiler: intel-classic, version: '2021.4'} 36 | - {compiler: intel-classic, version: '2021.3'} 37 | - {compiler: intel-classic, version: '2021.2'} 38 | - {compiler: intel-classic, version: '2021.1.2'} 39 | - {compiler: intel-classic, version: '2021.1'} 40 | - {compiler: lfortran, version: '0.45.0'} 41 | - {compiler: lfortran, version: '0.44.0'} 42 | - {compiler: lfortran, version: '0.43.0'} 43 | - {compiler: lfortran, version: '0.42.0'} 44 | - {compiler: lfortran, version: '0.41.0'} 45 | - {compiler: nvidia-hpc, version: '25.1'} 46 | - {compiler: nvidia-hpc, version: '24.5'} 47 | - {compiler: nvidia-hpc, version: '24.3'} 48 | - {compiler: nvidia-hpc, version: '24.1'} 49 | - {compiler: nvidia-hpc, version: '23.11'} 50 | - {compiler: nvidia-hpc, version: '23.9'} 51 | - {compiler: nvidia-hpc, version: '23.7'} 52 | - {compiler: nvidia-hpc, version: '23.5'} 53 | - {compiler: nvidia-hpc, version: '23.3'} 54 | - {compiler: nvidia-hpc, version: '23.1'} 55 | - {compiler: nvidia-hpc, version: '22.11'} 56 | - {compiler: nvidia-hpc, version: '22.9'} 57 | - {compiler: nvidia-hpc, version: '22.7'} 58 | - {compiler: nvidia-hpc, version: '22.5'} 59 | - {compiler: nvidia-hpc, version: '22.3'} 60 | - {compiler: nvidia-hpc, version: '22.2'} 61 | - {compiler: nvidia-hpc, version: '22.1'} 62 | - {compiler: nvidia-hpc, version: '21.11'} 63 | - {compiler: nvidia-hpc, version: '21.9'} 64 | - {compiler: nvidia-hpc, version: '21.7'} 65 | - {compiler: nvidia-hpc, version: '21.5'} 66 | - {compiler: nvidia-hpc, version: '21.3'} 67 | - {compiler: nvidia-hpc, version: '21.2'} 68 | - {compiler: nvidia-hpc, version: '21.1'} 69 | - {compiler: nvidia-hpc, version: '20.11'} 70 | - {compiler: nvidia-hpc, version: '20.9'} 71 | - {compiler: nvidia-hpc, version: '20.7'} 72 | exclude: 73 | # intel-classic >= 2021.10.0 not available for mac 74 | - os: macos-14 75 | toolchain: {compiler: intel-classic, version: 2021.12.0} 76 | - os: macos-13 77 | toolchain: {compiler: intel-classic, version: 2021.12.0} 78 | - os: macos-14 79 | toolchain: {compiler: intel-classic, version: 2021.11.0} 80 | - os: macos-13 81 | toolchain: {compiler: intel-classic, version: 2021.11.0} 82 | # ifx not available for mac 83 | - os: macos-14 84 | toolchain: {compiler: intel} 85 | - os: macos-13 86 | toolchain: {compiler: intel} 87 | # nvidia-hpc not available for mac 88 | - os: macos-14 89 | toolchain: {compiler: nvidia-hpc} 90 | - os: macos-13 91 | toolchain: {compiler: nvidia-hpc} 92 | # nvidia-hpc not available for windows 93 | - os: windows-2022 94 | toolchain: {compiler: nvidia-hpc} 95 | - os: windows-2019 96 | toolchain: {compiler: nvidia-hpc} -------------------------------------------------------------------------------- /.github/compat/matrix_json_from_csv.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import json 3 | import sys 4 | from pathlib import Path 5 | 6 | csv_path = Path(sys.argv[1]) # path to CSV file 7 | jsn_path = Path(sys.argv[2]) # path to JSON file 8 | 9 | include = [] 10 | 11 | with open(csv_path, "r") as csv_file: 12 | reader = csv.DictReader(csv_file) 13 | for row in reader: 14 | if not any(row["support"].strip()): 15 | continue 16 | include.append( 17 | { 18 | "os": row["runner"], 19 | "toolchain": {"compiler": row["compiler"], "version": row["version"]}, 20 | } 21 | ) 22 | 23 | with open(jsn_path, "w") as jsn_file: 24 | json.dump({"include": include}, jsn_file) 25 | -------------------------------------------------------------------------------- /.github/compat/update_compat_table.py: -------------------------------------------------------------------------------- 1 | """ 2 | Inserts Markdown compatibility tables 3 | between tags in target Markdown file. 4 | """ 5 | 6 | import re 7 | import sys 8 | from pathlib import Path 9 | 10 | compat_path = Path(sys.argv[1]) # path to Markdown table 11 | update_path = Path(sys.argv[2]) # path to file to update 12 | 13 | assert compat_path.is_file() 14 | assert update_path.is_file() 15 | 16 | with open(compat_path, "r") as compat: 17 | table = "".join(compat.readlines()) 18 | r = re.compile( 19 | r".*", 20 | re.DOTALL, 21 | ) 22 | ct = "{}".format("\n{}\n".format(table)) 23 | readme = update_path.open().read() 24 | update_path.open("w").write(r.sub(ct, readme)) 25 | -------------------------------------------------------------------------------- /.github/compat/wide_compat_reports.py: -------------------------------------------------------------------------------- 1 | """ 2 | Converts compatibility reports from long to wide format 3 | and makes a Markdown table from the wide format report. 4 | """ 5 | 6 | from pathlib import Path 7 | import pandas as pd 8 | import sys 9 | 10 | ip = Path(sys.argv[1]) # input file path 11 | op = Path(sys.argv[2]) # output file path 12 | assert ip.is_file() 13 | assert ip.suffix == ".csv" 14 | assert op.suffix == ".csv" 15 | 16 | # read long CSV 17 | df = pd.read_csv(ip) 18 | 19 | # pivot and sort by runners 20 | df = pd.pivot_table( 21 | df, 22 | index="runner", 23 | columns=["compiler", "version"], 24 | values="support", 25 | sort=True, 26 | aggfunc="first", 27 | ).sort_values(by=["runner"]) 28 | 29 | 30 | # group by compiler and sort by versions 31 | grouped_versions = {} 32 | for compiler in df.columns.get_level_values("compiler").unique(): 33 | versions = df.loc[:, (compiler,)].columns.get_level_values("version").unique() 34 | versions = sorted(versions, key=lambda version: tuple(map(int, version.split(".")))) 35 | grouped_versions[compiler] = versions 36 | 37 | sorted_columns = [] 38 | for compiler in grouped_versions: 39 | sorted_columns.extend( 40 | [(compiler, version) for version in grouped_versions[compiler]] 41 | ) 42 | 43 | df = df[sorted_columns] 44 | 45 | # write wide CSV 46 | df.to_csv(op) 47 | 48 | # write wide markdown table 49 | with open(op.with_suffix(".md"), "w") as file: 50 | file.write( 51 | df.to_markdown() 52 | .replace("nan", "") 53 | .replace("(", "") 54 | .replace(")", "") 55 | .replace(",", "") 56 | .replace("'", "") 57 | ) 58 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | # Workflow has two modes: assert and report 3 | # Push and pull request run in assert mode. 4 | # Schedule and dispatch run in report mode. 5 | on: 6 | push: 7 | paths-ignore: 8 | - '**.md' 9 | tags-ignore: 10 | - v** 11 | pull_request: 12 | branches: 13 | - main 14 | - develop* 15 | paths-ignore: 16 | - '**.md' 17 | schedule: 18 | - cron: '0 0 * * 0' 19 | workflow_dispatch: 20 | jobs: 21 | options: 22 | name: Set options 23 | runs-on: ubuntu-latest 24 | outputs: 25 | mode: ${{ steps.mode.outputs.mode }} 26 | matrix: ${{ steps.matrix.outputs.matrix }} 27 | steps: 28 | - name: Checkout repository 29 | uses: actions/checkout@v4 30 | 31 | - name: Set mode 32 | id: mode 33 | run: | 34 | trigger=${{ github.event_name }} 35 | if [[ "$trigger" == "schedule" ]] || [[ "$trigger" == "workflow_dispatch" ]]; then 36 | echo "mode=report" >> "$GITHUB_OUTPUT" 37 | else 38 | echo "mode=assert" >> "$GITHUB_OUTPUT" 39 | fi 40 | 41 | - name: Set matrix 42 | working-directory: .github/compat 43 | id: matrix 44 | run: | 45 | mode=${{ steps.mode.outputs.mode }} 46 | if [[ "$mode" == "report" ]]; then 47 | yq -o json matrix.yml > matrix.json 48 | else 49 | python matrix_json_from_csv.py "long_compat.csv" "matrix.json" 50 | fi 51 | matrix=$(cat matrix.json | jq -r tostring) 52 | echo "matrix=$matrix" >> "$GITHUB_OUTPUT" 53 | 54 | # debugging 55 | - name: Show matrix 56 | run: echo "${{ toJSON(fromJSON(steps.matrix.outputs.matrix)) }}" 57 | 58 | test: 59 | name: Test 60 | needs: options 61 | runs-on: ${{ matrix.os }} 62 | continue-on-error: ${{ needs.options.outputs.mode == 'report' }} 63 | strategy: 64 | fail-fast: false 65 | matrix: ${{ fromJSON(needs.options.outputs.matrix) }} 66 | steps: 67 | - name: Checkout repository 68 | uses: actions/checkout@v4 69 | 70 | - name: Setup Fortran 71 | id: setup-fortran 72 | continue-on-error: ${{ needs.options.outputs.mode == 'report' }} 73 | uses: ./ 74 | with: 75 | compiler: ${{ matrix.toolchain.compiler }} 76 | version: ${{ matrix.toolchain.version }} 77 | 78 | # - name: Debug with tmate 79 | # uses: mxschmitt/action-tmate@v3 80 | 81 | - name: Test Fortran compiler 82 | if: steps.setup-fortran.outcome == 'success' 83 | uses: ./.github/actions/test-fc 84 | with: 85 | compiler: ${{ matrix.toolchain.compiler }} 86 | version: ${{ matrix.toolchain.version }} 87 | 88 | - name: Test C compiler 89 | continue-on-error: true 90 | if: needs.options.outputs.mode == 'report' && steps.setup-fortran.outcome == 'success' 91 | uses: ./.github/actions/test-cc 92 | with: 93 | compiler: ${{ matrix.toolchain.compiler }} 94 | version: ${{ matrix.toolchain.version }} 95 | 96 | - name: Test C++ compiler 97 | continue-on-error: true 98 | if: needs.options.outputs.mode == 'report' && steps.setup-fortran.outcome == 'success' 99 | uses: ./.github/actions/test-cxx 100 | with: 101 | compiler: ${{ matrix.toolchain.compiler }} 102 | version: ${{ matrix.toolchain.version }} 103 | 104 | - name: Create compatibility report 105 | if: needs.options.outputs.mode == 'report' 106 | shell: bash 107 | run: | 108 | mkdir -p compat 109 | support=$([ "${{ steps.setup-fortran.outcome }}" == "success" ] && echo "✓" || echo "") 110 | prefix="${{ matrix.os }},${{ matrix.toolchain.compiler }},${{ matrix.toolchain.version }}" 111 | report="compat/${prefix//,/_}.csv" 112 | echo "$prefix,$support" >> "$report" 113 | cat "$report" 114 | 115 | - name: Upload compatibility report 116 | if: needs.options.outputs.mode == 'report' 117 | uses: actions/upload-artifact@v4 118 | with: 119 | name: compat-${{ matrix.os }}-${{ matrix.toolchain.compiler }}-${{ matrix.toolchain.version }} 120 | path: compat/*.csv 121 | 122 | compat: 123 | name: Report compatibility 124 | needs: 125 | - options 126 | - test 127 | if: needs.options.outputs.mode == 'report' 128 | runs-on: ubuntu-latest 129 | permissions: 130 | contents: write 131 | pull-requests: write 132 | steps: 133 | 134 | - name: Checkout repository 135 | uses: actions/checkout@v4 136 | 137 | - name: Setup Python 138 | uses: actions/setup-python@v4 139 | with: 140 | python-version: 3.9 141 | 142 | - name: Install packages 143 | run: pip install -r requirements.txt 144 | 145 | - name: Download reports 146 | uses: actions/download-artifact@v4 147 | with: 148 | pattern: compat-* 149 | path: compat 150 | merge-multiple: true 151 | 152 | - name: Concatenate reports 153 | run: | 154 | echo "runner,compiler,version,support" > .github/compat/long_compat.csv 155 | cat compat/*.csv >> .github/compat/long_compat.csv 156 | 157 | - name: Make wide reports 158 | working-directory: .github/compat 159 | run: | 160 | python wide_compat_reports.py "long_compat.csv" "compat.csv" 161 | cat compat.md 162 | 163 | - name: Upload artifacts 164 | uses: actions/upload-artifact@v4 165 | with: 166 | name: compat 167 | path: | 168 | .github/compat/long_compat.csv 169 | .github/compat/compat.csv 170 | .github/compat/compat.md 171 | 172 | - name: Check for changes 173 | working-directory: .github/compat 174 | id: diff 175 | run: | 176 | if ! [ -f compat.csv ]; then 177 | echo "diff=false" >> $GITHUB_OUTPUT 178 | exit 0 179 | fi 180 | 181 | diff=$(git diff compat.csv) 182 | if [[ $diff == "" ]]; then 183 | echo "No changes found" 184 | echo "diff=false" >> $GITHUB_OUTPUT 185 | else 186 | echo "Changes found:" 187 | echo "$diff" 188 | echo "diff=true" >> $GITHUB_OUTPUT 189 | fi 190 | 191 | - name: Update README 192 | if: ${{ steps.diff.outputs.diff == 'true' }} 193 | run: python .github/compat/update_compat_table.py ".github/compat/compat.md" "README.md" 194 | 195 | - name: Print README diff 196 | if: ${{ steps.diff.outputs.diff == 'true' }} 197 | run: git diff README.md 198 | 199 | - name: Create pull request 200 | if: ${{ steps.diff.outputs.diff == 'true' }} 201 | env: 202 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 203 | run: | 204 | git config user.name "github-actions[bot]" 205 | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" 206 | 207 | now=$(date +'%Y-%m-%dT%H-%M-%S') 208 | updated_branch="compat_$now" 209 | default_branch="${{ github.event.repository.default_branch }}" 210 | 211 | git switch -c "$updated_branch" 212 | git add .github/compat/*compat.csv README.md 213 | git commit -m "Update compatibility matrix" 214 | git push -u origin "$updated_branch" 215 | gh pr create -B "$default_branch" -H "$updated_branch" --title "Update compatibility matrix" --body-file .github/compat/compat.md 216 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .github/compat/*.json 2 | .github/compat/*.md 3 | **/.DS_Store 4 | venv/ 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Setup Fortran 2 | 3 | [![Test](https://github.com/fortran-lang/setup-fortran/actions/workflows/test.yml/badge.svg)](https://github.com/fortran-lang/setup-fortran/actions/workflows/test.yml) 4 | [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) 5 | [![GitHub tag](https://img.shields.io/github/tag/fortran-lang/setup-fortran.svg)](https://github.com/fortran-lang/setup-fortran/tags/latest) 6 | 7 | 8 | Set up a Fortran compiler on Ubuntu, macOS and Windows runners. 9 | 10 | 11 | 12 | 13 | 14 | - [Usage](#usage) 15 | - [Options](#options) 16 | - [Outputs](#outputs) 17 | - [Environment variables](#environment-variables) 18 | - [Runner compatibility](#runner-compatibility) 19 | - [License](#license) 20 | 21 | 22 | 23 | 24 | ## Usage 25 | 26 | ```yaml 27 | jobs: 28 | test: 29 | runs-on: ${{ matrix.os }} 30 | strategy: 31 | fail-fast: false 32 | matrix: 33 | os: [ubuntu-latest, macos-latest, windows-latest] 34 | toolchain: 35 | - {compiler: gcc, version: 13} 36 | - {compiler: intel, version: '2025.0'} 37 | - {compiler: intel-classic, version: '2021.10'} 38 | - {compiler: nvidia-hpc, version: '25.1'} 39 | - {compiler: lfortran, version: '0.45.0'} 40 | include: 41 | - os: ubuntu-latest 42 | toolchain: {compiler: gcc, version: 12} 43 | exclude: 44 | - os: macos-latest 45 | toolchain: {compiler: intel, version: '2023.2'} 46 | - os: macos-latest 47 | toolchain: {compiler: nvidia-hpc, version: '23.11'} 48 | - os: windows-latest 49 | toolchain: {compiler: nvidia-hpc, version: '23.11'} 50 | 51 | steps: 52 | - uses: fortran-lang/setup-fortran@v1 53 | id: setup-fortran 54 | with: 55 | compiler: ${{ matrix.toolchain.compiler }} 56 | version: ${{ matrix.toolchain.version }} 57 | 58 | - run: | 59 | ${{ env.FC }} ... # environment vars FC, CC, and CXX are set 60 | ${{ steps.setup-fortran.outputs.fc }} ... # outputs work too 61 | ``` 62 | 63 | 64 | ## Options 65 | 66 | - *compiler*: Compiler toolchain to setup, available options are 67 | - *gcc* for `gfortran` 68 | - *intel* for `ifx` 69 | - *intel-classic* for `ifort` 70 | - *lfortran* for `lfortran` 71 | - *nvidia-hpc* for `nvfortran` 72 | - *version*: Version of the compiler toolchain. See [runner compatibility](#runner-compatibility) charts below. 73 | 74 | 75 | ## Outputs 76 | 77 | The action sets the following outputs: 78 | 79 | - `fc`: Fortran compiler executable, e.g. `gfortran` 80 | - `cc`: C compiler executable, e.g. `gcc` 81 | - `cxx`: C++ compiler executable, e.g. `g++` 82 | 83 | C/C++ compilers of the same toolchain/version are provided where available. If a standalone Fortran compiler is selected, the action will attempt to configure compatible C/C++ compilers (typically GCC, or MSVC on Windows), but this is not guaranteed — use at your own risk. 84 | 85 | 86 | ## Environment variables 87 | 88 | The same values are also set as environment variables: 89 | 90 | - `FC` 91 | - `CC` 92 | - `CXX` 93 | 94 | Corresponding FPM environment variables are also set: 95 | 96 | - `FPM_FC` 97 | - `FPM_CC` 98 | - `FPM_CXX` 99 | 100 | These are made available to subsequent workflow steps via the [`GITHUB_ENV` environment file mechanism](https://docs.github.com/en/actions/learn-github-actions/environment-variables#passing-values-between-steps-and-jobs-in-a-workflow). 101 | 102 | 103 | ## Runner compatibility 104 | 105 | Toolchain support varies across GitHub-hosted runner images. 106 | 107 | 108 | | runner | gcc 12 | gcc 13 | gcc 14 | intel 2021.1 | intel 2021.1.2 | intel 2021.2 | intel 2021.4 | intel 2022.0 | intel 2022.1 | intel 2022.2 | intel 2022.2.1 | intel 2023.0 | intel 2023.1 | intel 2023.2 | intel 2024.0 | intel 2024.1 | intel 2025.0 | intel-classic 2021.1 | intel-classic 2021.1.2 | 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.7.1 | intel-classic 2021.8 | intel-classic 2021.9 | intel-classic 2021.10 | intel-classic 2021.11 | intel-classic 2021.12 | lfortran 0.41.0 | lfortran 0.42.0 | lfortran 0.43.0 | lfortran 0.44.0 | lfortran 0.45.0 | nvidia-hpc 20.11 | nvidia-hpc 21.11 | nvidia-hpc 22.11 | nvidia-hpc 23.3 | nvidia-hpc 23.5 | nvidia-hpc 23.7 | nvidia-hpc 23.9 | nvidia-hpc 23.11 | nvidia-hpc 24.1 | nvidia-hpc 24.3 | nvidia-hpc 24.5 | nvidia-hpc 25.1 | 109 | |:-------------|:----------------|:----------------|:----------------|:----------------------|:------------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:------------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:------------------------------|:--------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:------------------------------|:--------------------------------|:------------------------------|:------------------------------|:-------------------------------|:-------------------------------|:-------------------------------|:-------------------------|:-------------------------|:-------------------------|:-------------------------|:-------------------------|:--------------------------|:--------------------------|:--------------------------|:-------------------------|:-------------------------|:-------------------------|:-------------------------|:--------------------------|:-------------------------|:-------------------------|:-------------------------|:-------------------------| 110 | | macos-13 | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | 111 | | macos-14 | ✓ | ✓ | ✓ | | | | | | | | | | | | | | | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | 112 | | ubuntu-22.04 | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 113 | | ubuntu-24.04 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | ✓ | ✓ | 114 | | windows-2019 | ✓ | ✓ | | | | | | | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | 115 | | windows-2022 | ✓ | ✓ | | | | | | | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | | | | | | | | | 116 | 117 | 118 | **Note:** Intel's `ifx` compiler is not supported on macOS, so the `intel` option redirects to `intel-classic` (`ifort`). 119 | 120 | **Note:** LFortran is currently only discoverable by name with `bash` on Windows, see [here for context](https://github.com/fortran-lang/setup-fortran/pull/57#issuecomment-2021605094). 121 | 122 | ## License 123 | 124 | Licensed under the Apache License, Version 2.0 (the “License”); 125 | you may not use this file except in compliance with the License. 126 | You may obtain a copy of the License at 127 | http://www.apache.org/licenses/LICENSE-2.0 128 | 129 | Unless required by applicable law or agreed to in writing, software 130 | distributed under the License is distributed on an *“as is” basis*, 131 | *without warranties or conditions of any kind*, either express or implied. 132 | See the License for the specific language governing permissions and 133 | limitations under the License. 134 | 135 | Unless you explicitly state otherwise, any contribution intentionally 136 | submitted for inclusion in this project by you, as defined in the 137 | Apache-2.0 license, shall be licensed as above, without any additional 138 | terms or conditions. 139 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Setup Fortran" 2 | description: "Setup Fortran compiler and toolchain" 3 | inputs: 4 | compiler: 5 | description: "Toolchain or compiler to install" 6 | required: true 7 | default: "gcc" 8 | version: 9 | description: "Version of toolchain or compiler" 10 | required: false 11 | update-environment: 12 | description: "Whether to set environment variables" 13 | required: false 14 | default: true 15 | outputs: 16 | fc: 17 | description: "Path to Fortran compiler" 18 | value: ${{ steps.outputs.outputs.fc }} 19 | cc: 20 | description: "Path to C compiler" 21 | value: ${{ steps.outputs.outputs.cc }} 22 | cxx: 23 | description: "Path to C++ compiler" 24 | value: ${{ steps.outputs.outputs.cxx }} 25 | runs: 26 | using: "composite" 27 | steps: 28 | # On Windows runners the Intel toolchain is very slow to install, 29 | # setup caching with daily key rotation. Steps are also needed to 30 | # activate the oneAPI environment. 31 | - name: Set oneAPI install dir 32 | id: oneapi-root 33 | if: runner.os == 'Windows' && contains(inputs.compiler, 'intel') 34 | shell: bash 35 | run: echo "ONEAPI_ROOT=C:\Program Files (x86)\Intel\oneAPI" >> "$GITHUB_ENV" 36 | - name: Get date 37 | if: runner.os == 'Windows' && contains(inputs.compiler, 'intel') 38 | id: get-date 39 | shell: bash 40 | run: echo "date=$(/bin/date -u "+%Y%m%d")" >> "$GITHUB_OUTPUT" 41 | - name: Restore cache 42 | if: runner.os == 'Windows' && contains(inputs.compiler, 'intel') 43 | id: cache 44 | uses: actions/cache/restore@v3 45 | with: 46 | path: ${{ env.ONEAPI_ROOT }} 47 | key: ${{ runner.os }}-${{ inputs.compiler }}-${{ inputs.version }}-${{ steps.get-date.outputs.date }} 48 | 49 | # Use micromamba for lfortran install on mac. Check if micromamba already 50 | # exists, only install it if needed. If we install it, clean it up after. 51 | - name: Check for micromamba 52 | id: check-umamba 53 | if: runner.os == 'macOS' && contains(inputs.compiler, 'lfortran') 54 | shell: bash 55 | run: | 56 | if [ "$(command -v micromamba)" ]; then 57 | echo "install=false" >> $GITHUB_OUTPUT 58 | else 59 | echo "install=true" >> $GITHUB_OUTPUT 60 | fi 61 | - uses: mamba-org/setup-micromamba@v1 62 | if: runner.os == 'macOS' && contains(inputs.compiler, 'lfortran') && steps.check-umamba.outputs.install == 'true' 63 | with: 64 | init-shell: bash 65 | post-cleanup: 'all' 66 | 67 | # Set up the selected toolchain or compiler 68 | - name: Setup toolchain 69 | id: setup 70 | if: steps.cache.outputs.cache-hit != 'true' 71 | shell: bash 72 | env: 73 | COMPILER: ${{ inputs.compiler }} 74 | VERSION: ${{ inputs.version }} 75 | run: | 76 | cd $(echo '/${{ github.action_path }}' | sed -e 's/\\/\//g' -e 's/://') 77 | source ./main.sh 78 | 79 | if [[ "${{ inputs.update-environment }}" == "true" ]]; then 80 | echo "FC=${FC}" >> $GITHUB_ENV 81 | echo "CC=${CC}" >> $GITHUB_ENV 82 | echo "CXX=${CXX}" >> $GITHUB_ENV 83 | fi 84 | 85 | # save oneAPI cache and activate environment 86 | - name: Save cache 87 | if: runner.os == 'Windows' && contains(inputs.compiler, 'intel') && steps.cache.outputs.cache-hit != 'true' 88 | uses: actions/cache/save@v3 89 | with: 90 | path: ${{ env.ONEAPI_ROOT }} 91 | key: ${{ runner.os }}-${{ inputs.compiler }}-${{ inputs.version }}-${{ steps.get-date.outputs.date }} 92 | - name: Activate oneAPI 93 | if: runner.os == 'Windows' && contains(inputs.compiler, 'intel') 94 | shell: cmd 95 | run: | 96 | ver | findstr /i "10\.0\.17" && set VS2019INSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise 97 | ver | findstr /i "10\.0\.20" && set VS2022INSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Enterprise 98 | call "%ONEAPI_ROOT%\setvars.bat" 99 | set | findstr /c:"oneAPI" >> "%GITHUB_ENV%" 100 | 101 | - name: Set outputs and env vars 102 | shell: bash 103 | id: outputs 104 | run: | 105 | # Intel compilers may have restored from cache so env vars may not be set 106 | if [[ "$RUNNER_OS" == "Windows" ]]; then 107 | if [[ "${{ inputs.compiler }}" == "intel" ]]; then 108 | FC=ifx 109 | CC=icx 110 | CXX=icx 111 | echo SETVARS_COMPLETED=1>>$GITHUB_ENV 112 | elif [[ "${{ inputs.compiler }}" == "intel-classic" ]]; then 113 | FC=ifort 114 | CC=icl 115 | CXX=icl 116 | echo SETVARS_COMPLETED=1>>$GITHUB_ENV 117 | fi 118 | fi 119 | 120 | if [[ "${{ inputs.update-environment }}" == "true" ]]; then 121 | # cmake 122 | echo FC=$FC>>$GITHUB_ENV 123 | echo CC=$CC>>$GITHUB_ENV 124 | echo CXX=$CXX>>$GITHUB_ENV 125 | # fpm 126 | echo FPM_FC=$FC>>$GITHUB_ENV 127 | echo FPM_CC=$CC>>$GITHUB_ENV 128 | echo FPM_CXX=$CXX>>$GITHUB_ENV 129 | fi 130 | 131 | # set action outputs 132 | echo fc=$FC>>$GITHUB_OUTPUT 133 | echo cc=$CC>>$GITHUB_OUTPUT 134 | echo cxx=$CXX>>$GITHUB_OUTPUT 135 | 136 | - name: Hide GNU linker (Windows) 137 | if: runner.os == 'Windows' && !contains(inputs.compiler, 'gcc') 138 | shell: bash 139 | run: mv /usr/bin/link $RUNNER_TEMP/link 140 | 141 | - name: Setup MSVC toolchain (Windows) 142 | if: runner.os == 'Windows' && contains(inputs.compiler, 'lfortran') 143 | uses: ilammy/msvc-dev-cmd@v1 144 | -------------------------------------------------------------------------------- /install-intel-windows.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: download and unpack installer 4 | curl.exe --output %TEMP%\webimage.exe --url %1 --retry 5 --retry-delay 5 5 | start /b /wait %TEMP%\webimage.exe -s -x -f %TEMP%\webimage_extracted --log %TEMP%\extract.log 6 | del %TEMP%\webimage.exe 7 | 8 | :: run installer 9 | %TEMP%\webimage_extracted\bootstrapper.exe -s --action install --components=%2 --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=%TEMP% 10 | -------------------------------------------------------------------------------- /main.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | compiler=${COMPILER:-gcc} 5 | platform=$(uname -s | tr '[:upper:]' '[:lower:]') 6 | 7 | if [[ "$RUNNER_OS" == "macOS" ]] && [[ "$compiler" == "intel" ]]; then 8 | echo "Compiler 'intel' not supported on macOS, falling back to 'intel-classic'" 9 | compiler="intel-classic" 10 | fi 11 | 12 | source ./setup-fortran.sh 13 | 14 | case $compiler in 15 | gcc) 16 | version=${VERSION:-13} 17 | install_gcc $platform 18 | ;; 19 | intel-classic) 20 | version=${VERSION:-2023.2.0} 21 | install_intel $platform true 22 | ;; 23 | intel) 24 | version=${VERSION:-2025.0} 25 | install_intel $platform false 26 | ;; 27 | nvidia-hpc) 28 | version=${VERSION:-25.1} 29 | install_nvidiahpc $platform 30 | ;; 31 | lfortran) 32 | version=${VERSION:-0.45.0} 33 | install_lfortran $platform 34 | ;; 35 | *) 36 | exit 1 37 | ;; 38 | esac 39 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pandas 2 | tabulate 3 | -------------------------------------------------------------------------------- /setup-fortran.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | require_fetch() 6 | { 7 | if command -v curl > /dev/null 2>&1; then 8 | fetch="curl -L" 9 | elif command -v wget > /dev/null 2>&1; then 10 | fetch="wget -O -" 11 | else 12 | echo "No download mechanism found. Install curl or wget first." 13 | exit 1 14 | fi 15 | } 16 | 17 | # Function to install environment-modules via apt 18 | # https://github.com/cea-hpc/modules 19 | install_environment_modules_apt() { 20 | echo "Installing environment-modules package..." 21 | sudo apt-get install -y environment-modules 22 | echo "Environment-modules installed." 23 | echo "Sourcing modules.sh script to set up environment modules..." 24 | source /etc/profile.d/modules.sh 25 | echo "Environment modules set up completed." 26 | } 27 | 28 | install_gcc_brew() 29 | { 30 | brew install --force gcc@${version} 31 | 32 | # make an unversioned symlink 33 | os_ver=$(sw_vers -productVersion | cut -d'.' -f1) 34 | if (( "$os_ver" > 13 )); then 35 | # default homebrew bin dir changed with macos 14 36 | ln -fs /opt/homebrew/bin/gfortran-${version} /usr/local/bin/gfortran 37 | ln -fs /opt/homebrew/bin/gcc-${version} /usr/local/bin/gcc 38 | ln -fs /opt/homebrew/bin/g++-${version} /usr/local/bin/g++ 39 | else 40 | ln -fs /usr/local/bin/gfortran-${version} /usr/local/bin/gfortran 41 | ln -fs /usr/local/bin/gcc-${version} /usr/local/bin/gcc 42 | ln -fs /usr/local/bin/g++-${version} /usr/local/bin/g++ 43 | fi 44 | } 45 | 46 | install_gcc_apt() 47 | { 48 | # Check whether the system gcc version is the version we are after. 49 | cur=$(apt show gcc | grep "Version" | cut -d':' -f3 | cut -d'-' -f1) 50 | maj=$(echo $cur | cut -d'.' -f1) 51 | needs_install=1 52 | if [ "$maj" == "$version" ]; then 53 | # Check whether that version is installed. 54 | if apt list --installed gcc-${version} | grep -q "gcc-${version}/"; then 55 | echo "GCC $version already installed" 56 | needs_install=0 57 | fi 58 | else 59 | # Install the PPA for installing other versions of gcc. 60 | sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test 61 | sudo apt-get update 62 | fi 63 | 64 | if [ "${needs_install}" == "1" ]; then 65 | sudo apt-get install -y gcc-${version} gfortran-${version} g++-${version} 66 | fi 67 | 68 | sudo update-alternatives \ 69 | --install /usr/bin/gcc gcc /usr/bin/gcc-${version} 100 \ 70 | --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${version} \ 71 | --slave /usr/bin/gcov gcov /usr/bin/gcov-${version} \ 72 | --slave /usr/bin/g++ g++ /usr/bin/g++-${version} 73 | } 74 | 75 | install_gcc_choco() 76 | { 77 | # check if mingw preinstalled via choco, falling back to check directly for gfortran 78 | cur=$(choco list -e mingw -r | cut -d'|' -f2) 79 | if [[ "$cur" == "" ]] && [[ "$(which gfortran)" != "" ]]; then 80 | cur=$(gfortran --version | grep -woE '[0123456789.]+' | head -n 1) 81 | fi 82 | maj=$(echo $cur | cut -d'.' -f1) 83 | # if already installed, nothing to do 84 | if [ "$maj" == "$version" ]; then 85 | echo "GCC $version already installed" 86 | else 87 | # otherwise hide preinstalled mingw compilers 88 | mv /c/mingw64 "$RUNNER_TEMP/" 89 | # ...and install selected version 90 | case $version in 91 | 13) 92 | choco install mingw --version 13.2.0 --force 93 | # mingw 13 on Windows doesn't create shims (http://disq.us/p/2w5c5tj) 94 | # so hide Strawberry compilers and manually add mingw bin dir to PATH 95 | mkdir "$RUNNER_TEMP/strawberry" 96 | mv /c/Strawberry/c/bin/gfortran "$RUNNER_TEMP/strawberry/gfortran" 97 | mv /c/Strawberry/c/bin/gcc "$RUNNER_TEMP/strawberry/gcc" 98 | mv /c/Strawberry/c/bin/g++ "$RUNNER_TEMP/strawberry/g++" 99 | echo "C:\ProgramData\mingw64\mingw64\bin" >> $GITHUB_PATH 100 | ;; 101 | 12) 102 | choco install mingw --version 12.2.0 --force 103 | ;; 104 | 11) 105 | choco install mingw --version 11.2.0 --force 106 | ;; 107 | 10) 108 | choco install mingw --version 10.3.0 --force 109 | ;; 110 | 9) 111 | choco install mingw --version 9.4.0 --force 112 | ;; 113 | 8) 114 | choco install mingw --version 8.5.0 --force 115 | ;; 116 | *) 117 | echo "Unsupported version: $version (choose 8-13)" 118 | exit 1 119 | ;; 120 | esac 121 | fi 122 | 123 | # missing DLL workaround 124 | FCDIR=/c/ProgramData/Chocolatey/bin 125 | LNDIR=/c/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin 126 | if [ -d "$FCDIR" ] && [ -f "$LNDIR/libgfortran-5.dll" ] && [ ! -f "$FCDIR/libgfortran-5.dll" ]; then 127 | ln -s "$LNDIR/libgfortran-5.dll" "$FCDIR/libgfortran-5.dll" 128 | fi 129 | } 130 | 131 | install_gcc() 132 | { 133 | local platform=$1 134 | case $platform in 135 | linux*) 136 | install_gcc_apt 137 | ;; 138 | darwin*) 139 | install_gcc_brew 140 | ;; 141 | mingw*) 142 | install_gcc_choco 143 | ;; 144 | msys*) 145 | install_gcc_choco 146 | ;; 147 | cygwin*) 148 | install_gcc_choco 149 | ;; 150 | *) 151 | echo "Unsupported platform: $platform" 152 | exit 1 153 | ;; 154 | esac 155 | 156 | export FC="gfortran" 157 | export CC="gcc" 158 | export CXX="g++" 159 | } 160 | 161 | export_intel_vars() 162 | { 163 | cat >> $GITHUB_ENV <> $GITHUB_PATH 178 | done 179 | } 180 | 181 | intel_version_map_l() 182 | { 183 | local actual_version=$1 184 | local classic=$2 185 | if $classic; then 186 | case $actual_version in 187 | 2021.12.0 | 2021.12) 188 | version=2024.1 189 | ;; 190 | 2021.11.0 | 2021.11) 191 | version=2024.0 192 | ;; 193 | 2021.10.0 | 2021.10) 194 | version=2023.2.0 195 | ;; 196 | 2021.9.0 | 2021.9) 197 | version=2023.1.0 198 | ;; 199 | 2021.8.0 | 2021.8) 200 | version=2023.0.0 201 | ;; 202 | 2021.7.1) 203 | version=2022.2.1 204 | ;; 205 | 2021.7.0 | 2021.7) 206 | version=2022.2.0 207 | ;; 208 | 2021.6.0 | 2021.6) 209 | version=2022.1.0 210 | ;; 211 | 2021.5.0 | 2021.5) 212 | version=2022.0.2 213 | # version=2022.0.1 214 | ;; 215 | 2021.4 | 2021.3 | 2021.2) 216 | version=$actual_version.0 217 | ;; 218 | 2021.1) 219 | version=2021.1.1 220 | ;; 221 | *) 222 | version=$actual_version 223 | ;; 224 | esac 225 | else 226 | case $actual_version in 227 | 2022.0.0 | 2022.0) 228 | version=2022.0.2 229 | ;; 230 | 2023.2 | 2023.1 | 2023.0 | 2022.2 | 2022.1 | 2021.4 | 2021.2) 231 | version=$actual_version.0 232 | ;; 233 | 2024.1 | 2024.1.0) 234 | version=2024.1 235 | ;; 236 | 2024.0 | 2024.0.0) 237 | version=2024.0 238 | ;; 239 | 2025.0 | 2025.0.1) 240 | version=2025.0 241 | ;; 242 | 2021.1) 243 | version=2021.1.1 244 | ;; 245 | *) 246 | version=$actual_version 247 | ;; 248 | esac 249 | fi 250 | } 251 | 252 | intel_version_map_m() 253 | { 254 | local actual_version=$1 255 | case $actual_version in 256 | 2021.10.0 | 2021.10) 257 | version=2023.2.0 258 | ;; 259 | 2021.9.0 | 2021.9) 260 | version=2023.1.0 261 | ;; 262 | 2021.8.0 | 2021.8) 263 | version=2023.0.0 264 | ;; 265 | 2021.7.1) 266 | version=2022.3.1 267 | ;; 268 | 2021.7.0 | 2021.7) 269 | version=2022.3.0 270 | ;; 271 | 2021.6.0 | 2021.6) 272 | version=2022.2.0 273 | ;; 274 | 2021.5.0 | 2021.5) 275 | version=2022.1.0 276 | ;; 277 | 2021.4 | 2021.3 | 2021.2 | 2021.1) 278 | version=$actual_version.0 279 | ;; 280 | *) 281 | version=$actual_version 282 | ;; 283 | esac 284 | } 285 | 286 | intel_version_map_w() 287 | { 288 | local actual_version=$1 289 | local classic=$2 290 | if $classic; then 291 | case $actual_version in 292 | 2021.12.0 | 2021.12) 293 | version=2024.1.0 294 | ;; 295 | 2021.11.0 | 2021.11) 296 | version=2024.0.1 297 | ;; 298 | 2021.10.0 | 2021.10) 299 | version=2023.2.0 300 | ;; 301 | 2021.9.0 | 2021.9) 302 | version=2023.1.0 303 | ;; 304 | 2021.8.0 | 2021.8) 305 | version=2023.0.0 306 | ;; 307 | 2021.7.0 | 2021.7) 308 | version=2022.3.0 309 | ;; 310 | 2021.6.0 | 2021.6) 311 | version=2022.2.0 312 | ;; 313 | *) 314 | version=$actual_version 315 | ;; 316 | esac 317 | else 318 | case $actual_version in 319 | 2025.0 | 2025.0.1) 320 | version=2025.0.1 321 | ;; 322 | 2024.1 | 2024.1.0) 323 | version=2024.1.0 324 | ;; 325 | 2024.0 | 2024.0.0) 326 | version=2024.0.1 327 | ;; 328 | 2023.2 | 2023.1 | 2023.0) 329 | version=$actual_version.0 330 | ;; 331 | 2022.2.0 | 2022.2) 332 | version=2022.3.0 333 | ;; 334 | 2022.1.0 | 2022.1) 335 | version=2022.2.0 336 | ;; 337 | *) 338 | version=$actual_version 339 | ;; 340 | esac 341 | fi 342 | } 343 | 344 | install_intel_apt() 345 | { 346 | local version=$1 347 | local classic=$2 348 | intel_version_map_l $version $classic 349 | 350 | require_fetch 351 | local _KEY="GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" 352 | $fetch https://apt.repos.intel.com/intel-gpg-keys/$_KEY > $_KEY 353 | sudo apt-key add $_KEY 354 | rm $_KEY 355 | echo "deb https://apt.repos.intel.com/oneapi all main" \ 356 | | sudo tee /etc/apt/sources.list.d/oneAPI.list 357 | sudo apt-get update 358 | 359 | # c/cpp compiler package names changed with 2024+ 360 | case $version in 361 | 2024* | 2025*) 362 | sudo apt-get install -y \ 363 | intel-oneapi-compiler-{fortran,dpcpp-cpp}-$version 364 | ;; 365 | *) 366 | sudo apt-get install -y \ 367 | intel-oneapi-compiler-{fortran,dpcpp-cpp-and-cpp-classic}-$version 368 | ;; 369 | esac 370 | 371 | source /opt/intel/oneapi/setvars.sh 372 | export_intel_vars 373 | } 374 | 375 | install_intel_dmg() 376 | { 377 | local version=$1 378 | intel_version_map_m $version 379 | 380 | case $version in 381 | 2021.1.0) 382 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17426/m_BaseKit_p_2021.1.0.2427.dmg 383 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17398/m_HPCKit_p_2021.1.0.2681.dmg 384 | ;; 385 | 2021.2.0) 386 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17714/m_BaseKit_p_2021.2.0.2855.dmg 387 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17643/m_HPCKit_p_2021.2.0.2903.dmg 388 | ;; 389 | 2021.3.0) 390 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17969/m_BaseKit_p_2021.3.0.3043.dmg 391 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17890/m_HPCKit_p_2021.3.0.3226.dmg 392 | ;; 393 | 2021.4.0) 394 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18256/m_BaseKit_p_2021.4.0.3384.dmg 395 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18242/m_HPCKit_p_2021.4.0.3389.dmg 396 | ;; 397 | 2022.1.0) 398 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18342/m_BaseKit_p_2022.1.0.92.dmg 399 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18341/m_HPCKit_p_2022.1.0.86.dmg 400 | ;; 401 | 2022.2.0) 402 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18675/m_BaseKit_p_2022.2.0.226_offline.dmg 403 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18681/m_HPCKit_p_2022.2.0.158_offline.dmg 404 | ;; 405 | 2022.3.0) 406 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18865/m_BaseKit_p_2022.3.0.8743.dmg 407 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18866/m_HPCKit_p_2022.3.0.8685.dmg 408 | ;; 409 | 2022.3.1) 410 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18971/m_BaseKit_p_2022.3.1.17244.dmg 411 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18977/m_HPCKit_p_2022.3.1.15344.dmg 412 | ;; 413 | 2023.0.0) 414 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/19080/m_BaseKit_p_2023.0.0.25441.dmg 415 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/19086/m_HPCKit_p_2023.0.0.25440.dmg 416 | ;; 417 | 2023.1.0) 418 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/2516a0a0-de4d-4f3d-9e83-545b32127dbb/m_BaseKit_p_2023.1.0.45568.dmg 419 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/a99cb1c5-5af6-4824-9811-ae172d24e594/m_HPCKit_p_2023.1.0.44543.dmg 420 | ;; 421 | 2023.2.0) 422 | MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/cd013e6c-49c4-488b-8b86-25df6693a9b7/m_BaseKit_p_2023.2.0.49398.dmg 423 | MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/edb4dc2f-266f-47f2-8d56-21bc7764e119/m_HPCKit_p_2023.2.0.49443.dmg 424 | ;; 425 | *) 426 | exit 1 427 | ;; 428 | esac 429 | 430 | require_fetch 431 | $fetch $MACOS_HPCKIT_URL > m_HPCKit.dmg 432 | hdiutil attach m_HPCKit.dmg 433 | sudo /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \ 434 | --action install \ 435 | --eula=accept \ 436 | --continue-with-optional-error=yes \ 437 | --log-dir=. 438 | hdiutil detach /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)" -quiet 439 | rm m_HPCKit.dmg 440 | 441 | source /opt/intel/oneapi/setvars.sh 442 | export_intel_vars 443 | } 444 | 445 | install_intel_win() 446 | { 447 | local version=$1 448 | local classic=$2 449 | intel_version_map_w $version $classic 450 | 451 | case $version in 452 | 2025.0.1) 453 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/a37c30c3-a846-4371-a85d-603e9a9eb94c/intel-oneapi-hpc-toolkit-2025.0.1.48_offline.exe 454 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-dpcpp-common 455 | ;; 456 | 2024.1.0) 457 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/c95a3b26-fc45-496c-833b-df08b10297b9/w_HPCKit_p_2024.1.0.561_offline.exe 458 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-dpcpp-common 459 | ;; 460 | 2024.0.1) 461 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7a6db8a1-a8b9-4043-8e8e-ca54b56c34e4/w_HPCKit_p_2024.0.1.35_offline.exe 462 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-dpcpp-common 463 | ;; 464 | 2023.2.0) 465 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/438527fc-7140-422c-a851-389f2791816b/w_HPCKit_p_2023.2.0.49441_offline.exe 466 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-compiler 467 | ;; 468 | 2023.1.0) 469 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/2a13d966-fcc5-4a66-9fcc-50603820e0c9/w_HPCKit_p_2023.1.0.46357_offline.exe 470 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-compiler 471 | ;; 472 | 2023.0.0) 473 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/19085/w_HPCKit_p_2023.0.0.25931_offline.exe 474 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-compiler 475 | ;; 476 | 2022.3.1) 477 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18976/w_HPCKit_p_2022.3.1.19755_offline.exe 478 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-compiler 479 | ;; 480 | 2022.3.0) 481 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/18857/w_HPCKit_p_2022.3.0.9564_offline.exe 482 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-compiler 483 | ;; 484 | 2022.2.0) 485 | WINDOWS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18680/w_HPCKit_p_2022.2.0.173_offline.exe 486 | WINDOWS_HPCKIT_COMPONENTS=intel.oneapi.win.ifort-compiler:intel.oneapi.win.cpp-compiler 487 | ;; 488 | *) 489 | exit 1 490 | ;; 491 | esac 492 | 493 | "$GITHUB_ACTION_PATH/install-intel-windows.bat" $WINDOWS_HPCKIT_URL $WINDOWS_HPCKIT_COMPONENTS 494 | 495 | # don't call export_intel_vars here because the install may have 496 | # been restored from cache. export variables in action.yml after 497 | # installation or cache restore. 498 | } 499 | 500 | install_intel() 501 | { 502 | local platform=$1 503 | local classic=$2 504 | case $platform in 505 | linux*) 506 | install_intel_apt $version $classic 507 | ;; 508 | darwin*) 509 | install_intel_dmg $version 510 | ;; 511 | mingw*) 512 | install_intel_win $version $classic 513 | ;; 514 | msys*) 515 | install_intel_win $version $classic 516 | ;; 517 | cygwin*) 518 | install_intel_win $version $classic 519 | ;; 520 | *) 521 | echo "Unsupported platform: $platform" 522 | exit 1 523 | ;; 524 | esac 525 | 526 | if $classic; then 527 | export FC="ifort" 528 | export CC="icc" 529 | export CXX="icpc" 530 | else 531 | export FC="ifx" 532 | export CC="icx" 533 | export CXX="icpx" 534 | fi 535 | } 536 | 537 | export_nvidiahpc_vars() 538 | { 539 | local version=$1 540 | 541 | # to convert version format from X.Y to X-Y 542 | local cversion=$(echo "$version" | tr '.' '-') 543 | 544 | cat >> $GITHUB_ENV <> $GITHUB_PATH 554 | done 555 | } 556 | 557 | install_nvidiahpc_apt() 558 | { 559 | local version=$1 560 | 561 | # install environment-modules 562 | install_environment_modules_apt 563 | 564 | # to convert version format from X.Y to X-Y 565 | local cversion=$(echo "$version" | tr '.' '-') 566 | 567 | # install NVIDIA HPC SDK 568 | echo "Installing NVIDIA HPC SDK $version..." 569 | curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg 570 | echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list 571 | sudo apt-get update -y 572 | sudo apt-get install -y nvhpc-$cversion 573 | echo "NVIDIA HPC SDK $version installed." 574 | 575 | # load NVIDIA HPC SDK module 576 | echo "Loading NVIDIA HPC SDK $version module..." 577 | NVCOMPILERS=/opt/nvidia/hpc_sdk; export NVCOMPILERS 578 | export MODULEPATH=$NVCOMPILERS/modulefiles:$MODULEPATH 579 | module load nvhpc 580 | echo "NVIDIA HPC SDK $version module loaded." 581 | 582 | # set environment variables 583 | export_nvidiahpc_vars $version 584 | } 585 | 586 | install_nvidiahpc() 587 | { 588 | local platform=$1 589 | case $platform in 590 | linux*) 591 | install_nvidiahpc_apt $version 592 | ;; 593 | darwin*) 594 | echo "NVIDIA HPC SDK is not supported on macOS." 595 | exit 1 596 | ;; 597 | mingw*) 598 | echo "NVIDIA HPC SDK is not supported on Windows." 599 | exit 1 600 | ;; 601 | msys*) 602 | echo "NVIDIA HPC SDK is not supported on MSYS." 603 | exit 1 604 | ;; 605 | cygwin*) 606 | echo "NVIDIA HPC SDK is not supported on Cygwin." 607 | exit 1 608 | ;; 609 | *) 610 | echo "Unsupported platform: $platform" 611 | exit 1 612 | ;; 613 | esac 614 | 615 | export FC="nvfortran" 616 | export CC="nvc" 617 | export CXX="nvc++" 618 | } 619 | 620 | install_lfortran_l() 621 | { 622 | local version=$1 623 | export CC="gcc" 624 | export CXX="g++" 625 | export CONDA=conda 626 | $CONDA install -c conda-forge -n base -y lfortran=$version 627 | } 628 | 629 | install_lfortran_w() 630 | { 631 | local version=$1 632 | export CC="cl" 633 | export CXX="cl" 634 | export CONDA=$CONDA\\Scripts\\conda # https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#environment-variables 635 | $CONDA install -c conda-forge -n base -y lfortran=$version 636 | } 637 | 638 | install_lfortran_m() 639 | { 640 | local version=$1 641 | export CC="gcc" 642 | export CXX="g++" 643 | export CONDA_ROOT_PREFIX=$MAMBA_ROOT_PREFIX 644 | export CONDA=micromamba 645 | $CONDA install -c conda-forge -n base -y lfortran=$version 646 | } 647 | 648 | install_lfortran() 649 | { 650 | local platform=$1 651 | case $platform in 652 | linux*) 653 | install_lfortran_l $version 654 | ;; 655 | darwin*) 656 | install_lfortran_m $version 657 | ;; 658 | mingw*) 659 | install_lfortran_w $version 660 | ;; 661 | msys*) 662 | install_lfortran_w $version 663 | ;; 664 | cygwin*) 665 | install_lfortran_w $version 666 | ;; 667 | *) 668 | echo "Unsupported platform: $platform" 669 | exit 1 670 | ;; 671 | esac 672 | 673 | echo $($CONDA run -n base which lfortran | sed 's/lfortran//') >> $GITHUB_PATH 674 | export FC="lfortran" 675 | } 676 | -------------------------------------------------------------------------------- /test/hw.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | printf("hello world\n"); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /test/hw.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | std::cout << "hello world\n"; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /test/hw.f90: -------------------------------------------------------------------------------- 1 | program hello 2 | print *, "hello world" 3 | end program hello --------------------------------------------------------------------------------