Commit 6d2f182b authored by Sang Ik Lee's avatar Sang Ik Lee Committed by Robert Kimball

Fix missing libraries when library versioning is enabled. (#2617)

* Copy and install all mkldnn libraries if versioning is enabled on linux.

* Replace magic numbers with variables.

* Support mkl-dnn library versioning on macos.
parent ad3a1b6b
......@@ -17,6 +17,8 @@
include(ExternalProject)
# Includes blas 3.8.0 in mkldnn
set(NGRAPH_MKLDNN_SHORT_VERSION 0)
set(NGRAPH_MKLDNN_FULL_VERSION 0.18.0.0)
set(NGRAPH_MKLDNN_VERSION "v0.18")
set(NGRAPH_MKLDNN_SUB_VERSION "2019.0.3.20190220")
set(NGRAPH_MKLDNN_GIT_TAG "v0.18")
......@@ -29,9 +31,13 @@ set(MKLDNN_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}mkldnn${CMAKE_SHARED_LIBRARY_SUFFIX
if (LINUX)
set(MKLML_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}mklml_intel${CMAKE_SHARED_LIBRARY_SUFFIX})
set(OMP_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}iomp5${CMAKE_SHARED_LIBRARY_SUFFIX})
set(MKLDNN_SHORT_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}mkldnn${CMAKE_SHARED_LIBRARY_SUFFIX}.${NGRAPH_MKLDNN_SHORT_VERSION})
set(MKLDNN_FULL_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}mkldnn${CMAKE_SHARED_LIBRARY_SUFFIX}.${NGRAPH_MKLDNN_FULL_VERSION})
elseif (APPLE)
set(MKLML_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}mklml${CMAKE_SHARED_LIBRARY_SUFFIX})
set(OMP_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}iomp5${CMAKE_SHARED_LIBRARY_SUFFIX})
set(MKLDNN_SHORT_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}mkldnn.${NGRAPH_MKLDNN_SHORT_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(MKLDNN_FULL_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}mkldnn.${NGRAPH_MKLDNN_FULL_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX})
elseif (WIN32)
set(MKLDNN_IMPLIB mkldnn${CMAKE_STATIC_LIBRARY_SUFFIX})
set(MKLML_LIB mklml${CMAKE_SHARED_LIBRARY_SUFFIX})
......@@ -268,6 +274,16 @@ else()
COMMENT "Copy mkldnn runtime libraries to ngraph build directory."
DEPENDEES install
)
if(NGRAPH_LIB_VERSIONING_ENABLE)
ExternalProject_Add_Step(
ext_mkldnn
CopyMKLDNNEXTRA
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${EXTERNAL_PROJECTS_ROOT}/mkldnn/${CMAKE_INSTALL_LIBDIR}/${MKLDNN_SHORT_LIB} ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLDNN_SHORT_LIB}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${EXTERNAL_PROJECTS_ROOT}/mkldnn/${CMAKE_INSTALL_LIBDIR}/${MKLDNN_FULL_LIB} ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLDNN_FULL_LIB}
COMMENT "Copy extra mkldnn runtime libraries to ngraph build directory."
DEPENDEES install
)
endif()
endif()
ExternalProject_Add_Step(
......@@ -316,4 +332,14 @@ else()
${NGRAPH_INSTALL_LIB}
OPTIONAL
)
if(NGRAPH_LIB_VERSIONING_ENABLE)
install(
FILES
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLDNN_SHORT_LIB}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLDNN_FULL_LIB}
DESTINATION
${NGRAPH_INSTALL_LIB}
OPTIONAL
)
endif()
endif()
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