Skip to content

Commit

Permalink
Merge pull request #166 from DrTimothyAldenDavis/dev2
Browse files Browse the repository at this point in the history
selecing the BLAS
  • Loading branch information
DrTimothyAldenDavis authored Nov 6, 2022
2 parents 00ee0f3 + 9aba8d5 commit 7838c08
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
41 changes: 32 additions & 9 deletions SuiteSparse_config/cmake_modules/SuiteSparseBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,38 @@ if ( NOT DEFINED ALLOW_64BIT_BLAS )
set ( ALLOW_64BIT_BLAS false )
endif ( )

#-------------------------------------------------------------------------------
# look for a specific BLAS library
#-------------------------------------------------------------------------------

# To request specific BLAS, use either (for example):
#
# CMAKE_OPTIONS="-DBLA_VENDOR=Apple" make
# cd build ; cmake -DBLA_VENDOR=Apple .. ; make
#
# Note that the ALLOW_64BIT_BLAS flag is ignored in this case. If you want
# to select a specific BLAS integer size, use -DBLA_SIZEOF_INTEGER=64 or 32.

if ( DEFINED BLA_VENDOR )
# only look for the BLAS from a single vendor
message ( STATUS "============================================" )
message ( STATUS "Looking for BLAS: " ${BLA_VENDOR} )
if ( NOT DEFINED BLA_SIZEOF_INTEGER )
message ( FATAL_ERROR "Both BLA_VENDOR and BLA_SIZEOF_INTEGER must be specified" )
endif ( )
# only look for the BLAS with a specific integer size
find_package ( BLAS REQUIRED )
find_package ( LAPACK REQUIRED )
if ( BLA_SIZEOF_INTEGER EQUAL 8 )
include ( SuiteSparseBLAS64 )
elseif ( BLA_SIZEOF_INTEGER EQUAL 4 )
include ( SuiteSparseBLAS32 )
else ( )
message ( FATAL_ERROR "BLA_SIZEOF_INTEGER invalid (must be 4 or 8)" )
endif ( )
return ( )
endif ( )

#-------------------------------------------------------------------------------
# these blocks of code can be rearranged to change the search order for the BLAS
#-------------------------------------------------------------------------------
Expand All @@ -35,7 +67,6 @@ if ( ALLOW_64BIT_BLAS )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_INTEL_64ILP )
include ( SuiteSparseBLAS64 )
return ( )
endif ( )
Expand All @@ -48,7 +79,6 @@ set ( BLA_SIZEOF_INTEGER 4 )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_INTEL_64LP )
include ( SuiteSparseBLAS32 )
return ( )
endif ( )
Expand All @@ -60,7 +90,6 @@ set ( BLA_SIZEOF_INTEGER 4 )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_APPLE )
include ( SuiteSparseBLAS32 )
return ( )
endif ( )
Expand All @@ -73,7 +102,6 @@ if ( ALLOW_64BIT_BLAS )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_ARM_MP )
include ( SuiteSparseBLAS64 )
return ( )
endif ( )
Expand All @@ -86,7 +114,6 @@ set ( BLA_SIZEOF_INTEGER 4 )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_ARM_ILP64_MP )
include ( SuiteSparseBLAS32 )
return ( )
endif ( )
Expand All @@ -99,7 +126,6 @@ if ( ALLOW_64BIT_BLAS )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_IBMESSL_SMP_64 )
include ( SuiteSparseBLAS64 )
return ( )
endif ( )
Expand All @@ -112,7 +138,6 @@ set ( BLA_SIZEOF_INTEGER 4 )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_IBMESSL_SMP_32 )
include ( SuiteSparseBLAS32 )
return ( )
endif ( )
Expand All @@ -125,7 +150,6 @@ if ( ALLOW_64BIT_BLAS )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_OPENBLAS_64 )
include ( SuiteSparseBLAS64 )
return ( )
endif ( )
Expand All @@ -138,7 +162,6 @@ set ( BLA_SIZEOF_INTEGER 4 )
find_package ( BLAS )
find_package ( LAPACK )
if ( BLAS_FOUND AND LAPACK_FOUND )
add_compile_definitions ( BLAS_OPENBLAS )
include ( SuiteSparseBLAS32 )
return ( )
endif ( )
Expand Down
3 changes: 2 additions & 1 deletion SuiteSparse_config/cmake_modules/SuiteSparseBLAS32.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# actions taken when a 32-bit BLAS has been found

message ( STATUS "Found 32-bit BLAS+LAPACK" )
message ( STATUS "Found ${BLA_VENDOR} 32-bit BLAS+LAPACK" )
add_compile_definitions ( BLAS_${BLA_VENDOR} )
set ( SuiteSparse_BLAS_integer "int32_t" )

3 changes: 2 additions & 1 deletion SuiteSparse_config/cmake_modules/SuiteSparseBLAS64.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

# actions taken when a 64-bit BLAS has been found

message ( STATUS "Found 64-bit BLAS+LAPACK" )
message ( STATUS "Found ${BLA_VENDOR} 64-bit BLAS+LAPACK" )
add_compile_definitions ( BLAS_${BLA_VENDOR} )
add_compile_definitions ( BLAS64 )
set ( SuiteSparse_BLAS_integer "int64_t" )

Expand Down

0 comments on commit 7838c08

Please sign in to comment.