Commit 7f775b6a authored by Duncan Palmer's avatar Duncan Palmer

Seperate MKL FFT and MKL BLAS configurations.

MKL FFT bindings had assumed that MKL was also being used to provide the
BLAS implementation, however the build system allows these 2 things to
be configured independantly.
parent 67144941
......@@ -451,8 +451,8 @@ if (NOT TARGET dlib)
endif()
if (DLIB_USE_BLAS OR DLIB_USE_LAPACK)
# Try to find BLAS and LAPACK
if (DLIB_USE_BLAS OR DLIB_USE_LAPACK OR DLIB_USE_MKL_FFT)
# Try to find BLAS, LAPACK and MKL
include(cmake_utils/cmake_find_blas.txt)
if (DLIB_USE_BLAS)
......@@ -472,13 +472,16 @@ if (NOT TARGET dlib)
toggle_preprocessor_switch(DLIB_USE_LAPACK)
endif()
endif()
endif()
if (found_intel_mkl)
include_directories(${mkl_include_dir})
else()
set(DLIB_USE_MKL_FFT OFF CACHE STRING ${DLIB_USE_MKL_FFT_STR} FORCE )
toggle_preprocessor_switch(DLIB_USE_MKL_FFT)
if (DLIB_USE_MKL_FFT)
if (found_intel_mkl)
set (dlib_needed_libraries ${dlib_needed_libraries} ${mkl_libraries})
include_directories(${mkl_include_dir})
else()
set(DLIB_USE_MKL_FFT OFF CACHE STRING ${DLIB_USE_MKL_FFT_STR} FORCE )
toggle_preprocessor_switch(DLIB_USE_MKL_FFT)
endif()
endif()
endif()
......
......@@ -10,14 +10,18 @@
#
# blas_found - True if BLAS is available
# lapack_found - True if LAPACK is available
# found_intel_mkl - True is the the Intel MKL library is available
# blas_libraries - link against these to use BLAS library
# lapack_libraries - link against these to use LAPACK library
# mkl_libraries - link against these to use the MKL library
# mkl_include_dir - add to the include path to use the MKL library
# setting this makes CMake allow normal looking if else statements
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
SET(blas_found 0)
SET(lapack_found 0)
SET(found_intel_mkl 0)
if (UNIX)
......@@ -79,13 +83,20 @@ if (UNIX)
include(CheckLibraryExists)
# Get mkl_include_dir
set(mkl_include_search_path
/opt/intel/mkl/include
/opt/intel/include
)
find_path(mkl_include_dir mkl_version.h ${mkl_include_search_path})
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases.
find_library(mkl_rt mkl_rt ${mkl_search_path})
mark_as_advanced( mkl_rt )
# if we found the MKL
if ( mkl_rt)
if (mkl_include_dir AND mkl_rt)
set(mkl_libraries ${mkl_rt} )
set(blas_libraries ${mkl_rt} )
set(lapack_libraries ${mkl_rt} )
set(blas_found 1)
......@@ -104,7 +115,8 @@ if (UNIX)
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread)
# If we found the MKL
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
if (mkl_include_dir AND mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
set(mkl_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(blas_found 1)
......@@ -114,15 +126,6 @@ if (UNIX)
endif()
endif()
# Get mkl_include_dir
if (found_intel_mkl)
set(mkl_include_search_path
/opt/intel/mkl/include
/opt/intel/include
)
find_path(mkl_include_dir mkl_version.h ${mkl_include_search_path})
endif()
# try to find some other LAPACK libraries if we didn't find the MKL
set(extra_paths
/usr/lib64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment