FindBLAS: Choose MKL arch based on BLA_VENDOR

Recently, FindBLAS has been extended with additional library search
path based on the environment variable MKLROOT. However, the choice
of the Intel MKL architecture (IA-32 vs Intel64) was based on
unrelated (and possibly undefined) size of integer.

This commit changes the selection of the Intel MKL architecture to
instead consider the variable BLA_VENDOR, if available.

So, if the environment variable MKLROOT is defined and
BLA_VENDOR=Intel10_32, then $ENV{MKLROOT}/lib/ia32_<OS> will be added
to the search path (OS = lin, win, or mac).

Similarly, if MKLROOT is defined and BLA_VENDOR=Intel10_64lp or
BLA_VENDOR=Intel10_64ilp, then the path $ENV{MKLROOT}/intel64_<OS>
will be used.

If either MKLROOT or BLA_VENDOR is undefined, no additional search
path on top of LD_LIBRARY_PATH / DYLD_LIBRARY_PATH / LIB is be added.
This commit is contained in:
Jakub Benda
2019-05-16 09:00:21 +01:00
parent 82c6ec964d
commit 89ab54c112

View File

@@ -403,20 +403,19 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
endif ()
if (DEFINED ENV{MKLROOT})
set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}")
if (BLA_VENDOR STREQUAL "Intel10_32")
set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/ia32")
elseif (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$")
set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/intel64")
endif ()
endif ()
if (_BLAS_MKLROOT_LIB_DIR)
if( SIZEOF_INTEGER EQUAL 8 )
set( _BLAS_MKL_PATH_PREFIX "intel64" )
else()
set( _BLAS_MKL_PATH_PREFIX "ia32" )
endif()
if (WIN32)
string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_win")
string(APPEND _BLAS_MKLROOT_LIB_DIR "_win")
elseif (APPLE)
string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_mac")
string(APPEND _BLAS_MKLROOT_LIB_DIR "_mac")
else ()
string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_lin")
string(APPEND _BLAS_MKLROOT_LIB_DIR "_lin")
endif ()
endif ()