Skip to content

Commit

Permalink
config: search for BLIS and libFLAME
Browse files Browse the repository at this point in the history
  • Loading branch information
mgates3 committed Dec 22, 2024
1 parent cc200e3 commit 7b7d165
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __pycache__
blaspp-*
build*
config/blas
config/blis_version
config/cblas
config/compiler_cxx
config/cublas
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions config/blis_version.cc
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <blis.h>

int main()
{
const char* v = bli_info_get_version_str();
printf( "BLIS_VERSION=%s\n", v );
return 0;
}
32 changes: 28 additions & 4 deletions config/lapack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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():
'''
Expand Down Expand Up @@ -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):
Expand All @@ -661,6 +684,7 @@ def vendor_version():
pass
else:
mkl_version()
blis_version()
essl_version()
openblas_version()
# end
Expand Down

0 comments on commit 7b7d165

Please sign in to comment.