Skip to content

Commit b63e458

Browse files
authored
Merge pull request #4016 from mmuetzel/ci-msys2
Add support for LLVM Flang
2 parents 8a17135 + 5337829 commit b63e458

File tree

2 files changed

+46
-16
lines changed

2 files changed

+46
-16
lines changed

.github/workflows/dynamic_arch.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,40 +151,53 @@ jobs:
151151
strategy:
152152
fail-fast: false
153153
matrix:
154-
msystem: [MINGW64, MINGW32, CLANG64]
154+
msystem: [MINGW64, MINGW32, CLANG64, CLANG32]
155155
idx: [int32, int64]
156156
build-type: [Release]
157157
include:
158158
- msystem: MINGW64
159159
idx: int32
160160
target-prefix: mingw-w64-x86_64
161-
fc-pkg: mingw-w64-x86_64-gcc-fortran
161+
fc-pkg: fc
162162
- msystem: MINGW32
163163
idx: int32
164164
target-prefix: mingw-w64-i686
165-
fc-pkg: mingw-w64-i686-gcc-fortran
165+
fc-pkg: fc
166166
- msystem: CLANG64
167167
idx: int32
168168
target-prefix: mingw-w64-clang-x86_64
169+
fc-pkg: fc
170+
# Compiling with Flang 16 seems to cause test errors on machines
171+
# with AVX512 instructions. Revisit after MSYS2 distributes Flang 17.
172+
no-avx512-flags: -DNO_AVX512=1
173+
- msystem: CLANG32
174+
idx: int32
175+
target-prefix: mingw-w64-clang-i686
176+
fc-pkg: cc
169177
c-lapack-flags: -DC_LAPACK=ON
170178
- msystem: MINGW64
171179
idx: int64
172180
idx64-flags: -DBINARY=64 -DINTERFACE64=1
173181
target-prefix: mingw-w64-x86_64
174-
fc-pkg: mingw-w64-x86_64-gcc-fortran
182+
fc-pkg: fc
175183
- msystem: CLANG64
176184
idx: int64
177185
idx64-flags: -DBINARY=64 -DINTERFACE64=1
178186
target-prefix: mingw-w64-clang-x86_64
179-
c-lapack-flags: -DC_LAPACK=ON
187+
fc-pkg: fc
188+
# Compiling with Flang 16 seems to cause test errors on machines
189+
# with AVX512 instructions. Revisit after MSYS2 distributes Flang 17.
190+
no-avx512-flags: -DNO_AVX512=1
180191
- msystem: MINGW64
181192
idx: int32
182193
target-prefix: mingw-w64-x86_64
183-
fc-pkg: mingw-w64-x86_64-gcc-fortran
194+
fc-pkg: fc
184195
build-type: None
185196
exclude:
186197
- msystem: MINGW32
187198
idx: int64
199+
- msystem: CLANG32
200+
idx: int64
188201

189202
defaults:
190203
run:
@@ -209,7 +222,7 @@ jobs:
209222
install: >-
210223
base-devel
211224
${{ matrix.target-prefix }}-cc
212-
${{ matrix.fc-pkg }}
225+
${{ matrix.target-prefix }}-${{ matrix.fc-pkg }}
213226
${{ matrix.target-prefix }}-cmake
214227
${{ matrix.target-prefix }}-ninja
215228
${{ matrix.target-prefix }}-ccache
@@ -261,6 +274,7 @@ jobs:
261274
-DTARGET=CORE2 \
262275
${{ matrix.idx64-flags }} \
263276
${{ matrix.c-lapack-flags }} \
277+
${{ matrix.no-avx512-flags }} \
264278
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
265279
-DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
266280
..
@@ -280,9 +294,22 @@ jobs:
280294
key: ${{ steps.ccache-prepare.outputs.key }}
281295

282296
- name: Run tests
297+
id: run-ctest
283298
timeout-minutes: 60
284299
run: cd build && ctest
285300

301+
- name: Re-run tests
302+
if: always() && (steps.run-ctest.outcome == 'failure')
303+
timeout-minutes: 60
304+
run: |
305+
cd build
306+
echo "::group::Re-run ctest"
307+
ctest --rerun-failed --output-on-failure || true
308+
echo "::endgroup::"
309+
echo "::group::Log from these tests"
310+
[ ! -f Testing/Temporary/LastTest.log ] || cat Testing/Temporary/LastTest.log
311+
echo "::endgroup::"
312+
286313
287314
cross_build:
288315
runs-on: ubuntu-22.04

cmake/fc.cmake

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
## Description: Ported from portion of OpenBLAS/Makefile.system
44
## Sets Fortran related variables.
55

6-
if (${F_COMPILER} STREQUAL "FLANG")
6+
if (${F_COMPILER} STREQUAL "FLANG" AND NOT CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
7+
# This is for classic Flang. LLVM Flang is handled with gfortran below.
78
set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_FLANG")
89
if (BINARY64 AND INTERFACE64)
910
set(FCOMMON_OPT "${FCOMMON_OPT} -i8")
@@ -38,15 +39,17 @@ if (${F_COMPILER} STREQUAL "G95")
3839
endif ()
3940
endif ()
4041

41-
if (${F_COMPILER} STREQUAL "GFORTRAN" OR ${F_COMPILER} STREQUAL "F95")
42+
if (${F_COMPILER} STREQUAL "GFORTRAN" OR ${F_COMPILER} STREQUAL "F95" OR CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
4243
set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_GFORT")
43-
# ensure reentrancy of lapack codes
44-
set(FCOMMON_OPT "${FCOMMON_OPT} -Wall -frecursive")
45-
# work around ABI violation in passing string arguments from C
46-
set(FCOMMON_OPT "${FCOMMON_OPT} -fno-optimize-sibling-calls")
47-
#Don't include -lgfortran, when NO_LAPACK=1 or lsbcc
48-
if (NOT NO_LAPACK)
49-
set(EXTRALIB "${EXTRALIB} -lgfortran")
44+
if (NOT CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
45+
# ensure reentrancy of lapack codes
46+
set(FCOMMON_OPT "${FCOMMON_OPT} -Wall -frecursive")
47+
# work around ABI violation in passing string arguments from C
48+
set(FCOMMON_OPT "${FCOMMON_OPT} -fno-optimize-sibling-calls")
49+
if (NOT NO_LAPACK)
50+
# Don't include -lgfortran, when NO_LAPACK=1 or lsbcc
51+
set(EXTRALIB "${EXTRALIB} -lgfortran")
52+
endif ()
5053
endif ()
5154
if (NO_BINARY_MODE)
5255
if (MIPS64)

0 commit comments

Comments
 (0)