Commit 65ac0e68 authored by Sang Ik Lee's avatar Sang Ik Lee Committed by Scott Cyphers

Update mkl-dnn build script. (#2487)

Update TBB build script for Windows.

Fix typo.

Fix incorrect omp lib name on Windows.

Fix incorrect tbb.dll path on Windows.

Make LIBRARY and ARCHIVE output directory consistent.

Function missing on Windows.

Update test::util::all_close() to fix compilation issue on Windows

Export CPU_Executable on Windows.

Change nbench path for unit-test on Windows.

Change copy to copy_if_different.

Install CPU backend on Windows.

Disable tools test on Windows.

Disable two failing unit test on Windows CPU.

Fix incorrect CPU backend install path on Windows.
parent e9162eb5
......@@ -151,11 +151,11 @@ if (NGRAPH_GPUH_ENABLE)
endif()
if (NGRAPH_DISTRIBUTED_MLSL_ENABLE AND NGRAPH_DISTRIBUTED_OMPI_ENABLE)
message(FATAL_ERROR
message(FATAL_ERROR
"Does not support the use of two distributed libraries simultaneously.\n"
"If CPU only backend recommend Intel MLSL by setting NGRAPH_DISTRIBUTED_MLSL_ENABLE flag to true.\n"
"For all other backends use OpenMPI by setting NGRAPH_DISTRIBUTED_OMPI_ENABLE flag to true.\n")
elseif(NGRAPH_DISTRIBUTED_MLSL_ENABLE OR NGRAPH_DISTRIBUTED_OMPI_ENABLE)
elseif(NGRAPH_DISTRIBUTED_MLSL_ENABLE OR NGRAPH_DISTRIBUTED_OMPI_ENABLE)
set(NGRAPH_DISTRIBUTED_ENABLE TRUE)
else()
set(NGRAPH_DISTRIBUTED_ENABLE FALSE)
......@@ -341,9 +341,11 @@ endif()
#-----------------------------------------------------------------------------------------------
set(NGRAPH_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/ngraph)
if (WIN32)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
set(NGRAPH_LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR}/${CMAKE_CFG_INTDIR})
if(WIN32)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
set(NGRAPH_ARCHIVE_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR}/${CMAKE_CFG_INTDIR})
set(CMAKE_PDB_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
endif()
......
......@@ -20,6 +20,21 @@ include(ExternalProject)
# Fetch and install MKL-DNN
#------------------------------------------------------------------------------
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})
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})
elseif (WIN32)
set(MKLDNN_IMPLIB mkldnn${CMAKE_STATIC_LIBRARY_SUFFIX})
set(MKLML_LIB mklml${CMAKE_SHARED_LIBRARY_SUFFIX})
set(MKLML_IMPLIB mklml${CMAKE_STATIC_LIBRARY_SUFFIX})
set(OMP_LIB libiomp5md${CMAKE_SHARED_LIBRARY_SUFFIX})
set(OMP_IMPLIB libiomp5md${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
if(MKLDNN_INCLUDE_DIR AND MKLDNN_LIB_DIR)
if(NOT LINUX)
message(FATAL_ERROR "Unsupported platform for prebuilt mkl-dnn!")
......@@ -27,24 +42,12 @@ if(MKLDNN_INCLUDE_DIR AND MKLDNN_LIB_DIR)
if(NOT MKLML_LIB_DIR)
set(MKLML_LIB_DIR ${MKLDNN_LIB_DIR})
endif()
ExternalProject_Add(
ext_mkldnn
PREFIX mkldnn
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
add_library(libmkldnn INTERFACE)
add_library(libmkldnn SHARED IMPORTED)
set_property(TARGET libmkldnn PROPERTY IMPORTED_LOCATION ${MKLDNN_LIB_DIR}/${MKLDNN_LIB})
target_include_directories(libmkldnn SYSTEM INTERFACE ${MKLDNN_INCLUDE_DIR})
target_link_libraries(libmkldnn INTERFACE
${MKLDNN_LIB_DIR}/libmkldnn.so
${MKLML_LIB_DIR}/libmklml_intel.so
${MKLML_LIB_DIR}/libiomp5.so
)
install(FILES ${MKLDNN_LIB_DIR}/libmkldnn.so ${MKLML_LIB_DIR}/libmklml_intel.so ${MKLML_LIB_DIR}/libiomp5.so DESTINATION ${NGRAPH_INSTALL_LIB})
install(FILES ${MKLDNN_LIB_DIR}/${MKLDNN_LIB} ${MKLML_LIB_DIR}/${MKLML_LIB} ${MKLML_LIB_DIR}/${OMP_LIB} DESTINATION ${NGRAPH_INSTALL_LIB})
return()
endif()
......@@ -52,21 +55,30 @@ endif()
set(MKLURLROOT "https://github.com/intel/mkl-dnn/releases/download/v0.17.2/")
set(MKLVERSION "2019.0.1.20180928")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (LINUX)
set(MKLPACKAGE "mklml_lnx_${MKLVERSION}.tgz")
set(MKL_SHA1_HASH 0d9cc8bfc2c1a1e3df5e0b07e2f363bbf934a7e9)
set(MKL_LIBS libiomp5.so libmklml_intel.so)
elseif (APPLE)
set(MKLPACKAGE "mklml_mac_${MKLVERSION}.tgz")
set(MKL_SHA1_HASH 232787f41cb42f53f5b7e278d8240f6727896133)
set(MKL_LIBS libmklml.dylib libiomp5.dylib)
elseif (WIN32)
set(MKLPACKAGE "mklml_win_${MKLVERSION}.zip")
set(MKL_SHA1_HASH 97f01ab854d8ee88cc0429f301df84844d7cce6b)
set(MKL_LIBS mklml.lib libiomp5md.lib)
endif()
set(MKL_LIBS ${MKLML_LIB} ${OMP_LIB})
set(MKLURL ${MKLURLROOT}${MKLPACKAGE})
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(APPLE)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0)
set(MKLDNN_FLAG "-Wno-stringop-truncation -Wno-stringop-overflow")
endif()
elseif(NGRAPH_MANYLINUX_ENABLE) #pragma GCC diagnostic ignored does not work on GCC used for manylinux1
set(MKLDNN_FLAG "-Wno-error=strict-overflow -Wno-error=unused-result -Wno-error=array-bounds")
set(MKLDNN_FLAG "${MKLDNN_FLAG} -Wno-unused-result -Wno-unused-value")
endif()
endif()
ExternalProject_Add(
ext_mkl
PREFIX mkl
......@@ -79,31 +91,68 @@ ExternalProject_Add(
DOWNLOAD_NO_PROGRESS TRUE
EXCLUDE_FROM_ALL TRUE
)
set(MKLDNN_DEPENDS ext_mkl)
ExternalProject_Get_Property(ext_mkl source_dir)
set(MKL_ROOT ${EXTERNAL_PROJECTS_ROOT}/mkldnn/src/external/mkl)
set(MKL_SOURCE_DIR ${source_dir})
ExternalProject_Add_Step(
ext_mkl
CopyMKL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MKL_SOURCE_DIR}/lib/${MKLML_LIB} ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}
COMMENT "Copy mklml runtime libraries to ngraph build directory."
DEPENDEES download
)
ExternalProject_Add_Step(
ext_mkl
CopyOMP
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MKL_SOURCE_DIR}/lib/${OMP_LIB} ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}
COMMENT "Copy OpenMP runtime libraries to ngraph build directory."
DEPENDEES download
)
if(WIN32)
ExternalProject_Add_Step(
ext_mkl
CopyMKLIMP
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MKL_SOURCE_DIR}/lib/${MKLML_IMPLIB} ${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}
COMMENT "Copy mklml runtime libraries to ngraph build directory."
DEPENDEES download
)
ExternalProject_Add_Step(
ext_mkl
CopyOMPIMP
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MKL_SOURCE_DIR}/lib/${OMP_IMPLIB} ${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}
COMMENT "Copy OpenMP runtime libraries to ngraph build directory."
DEPENDEES download
)
endif()
add_library(libmkl INTERFACE)
add_dependencies(libmkl ext_mkl)
foreach(LIB ${MKL_LIBS})
if (WIN32)
list(APPEND TMP_PATHS ${EXTERNAL_PROJECTS_ROOT}/mkl/src/ext_mkl/lib/${LIB})
else()
list(APPEND TMP_PATHS ${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/${LIB})
endif()
endforeach()
set(MKL_LIBS ${TMP_PATHS})
target_link_libraries(libmkl INTERFACE ${MKL_LIBS})
if(WIN32)
target_link_libraries(libmkl INTERFACE
${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${MKLML_IMPLIB}
${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${OMP_IMPLIB})
else()
target_link_libraries(libmkl INTERFACE
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLML_LIB}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${OMP_LIB})
endif()
set(MKLDNN_GIT_REPO_URL https://github.com/intel/mkl-dnn)
set(MKLDNN_GIT_TAG "b9ce57a")
set(MKLDNN_PATCH_FILE mkldnn.patch)
set(MKLDNN_LIBS ${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/libmkldnn${CMAKE_SHARED_LIBRARY_SUFFIX})
set(MKLDNN_LIBS ${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/${MKLDNN_LIB})
if (WIN32)
ExternalProject_Add(
ext_mkldnn
PREFIX mkldnn
DEPENDS ext_mkl
DEPENDS ${MKLDNN_DEPENDS}
GIT_REPOSITORY ${MKLDNN_GIT_REPO_URL}
GIT_TAG ${MKLDNN_GIT_TAG}
UPDATE_COMMAND ""
......@@ -139,7 +188,7 @@ else()
ExternalProject_Add(
ext_mkldnn
PREFIX mkldnn
DEPENDS ext_mkl
DEPENDS ${MKLDNN_DEPENDS}
GIT_REPOSITORY ${MKLDNN_GIT_REPO_URL}
GIT_TAG ${MKLDNN_GIT_TAG}
UPDATE_COMMAND ""
......@@ -163,7 +212,7 @@ else()
-DMKLDNN_ENABLE_CONCURRENT_EXEC=ON
-DMKLROOT=${MKL_ROOT}
-DMKLDNN_LIB_VERSIONING_ENABLE=${NGRAPH_LIB_VERSIONING_ENABLE}
"-DARCH_OPT_FLAGS=-march=${NGRAPH_TARGET_ARCH} -mtune=${NGRAPH_TARGET_ARCH}"
"-DARCH_OPT_FLAGS=-march=${NGRAPH_TARGET_ARCH} -mtune=${NGRAPH_TARGET_ARCH} ${MKLDNN_FLAG}"
TMP_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/tmp"
STAMP_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/stamp"
DOWNLOAD_DIR "${EXTERNAL_PROJECTS_ROOT}/mkldnn/download"
......@@ -174,6 +223,24 @@ else()
)
endif()
ExternalProject_Add_Step(
ext_mkldnn
CopyMKLDNN
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/${MKLDNN_LIB} ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}
COMMENT "Copy mkldnn runtime libraries to ngraph build directory."
DEPENDEES install
)
if(WIN32)
ExternalProject_Add_Step(
ext_mkldnn
CopyMKLDNNIMP
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/${MKLDNN_IMPLIB} ${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}
COMMENT "Copy mkldnn runtime libraries to ngraph build directory."
DEPENDEES install
)
endif()
ExternalProject_Add_Step(
ext_mkldnn
PrepareMKL
......@@ -182,23 +249,42 @@ ExternalProject_Add_Step(
DEPENDERS configure
)
add_custom_command(TARGET ext_mkldnn POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib ${NGRAPH_BUILD_DIR}
COMMENT "Move mkldnn libraries to ngraph build directory"
)
add_library(libmkldnn INTERFACE)
add_dependencies(libmkldnn ext_mkldnn)
target_include_directories(libmkldnn SYSTEM INTERFACE ${EXTERNAL_PROJECTS_ROOT}/mkldnn/include)
if (WIN32)
target_link_libraries(libmkldnn INTERFACE
${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/mkldnn.lib
libmkl
${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${MKLDNN_IMPLIB}
libmkl
)
else()
target_link_libraries(libmkldnn INTERFACE
${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mkldnn${CMAKE_SHARED_LIBRARY_SUFFIX}
libmkl
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLDNN_LIB}
libmkl
)
endif()
install(DIRECTORY ${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/ DESTINATION ${NGRAPH_INSTALL_LIB} OPTIONAL)
if(WIN32)
install(
FILES
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLML_LIB}
${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${MKLML_IMPLIB}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${OMP_LIB}
${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${OMP_IMPLIB}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLDNN_LIB}
${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${MKLDNN_IMPLIB}
DESTINATION
${NGRAPH_INSTALL_LIB}
OPTIONAL
)
else()
install(
FILES
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLML_LIB}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${OMP_LIB}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${MKLDNN_LIB}
DESTINATION
${NGRAPH_INSTALL_LIB}
OPTIONAL
)
endif()
......@@ -54,24 +54,24 @@ if(NGRAPH_TBB_ENABLE)
set(TBB_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
file(COPY
${TBB_BUILD_DIR}/${TBB_LIB}
DESTINATION ${NGRAPH_BUILD_DIR})
DESTINATION ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY})
if(LINUX)
execute_process(COMMAND grep TBB_COMPATIBLE_INTERFACE_VERSION ${TBB_ROOT}/include/tbb/tbb_stddef.h OUTPUT_VARIABLE TBB_SOVER_LINE)
string(REGEX MATCH "[0-9.]+" TBB_SOVER ${TBB_SOVER_LINE})
message(STATUS "TBB so version: ${TBB_SOVER}")
file(COPY
${TBB_BUILD_DIR}/${TBB_LIB}.${TBB_SOVER}
DESTINATION ${NGRAPH_BUILD_DIR})
DESTINATION ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY})
endif()
install(FILES ${NGRAPH_BUILD_DIR}/${TBB_LIB}
install(FILES ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${TBB_LIB}
DESTINATION ${NGRAPH_INSTALL_LIB})
if(LINUX)
install(FILES ${NGRAPH_BUILD_DIR}/${TBB_LIB}.${TBB_SOVER}
install(FILES ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${TBB_LIB}.${TBB_SOVER}
DESTINATION ${NGRAPH_INSTALL_LIB})
endif()
add_library(libtbb INTERFACE)
target_link_libraries(libtbb INTERFACE
${NGRAPH_BUILD_DIR}/${TBB_LIB}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${TBB_LIB}
)
target_include_directories(libtbb SYSTEM INTERFACE ${TBB_ROOT}/include)
endif()
......@@ -48,18 +48,38 @@ else()
endif()
if (WIN32)
set(TBB_LINK_LIBS ${INSTALL_DIR}/lib/intel64/vc14/${TBB_LIB_NAME}.lib)
set(TBB_LINK_LIBS ${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${TBB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
ExternalProject_Add_Step(
ext_tbb
CopyTBB
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INSTALL_DIR}/bin/intel64/vc14/${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}
COMMENT "Move tbb shared libraries to ngraph build directory"
DEPENDEES download
)
ExternalProject_Add_Step(
ext_tbb
CopyTBBIMP
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INSTALL_DIR}/lib/intel64/vc14/${TBB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} ${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}
COMMENT "Move tbb libraries to ngraph build directory"
DEPENDEES download
)
install(FILES ${NGRAPH_ARCHIVE_OUTPUT_DIRECTORY}/${TBB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${NGRAPH_INSTALL_LIB})
elseif(APPLE)
set(TBB_LINK_LIBS
${NGRAPH_BUILD_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
)
add_custom_command(TARGET ext_tbb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${NGRAPH_BUILD_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}
COMMENT "Move tbb libraries to ngraph build directory"
)
install(FILES ${NGRAPH_BUILD_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
install(FILES ${NGRAPH_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${NGRAPH_INSTALL_LIB})
endif()
......
......@@ -99,5 +99,4 @@ if (NGRAPH_CPU_ENABLE)
endif()
target_include_directories(codegen SYSTEM PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(codegen PRIVATE libllvm ngraph)
set_target_properties(codegen PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
install(TARGETS codegen DESTINATION ${NGRAPH_INSTALL_LIB})
......@@ -191,12 +191,11 @@ if (NGRAPH_CPU_ENABLE)
endif()
add_dependencies(cpu_backend ext_mkldnn ext_eigen)
target_link_libraries(cpu_backend PUBLIC ngraph libmkldnn libeigen libjson libtbb)
target_link_libraries(cpu_backend PUBLIC ngraph libmkldnn libmkl libeigen libjson libtbb)
if (NOT NGRAPH_DEX_ONLY)
target_link_libraries(cpu_backend PUBLIC codegen)
endif()
target_include_directories(cpu_backend SYSTEM PUBLIC libmkldnn)
set_target_properties(cpu_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
if (NOT APPLE AND NOT MSVS)
# CPU backend uses third-party libraries like Eigen that might be linked in and
# exported by other DSOs as well. In the absence of versioning, this could lead to the
......@@ -206,7 +205,5 @@ if (NGRAPH_CPU_ENABLE)
set_property(TARGET cpu_backend APPEND PROPERTY LINK_FLAGS "-Wl,-Bsymbolic-functions -Wl,--exclude-libs=ALL")
endif()
if (NOT WIN32)
install(TARGETS cpu_backend LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB})
endif()
install(TARGETS cpu_backend DESTINATION ${NGRAPH_INSTALL_LIB})
endif()
......@@ -60,7 +60,7 @@ namespace ngraph
m_exec_map;
};
class CPU_Executable : public runtime::Executable
class CPU_BACKEND_API CPU_Executable : public runtime::Executable
{
public:
CPU_Executable(std::shared_ptr<Function> func, bool performance_counters_enabled);
......
......@@ -37,10 +37,12 @@ MKLDNNEmitter::~MKLDNNEmitter()
{
for (auto p : m_mkldnn_primitives)
delete p;
#ifndef _WIN32
//To avoid memory leak in mkldnn, release any buffers that are not free'd yet.
//https://software.intel.com/en-us/mkl-linux-developer-guide-avoiding-memory-leaks-in-intel-mkl
//mkl_free_buffers() is not exposed at this point, hence using mkl_serv_free_buffers()
mkldnn_utils::mkl_serv_free_buffers();
#endif
}
const std::vector<mkldnn::primitive*>& MKLDNNEmitter::get_mkldnn_primitives() const
......
......@@ -34,8 +34,9 @@ namespace ngraph
namespace mkldnn_utils
{
extern mkldnn::engine global_cpu_engine;
#ifndef _WIN32
extern "C" void mkl_serv_free_buffers();
#endif
mkldnn::memory::format
CreateNativeDataFormat(const ngraph::runtime::cpu::LayoutDescriptor& layout);
mkldnn::memory::format CreateNativeDataFormat(const Shape& shape);
......
......@@ -28,7 +28,6 @@ if (NGRAPH_GENERIC_CPU_ENABLE)
endif()
target_link_libraries(gcpu_backend PRIVATE ngraph libeigen hybrid_base interpreter_backend)
target_compile_options(gcpu_backend PUBLIC -fopenmp)
set_target_properties(gcpu_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
install(TARGETS gcpu_backend
LIBRARY DESTINATION "${NGRAPH_INSTALL_LIB}"
......
......@@ -174,8 +174,6 @@ if (NGRAPH_GPU_ENABLE)
${CUDA_CUBLAS_LIBRARIES}
${CUDNN_LIBRARIES})
set_target_properties(gpu_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
install(TARGETS gpu_backend
ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB}
LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB})
......
......@@ -22,7 +22,6 @@ if (NGRAPH_GPUH_ENABLE)
SOVERSION ${NGRAPH_API_VERSION})
endif()
target_link_libraries(gpuh_backend PUBLIC ngraph hybrid_base gpu_backend)
set_target_properties(gpuh_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
install(TARGETS gpuh_backend
LIBRARY DESTINATION "${NGRAPH_INSTALL_LIB}"
......
......@@ -25,7 +25,6 @@ add_library(hybrid_base STATIC
pass/memory_layout.cpp
)
target_link_libraries(hybrid_base PUBLIC ngraph)
set_target_properties(hybrid_base PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
install(TARGETS hybrid_base
ARCHIVE DESTINATION "${NGRAPH_INSTALL_LIB}"
......
......@@ -40,9 +40,5 @@ if (NGRAPH_INTELGPU_ENABLE)
SOVERSION ${NGRAPH_API_VERSION})
endif()
set_target_properties(intelgpu_backend
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
install(TARGETS intelgpu_backend LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB})
endif()
......@@ -22,7 +22,6 @@ if (NGRAPH_INTERPRETER_ENABLE)
SOVERSION ${NGRAPH_API_VERSION})
endif()
target_link_libraries(interpreter_backend PUBLIC ngraph)
set_target_properties(interpreter_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
if(NGRAPH_DISTRIBUTED_ENABLE)
if(NGRAPH_DISTRIBUTED_MLSL_ENABLE)
......
......@@ -22,7 +22,6 @@ if (NGRAPH_NOP_ENABLE)
SOVERSION ${NGRAPH_API_VERSION})
endif()
target_link_libraries(nop_backend PUBLIC ngraph)
set_target_properties(nop_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
install(TARGETS nop_backend
LIBRARY DESTINATION "${NGRAPH_INSTALL_LIB}"
......
......@@ -69,6 +69,5 @@ if(NGRAPH_LIB_VERSIONING_ENABLE)
endif()
target_include_directories(plaidml_backend SYSTEM PUBLIC ${PLAIDML_INCLUDE_DIRS})
target_link_libraries(plaidml_backend PUBLIC ngraph libplaidml)
set_target_properties(plaidml_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${NGRAPH_BUILD_DIR}")
install(TARGETS plaidml_backend LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB})
......@@ -25,11 +25,6 @@ if (APPLE)
set_property(TARGET nbench APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-rpath,@loader_path/../lib")
endif()
target_link_libraries(nbench PRIVATE ngraph)
# if (WIN32)
# set_target_properties(nbench
# PROPERTIES
# LIBRARY_OUTPUT_DIRECTORY ${NGRAPH_BUILD_DIR})
# endif()
if (NGRAPH_CPU_ENABLE)
target_link_libraries(nbench PRIVATE cpu_backend)
endif()
......@@ -60,5 +55,5 @@ if(NGRAPH_DISTRIBUTED_ENABLE)
message(FATAL_ERROR "Distributed Library not supported/mentioned")
endif()
endif()
install(TARGETS nbench RUNTIME DESTINATION ${NGRAPH_INSTALL_BIN})
......@@ -59,7 +59,7 @@ set(SRC
zero_dim_tensor_elimination.cpp
)
if(NGRAPH_TOOLS_ENABLE)
if(NOT WIN32 AND NGRAPH_TOOLS_ENABLE)
list(APPEND SRC tools.cpp)
endif()
......
......@@ -527,6 +527,7 @@ NGRAPH_TEST(${BACKEND_NAME}, sum_trivial_in_double)
#if NGRAPH_INTERPRETER_ENABLE
#ifndef _WIN32
NGRAPH_TEST(${BACKEND_NAME}, sum_stable_acc)
{
std::string backend_name = "${BACKEND_NAME}";
......@@ -558,6 +559,7 @@ NGRAPH_TEST(${BACKEND_NAME}, sum_stable_acc)
EXPECT_TRUE(
test::all_close_f(ref_results.at(0), bk_results.at(0), DEFAULT_FLOAT_TOLERANCE_BITS + 1));
}
#endif
NGRAPH_TEST(${BACKEND_NAME}, sum_stable_acc_double)
{
......@@ -618,6 +620,7 @@ NGRAPH_TEST(${BACKEND_NAME}, sum_stable_simple_float)
test::all_close_f(ref_results.at(0), bk_results.at(0), DEFAULT_FLOAT_TOLERANCE_BITS - 1));
}
#ifndef _WIN32
NGRAPH_TEST(${BACKEND_NAME}, sum_stable_simple_double)
{
std::string backend_name = "${BACKEND_NAME}";
......@@ -662,3 +665,5 @@ NGRAPH_TEST(${BACKEND_NAME}, sum_stable_simple_double)
EXPECT_TRUE(test::all_close(ref_results.at(0), bk_results.at(0), 0.0, 2.0));
}
#endif
#endif
......@@ -35,7 +35,7 @@ namespace ngraph
/// \param atol Absolute tolerance
/// \returns true if shapes match and for all elements, |a_i-b_i| <= atol + rtol*|b_i|.
template <typename T>
typename std::enable_if<std::is_signed<T>::value, ::testing::AssertionResult>::type
typename std::enable_if<std::is_floating_point<T>::value, ::testing::AssertionResult>::type
all_close(const std::vector<T>& a,
const std::vector<T>& b,
T rtol = static_cast<T>(1e-5),
......@@ -70,7 +70,7 @@ namespace ngraph
/// \param atol Absolute tolerance
/// \returns true if shapes match and for all elements, |a_i-b_i| <= atol + rtol*|b_i|.
template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, ::testing::AssertionResult>::type
typename std::enable_if<std::is_integral<T>::value, ::testing::AssertionResult>::type
all_close(const std::vector<T>& a,
const std::vector<T>& b,
T rtol = static_cast<T>(1e-5),
......
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