Skip to content

Commit

Permalink
Merge pull request #131 from abouteiller/feature/detect-aocl
Browse files Browse the repository at this point in the history
Add special casing for AOCL/BLIS+FLAME detection
  • Loading branch information
abouteiller authored Oct 30, 2024
2 parents 42f4773 + 68c6feb commit f8d7cd9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmake_modules/FindLAPACKE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ if(BLA_VENDOR STREQUAL "" OR BLA_VENDOR STREQUAL "All")
if(CC_HAS_BLAS)
find_package(BLAS) # populate the variables with findBLAS(All)
else(CC_HAS_BLAS)
foreach(BLA_VENDOR Intel10_64lp_seq IBMESSL All)
foreach(BLA_VENDOR Intel10_64lp_seq IBMESSL AOCL All)
find_package(BLAS)
if(BLAS_FOUND)
break()
Expand Down Expand Up @@ -232,16 +232,23 @@ if(BLAS_FOUND)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${BLAS_LIBRARIES} ${MATH_LIB})
set(CMAKE_REQUIRED_INCLUDES ${BLAS_INCLUDE_DIRS})
check_c_source_compiles("extern void cblas_ztrsm(); int main(void) { cblas_ztrsm(); return 0; }" BLAS_HAS_CBLAS)
if(CMAKE_Fortran_COMPILER_WORKS)
check_fortran_function_exists(zgeqrf BLAS_HAS_LAPACK)
else()
check_c_source_compiles("extern void zgeqrf_(); int main(void) { zgeqrf_(); return 0; }" BLAS_HAS_LAPACK)
endif()
check_c_source_compiles("extern void cblas_zgemm(); int main(void) { cblas_zgemm(); return 0; }" BLAS_HAS_CBLAS)
check_c_source_compiles("extern void LAPACKE_zgeqrf(); int main(void) { LAPACKE_zgeqrf(); return 0; }" BLAS_HAS_LAPACKE)
cmake_pop_check_state()
endif(BLAS_FOUND)

# Special casing for AOCL/BLIS: pick FLAME as the lapack library first
if(BLAS_LIBRARIES MATCHES "blis[.]so")
list(APPEND LAPACKE_FIND_COMPONENTS LAPACKE_H)
list(APPEND find_first_lapack_libnames flame libflame)
set(BLAS_HAS_LAPACKE 1)
endif()

# Ok, now look for a ref-lapack
foreach(_comp ${LAPACKE_FIND_COMPONENTS})
if(_comp STREQUAL "LAPACKE")
Expand All @@ -266,7 +273,7 @@ foreach(_comp ${LAPACKE_FIND_COMPONENTS})
if("${BLA_VENDOR}" STREQUAL "IBMESSL" OR NOT BLAS_HAS_LAPACK)
# LAPACK is not in BLAS, or we have IBMESSL
# As IBMESSL is incomplete, we complete it with ref lapack
_find_library_with_header(${_comp} "" lapack liblapack)
_find_library_with_header(${_comp} "" ${find_first_lapack_libnames} lapack liblapack)
else()
set(LAPACKE_LAPACK_FOUND 1)
set(LAPACKE_LAPACK_LIB_FOUND 1)
Expand Down

0 comments on commit f8d7cd9

Please sign in to comment.