Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Check for known bad configurations with LLVM Flang #4180

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/dynamic_arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ jobs:
idx: int32
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
Expand All @@ -185,9 +182,6 @@ jobs:
idx64-flags: -DBINARY=64 -DINTERFACE64=1
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: MINGW64
idx: int32
target-prefix: mingw-w64-x86_64
Expand Down Expand Up @@ -274,7 +268,6 @@ jobs:
-DTARGET=CORE2 \
${{ matrix.idx64-flags }} \
${{ matrix.c-lapack-flags }} \
${{ matrix.no-avx512-flags }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
..
Expand Down
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,38 @@ endif()

message(WARNING "CMake support is experimental. It does not yet support all build options and may not produce the same Makefiles that OpenBLAS ships with.")

if(NOT NOFORTRAN)
# Check for working Fortran compiler
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
else()
set(NOFORTRAN 1)
endif()
endif()

if (NOT NOFORTRAN AND CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 17 OR WIN32)
# The *blas3 tests fail on hardware with AVX512 instruction when using
# LLVM Flang before version 17 or when using LLVM Flang on Windows.
# Tested with LLVM Flang 16 and LLVM Flang 17 on Windows (MSYS2/CLANG64).
# FIXME: Revisit with LLVM Flang 18.
if (NOT NO_AVX512)
message(STATUS "Disabling AVX512 instructions for LLVM Flang before version 17 or on Windows.")
endif()
set(NO_AVX512 1)
endif()

if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 17)
# LLVM Flang before version 17 doesn't support necessary OpenMP constructs.
if (USE_OPENMP)
message(STATUS "Disabling OpenMP for LLVM Flang before version 17.")
set(USE_OPENMP 0)
endif()
endif()
endif()

include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake")
include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")

Expand Down
7 changes: 1 addition & 6 deletions cmake/f_check.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
# NEEDBUNDERSCORE
# NEED2UNDERSCORES

include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
else()
set (NOFORTRAN 1)
if(NOT CMAKE_Fortran_COMPILER)
if (NOT NO_LAPACK)
if (NOT XXXXX)
message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK")
Expand Down
Loading