Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLIS #97

Merged
merged 5 commits into from
Jan 5, 2025
Merged

BLIS #97

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
__pycache__
blaspp-*
build*
config/acml_version
config/blas
config/blis_version
config/cblas
config/compiler_cxx
config/cublas
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ set( blas "auto" CACHE STRING
"BLAS library to search for" )
set_property(
CACHE blas PROPERTY STRINGS
"auto" "Apple Accelerate" "Cray LibSci" "IBM ESSL"
"Intel MKL" "OpenBLAS" "AMD ACML" "generic" )
"auto" "AMD AOCL" "Apple Accelerate" "BLIS" "Cray LibSci" "IBM ESSL"
"Intel MKL" "OpenBLAS" "generic" )

set( blas_fortran "auto" CACHE STRING
"For Intel MKL: use Intel ifort or GNU gfortran conventions?" )
Expand Down
3 changes: 2 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ 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
ACML AMD ACML (deprecated)
generic generic -lblas

blas_int
Expand Down
46 changes: 23 additions & 23 deletions cmake/BLASConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ if (NOT found)
endif()
endif()

#---------------------------------------- IBM ESSL
#---------------------------------------- BLIS
if (NOT found)
try_run(
run_result compile_result ${CMAKE_CURRENT_BINARY_DIR}
SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/config/essl_version.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/config/blis_version.cc"
LINK_LIBRARIES
${BLAS_LIBRARIES} ${openmp_lib} # not "..." quoted; screws up OpenMP
COMPILE_DEFINITIONS
Expand All @@ -87,26 +87,26 @@ if (NOT found)
)
# For cross-compiling, if it links, assume the run is okay.
if (CMAKE_CROSSCOMPILING AND compile_result)
message( DEBUG "cross: essl" )
message( DEBUG "cross: blis" )
set( run_result "0" CACHE STRING "" FORCE )
set( run_output "ESSL_VERSION=unknown" CACHE STRING "" FORCE )
set( run_output "BLIS_VERSION=unknown" CACHE STRING "" FORCE )
endif()
debug_try_run( "essl_version.cc" "${compile_result}" "${compile_output}"
debug_try_run( "blis_version.cc" "${compile_result}" "${compile_output}"
"${run_result}" "${run_output}" )

if (compile_result AND "${run_output}" MATCHES "ESSL_VERSION")
if (compile_result AND "${run_output}" MATCHES "BLIS_VERSION")
message( "${blue} ${run_output}${plain}" )
list( APPEND blaspp_defs_ "-DBLAS_HAVE_ESSL" )
list( APPEND blaspp_defs_ "-DBLAS_HAVE_BLIS" )
set( found true )
endif()
endif()

#---------------------------------------- OpenBLAS
#---------------------------------------- IBM ESSL
if (NOT found)
try_run(
run_result compile_result ${CMAKE_CURRENT_BINARY_DIR}
SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/config/openblas_version.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/config/essl_version.cc"
LINK_LIBRARIES
${BLAS_LIBRARIES} ${openmp_lib} # not "..." quoted; screws up OpenMP
COMPILE_DEFINITIONS
Expand All @@ -118,26 +118,26 @@ if (NOT found)
)
# For cross-compiling, if it links, assume the run is okay.
if (CMAKE_CROSSCOMPILING AND compile_result)
message( DEBUG "cross: openblas" )
message( DEBUG "cross: essl" )
set( run_result "0" CACHE STRING "" FORCE )
set( run_output "OPENBLAS_VERSION=unknown" CACHE STRING "" FORCE )
set( run_output "ESSL_VERSION=unknown" CACHE STRING "" FORCE )
endif()
debug_try_run( "openblas_version.cc" "${compile_result}" "${compile_output}"
"${run_result}" "${run_output}" )
debug_try_run( "essl_version.cc" "${compile_result}" "${compile_output}"
"${run_result}" "${run_output}" )

if (compile_result AND "${run_output}" MATCHES "OPENBLAS_VERSION")
if (compile_result AND "${run_output}" MATCHES "ESSL_VERSION")
message( "${blue} ${run_output}${plain}" )
list( APPEND blaspp_defs_ "-DBLAS_HAVE_OPENBLAS" )
list( APPEND blaspp_defs_ "-DBLAS_HAVE_ESSL" )
set( found true )
endif()
endif()

#---------------------------------------- ACML
#---------------------------------------- OpenBLAS
if (NOT found)
try_run(
run_result compile_result ${CMAKE_CURRENT_BINARY_DIR}
SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/config/acml_version.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/config/openblas_version.cc"
LINK_LIBRARIES
${BLAS_LIBRARIES} ${openmp_lib} # not "..." quoted; screws up OpenMP
COMPILE_DEFINITIONS
Expand All @@ -149,16 +149,16 @@ if (NOT found)
)
# For cross-compiling, if it links, assume the run is okay.
if (CMAKE_CROSSCOMPILING AND compile_result)
message( DEBUG "cross: acml" )
message( DEBUG "cross: openblas" )
set( run_result "0" CACHE STRING "" FORCE )
set( run_output "ACML_VERSION=unknown" CACHE STRING "" FORCE )
set( run_output "OPENBLAS_VERSION=unknown" CACHE STRING "" FORCE )
endif()
debug_try_run( "acml_version.cc" "${compile_result}" "${compile_output}"
"${run_result}" "${run_output}" )
debug_try_run( "openblas_version.cc" "${compile_result}" "${compile_output}"
"${run_result}" "${run_output}" )

if (compile_result AND "${run_output}" MATCHES "ACML_VERSION")
if (compile_result AND "${run_output}" MATCHES "OPENBLAS_VERSION")
message( "${blue} ${run_output}${plain}" )
list( APPEND blaspp_defs_ "-DBLAS_HAVE_ACML" )
list( APPEND blaspp_defs_ "-DBLAS_HAVE_OPENBLAS" )
set( found true )
endif()
endif()
Expand Down
31 changes: 11 additions & 20 deletions cmake/BLASFinder.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,21 @@ endif()
#---------------------------------------- blas
string( TOLOWER "${blas}" blas_ )

string( REGEX MATCH "auto|acml" test_acml "${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}'
blas = '${blas}'
blas_ = '${blas_}'
test_blas_libraries = '${test_blas_libraries}'
test_acml = '${test_acml}'
test_accelerate = '${test_accelerate}'
test_blis = '${test_blis}'
test_default = '${test_default}'
test_essl = '${test_essl}'
test_mkl = '${test_mkl}'
Expand Down Expand Up @@ -362,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" )
Expand All @@ -376,22 +383,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.

Expand Down
10 changes: 4 additions & 6 deletions config/acml_version.cc → config/blis_version.cc
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// Copyright (c) 2017-2023, University of Tennessee. All rights reserved.
// 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 <mkl.h>
#include <blis.h>

int main()
{
int major, minor, patch, build;
acmlversion( &major, &minor, &patch, &build );
printf( "ACML_VERSION=%d.%d.%d.%d\n",
major, minor, patch, build );
const char* v = bli_info_get_version_str();
printf( "BLIS_VERSION=%s\n", v );
return 0;
}
2 changes: 1 addition & 1 deletion config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading