Skip to content

Commit 2b7dceb

Browse files
committed
Merge branch 'fortran-lang-main'
2 parents 81c4847 + 3dacbb4 commit 2b7dceb

19 files changed

+934
-320
lines changed

.github/actions/test-cc/action.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
if ([ "$RUNNER_OS" == "Windows" ] && [[ "${{ inputs.compiler }}" =~ "intel" ]] && [[ "${{ inputs.compiler }}" != "nvidia-hpc" ]]); then
18+
# only last line of output captured by command substitution, write to temp file instead
19+
${{ env.CC }} //QV > "$RUNNER_TEMP/${{ env.CC }}.ver" 2>&1
20+
ccv=$(cat "$RUNNER_TEMP/${{ env.CC }}.ver" | head -n 1)
21+
ccv=${ccv#*Version }
22+
ccv=${ccv%% Build*}
23+
elif ([ "$RUNNER_OS" == "Linux" ] && [[ "${{ inputs.compiler }}" == "nvidia-hpc" ]]); then
24+
# Get the compiler version and extract the version number
25+
ccv=$(${{ env.CC }} --version 2>&1 | awk '/nvc/ {print $2}' | cut -d'-' -f1)
26+
elif ([[ "${{ inputs.compiler }}" != "nvidia-hpc" ]]); then
27+
ccv=$(${{ env.CC }} --version | head -n 1)
28+
ccv=$(echo "$ccv" | grep -woE '[0123456789.]+' | head -n 1)
29+
fi
30+
[[ "$ccv" == ${{ inputs.version }}* ]] && (echo "found ${{ env.CC }} version: $ccv") || (echo "unexpected ${{ env.CC }} version: $ccv"; exit 1)
31+
32+
- name: Test compile (bash)
33+
working-directory: test
34+
shell: bash
35+
run: |
36+
${{ env.CC }} -o hw hw.c
37+
output=$(./hw '2>&1')
38+
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected C program output: $output"; exit 1)
39+
rm hw
40+

.github/actions/test-cxx/action.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
if ([ "$RUNNER_OS" == "Windows" ] && [[ "${{ matrix.toolchain.compiler }}" =~ "intel" ]] && [[ "${{ matrix.toolchain.compiler }}" != "nvidia-hpc" ]]); then
18+
# only last line of output captured by command substitution, write to temp file instead
19+
${{ env.CXX }} //QV > "$RUNNER_TEMP/${{ env.CXX }}.ver" 2>&1
20+
cxxv=$(cat "$RUNNER_TEMP/${{ env.CXX }}.ver" | head -n 1)
21+
cxxv=${cxxv#*Version }
22+
cxxv=${cxxv%% Build*}
23+
elif ([ "$RUNNER_OS" == "Linux" ] && [[ "${{ matrix.toolchain.compiler}}" == "nvidia-hpc" ]]); then
24+
# Get the compiler version and extract the version number
25+
cxxv=$(${{ env.CXX }} --version 2>&1 | awk '/nvc++/ {print $2}' | cut -d'-' -f1)
26+
elif ([[ "${{ matrix.toolchain.compiler}}" != "nvidia-hpc" ]]); then
27+
cxxv=$(${{ env.CXX }} --version | head -n 1)
28+
cxxv=$(echo "$cxxv" | grep -woE '[0123456789.]+' | head -n 1)
29+
fi
30+
[[ "$cxxv" == ${{ matrix.toolchain.version }}* ]] && (echo "found ${{ env.CXX }} version: $cxxv") || (echo "unexpected ${{ env.CXX }} version: $cxxv"; exit 1)
31+
32+
- name: Test compile (bash)
33+
working-directory: test
34+
shell: bash
35+
run: |
36+
${{ env.CXX }} -o hw hw.cpp
37+
output=$(./hw '2>&1')
38+
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected C++ program output: $output"; exit 1)
39+
rm hw
40+

.github/actions/test-fc/action.yml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
if ([ "$RUNNER_OS" == "Windows" ] && [[ "${{ inputs.compiler }}" =~ "intel" ]] && [[ "${{ inputs.compiler }}" != "nvidia-hpc" ]]); then
18+
# only last line of output captured by command substitution, write to temp file instead
19+
${{ env.FC }} //QV > "$RUNNER_TEMP/${{ env.FC }}.ver" 2>&1
20+
fcv=$(cat "$RUNNER_TEMP/${{ env.FC }}.ver" | head -n 1)
21+
fcv=${fcv#*Version }
22+
fcv=${fcv%% Build*}
23+
elif ([ "$RUNNER_OS" == "Linux" ] && [[ "${{ inputs.compiler }}" == "nvidia-hpc" ]]); then
24+
# Get the compiler version and extract the version number
25+
fcv=$(${{ env.FC }} --version 2>&1 | awk '/nvfortran/ {print $2}' | cut -d'-' -f1)
26+
elif ([[ "${{ inputs.compiler }}" != "nvidia-hpc" ]]); then
27+
fcv=$(${{ env.FC }} --version | head -n 1)
28+
fcv=$(echo "$fcv" | grep -woE '[0123456789.]+' | head -n 1)
29+
fi
30+
[[ "$fcv" == ${{ inputs.version }}* ]] && (echo "found ${{ env.FC }} version: $fcv") || (echo "unexpected ${{ env.FC }} version: $fcv"; exit 1)
31+
32+
- name: Test compile (bash)
33+
working-directory: test
34+
shell: bash
35+
run: |
36+
# macos-13/gfortran 7-9 compatibility workaround
37+
args=""
38+
if [ "$RUNNER_OS" == "macOS" ]; then
39+
if [[ $(sw_vers -productVersion) == 13* ]] && \
40+
[[ ${{ inputs.compiler }} == "gcc" ]] && \
41+
[[ ${{ inputs.version }} =~ ^(7|8|9)$ ]]
42+
then
43+
args="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
44+
fi
45+
fi
46+
47+
# hello world program
48+
${{ env.FC }} $args -o hw hw.f90
49+
output=$(./hw '2>&1')
50+
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected Fortran program 'hw' output: $output"; exit 1)
51+
rm hw
52+
53+
- name: Test compile Fortran (pwsh)
54+
working-directory: test
55+
if: ${{ (success() || failure()) && runner.os == 'Windows' }}
56+
shell: pwsh
57+
run: |
58+
${{ env.FC }} -o hw.exe hw.f90
59+
$output=$(& ".\hw.exe")
60+
if ($output -match "hello world") {
61+
write-output $output
62+
} else {
63+
write-output "unexpected output: $output"
64+
exit 1
65+
}
66+
rm hw.exe
67+
68+
- name: Test compile Fortran (powershell)
69+
working-directory: test
70+
if: ${{ (success() || failure()) && runner.os == 'Windows' }}
71+
shell: powershell
72+
run: |
73+
${{ env.FC }} -o hw.exe hw.f90
74+
$output=$(& ".\hw.exe")
75+
if ($output -match "hello world") {
76+
write-output $output
77+
} else {
78+
write-output "unexpected output: $output"
79+
exit 1
80+
}
81+
rm hw.exe
82+
83+
- name: Test compile Fortran (cmd)
84+
working-directory: test
85+
if: ${{ (success() || failure()) && runner.os == 'Windows' }}
86+
shell: cmd
87+
run: |
88+
${{ env.FC }} -o hw.exe hw.f90
89+
for /f "tokens=* usebackq" %%f in (`.\hw.exe`) do @set "OUTPUT=%%f"
90+
if "%OUTPUT%"=="hello world" (
91+
echo %OUTPUT%
92+
) else (
93+
echo unexpected output: %OUTPUT%
94+
exit 1
95+
)
96+
del hw.exe
97+

.github/compat/compat.csv

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
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
2+
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
3+
runner,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
4+
macos-11,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,,,
5+
macos-12,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,,,
6+
macos-13,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,,,,,,,,,,,,,,,,,,,,,
7+
ubuntu-20.04,✓,✓,,✓,✓,✓,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓
8+
ubuntu-22.04,✓,✓,✓,✓,,,✓,✓,✓,✓,,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓,✓
9+
windows-2019,✓,✓,✓,✓,,✓,✓,,✓,,,,,✓,,✓,✓,✓,,,,,,,✓,,✓,✓,✓,✓,,,,,,,,,
10+
windows-2022,✓,✓,✓,✓,,✓,✓,,✓,,,,,✓,,✓,✓,✓,,,,,,,✓,,✓,✓,✓,✓,,,,,,,,,

0 commit comments

Comments
 (0)