Skip to content

Commit fe5af11

Browse files
authored
Merge pull request #621 from quellyn/xl-fixes
Address issues with IBM XL builds
2 parents 85ef8de + 26a81d1 commit fe5af11

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

CBLAS/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/cblas_mangling.h
1111
MACRO_NAMESPACE "F77_"
1212
SYMBOL_NAMESPACE "F77_")
1313
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
14-
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
15-
configure_file(include/lapacke_mangling_with_flags.h.in
16-
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
14+
message(WARNING "Reverting to pre-defined include/cblas_mangling.h")
1715
configure_file(include/cblas_mangling_with_flags.h.in
1816
${LAPACK_BINARY_DIR}/include/cblas_mangling.h)
1917
endif()

CMakeLists.txt

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,28 +91,44 @@ include(PreventInBuildInstalls)
9191

9292
# Check if recursive flag exists
9393
include(CheckFortranCompilerFlag)
94-
check_fortran_compiler_flag("-recursive" _recursiveFlag)
95-
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
96-
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
94+
if(CMAKE_Fortran_COMPILER_ID STREQUAL Flang)
95+
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
96+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
97+
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
98+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
99+
check_fortran_compiler_flag("-recursive" _recursiveFlag)
100+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
101+
check_fortran_compiler_flag("-qrecur" _qrecurFlag)
102+
else()
103+
message(WARNING "Fortran local arrays should be allocated on the stack."
104+
" Please use a compiler which guarantees that feature."
105+
" See https://github.com/Reference-LAPACK/lapack/pull/188 and references therein.")
106+
endif()
97107

98108
# Add recursive flag
99-
if(_recursiveFlag)
100-
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
109+
if(_MrecursiveFlag)
110+
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
101111
if(NOT output_test)
102-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
112+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
103113
CACHE STRING "Recursive flag must be set" FORCE)
104114
endif()
105115
elseif(_frecursiveFlag)
106116
string(REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
107117
if(NOT output_test)
108118
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
109-
CACHE STRING "Recursive flag must be set" FORCE)
119+
CACHE STRING "Recursive flag must be set" FORCE)
110120
endif()
111-
elseif(_MrecursiveFlag)
112-
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
121+
elseif(_recursiveFlag)
122+
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
113123
if(NOT output_test)
114-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
115-
CACHE STRING "Recursive flag must be set" FORCE)
124+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
125+
CACHE STRING "Recursive flag must be set" FORCE)
126+
endif()
127+
elseif(_qrecurFlag)
128+
string(REGEX MATCH "-qrecur" output_test <string> "${CMAKE_Fortran_FLAGS}")
129+
if(NOT output_test)
130+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur"
131+
CACHE STRING "Recursive flag must be set" FORCE)
116132
endif()
117133
endif()
118134

@@ -121,7 +137,7 @@ if(UNIX)
121137
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
122138
endif()
123139
if(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
124-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none")
140+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict")
125141
endif()
126142
# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
127143
# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin

INSTALL/make.inc.XLF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ CFLAGS = -O3 -qnosave
1414
# the compiler options desired when NO OPTIMIZATION is selected.
1515
#
1616
FC = xlf
17-
FFLAGS = -O3 -qfixed -qnosave
17+
FFLAGS = -O3 -qfixed -qnosave -qrecur
1818
# For -O2, add -qstrict=none
1919
FFLAGS_DRV = $(FFLAGS)
20-
FFLAGS_NOOPT = -O0 -qfixed -qnosave
20+
FFLAGS_NOOPT = -O0 -qfixed -qnosave -qrecur
2121

2222
# Define LDFLAGS to the desired linker options for your machine.
2323
#

0 commit comments

Comments
 (0)