Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fixed MKL root path
Browse files Browse the repository at this point in the history
  • Loading branch information
lebeg committed Jul 16, 2018
1 parent 091a680 commit 596784e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
20 changes: 10 additions & 10 deletions cmake/DownloadMKLML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ if(MSVC)

execute_process(COMMAND "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z2.exe" "-o${CMAKE_CURRENT_BINARY_DIR}/mklml/" "-y")
execute_process(COMMAND "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z.exe" "x" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.zip" "-o${CMAKE_CURRENT_BINARY_DIR}/mklml/" "-y")
set(MKLDNN_ROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}")
set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}")

file(COPY ${MKLDNN_ROOT}/lib/libiomp5md.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLDNN_ROOT}/lib/mklml.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLROOT}/lib/libiomp5md.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLROOT}/lib/mklml.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_SOURCE_DIR}/3rdparty/mkldnn/config_template.vcxproj.user DESTINATION ${CMAKE_SOURCE_DIR})
elseif(UNIX)
set(MKL_NAME "mklml_lnx_2018.0.3.20180406")
file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/v0.14/${MKL_NAME}.tgz" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" EXPECTED_MD5 "DAF7EFC3C1C0036B447213004467A8AE" SHOW_PROGRESS)
execute_process(COMMAND "tar" "-xzf" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" "-C" "${CMAKE_CURRENT_BINARY_DIR}/mklml/")
set(MKLDNN_ROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}")
set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}")

file(COPY ${MKLDNN_ROOT}/lib/libiomp5.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLDNN_ROOT}/lib/libmklml_gnu.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLDNN_ROOT}/lib/libmklml_intel.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLROOT}/lib/libiomp5.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLROOT}/lib/libmklml_gnu.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLROOT}/lib/libmklml_intel.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
elseif(APPLE)
set(MKL_NAME "mklml_mac_2018.0.3.20180406.tgz")
file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/v0.14/${MKL_NAME}.tgz" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" EXPECTED_MD5 "23a6f7fd04fb1fa6de0d52a2ec5a2a14" SHOW_PROGRESS)
execute_process(COMMAND "tar" "-xzf" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" "-C" "${CMAKE_CURRENT_BINARY_DIR}/mklml/")
set(MKLDNN_ROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}")
set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}")

file(COPY ${MKLDNN_ROOT}/lib/libiomp5.dylib DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLDNN_ROOT}/lib/libmklml.dylib DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLROOT}/lib/libiomp5.dylib DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${MKLROOT}/lib/libmklml.dylib DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
else()
message(FATAL_ERROR "Wrong platform")
endif()
18 changes: 8 additions & 10 deletions cmake/Modules/FindMKLML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
# specific language governing permissions and limitations
# under the License.

# Find the MKLML libraries
# Find the MKLML (subset of MKL) libraries
#
# The following variables are optionally searched for defaults
#
# MKLML_ROOT: Base directory where all MKLML components are found
# MKLROOT: Base directory where all MKL/MKLML components are found
#
# The following are set after configuration is done:
#
# MKLML_FOUND
# MKLML_INCLUDE_DIRS
# MKLML_LIBRARIES

if($ENV{MKLML_ROOT})
file(TO_CMAKE_PATH "$ENV{MKLML_ROOT}" MKLML_ROOT)
if($ENV{MKLROOT})
file(TO_CMAKE_PATH "$ENV{MKLROOT}" MKLROOT)
endif()

set(MKLML_INCLUDE_SEARCH_PATHS
${MKLML_INCLUDE_SEARCH_PATHS}

${MKLML_ROOT}
${MKLML_ROOT}/include
${MKLROOT}
${MKLROOT}/include

${PROJECT_SOURCE_DIR}/3rdparty/MKLML/include
)
Expand All @@ -50,13 +50,11 @@ endif()
set(MKLML_LIB_SEARCH_PATHS
${MKLML_LIB_SEARCH_PATHS}

${MKLML_ROOT}
${MKLROOT}

${PROJECT_SOURCE_DIR}/3rdparty/MKLML/lib
)

message("MKLML_INCLUDE_SEARCH_PATHS=${MKLML_INCLUDE_SEARCH_PATHS}")

find_path(MKLML_INCLUDE_DIR
NAMES mkl_blas.h
PATHS ${MKLML_INCLUDE_SEARCH_PATHS})
Expand All @@ -65,7 +63,7 @@ set(LOOKED_FOR
MKLML_INCLUDE_DIR
)

set(MKLML_LIBS "")
set(MKLML_LIBS iomp5)

if(WIN32)
list(APPEND MKLML_LIBS mklml_intel)
Expand Down

0 comments on commit 596784e

Please sign in to comment.