Commit 4fa75e5a authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Merge pull request #153 from NervanaSystems/jmenon/cmake_mkldnn

CMake: Update MKL-DNN tag and remove upstreamed patch
parents f6e536cd d22a3992
......@@ -20,6 +20,7 @@ include(ExternalProject)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MKLDNN_GIT_REPO_URL https://github.com/01org/mkl-dnn)
set(MKLDNN_GIT_TAG "144e0db")
set(MKLDNN_INSTALL_DIR ${EXTERNAL_INSTALL_DIR}/mkldnn)
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2.
......@@ -27,18 +28,20 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ExternalProject_Add(
ext_mkldnn
GIT_REPOSITORY ${MKLDNN_GIT_REPO_URL}
GIT_TAG "v0.10"
GIT_TAG ${MKLDNN_GIT_TAG}
UPDATE_COMMAND ""
PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/third-party/patches/mkldnn-cmake-openmp.patch
# 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 -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR}
)
else()
ExternalProject_Add(
ext_mkldnn
GIT_REPOSITORY ${MKLDNN_GIT_REPO_URL}
GIT_TAG "v0.10"
GIT_TAG ${MKLDNN_GIT_TAG}
UPDATE_COMMAND ""
PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/third-party/patches/mkldnn-cmake-openmp.patch
# 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 -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR}
BUILD_BYPRODUCTS "${MKLDNN_INSTALL_DIR}/include/mkldnn.hpp"
)
......
From 6ca95a7c6802eef486ef1d47ad76094eb1164a7c Mon Sep 17 00:00:00 2001
From: Jaikrishnan Menon <jaikrishnan.menon@intel.com>
Date: Fri, 8 Sep 2017 15:01:59 -0700
Subject: [PATCH] CMake: Detect the right OpenMP flags on the host platform
instead of hardcoding '-fopenmp'
---
CMakeLists.txt | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e19215..3cb71bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,8 +81,18 @@ if(WIN32)
add_definitions(/Qpar)
endif()
elseif(UNIX OR APPLE)
- set(OPENMP_FLAGS "-fopenmp")
- set(CMAKE_CCXX_FLAGS "${CMAKE_CCXX_FLAGS} ${OPENMP_FLAGS} ${CCXX_WARN_FLAGS} -DMKLDNN_DLL -DMKLDNN_DLL_EXPORTS -fvisibility=internal")
+ # Discover the right OpenMP flags
+ set(OPENMP_FLAGS "")
+ find_package(OpenMP)
+ if(OpenMP_C_FOUND)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+ endif()
+ if(OpenMP_CXX_FOUND)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+ set(OPENMP_FLAGS "${OpenMP_CXX_FLAGS}")
+ endif()
+
+ set(CMAKE_CCXX_FLAGS "${CMAKE_CCXX_FLAGS} ${CCXX_WARN_FLAGS} -DMKLDNN_DLL -DMKLDNN_DLL_EXPORTS -fvisibility=internal")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CCXX_FLAGS} -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CCXX_FLAGS} -std=c++11 -fvisibility-inlines-hidden")
set(CCXX_WARN_FLAGS "-Wall -Werror -Wno-unknown-pragmas")
--
1.9.1
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