From cb414f1f21074d8b61586dc14088f06335c97ed4 Mon Sep 17 00:00:00 2001 From: Mark Gates Date: Sat, 21 Dec 2024 20:37:50 -0700 Subject: [PATCH 1/5] config: remove ACML --- .gitignore | 1 - CMakeLists.txt | 2 +- INSTALL.md | 1 - cmake/BLASConfig.cmake | 31 ------------------------------- cmake/BLASFinder.cmake | 18 ------------------ config/acml_version.cc | 16 ---------------- config/lapack.py | 35 +++-------------------------------- 7 files changed, 4 insertions(+), 100 deletions(-) delete mode 100644 config/acml_version.cc diff --git a/.gitignore b/.gitignore index dc33bfa2..df001296 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ __pycache__ blaspp-* build* -config/acml_version config/blas config/cblas config/compiler_cxx diff --git a/CMakeLists.txt b/CMakeLists.txt index eeb2a84a..c865aa5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ set( blas "auto" CACHE STRING set_property( CACHE blas PROPERTY STRINGS "auto" "Apple Accelerate" "Cray LibSci" "IBM ESSL" - "Intel MKL" "OpenBLAS" "AMD ACML" "generic" ) + "Intel MKL" "OpenBLAS" "generic" ) set( blas_fortran "auto" CACHE STRING "For Intel MKL: use Intel ifort or GNU gfortran conventions?" ) diff --git a/INSTALL.md b/INSTALL.md index e5d75507..e4703fe0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -52,7 +52,6 @@ BLAS++ specific options include (all values are case insensitive): ESSL IBM ESSL OpenBLAS OpenBLAS Accelerate Apple Accelerate framework - ACML AMD ACML (deprecated) generic generic -lblas blas_int diff --git a/cmake/BLASConfig.cmake b/cmake/BLASConfig.cmake index 41be1eed..8ae80faf 100644 --- a/cmake/BLASConfig.cmake +++ b/cmake/BLASConfig.cmake @@ -132,37 +132,6 @@ if (NOT found) endif() endif() -#---------------------------------------- ACML -if (NOT found) - try_run( - run_result compile_result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES - "${CMAKE_CURRENT_SOURCE_DIR}/config/acml_version.cc" - LINK_LIBRARIES - ${BLAS_LIBRARIES} ${openmp_lib} # not "..." quoted; screws up OpenMP - COMPILE_DEFINITIONS - ${blaspp_defs_} - COMPILE_OUTPUT_VARIABLE - compile_output - RUN_OUTPUT_VARIABLE - run_output - ) - # For cross-compiling, if it links, assume the run is okay. - if (CMAKE_CROSSCOMPILING AND compile_result) - message( DEBUG "cross: acml" ) - set( run_result "0" CACHE STRING "" FORCE ) - set( run_output "ACML_VERSION=unknown" CACHE STRING "" FORCE ) - endif() - debug_try_run( "acml_version.cc" "${compile_result}" "${compile_output}" - "${run_result}" "${run_output}" ) - - if (compile_result AND "${run_output}" MATCHES "ACML_VERSION") - message( "${blue} ${run_output}${plain}" ) - list( APPEND blaspp_defs_ "-DBLAS_HAVE_ACML" ) - set( found true ) - endif() -endif() - # todo: detect Accelerate # todo: detect Cray libsci diff --git a/cmake/BLASFinder.cmake b/cmake/BLASFinder.cmake index 0c05cca2..b7763b79 100644 --- a/cmake/BLASFinder.cmake +++ b/cmake/BLASFinder.cmake @@ -125,7 +125,6 @@ endif() #---------------------------------------- blas string( TOLOWER "${blas}" blas_ ) -string( REGEX MATCH "auto|acml" test_acml "${blas_}" ) string( REGEX MATCH "auto|ibm|essl" test_essl "${blas_}" ) string( REGEX MATCH "auto|intel|mkl" test_mkl "${blas_}" ) string( REGEX MATCH "auto|openblas" test_openblas "${blas_}" ) @@ -138,7 +137,6 @@ BLAS_LIBRARIES = '${BLAS_LIBRARIES}' blas = '${blas}' blas_ = '${blas_}' test_blas_libraries = '${test_blas_libraries}' -test_acml = '${test_acml}' test_accelerate = '${test_accelerate}' test_default = '${test_default}' test_essl = '${test_essl}' @@ -376,22 +374,6 @@ if (test_generic) debug_print_list( "generic" ) endif() -#---------------------------------------- AMD ACML -# Deprecated libraries last. -if (test_acml) - # todo: ACML_?(ROOT|DIR) - if (test_threaded) - list( APPEND blas_name_list "AMD ACML threaded" ) - list( APPEND blas_libs_list "-lacml_mp" ) - endif() - - if (test_sequential) - list( APPEND blas_name_list "AMD ACML sequential" ) - list( APPEND blas_libs_list "-lacml" ) - endif() - debug_print_list( "acml" ) -endif() - #------------------------------------------------------------------------------- # Check each BLAS library. diff --git a/config/acml_version.cc b/config/acml_version.cc deleted file mode 100644 index 76c95262..00000000 --- a/config/acml_version.cc +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2017-2023, University of Tennessee. All rights reserved. -// SPDX-License-Identifier: BSD-3-Clause -// This program is free software: you can redistribute it and/or modify it under -// the terms of the BSD 3-Clause license. See the accompanying LICENSE file. - -#include -#include - -int main() -{ - int major, minor, patch, build; - acmlversion( &major, &minor, &patch, &build ); - printf( "ACML_VERSION=%d.%d.%d.%d\n", - major, minor, patch, build ); - return 0; -} diff --git a/config/lapack.py b/config/lapack.py index cfaeabb5..0aa3df8a 100644 --- a/config/lapack.py +++ b/config/lapack.py @@ -129,12 +129,12 @@ def compile_with_manglings( src, env, manglings, int_sizes ): #------------------------------------------------------------------------------- def blas(): ''' - Searches for BLAS in default libraries, MKL, ACML, ESSL, OpenBLAS, + Searches for BLAS in default libraries, MKL, ESSL, OpenBLAS, and Accelerate. Checks FORTRAN_ADD_, FORTRAN_LOWER, FORTRAN_UPPER. Checks int (LP64) and int64 (ILP64). Setting one or more of: - blas = {mkl, acml, essl, openblas, accelerate, generic}; + blas = {mkl, essl, openblas, accelerate, generic}; blas_int = {int, int64}; blas_threaded = {y, n}; blas_fortran = {gfortran, ifort}; @@ -167,7 +167,6 @@ def blas(): #-------------------- blas test_all = (not blas or blas == 'auto') - test_acml = re.search( r'\b(acml)\b', blas ) is not None test_accelerate = re.search( r'\b(apple|accelerate)\b', blas ) is not None test_default = re.search( r'\b(cray|libsci|default)\b', blas ) is not None test_essl = re.search( r'\b(ibm|essl)\b', blas ) is not None @@ -177,7 +176,6 @@ def blas(): if (config.debug()): print( "blas = '" + blas + "'\n" - + "test_acml = ", test_acml, "\n" + "test_accelerate = ", test_accelerate, "\n" + "test_default = ", test_default, "\n" + "test_essl = ", test_essl, "\n" @@ -356,15 +354,6 @@ def blas(): if (test_all or test_generic): choices.append( ['Generic BLAS', {'LIBS': '-lblas'}]) - #-------------------- AMD ACML - # Deprecated libraries last. - if (test_all or test_acml): - if (test_threaded): - choices.append( ['AMD ACML (threaded)', {'LIBS': '-lacml_mp'}]) - if (test_sequential): - choices.append( ['AMD ACML (sequential)', {'LIBS': '-lacml'}]) - # end - #---------------------------------------- # Test choices. manglings = get_fortran_manglings() @@ -623,21 +612,6 @@ def mkl_version(): config.print_result( 'MKL', rc ) # end -#------------------------------------------------------------------------------- -def acml_version(): - ''' - Check for ACML version via acmlversion(). - ''' - config.print_test( 'ACML version' ) - (rc, out, err) = config.compile_run( 'config/acml_version.cc' ) - s = re.search( r'^ACML_VERSION=((\d+)\.(\d+)\.(\d+)\.(\d+))', out ) - if (rc == 0 and s): - config.environ.append( 'CXXFLAGS', define('HAVE_ACML') ) - config.print_result( 'ACML', rc, '(' + s.group(1) + ')' ) - else: - config.print_result( 'ACML', rc ) -# end - #------------------------------------------------------------------------------- def essl_version(): ''' @@ -671,7 +645,7 @@ def openblas_version(): #------------------------------------------------------------------------------- def vendor_version(): ''' - Check for MKL, ACML, ESSL, or OpenBLAS version number in BLAS/LAPACK + Check for MKL, ESSL, or OpenBLAS version number in BLAS/LAPACK libraries. ''' # If we can, be smart looking for MKL, ESSL, or OpenBLAS version; @@ -679,8 +653,6 @@ def vendor_version(): LIBS = config.environ['LIBS'] if ('-lmkl' in LIBS): mkl_version() - elif ('-lacml' in LIBS): - acml_version() elif ('-lessl' in LIBS): essl_version() elif ('-lopenblas' in LIBS): @@ -689,7 +661,6 @@ def vendor_version(): pass else: mkl_version() - acml_version() essl_version() openblas_version() # end From 4de6f214f9e7f92008a0d16fc65ba11b62ba25a4 Mon Sep 17 00:00:00 2001 From: Mark Gates Date: Tue, 24 Dec 2024 12:02:34 -0700 Subject: [PATCH 2/5] config: search for BLIS and libFLAME --- .gitignore | 1 + INSTALL.md | 2 ++ config/blis_version.cc | 14 ++++++++++++++ config/lapack.py | 32 ++++++++++++++++++++++++++++---- 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 config/blis_version.cc diff --git a/.gitignore b/.gitignore index df001296..499146aa 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__ blaspp-* build* config/blas +config/blis_version config/cblas config/compiler_cxx config/cublas diff --git a/INSTALL.md b/INSTALL.md index e4703fe0..1258bfdf 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -50,6 +50,8 @@ BLAS++ specific options include (all values are case insensitive): LibSci Cray LibSci MKL Intel MKL ESSL IBM ESSL + AOCL AMD AOCL (same as BLIS) + BLIS BLIS and libFLAME OpenBLAS OpenBLAS Accelerate Apple Accelerate framework generic generic -lblas diff --git a/config/blis_version.cc b/config/blis_version.cc new file mode 100644 index 00000000..ac0a0913 --- /dev/null +++ b/config/blis_version.cc @@ -0,0 +1,14 @@ +// Copyright (c) 2017-2024, University of Tennessee. All rights reserved. +// SPDX-License-Identifier: BSD-3-Clause +// This program is free software: you can redistribute it and/or modify it under +// the terms of the BSD 3-Clause license. See the accompanying LICENSE file. + +#include +#include + +int main() +{ + const char* v = bli_info_get_version_str(); + printf( "BLIS_VERSION=%s\n", v ); + return 0; +} diff --git a/config/lapack.py b/config/lapack.py index 0aa3df8a..d6bf7488 100644 --- a/config/lapack.py +++ b/config/lapack.py @@ -129,12 +129,12 @@ def compile_with_manglings( src, env, manglings, int_sizes ): #------------------------------------------------------------------------------- def blas(): ''' - Searches for BLAS in default libraries, MKL, ESSL, OpenBLAS, + Searches for BLAS in default libraries, MKL, BLIS, ESSL, OpenBLAS, and Accelerate. Checks FORTRAN_ADD_, FORTRAN_LOWER, FORTRAN_UPPER. Checks int (LP64) and int64 (ILP64). Setting one or more of: - blas = {mkl, essl, openblas, accelerate, generic}; + blas = {mkl, blis, essl, openblas, accelerate, generic}; blas_int = {int, int64}; blas_threaded = {y, n}; blas_fortran = {gfortran, ifort}; @@ -168,6 +168,7 @@ def blas(): #-------------------- blas test_all = (not blas or blas == 'auto') test_accelerate = re.search( r'\b(apple|accelerate)\b', blas ) is not None + test_blis = re.search( r'\b(aocl|blis)\b', blas ) is not None test_default = re.search( r'\b(cray|libsci|default)\b', blas ) is not None test_essl = re.search( r'\b(ibm|essl)\b', blas ) is not None test_mkl = re.search( r'\b(intel|mkl)\b', blas ) is not None @@ -177,6 +178,7 @@ def blas(): if (config.debug()): print( "blas = '" + blas + "'\n" + "test_accelerate = ", test_accelerate, "\n" + + "test_blis = ", test_blis, "\n" + "test_default = ", test_default, "\n" + "test_essl = ", test_essl, "\n" + "test_mkl = ", test_mkl, "\n" @@ -331,6 +333,10 @@ def blas(): if (test_all or test_openblas): choices.append( ['OpenBLAS', {'LIBS': '-lopenblas'}]) + #-------------------- BLIS (also used by AMD AOCL) + if (test_all or test_blis): + choices.append( ['BLIS', {'LIBS': '-lflame -lblis'}]) + #-------------------- Apple Accelerate if (test_all or test_accelerate): # macOS puts cblas.h in weird places. @@ -612,6 +618,21 @@ def mkl_version(): config.print_result( 'MKL', rc ) # end +#------------------------------------------------------------------------------- +def blis_version(): + ''' + Check for BLIS version via bli_info_get_version_str. + ''' + config.print_test( 'BLIS version' ) + (rc, out, err) = config.compile_run( 'config/blis_version.cc' ) + s = re.search( r'^BLIS_VERSION=(.*)', out ) + if (rc == 0 and s): + config.environ.append( 'CXXFLAGS', define('HAVE_BLIS') ) + config.print_result( 'BLIS', rc, '(' + s.group(1) + ')' ) + else: + config.print_result( 'BLIS', rc ) +# end + #------------------------------------------------------------------------------- def essl_version(): ''' @@ -645,14 +666,16 @@ def openblas_version(): #------------------------------------------------------------------------------- def vendor_version(): ''' - Check for MKL, ESSL, or OpenBLAS version number in BLAS/LAPACK + Check for MKL, BLIS, ESSL, or OpenBLAS version number in BLAS/LAPACK libraries. ''' - # If we can, be smart looking for MKL, ESSL, or OpenBLAS version; + # If we can, be smart looking for MKL, BLIS, ESSL, or OpenBLAS version; # otherwise, check them all. LIBS = config.environ['LIBS'] if ('-lmkl' in LIBS): mkl_version() + elif ('-lblis' in LIBS): + blis_version() elif ('-lessl' in LIBS): essl_version() elif ('-lopenblas' in LIBS): @@ -661,6 +684,7 @@ def vendor_version(): pass else: mkl_version() + blis_version() essl_version() openblas_version() # end From 55bb534f10cea81f82c49d1e6f1b35b1353f524e Mon Sep 17 00:00:00 2001 From: Mark Gates Date: Tue, 24 Dec 2024 12:02:45 -0700 Subject: [PATCH 3/5] cmake: search for BLIS and libFLAME --- CMakeLists.txt | 2 +- cmake/BLASConfig.cmake | 31 +++++++++++++++++++++++++++++++ cmake/BLASFinder.cmake | 13 +++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c865aa5e..d741f6a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ set( blas "auto" CACHE STRING "BLAS library to search for" ) set_property( CACHE blas PROPERTY STRINGS - "auto" "Apple Accelerate" "Cray LibSci" "IBM ESSL" + "auto" "AMD AOCL" "Apple Accelerate" "BLIS" "Cray LibSci" "IBM ESSL" "Intel MKL" "OpenBLAS" "generic" ) set( blas_fortran "auto" CACHE STRING diff --git a/cmake/BLASConfig.cmake b/cmake/BLASConfig.cmake index 8ae80faf..ab572a48 100644 --- a/cmake/BLASConfig.cmake +++ b/cmake/BLASConfig.cmake @@ -70,6 +70,37 @@ if (NOT found) endif() endif() +#---------------------------------------- BLIS +if (NOT found) + try_run( + run_result compile_result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/config/blis_version.cc" + LINK_LIBRARIES + ${BLAS_LIBRARIES} ${openmp_lib} # not "..." quoted; screws up OpenMP + COMPILE_DEFINITIONS + ${blaspp_defs_} + COMPILE_OUTPUT_VARIABLE + compile_output + RUN_OUTPUT_VARIABLE + run_output + ) + # For cross-compiling, if it links, assume the run is okay. + if (CMAKE_CROSSCOMPILING AND compile_result) + message( DEBUG "cross: blis" ) + set( run_result "0" CACHE STRING "" FORCE ) + set( run_output "BLIS_VERSION=unknown" CACHE STRING "" FORCE ) + endif() + debug_try_run( "blis_version.cc" "${compile_result}" "${compile_output}" + "${run_result}" "${run_output}" ) + + if (compile_result AND "${run_output}" MATCHES "BLIS_VERSION") + message( "${blue} ${run_output}${plain}" ) + list( APPEND blaspp_defs_ "-DBLAS_HAVE_BLIS" ) + set( found true ) + endif() +endif() + #---------------------------------------- IBM ESSL if (NOT found) try_run( diff --git a/cmake/BLASFinder.cmake b/cmake/BLASFinder.cmake index b7763b79..5912e775 100644 --- a/cmake/BLASFinder.cmake +++ b/cmake/BLASFinder.cmake @@ -125,12 +125,13 @@ endif() #---------------------------------------- blas string( TOLOWER "${blas}" blas_ ) +string( REGEX MATCH "auto|apple|accelerate" test_accelerate "${blas_}" ) +string( REGEX MATCH "auto|aocl|blis" test_blis "${blas_}" ) +string( REGEX MATCH "auto|cray|libsci|default" test_default "${blas_}" ) string( REGEX MATCH "auto|ibm|essl" test_essl "${blas_}" ) string( REGEX MATCH "auto|intel|mkl" test_mkl "${blas_}" ) string( REGEX MATCH "auto|openblas" test_openblas "${blas_}" ) string( REGEX MATCH "auto|generic" test_generic "${blas_}" ) -string( REGEX MATCH "auto|apple|accelerate" test_accelerate "${blas_}" ) -string( REGEX MATCH "auto|cray|libsci|default" test_default "${blas_}" ) message( DEBUG " BLAS_LIBRARIES = '${BLAS_LIBRARIES}' @@ -138,6 +139,7 @@ blas = '${blas}' blas_ = '${blas_}' test_blas_libraries = '${test_blas_libraries}' test_accelerate = '${test_accelerate}' +test_blis = '${test_blis}' test_default = '${test_default}' test_essl = '${test_essl}' test_mkl = '${test_mkl}' @@ -360,6 +362,13 @@ if (test_openblas) debug_print_list( "openblas" ) endif() +#---------------------------------------- BLIS (also used by AMD AOCL) +if (test_blis) + list( APPEND blas_name_list "BLIS" ) + list( APPEND blas_libs_list "-lflame -lblis" ) + debug_print_list( "blis" ) +endif() + #---------------------------------------- Apple Accelerate if (test_accelerate) list( APPEND blas_name_list "Apple Accelerate" ) From 5a22f1e6220240b57d81c080d9509383cec4c868 Mon Sep 17 00:00:00 2001 From: Mark Gates Date: Tue, 24 Dec 2024 12:01:22 -0700 Subject: [PATCH 4/5] config: simplify "auto" --- config/lapack.py | 84 ++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 50 deletions(-) diff --git a/config/lapack.py b/config/lapack.py index d6bf7488..65b5f65b 100644 --- a/config/lapack.py +++ b/config/lapack.py @@ -62,12 +62,9 @@ def get_int_sizes(): where '' is compiler's default, usually 32-bit int in LP64. ''' # todo: repeated from below - blas_int = config.environ['blas_int'].lower() - test_int = re.search( r'\b(lp64|int|int32|int32_t)\b', blas_int ) is not None - test_int64 = re.search( r'\b(ilp64|int64|int64_t)\b', blas_int ) is not None - if (not blas_int or blas_int == 'auto'): - test_int = True - test_int64 = True + blas_int = config.environ['blas_int'].lower() or 'auto' + test_int = re.search( r'\b(auto|lp64|int|int32|int32_t)\b', blas_int ) is not None + test_int64 = re.search( r'\b(auto|ilp64|int64|int64_t)\b', blas_int ) is not None int_sizes = [] if (test_int): @@ -147,10 +144,10 @@ def blas(): #---------------------------------------- # Parse options. BLAS_LIBRARIES = config.environ['BLAS_LIBRARIES'] - blas = config.environ['blas'].lower() - blas_fortran = config.environ['blas_fortran'].lower() - blas_int = config.environ['blas_int'].lower() - blas_threaded = config.environ['blas_threaded'].lower() + blas = config.environ['blas' ].lower() or 'auto' + blas_fortran = config.environ['blas_fortran' ].lower() or 'auto' + blas_int = config.environ['blas_int' ].lower() or 'auto' + blas_threaded = config.environ['blas_threaded'].lower() or 'auto' #-------------------- BLAS_LIBRARIES # If testing BLAS_LIBRARIES, ignore other flags (blas, ...). @@ -166,14 +163,13 @@ def blas(): + "test_blas_libraries = ", test_blas_libraries, "\n" ) #-------------------- blas - test_all = (not blas or blas == 'auto') - test_accelerate = re.search( r'\b(apple|accelerate)\b', blas ) is not None - test_blis = re.search( r'\b(aocl|blis)\b', blas ) is not None - test_default = re.search( r'\b(cray|libsci|default)\b', blas ) is not None - test_essl = re.search( r'\b(ibm|essl)\b', blas ) is not None - test_mkl = re.search( r'\b(intel|mkl)\b', blas ) is not None - test_openblas = re.search( r'\b(openblas)\b', blas ) is not None - test_generic = re.search( r'\b(generic)\b', blas ) is not None + test_accelerate = re.search( r'\b(auto|apple|accelerate)\b', blas ) is not None + test_blis = re.search( r'\b(auto|aocl|blis)\b', blas ) is not None + test_default = re.search( r'\b(auto|cray|libsci|default)\b', blas ) is not None + test_essl = re.search( r'\b(auto|ibm|essl)\b', blas ) is not None + test_mkl = re.search( r'\b(auto|intel|mkl)\b', blas ) is not None + test_openblas = re.search( r'\b(auto|openblas)\b', blas ) is not None + test_generic = re.search( r'\b(auto|generic)\b', blas ) is not None if (config.debug()): print( "blas = '" + blas + "'\n" @@ -183,15 +179,11 @@ def blas(): + "test_essl = ", test_essl, "\n" + "test_mkl = ", test_mkl, "\n" + "test_openblas = ", test_openblas, "\n" - + "test_generic = ", test_generic, "\n" - + "test_all = ", test_all, "\n" ) + + "test_generic = ", test_generic, "\n" ) #-------------------- blas_fortran - test_gfortran = re.search( r'\b(gfortran)\b', blas_fortran ) is not None - test_ifort = re.search( r'\b(ifort)\b', blas_fortran ) is not None - if (not blas_fortran or blas_fortran == 'auto'): - test_gfortran = True - test_ifort = True + test_gfortran = re.search( r'\b(auto|gfortran)\b', blas_fortran ) is not None + test_ifort = re.search( r'\b(auto|ifort)\b', blas_fortran ) is not None if (config.debug()): print( "blas_fortran = '" + blas_fortran + "'\n" @@ -199,11 +191,8 @@ def blas(): + "test_ifort = ", + test_ifort, "\n" ) #-------------------- blas_int - test_int = re.search( r'\b(lp64|int|int32|int32_t)\b', blas_int ) is not None - test_int64 = re.search( r'\b(ilp64|int64|int64_t)\b', blas_int ) is not None - if (not blas_int or blas_int == 'auto'): - test_int = True - test_int64 = True + test_int = re.search( r'\b(auto|lp64|int|int32|int32_t)\b', blas_int ) is not None + test_int64 = re.search( r'\b(auto|ilp64|int64|int64_t)\b', blas_int ) is not None if (config.debug()): print( "blas_int = '" + blas_int + "'\n" @@ -211,11 +200,8 @@ def blas(): + "test_int64 = ", test_int64, "\n" ) #-------------------- blas_threaded - test_threaded = re.search( r'\b(y|yes|true|on|1)\b', blas_threaded ) is not None - test_sequential = re.search( r'\b(n|no|false|off|0)\b', blas_threaded ) is not None - if (not blas_threaded or blas_threaded == 'auto'): - test_threaded = True - test_sequential = True + test_threaded = re.search( r'\b(auto|y|yes|true|on|1)\b', blas_threaded ) is not None + test_sequential = re.search( r'\b(auto|n|no|false|off|0)\b', blas_threaded ) is not None if (config.debug()): print( "blas_threaded = '" + blas_threaded + "'\n" @@ -235,12 +221,12 @@ def blas(): choices.append( ['BLAS_LIBRARIES', {'LIBS': BLAS_LIBRARIES}] ) #-------------------- default; Cray libsci - if (test_all or test_default): + if (test_default): # Sometimes BLAS is in default libraries (e.g., on Cray). choices.append( ['Default', {}] ) #-------------------- Intel MKL - if (test_all or test_mkl): + if (test_mkl): choices_ifort = [] choices_gfortran = [] if (test_threaded and has_openmp): @@ -307,7 +293,7 @@ def blas(): # end mkl #-------------------- IBM ESSL - if (test_all or test_essl): + if (test_essl): if (test_threaded): if (test_int): choices.append( @@ -330,15 +316,15 @@ def blas(): # end essl #-------------------- OpenBLAS - if (test_all or test_openblas): + if (test_openblas): choices.append( ['OpenBLAS', {'LIBS': '-lopenblas'}]) #-------------------- BLIS (also used by AMD AOCL) - if (test_all or test_blis): + if (test_blis): choices.append( ['BLIS', {'LIBS': '-lflame -lblis'}]) #-------------------- Apple Accelerate - if (test_all or test_accelerate): + if (test_accelerate): # macOS puts cblas.h in weird places. paths = [ '/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers', @@ -357,7 +343,7 @@ def blas(): # end #-------------------- generic -lblas - if (test_all or test_generic): + if (test_generic): choices.append( ['Generic BLAS', {'LIBS': '-lblas'}]) #---------------------------------------- @@ -426,7 +412,7 @@ def lapack(): #---------------------------------------- # Parse options. LAPACK_LIBRARIES = config.environ['LAPACK_LIBRARIES'] - lapack = config.environ['lapack'].lower() + lapack = config.environ['lapack'].lower() or 'auto' #-------------------- LAPACK_LIBRARIES # If testing LAPACK_LIBRARIES, ignore other flags (lapack, ...). @@ -439,15 +425,13 @@ def lapack(): + "test_lapack_libraries = ", test_lapack_libraries, "\n" ) #-------------------- lapack - test_all = (not lapack or lapack == 'auto') - test_default = re.search( r'\b(default)\b', lapack ) is not None - test_generic = re.search( r'\b(generic)\b', lapack ) is not None + test_default = re.search( r'\b(auto|default)\b', lapack ) is not None + test_generic = re.search( r'\b(auto|generic)\b', lapack ) is not None if (config.debug()): print( "lapack = '" + lapack + "'\n" + "test_default = ", test_default, "\n" - + "test_generic = ", test_generic, "\n" - + "test_all = ", test_all, "\n" ) + + "test_generic = ", test_generic, "\n" ) #---------------------------------------- # Build list of libraries to check. @@ -459,11 +443,11 @@ def lapack(): {'LIBS': LAPACK_LIBRARIES}] ) #-------------------- default (e.g., in BLAS library) - if (test_all or test_default): + if (test_default): choices.append( ['BLAS library', {}] ) #-------------------- generic -llapack - if (test_all or test_generic): + if (test_generic): choices.append( ['generic -llapack', {'LIBS': '-llapack'}]) #---------------------------------------- From 23dab30251a4119d90b428afdb52d8366f32fccc Mon Sep 17 00:00:00 2001 From: Mark Gates Date: Wed, 25 Dec 2024 15:59:32 -0700 Subject: [PATCH 5/5] config: fix regex --- config/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.py b/config/config.py index a644314b..264f5963 100644 --- a/config/config.py +++ b/config/config.py @@ -1010,7 +1010,7 @@ def parse_args(): # Parse name=value pairs. for arg in opts.options: - s = re.search( '^(\w+)=(.*)', arg ) + s = re.search( r'^(\w+)=(.*)', arg ) if (s): environ[ s.group(1) ] = s.group(2) else: