Unverified Commit b4435f29 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Set MKLROOT when building MKLDNN (#1093)

* finally have something almost acceptable
parent 0b95efa6
......@@ -41,6 +41,38 @@ if(MKLDNN_INCLUDE_DIR AND MKLDNN_LIB_DIR)
return()
endif()
# This section sets up MKL as an external project to be used later by MKLDNN
set(MKLURLROOT "https://github.com/intel/mkl-dnn/releases/download/v0.14/")
set(MKLVERSION "2018.0.3.20180406")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(MKLPACKAGE "mklml_lnx_${MKLVERSION}.tgz")
set(MKL_SHA1_HASH aea0d9ce65773cfcf5d8292b8db553bde965fc8f)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(MKLPACKAGE "mklml_mac_${MKLVERSION}.tgz")
set(MKL_SHA1_HASH d76083fd5a79767a96572ad0e23e7f4c892818f2)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(MKLPACKAGE "mklml_win_${MKLVERSION}.tgz")
set(MKL_SHA1_HASH d607ca92d7bfc101f0828c0b005098b75531669b)
endif()
set(MKLURL ${MKLURLROOT}${MKLPACKAGE})
ExternalProject_Add(
ext_mkl
PREFIX mkl
URL ${MKLURL}
URL_HASH SHA1=${MKL_SHA1_HASH}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_COMMAND ""
DOWNLOAD_NO_PROGRESS TRUE
EXCLUDE_FROM_ALL TRUE
)
ExternalProject_Get_Property(ext_mkl source_dir)
set(MKL_ROOT ${EXTERNAL_PROJECTS_ROOT}/mkldnn/src/external/mkl)
set(MKL_SOURCE_DIR ${source_dir})
set(MKLDNN_GIT_REPO_URL https://github.com/intel/mkl-dnn)
set(MKLDNN_GIT_TAG "0e7ca73")
......@@ -48,9 +80,11 @@ set(MKLDNN_GIT_TAG "0e7ca73")
if(${CMAKE_VERSION} VERSION_LESS 3.2)
ExternalProject_Add(
ext_mkldnn
DEPENDS ext_mkl
GIT_REPOSITORY ${MKLDNN_GIT_REPO_URL}
GIT_TAG ${MKLDNN_GIT_TAG}
UPDATE_COMMAND ""
CONFIGURE_COMMAND
# Uncomment below with any in-flight MKL-DNN patches
# PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/third-party/patches/mkldnn-cmake-openmp.patch
CMAKE_ARGS
......@@ -60,6 +94,7 @@ if(${CMAKE_VERSION} VERSION_LESS 3.2)
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_PROJECTS_ROOT}/mkldnn
-DMKLROOT=${MKL_ROOT}
TMP_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/tmp"
STAMP_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/stamp"
DOWNLOAD_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/download"
......@@ -71,6 +106,7 @@ if(${CMAKE_VERSION} VERSION_LESS 3.2)
else()
ExternalProject_Add(
ext_mkldnn
DEPENDS ext_mkl
GIT_REPOSITORY ${MKLDNN_GIT_REPO_URL}
GIT_TAG ${MKLDNN_GIT_TAG}
UPDATE_COMMAND ""
......@@ -83,6 +119,7 @@ else()
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_PROJECTS_ROOT}/mkldnn
-DMKLROOT=${MKL_ROOT}
TMP_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/tmp"
STAMP_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/stamp"
DOWNLOAD_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/download"
......@@ -94,12 +131,10 @@ else()
)
endif()
ExternalProject_Get_Property(ext_mkldnn source_dir binary_dir)
ExternalProject_Add_Step(
ext_mkldnn
PrepareMKL
COMMAND ${source_dir}/scripts/prepare_mkl.sh
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MKL_SOURCE_DIR} ${MKL_ROOT}
DEPENDEES download
DEPENDERS configure
)
......
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