Skip to content

Commit 55bb534

Browse files
committed
cmake: search for BLIS and libFLAME
1 parent 4de6f21 commit 55bb534

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ set( blas "auto" CACHE STRING
106106
"BLAS library to search for" )
107107
set_property(
108108
CACHE blas PROPERTY STRINGS
109-
"auto" "Apple Accelerate" "Cray LibSci" "IBM ESSL"
109+
"auto" "AMD AOCL" "Apple Accelerate" "BLIS" "Cray LibSci" "IBM ESSL"
110110
"Intel MKL" "OpenBLAS" "generic" )
111111

112112
set( blas_fortran "auto" CACHE STRING

cmake/BLASConfig.cmake

+31
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,37 @@ if (NOT found)
7070
endif()
7171
endif()
7272

73+
#---------------------------------------- BLIS
74+
if (NOT found)
75+
try_run(
76+
run_result compile_result ${CMAKE_CURRENT_BINARY_DIR}
77+
SOURCES
78+
"${CMAKE_CURRENT_SOURCE_DIR}/config/blis_version.cc"
79+
LINK_LIBRARIES
80+
${BLAS_LIBRARIES} ${openmp_lib} # not "..." quoted; screws up OpenMP
81+
COMPILE_DEFINITIONS
82+
${blaspp_defs_}
83+
COMPILE_OUTPUT_VARIABLE
84+
compile_output
85+
RUN_OUTPUT_VARIABLE
86+
run_output
87+
)
88+
# For cross-compiling, if it links, assume the run is okay.
89+
if (CMAKE_CROSSCOMPILING AND compile_result)
90+
message( DEBUG "cross: blis" )
91+
set( run_result "0" CACHE STRING "" FORCE )
92+
set( run_output "BLIS_VERSION=unknown" CACHE STRING "" FORCE )
93+
endif()
94+
debug_try_run( "blis_version.cc" "${compile_result}" "${compile_output}"
95+
"${run_result}" "${run_output}" )
96+
97+
if (compile_result AND "${run_output}" MATCHES "BLIS_VERSION")
98+
message( "${blue} ${run_output}${plain}" )
99+
list( APPEND blaspp_defs_ "-DBLAS_HAVE_BLIS" )
100+
set( found true )
101+
endif()
102+
endif()
103+
73104
#---------------------------------------- IBM ESSL
74105
if (NOT found)
75106
try_run(

cmake/BLASFinder.cmake

+11-2
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,21 @@ endif()
125125
#---------------------------------------- blas
126126
string( TOLOWER "${blas}" blas_ )
127127

128+
string( REGEX MATCH "auto|apple|accelerate" test_accelerate "${blas_}" )
129+
string( REGEX MATCH "auto|aocl|blis" test_blis "${blas_}" )
130+
string( REGEX MATCH "auto|cray|libsci|default" test_default "${blas_}" )
128131
string( REGEX MATCH "auto|ibm|essl" test_essl "${blas_}" )
129132
string( REGEX MATCH "auto|intel|mkl" test_mkl "${blas_}" )
130133
string( REGEX MATCH "auto|openblas" test_openblas "${blas_}" )
131134
string( REGEX MATCH "auto|generic" test_generic "${blas_}" )
132-
string( REGEX MATCH "auto|apple|accelerate" test_accelerate "${blas_}" )
133-
string( REGEX MATCH "auto|cray|libsci|default" test_default "${blas_}" )
134135

135136
message( DEBUG "
136137
BLAS_LIBRARIES = '${BLAS_LIBRARIES}'
137138
blas = '${blas}'
138139
blas_ = '${blas_}'
139140
test_blas_libraries = '${test_blas_libraries}'
140141
test_accelerate = '${test_accelerate}'
142+
test_blis = '${test_blis}'
141143
test_default = '${test_default}'
142144
test_essl = '${test_essl}'
143145
test_mkl = '${test_mkl}'
@@ -360,6 +362,13 @@ if (test_openblas)
360362
debug_print_list( "openblas" )
361363
endif()
362364

365+
#---------------------------------------- BLIS (also used by AMD AOCL)
366+
if (test_blis)
367+
list( APPEND blas_name_list "BLIS" )
368+
list( APPEND blas_libs_list "-lflame -lblis" )
369+
debug_print_list( "blis" )
370+
endif()
371+
363372
#---------------------------------------- Apple Accelerate
364373
if (test_accelerate)
365374
list( APPEND blas_name_list "Apple Accelerate" )

0 commit comments

Comments
 (0)