Skip to content

Commit 3b8d7df

Browse files
authored
Merge pull request #4846 from martin-frbg/lapack1025
Make the type used for the "hidden" string length argument configurable (adapted from Reference-LAPACK PR 1025)
2 parents 5bdd3a0 + 797ae08 commit 3b8d7df

File tree

5 files changed

+1051
-1032
lines changed

5 files changed

+1051
-1032
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ option(BUILD_WITHOUT_LAPACK "Do not build LAPACK and LAPACKE (Only BLAS or CBLAS
2222

2323
option(BUILD_LAPACK_DEPRECATED "When building LAPACK, include also some older, deprecated routines" ON)
2424

25+
set(LAPACK_STRLEN "" CACHE STRING "When building LAPACK, use this type (e.g. \"int\") for character lengths (defaults to size_t)")
26+
2527
option(BUILD_TESTING "Build LAPACK testsuite when building LAPACK" ON)
2628

2729
option(BUILD_BENCHMARKS "Build the collection of BLAS/LAPACK benchmarks" OFF)

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ else
4545
LAPACK_NOOPT := $(filter-out -O0 -O1 -O2 -O3 -Ofast -O -Og -Os,$(LAPACK_FFLAGS))
4646
endif
4747

48+
ifdef LAPACK_STRLEN
49+
LAPACK_FFLAGS += -DLAPACK_STRLEN=$(LAPACK_STRLEN)
50+
endif
51+
4852
SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench cpp_thread_test
4953

5054
.PHONY : all libs netlib $(RELA) test ctest shared install

Makefile.rule

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ VERSION = 0.3.27.dev
134134
# Build LAPACK Deprecated functions since LAPACK 3.6.0
135135
BUILD_LAPACK_DEPRECATED = 1
136136

137+
# The variable type assumed for the length of character arguments when passing
138+
# data between Fortran LAPACK and C BLAS (defaults to "size_t", but older GCC
139+
# versions used "int"). Mismatches will not cause runtime failures but may result
140+
# in build warnings or errors when building with link-time optimization (LTO)
141+
# LAPACK_STRLEN=int
142+
137143
# Build RecursiveLAPACK on top of LAPACK
138144
# BUILD_RELAPACK = 1
139145
# Have RecursiveLAPACK actually replace standard LAPACK routines instead of

cmake/system.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,10 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${FCOMMON_OPT}")
621621
set(FPFLAGS "${FPFLAGS} ${FCOMMON_OPT} ${COMMON_PROF}")
622622

623623
#For LAPACK Fortran codes.
624-
set(LAPACK_FFLAGS "${LAPACK_FFLAGS} ${CMAKE_Fortran_FLAGS}")
624+
set(LAPACK_FFLAGS "${LAPACK_FFLAGS} ${CMAKE_Fortran_FLAGS}" )
625+
if (LAPACK_STRLEN)
626+
set (LAPACK_FFLAGS "${LAPACK_FFLAGS} -DLAPACK_STRLEN=${LAPACK_STRLEN}")
627+
endif()
625628
set(LAPACK_FPFLAGS "${LAPACK_FPFLAGS} ${FPFLAGS}")
626629

627630
#Disable -fopenmp for LAPACK Fortran codes on Windows.

0 commit comments

Comments
 (0)