In a project I am using
find_package(BLAS REQUIRED)
to detect BLAS.
Is there a way to tell which implementation of BLAS was found after this?
According to the documentation BLA_VENDOR
can be used to require a certain implementation, but it doesn't report which one was found.
Unfortunatelly I need to know which BLAS was found because different implementations have subtle differences in their interfaces, for example MKL uses zdotu
with 6 arguments rather than 5 (first is the pointer to the result value).
Per @Tsyvarev suggestion I ended up doing this
set(BLA_VENDOR Intel10_64lp)
find_package(BLAS)
if(BLAS_FOUND)
message("MKL environment detected")
add_definitions(-DRETURN_BY_STACK)
else()
unset(BLA_VENDOR)
find_package(BLAS REQUIRED)
endif()
It seems that -DRETURN_BY_STACK
(or -DFORTRAN_COMPLEX_FUNCTIONS_RETURN_VOID
) is a way recognized by some BLAS headers (e.g. cblas.h
) to have MKL-compatible declarations.
Technically one might need to try with every variant of intel
mkl BLAS, and choose one somehow, I am putting it here for completeness.
Intel10_32 (intel mkl v10 32 bit)
Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model)
Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model)
Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model)
Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model)
Intel