Merge pull request #4016 from mmuetzel/ci-msys2
Add support for LLVM Flang
This commit is contained in:
		
						commit
						b63e4581a3
					
				| 
						 | 
					@ -151,40 +151,53 @@ jobs:
 | 
				
			||||||
    strategy:
 | 
					    strategy:
 | 
				
			||||||
      fail-fast: false
 | 
					      fail-fast: false
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        msystem: [MINGW64, MINGW32, CLANG64]
 | 
					        msystem: [MINGW64, MINGW32, CLANG64, CLANG32]
 | 
				
			||||||
        idx: [int32, int64]
 | 
					        idx: [int32, int64]
 | 
				
			||||||
        build-type: [Release]
 | 
					        build-type: [Release]
 | 
				
			||||||
        include:
 | 
					        include:
 | 
				
			||||||
          - msystem: MINGW64
 | 
					          - msystem: MINGW64
 | 
				
			||||||
            idx: int32
 | 
					            idx: int32
 | 
				
			||||||
            target-prefix: mingw-w64-x86_64
 | 
					            target-prefix: mingw-w64-x86_64
 | 
				
			||||||
            fc-pkg: mingw-w64-x86_64-gcc-fortran
 | 
					            fc-pkg: fc
 | 
				
			||||||
          - msystem: MINGW32
 | 
					          - msystem: MINGW32
 | 
				
			||||||
            idx: int32
 | 
					            idx: int32
 | 
				
			||||||
            target-prefix: mingw-w64-i686
 | 
					            target-prefix: mingw-w64-i686
 | 
				
			||||||
            fc-pkg: mingw-w64-i686-gcc-fortran
 | 
					            fc-pkg: fc
 | 
				
			||||||
          - msystem: CLANG64
 | 
					          - msystem: CLANG64
 | 
				
			||||||
            idx: int32
 | 
					            idx: int32
 | 
				
			||||||
            target-prefix: mingw-w64-clang-x86_64
 | 
					            target-prefix: mingw-w64-clang-x86_64
 | 
				
			||||||
 | 
					            fc-pkg: fc
 | 
				
			||||||
 | 
					            # Compiling with Flang 16 seems to cause test errors on machines
 | 
				
			||||||
 | 
					            # with AVX512 instructions. Revisit after MSYS2 distributes Flang 17.
 | 
				
			||||||
 | 
					            no-avx512-flags: -DNO_AVX512=1
 | 
				
			||||||
 | 
					          - msystem: CLANG32
 | 
				
			||||||
 | 
					            idx: int32
 | 
				
			||||||
 | 
					            target-prefix: mingw-w64-clang-i686
 | 
				
			||||||
 | 
					            fc-pkg: cc
 | 
				
			||||||
            c-lapack-flags: -DC_LAPACK=ON
 | 
					            c-lapack-flags: -DC_LAPACK=ON
 | 
				
			||||||
          - msystem: MINGW64
 | 
					          - msystem: MINGW64
 | 
				
			||||||
            idx: int64
 | 
					            idx: int64
 | 
				
			||||||
            idx64-flags: -DBINARY=64 -DINTERFACE64=1
 | 
					            idx64-flags: -DBINARY=64 -DINTERFACE64=1
 | 
				
			||||||
            target-prefix: mingw-w64-x86_64
 | 
					            target-prefix: mingw-w64-x86_64
 | 
				
			||||||
            fc-pkg: mingw-w64-x86_64-gcc-fortran
 | 
					            fc-pkg: fc
 | 
				
			||||||
          - msystem: CLANG64
 | 
					          - msystem: CLANG64
 | 
				
			||||||
            idx: int64
 | 
					            idx: int64
 | 
				
			||||||
            idx64-flags: -DBINARY=64 -DINTERFACE64=1
 | 
					            idx64-flags: -DBINARY=64 -DINTERFACE64=1
 | 
				
			||||||
            target-prefix: mingw-w64-clang-x86_64
 | 
					            target-prefix: mingw-w64-clang-x86_64
 | 
				
			||||||
            c-lapack-flags: -DC_LAPACK=ON
 | 
					            fc-pkg: fc
 | 
				
			||||||
 | 
					            # Compiling with Flang 16 seems to cause test errors on machines
 | 
				
			||||||
 | 
					            # with AVX512 instructions. Revisit after MSYS2 distributes Flang 17.
 | 
				
			||||||
 | 
					            no-avx512-flags: -DNO_AVX512=1
 | 
				
			||||||
          - msystem: MINGW64
 | 
					          - msystem: MINGW64
 | 
				
			||||||
            idx: int32
 | 
					            idx: int32
 | 
				
			||||||
            target-prefix: mingw-w64-x86_64
 | 
					            target-prefix: mingw-w64-x86_64
 | 
				
			||||||
            fc-pkg: mingw-w64-x86_64-gcc-fortran
 | 
					            fc-pkg: fc
 | 
				
			||||||
            build-type: None
 | 
					            build-type: None
 | 
				
			||||||
        exclude:
 | 
					        exclude:
 | 
				
			||||||
          - msystem: MINGW32
 | 
					          - msystem: MINGW32
 | 
				
			||||||
            idx: int64
 | 
					            idx: int64
 | 
				
			||||||
 | 
					          - msystem: CLANG32
 | 
				
			||||||
 | 
					            idx: int64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    defaults:
 | 
					    defaults:
 | 
				
			||||||
      run:
 | 
					      run:
 | 
				
			||||||
| 
						 | 
					@ -209,7 +222,7 @@ jobs:
 | 
				
			||||||
          install: >-
 | 
					          install: >-
 | 
				
			||||||
            base-devel
 | 
					            base-devel
 | 
				
			||||||
            ${{ matrix.target-prefix }}-cc
 | 
					            ${{ matrix.target-prefix }}-cc
 | 
				
			||||||
            ${{ matrix.fc-pkg }}
 | 
					            ${{ matrix.target-prefix }}-${{ matrix.fc-pkg }}
 | 
				
			||||||
            ${{ matrix.target-prefix }}-cmake
 | 
					            ${{ matrix.target-prefix }}-cmake
 | 
				
			||||||
            ${{ matrix.target-prefix }}-ninja
 | 
					            ${{ matrix.target-prefix }}-ninja
 | 
				
			||||||
            ${{ matrix.target-prefix }}-ccache
 | 
					            ${{ matrix.target-prefix }}-ccache
 | 
				
			||||||
| 
						 | 
					@ -261,6 +274,7 @@ jobs:
 | 
				
			||||||
                -DTARGET=CORE2 \
 | 
					                -DTARGET=CORE2 \
 | 
				
			||||||
                ${{ matrix.idx64-flags }} \
 | 
					                ${{ matrix.idx64-flags }} \
 | 
				
			||||||
                ${{ matrix.c-lapack-flags }} \
 | 
					                ${{ matrix.c-lapack-flags }} \
 | 
				
			||||||
 | 
					                ${{ matrix.no-avx512-flags }} \
 | 
				
			||||||
                -DCMAKE_C_COMPILER_LAUNCHER=ccache \
 | 
					                -DCMAKE_C_COMPILER_LAUNCHER=ccache \
 | 
				
			||||||
                -DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
 | 
					                -DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
 | 
				
			||||||
                ..
 | 
					                ..
 | 
				
			||||||
| 
						 | 
					@ -280,9 +294,22 @@ jobs:
 | 
				
			||||||
          key: ${{ steps.ccache-prepare.outputs.key }}
 | 
					          key: ${{ steps.ccache-prepare.outputs.key }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Run tests
 | 
					      - name: Run tests
 | 
				
			||||||
 | 
					        id: run-ctest
 | 
				
			||||||
        timeout-minutes: 60
 | 
					        timeout-minutes: 60
 | 
				
			||||||
        run: cd build && ctest
 | 
					        run: cd build && ctest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Re-run tests
 | 
				
			||||||
 | 
					        if: always() && (steps.run-ctest.outcome == 'failure')
 | 
				
			||||||
 | 
					        timeout-minutes: 60
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          cd build
 | 
				
			||||||
 | 
					          echo "::group::Re-run ctest"
 | 
				
			||||||
 | 
					          ctest --rerun-failed --output-on-failure || true
 | 
				
			||||||
 | 
					          echo "::endgroup::"
 | 
				
			||||||
 | 
					          echo "::group::Log from these tests"
 | 
				
			||||||
 | 
					          [ ! -f Testing/Temporary/LastTest.log ] || cat Testing/Temporary/LastTest.log
 | 
				
			||||||
 | 
					          echo "::endgroup::"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  cross_build:
 | 
					  cross_build:
 | 
				
			||||||
    runs-on: ubuntu-22.04
 | 
					    runs-on: ubuntu-22.04
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,8 @@
 | 
				
			||||||
## Description: Ported from portion of OpenBLAS/Makefile.system
 | 
					## Description: Ported from portion of OpenBLAS/Makefile.system
 | 
				
			||||||
##              Sets Fortran related variables.
 | 
					##              Sets Fortran related variables.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (${F_COMPILER} STREQUAL "FLANG")
 | 
					if (${F_COMPILER} STREQUAL "FLANG" AND NOT CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
 | 
				
			||||||
 | 
					  # This is for classic Flang. LLVM Flang is handled with gfortran below.
 | 
				
			||||||
  set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_FLANG")
 | 
					  set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_FLANG")
 | 
				
			||||||
  if (BINARY64 AND INTERFACE64)
 | 
					  if (BINARY64 AND INTERFACE64)
 | 
				
			||||||
    set(FCOMMON_OPT "${FCOMMON_OPT} -i8")
 | 
					    set(FCOMMON_OPT "${FCOMMON_OPT} -i8")
 | 
				
			||||||
| 
						 | 
					@ -38,16 +39,18 @@ if (${F_COMPILER} STREQUAL "G95")
 | 
				
			||||||
  endif ()
 | 
					  endif ()
 | 
				
			||||||
endif ()
 | 
					endif ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (${F_COMPILER} STREQUAL "GFORTRAN" OR ${F_COMPILER} STREQUAL "F95")
 | 
					if (${F_COMPILER} STREQUAL "GFORTRAN" OR ${F_COMPILER} STREQUAL "F95" OR CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
 | 
				
			||||||
  set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_GFORT")
 | 
					  set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_GFORT")
 | 
				
			||||||
 | 
					  if (NOT CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
 | 
				
			||||||
    # ensure reentrancy of lapack codes
 | 
					    # ensure reentrancy of lapack codes
 | 
				
			||||||
    set(FCOMMON_OPT "${FCOMMON_OPT} -Wall -frecursive")
 | 
					    set(FCOMMON_OPT "${FCOMMON_OPT} -Wall -frecursive")
 | 
				
			||||||
    # work around ABI violation in passing string arguments from C
 | 
					    # work around ABI violation in passing string arguments from C
 | 
				
			||||||
    set(FCOMMON_OPT "${FCOMMON_OPT} -fno-optimize-sibling-calls")
 | 
					    set(FCOMMON_OPT "${FCOMMON_OPT} -fno-optimize-sibling-calls")
 | 
				
			||||||
  #Don't include -lgfortran, when NO_LAPACK=1 or lsbcc
 | 
					 | 
				
			||||||
    if (NOT NO_LAPACK)
 | 
					    if (NOT NO_LAPACK)
 | 
				
			||||||
 | 
					      # Don't include -lgfortran, when NO_LAPACK=1 or lsbcc
 | 
				
			||||||
      set(EXTRALIB "${EXTRALIB} -lgfortran")
 | 
					      set(EXTRALIB "${EXTRALIB} -lgfortran")
 | 
				
			||||||
    endif ()
 | 
					    endif ()
 | 
				
			||||||
 | 
					  endif ()
 | 
				
			||||||
  if (NO_BINARY_MODE)
 | 
					  if (NO_BINARY_MODE)
 | 
				
			||||||
    if (MIPS64)
 | 
					    if (MIPS64)
 | 
				
			||||||
      if (BINARY64)
 | 
					      if (BINARY64)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue