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

Address issues with IBM XL builds #621

Merged
merged 3 commits into from
Sep 21, 2021
Merged
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
4 changes: 1 addition & 3 deletions CBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/cblas_mangling.h
MACRO_NAMESPACE "F77_"
SYMBOL_NAMESPACE "F77_")
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
configure_file(include/lapacke_mangling_with_flags.h.in
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
message(WARNING "Reverting to pre-defined include/cblas_mangling.h")
configure_file(include/cblas_mangling_with_flags.h.in
${LAPACK_BINARY_DIR}/include/cblas_mangling.h)
endif()
Expand Down
40 changes: 28 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,44 @@ include(PreventInBuildInstalls)

# Check if recursive flag exists
include(CheckFortranCompilerFlag)
check_fortran_compiler_flag("-recursive" _recursiveFlag)
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
if(CMAKE_Fortran_COMPILER_ID STREQUAL Flang)
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
check_fortran_compiler_flag("-recursive" _recursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
check_fortran_compiler_flag("-qrecur" _qrecurFlag)
else()
message(WARNING "Fortran local arrays should be allocated on the stack."
" Please use a compiler which guarantees that feature."
" See https://github.com/Reference-LAPACK/lapack/pull/188 and references therein.")
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is a good idea to have a non-empty else() for other compiler IDs. I would considers using either:

else()
  check_fortran_compiler_flag("-recursive" _recursiveFlag)
  check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
  check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
  check_fortran_compiler_flag("-qrecur" _qrecurFlag)
endif()

or:

else()
  message( WARNING "Fortran local arrays should be allocated on the stack."
    " Please assure your compiler guarantees that."
    " See https://github.com/Reference-LAPACK/lapack/pull/188 and references therein." )
endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I like the second choice better; the shotgunning approach didn't work so well with XL ...


# Add recursive flag
if(_recursiveFlag)
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(_MrecursiveFlag)
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
CACHE STRING "Recursive flag must be set" FORCE)
endif()
elseif(_frecursiveFlag)
string(REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
CACHE STRING "Recursive flag must be set" FORCE)
CACHE STRING "Recursive flag must be set" FORCE)
endif()
elseif(_MrecursiveFlag)
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
elseif(_recursiveFlag)
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
CACHE STRING "Recursive flag must be set" FORCE)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
CACHE STRING "Recursive flag must be set" FORCE)
endif()
elseif(_qrecurFlag)
string(REGEX MATCH "-qrecur" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur"
CACHE STRING "Recursive flag must be set" FORCE)
endif()
endif()

Expand All @@ -121,7 +137,7 @@ if(UNIX)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
endif()
if(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict")
endif()
# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
Expand Down
4 changes: 2 additions & 2 deletions INSTALL/make.inc.XLF
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ CFLAGS = -O3 -qnosave
# the compiler options desired when NO OPTIMIZATION is selected.
#
FC = xlf
FFLAGS = -O3 -qfixed -qnosave
FFLAGS = -O3 -qfixed -qnosave -qrecur
# For -O2, add -qstrict=none
FFLAGS_DRV = $(FFLAGS)
FFLAGS_NOOPT = -O0 -qfixed -qnosave
FFLAGS_NOOPT = -O0 -qfixed -qnosave -qrecur

# Define LDFLAGS to the desired linker options for your machine.
#
Expand Down