diff --git a/.gitignore b/.gitignore index df00129..499146a 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/CMakeLists.txt b/CMakeLists.txt index 14fefd7..c266470 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,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/INSTALL.md b/INSTALL.md index e4703fe..1258bfd 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 0000000..ac0a091 --- /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 0aa3df8..d6bf748 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