Skip to content

Commit bf0bcfd

Browse files
authored
Add support for Intel compiler (#10)
1 parent 07e659a commit bf0bcfd

File tree

4 files changed

+368
-58
lines changed

4 files changed

+368
-58
lines changed

.github/workflows/test.yml

+62-18
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,66 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-22.04, ubuntu-20.04, macos-12, macos-11, windows-2022, windows-2019]
23-
compiler: [gcc]
24-
version: [12, 11, 10, 9, 8, 7, 6, 5]
23+
toolchain:
24+
- {compiler: gcc, version: 12}
25+
- {compiler: gcc, version: 11}
26+
- {compiler: gcc, version: 10}
27+
- {compiler: gcc, version: 9}
28+
- {compiler: gcc, version: 8}
29+
- {compiler: gcc, version: 7}
30+
- {compiler: gcc, version: 6}
31+
# {compiler: gcc, version: 5}
32+
include:
33+
- {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2023.1'}}
34+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2023.0'}}
35+
- {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.2.1'}}
36+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.2'}}
37+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.1'}}
38+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.0'}}
39+
- {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.4'}}
40+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.3'}}
41+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.2'}}
42+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.1.2'}}
43+
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.1'}}
44+
45+
- {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.9'}}
46+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.8'}}
47+
- {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.7.1'}}
48+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.7'}}
49+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.6'}}
50+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.5'}}
51+
- {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.4'}}
52+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.3'}}
53+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.2'}}
54+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.1.2'}}
55+
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.1'}}
56+
57+
- {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.9'}}
58+
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.8'}}
59+
- {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.7.1'}}
60+
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.7'}}
61+
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.6'}}
62+
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.5'}}
63+
- {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.4'}}
64+
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.3'}}
65+
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.2'}}
66+
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.1'}}
67+
2568
steps:
2669

2770
- name: Checkout repository
2871
uses: actions/checkout@v3
2972

3073
- name: Setup Fortran
31-
continue-on-error: true
74+
continue-on-error: ${{ matrix.toolchain.compiler == 'gcc' }}
3275
id: setup-fortran
3376
uses: ./
3477
with:
35-
compiler: ${{ matrix.compiler }}
36-
version: ${{ matrix.version }}
78+
compiler: ${{ matrix.toolchain.compiler }}
79+
version: ${{ matrix.toolchain.version }}
3780

3881
- name: Check compiler version
39-
if: steps.setup-fortran.outcome == 'success'
82+
if: ${{ steps.setup-fortran.outcome == 'success' }}
4083
shell: bash
4184
env:
4285
FC: ${{ steps.setup-fortran.outputs.fc }}
@@ -48,14 +91,14 @@ jobs:
4891
echo $fcv
4992
echo $ccv
5093
51-
fcv=$(echo "${fcv##*)}" | xargs)
52-
ccv=$(echo "${ccv##*)}" | xargs)
94+
fcv=$(echo "$fcv" | grep -woE '[0123456789.]+' | head -n 1)
95+
ccv=$(echo "$ccv" | grep -woE '[0123456789.]+' | head -n 1)
5396
54-
[[ $fcv == ${{ matrix.version }}* ]] || (echo "unexpected Fortran compiler version: $fcv"; exit 1)
55-
[[ $ccv == ${{ matrix.version }}* ]] || (echo "unexpected C compiler version: $ccv"; exit 1)
97+
[[ $fcv == ${{ matrix.toolchain.version }}* ]] || (echo "unexpected Fortran compiler version: $fcv"; exit 1)
98+
[[ $ccv == ${{ matrix.toolchain.version }}* ]] || (echo "unexpected C compiler version: $ccv"; exit 1)
5699
57100
- name: Test compile program (bash)
58-
if: steps.setup-fortran.outcome == 'success'
101+
if: ${{ steps.setup-fortran.outcome == 'success' }}
59102
shell: bash
60103
env:
61104
FC: ${{ steps.setup-fortran.outputs.fc }}
@@ -66,7 +109,7 @@ jobs:
66109
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected output: $output"; exit 1)
67110
68111
- name: Test compile program (Powershell Core)
69-
if: steps.setup-fortran.outcome == 'success' && runner.os == 'Windows'
112+
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
70113
shell: pwsh
71114
env:
72115
FC: ${{ steps.setup-fortran.outputs.fc }}
@@ -83,7 +126,7 @@ jobs:
83126
}
84127
85128
- name: Test compile program (Powershell Desktop)
86-
if: steps.setup-fortran.outcome == 'success' && runner.os == 'Windows'
129+
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
87130
shell: powershell
88131
env:
89132
FC: ${{ steps.setup-fortran.outputs.fc }}
@@ -100,7 +143,7 @@ jobs:
100143
}
101144
102145
- name: Test compile program (cmd)
103-
if: steps.setup-fortran.outcome == 'success' && runner.os == 'Windows'
146+
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
104147
shell: cmd
105148
env:
106149
FC: ${{ steps.setup-fortran.outputs.fc }}
@@ -126,10 +169,11 @@ jobs:
126169
fi
127170
128171
mkdir compat
129-
prefix="${{ matrix.os }},${{ matrix.compiler }},${{ matrix.version }}"
172+
prefix="${{ matrix.os }},${{ matrix.toolchain.compiler }},${{ matrix.toolchain.version }}"
130173
echo "$prefix,$support" >> "compat/${prefix//,/_}.csv"
131174
132175
- name: Upload compatibility report
176+
if: ${{ matrix.toolchain.compiler == 'gcc' }}
133177
uses: actions/upload-artifact@v3
134178
with:
135179
name: compat
@@ -206,7 +250,7 @@ jobs:
206250
fi
207251
208252
- name: Update README
209-
if: steps.diff.outputs.diff == 'true' && github.event_name == 'push'
253+
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }}
210254
shell: python
211255
run: |
212256
import re
@@ -220,12 +264,12 @@ jobs:
220264
readme_path.open('w').write(r.sub(chunk, readme))
221265
222266
- name: Print README diff
223-
if: steps.diff.outputs.diff == 'true' && github.event_name == 'push'
267+
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }}
224268
run: |
225269
git diff README.md
226270
227271
- name: Create pull request
228-
if: steps.diff.outputs.diff == 'true' && github.event_name == 'push'
272+
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }}
229273
env:
230274
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231275
run: |

README.md

+35-11
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,39 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
os: [ubuntu-latest, macos-latest, windows-latest]
32+
toolchain:
33+
- {compiler: gcc, version: 11}
34+
- {compiler: intel-classic, version: '2021.9'}
35+
include:
36+
- os: ubuntu-latest
37+
toolchain: {compiler: intel, version: '2023.1'}
38+
exclude:
39+
- os: windows-latest
40+
toolchain: {compiler: intel-classic, version: '2021.9'}
3241

3342
steps:
34-
- uses: awvwgk/setup-fortran@main
35-
id: setup-fortran
36-
with:
37-
compiler: gcc
38-
version: 11
39-
40-
- run: ${{ env.FC }} --version
41-
env:
42-
FC: ${{ steps.setup-fortran.outputs.fc }}
43+
- uses: awvwgk/setup-fortran@v1
44+
id: setup-fortran
45+
with:
46+
compiler: ${{ matrix.toolchain.compiler }}
47+
version: ${{ matrix.toolchain.version }}
48+
49+
- run: ${{ env.FC }} --version
50+
env:
51+
FC: ${{ steps.setup-fortran.outputs.fc }}
4352
```
4453
4554
4655
## Options
4756
48-
- *compiler*: Compiler toolchain to setup, available options are *gcc*
49-
- *version*: Version of the compiler toolchain, available options for *gcc* are *5-12*
57+
- *compiler*: Compiler toolchain to setup, available options are
58+
- *gcc* (for `gfortran`)
59+
- *intel* (for `ifx`)
60+
- *intel-classic* (for `ifort`)
61+
- *version*: Version of the compiler toolchain, available options are
62+
- *5–12* for *gcc*
63+
- *2021.1–2023.1* for *intel*
64+
- *2021.1–2021.9* for *intel-classic*
5065

5166

5267
## Outputs
@@ -83,6 +98,15 @@ Support for the GCC toolchain varies across GitHub-hosted runner images.
8398
<!-- compat ends -->
8499

85100

101+
Supported Intel toolchains:
102+
103+
| runner | compiler | version |
104+
| :-------- | :------------- | :------ |
105+
| ubuntu-\* | intel | 2023.1, 2023.0, <br/> 2022.2.1, 2022.2, 2022.1, 2022.0, <br/> 2021.4, 2021.3, 2021.2, 2021.1.2, 2021.1 |
106+
| ubuntu-\* | intel-classic | 2021.9, 2021.8, <br/> 2021.7.1, 2021.7, 2021.6, 2021.5, <br/> 2021.4, 2021.3, 2021.2, 2021.1.2, 2021.1 |
107+
| macos-\* | intel-classic | 2021.9, 2021.8, <br/> 2021.7.1, 2021.7, 2021.6, 2021.5, <br/> 2021.4, 2021.3, 2021.2, 2021.1 |
108+
109+
86110
## License
87111

88112
Licensed under the Apache License, Version 2.0 (the “License”);

action.yml

+7-20
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,17 @@ runs:
3434
case $compiler in
3535
gcc)
3636
version=${VERSION:-11}
37+
install_gcc $platform
3738
;;
38-
*)
39-
exit 1
40-
;;
41-
esac
42-
43-
case $platform in
44-
linux*)
45-
install_gcc_apt
46-
;;
47-
darwin*)
48-
install_gcc_brew
49-
;;
50-
mingw*)
51-
install_gcc_choco
52-
;;
53-
msys*)
54-
install_gcc_choco
39+
intel-classic)
40+
version=${VERSION:-2023.1.0}
41+
install_intel $platform true
5542
;;
56-
cygwin*)
57-
install_gcc_choco
43+
intel)
44+
version=${VERSION:-2023.1.0}
45+
install_intel $platform false
5846
;;
5947
*)
60-
echo "Unsupported platform: $platform"
6148
exit 1
6249
;;
6350
esac

0 commit comments

Comments
 (0)