Commit 786a7f21 authored by Chuck Atkins's avatar Chuck Atkins Committed by Kitware Robot
Browse files

Merge topic 'update-embree' into release

2fb44ef3

 embree: Patch for cray problems
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !436
parents 4c744547 2fb44ef3
......@@ -25,3 +25,9 @@ superbuild_add_project(embree
superbuild_apply_patch(embree improve-findtbb
"Improve FindTBB")
superbuild_apply_patch(embree rename-options-file
"Rename compiler options file")
superbuild_apply_patch(embree craype-include
"Let CrayPE include other compiler options")
superbuild_apply_patch(embree move-sse2-flags
"Move FLAGS_SSE2 out of CMAKE_CXX_FLAGS")
From 0eae5cd681d0321e8eea04cdd18f0a09ac684349 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon, 5 Mar 2018 09:23:31 -0600
Subject: [PATCH 2/3] Have Cray options include underlying compiler options
---
common/cmake/clang.cmake | 20 +++++++++++---------
common/cmake/crayprgenv.cmake | 10 +++++++---
common/cmake/gnu.cmake | 18 ++++++++++++------
common/cmake/intel.cmake | 32 +++++++++++++++++++-------------
4 files changed, 49 insertions(+), 31 deletions(-)
diff --git a/common/cmake/clang.cmake b/common/cmake/clang.cmake
index 439588580..58dc39c94 100644
--- a/common/cmake/clang.cmake
+++ b/common/cmake/clang.cmake
@@ -13,16 +13,18 @@
## See the License for the specific language governing permissions and ##
## limitations under the License. ##
## ======================================================================== ##
+MACRO(_SET_IF_EMPTY VAR VALUE)
+ IF(NOT ${VAR})
+ SET(${VAR} "${VALUE}")
+ ENDIF()
+ENDMACRO()
-SET(FLAGS_SSE2 "-msse2")
-SET(FLAGS_SSE3 "-msse3")
-SET(FLAGS_SSSE3 "-mssse3")
-SET(FLAGS_SSE41 "-msse4.1")
-SET(FLAGS_SSE42 "-msse4.2")
-SET(FLAGS_AVX "-mavx")
-SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
-SET(FLAGS_AVX512KNL "-march=knl")
-SET(FLAGS_AVX512SKX "-march=skx")
+_SET_IF_EMPTY(FLAGS_SSE2 "-msse2")
+_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
+_SET_IF_EMPTY(FLAGS_AVX "-mavx")
+_SET_IF_EMPTY(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+_SET_IF_EMPTY(FLAGS_AVX512KNL "-march=knl")
+_SET_IF_EMPTY(FLAGS_AVX512SKX "-march=skx")
IF (WIN32)
diff --git a/common/cmake/crayprgenv.cmake b/common/cmake/crayprgenv.cmake
index 87abed619..c466330da 100644
--- a/common/cmake/crayprgenv.cmake
+++ b/common/cmake/crayprgenv.cmake
@@ -13,10 +13,14 @@
## See the License for the specific language governing permissions and ##
## limitations under the License. ##
## ======================================================================== ##
-
-SET(FLAGS_SSE2 "-target-cpu=xeon")
-SET(FLAGS_SSE42 "-target-cpu=interlagos")
+SET(FLAGS_SSE2 "-target-cpu=x86_64")
+SET(FLAGS_SSE42 "NOT_SUPPORTED")
SET(FLAGS_AVX "-target-cpu=sandybridge")
SET(FLAGS_AVX2 "-target-cpu=haswell")
SET(FLAGS_AVX512KNL "-target-cpu=mic-knl")
SET(FLAGS_AVX512SKX "-target-cpu=x86-skylake")
+
+SET_PROPERTY(CACHE EMBREE_ISA_SSE42 PROPERTY VALUE OFF)
+
+STRING(TOLOWER "${CMAKE_CXX_COMPILER_ID}" _lower_compiler_id)
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/${_lower_compiler_id}.cmake" OPTIONAL)
diff --git a/common/cmake/gnu.cmake b/common/cmake/gnu.cmake
index 80620a75f..191c134ae 100644
--- a/common/cmake/gnu.cmake
+++ b/common/cmake/gnu.cmake
@@ -14,12 +14,18 @@
## limitations under the License. ##
## ======================================================================== ##
-SET(FLAGS_SSE2 "-msse2")
-SET(FLAGS_SSE42 "-msse4.2")
-SET(FLAGS_AVX "-mavx")
-SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
-SET(FLAGS_AVX512KNL "-mavx512f -mavx512pf -mavx512er -mavx512cd -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
-SET(FLAGS_AVX512SKX "-mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+MACRO(_SET_IF_EMPTY VAR VALUE)
+ IF(NOT ${VAR})
+ SET(${VAR} "${VALUE}")
+ ENDIF()
+ENDMACRO()
+
+_SET_IF_EMPTY(FLAGS_SSE2 "-msse2")
+_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
+_SET_IF_EMPTY(FLAGS_AVX "-mavx")
+_SET_IF_EMPTY(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+_SET_IF_EMPTY(FLAGS_AVX512KNL "-mavx512f -mavx512pf -mavx512er -mavx512cd -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+_SET_IF_EMPTY(FLAGS_AVX512SKX "-mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
diff --git a/common/cmake/intel.cmake b/common/cmake/intel.cmake
index 1d99d2e7b..4c414032c 100644
--- a/common/cmake/intel.cmake
+++ b/common/cmake/intel.cmake
@@ -14,14 +14,20 @@
## limitations under the License. ##
## ======================================================================== ##
+MACRO(_SET_IF_EMPTY VAR VALUE)
+ IF(NOT ${VAR})
+ SET(${VAR} "${VALUE}")
+ ENDIF()
+ENDMACRO()
+
IF (WIN32)
- SET(FLAGS_SSE2 "/QxSSE2")
- SET(FLAGS_SSE42 "/QxSSE4.2")
- SET(FLAGS_AVX "/arch:AVX")
- SET(FLAGS_AVX2 "/QxCORE-AVX2")
- SET(FLAGS_AVX512KNL "/QxMIC-AVX512")
- SET(FLAGS_AVX512SKX "/QxCORE-AVX512")
+ _SET_IF_EMPTY(FLAGS_SSE2 "/QxSSE2")
+ _SET_IF_EMPTY(FLAGS_SSE42 "/QxSSE4.2")
+ _SET_IF_EMPTY(FLAGS_AVX "/arch:AVX")
+ _SET_IF_EMPTY(FLAGS_AVX2 "/QxCORE-AVX2")
+ _SET_IF_EMPTY(FLAGS_AVX512KNL "/QxMIC-AVX512")
+ _SET_IF_EMPTY(FLAGS_AVX512SKX "/QxCORE-AVX512")
SET(COMMON_CXX_FLAGS "")
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /EHsc") # catch C++ exceptions only and extern "C" functions never throw a C++ exception
@@ -79,15 +85,15 @@ IF (WIN32)
ELSE()
IF (APPLE)
- SET(FLAGS_SSE2 "-xssse3") # on MacOSX ICC does not support SSE2
+ _SET_IF_EMPTY(FLAGS_SSE2 "-xssse3") # on MacOSX ICC does not support SSE2
ELSE()
- SET(FLAGS_SSE2 "-xsse2")
+ _SET_IF_EMPTY(FLAGS_SSE2 "-xsse2")
ENDIF()
- SET(FLAGS_SSE42 "-xsse4.2")
- SET(FLAGS_AVX "-xAVX")
- SET(FLAGS_AVX2 "-xCORE-AVX2")
- SET(FLAGS_AVX512KNL "-xMIC-AVX512")
- SET(FLAGS_AVX512SKX "-xCORE-AVX512")
+ _SET_IF_EMPTY(FLAGS_SSE42 "-xsse4.2")
+ _SET_IF_EMPTY(FLAGS_AVX "-xAVX")
+ _SET_IF_EMPTY(FLAGS_AVX2 "-xCORE-AVX2")
+ _SET_IF_EMPTY(FLAGS_AVX512KNL "-xMIC-AVX512")
+ _SET_IF_EMPTY(FLAGS_AVX512SKX "-xCORE-AVX512")
OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
--
2.14.3
From a94ed12e8f35d28cec3e72e47e129f9485c29fe4 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon, 5 Mar 2018 09:26:30 -0600
Subject: [PATCH 3/3] Move SSE2 options from CMAKE_CXX_FLAGS to common target
properties
---
common/algorithms/CMakeLists.txt | 4 ++--
common/cmake/msvc.cmake | 2 +-
common/lexers/CMakeLists.txt | 2 ++
common/math/CMakeLists.txt | 2 ++
common/simd/CMakeLists.txt | 3 ++-
common/sys/CMakeLists.txt | 2 ++
common/tasking/CMakeLists.txt | 10 ++++------
7 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/common/algorithms/CMakeLists.txt b/common/algorithms/CMakeLists.txt
index dc35c6237..0c6d98dc3 100644
--- a/common/algorithms/CMakeLists.txt
+++ b/common/algorithms/CMakeLists.txt
@@ -28,5 +28,5 @@ ADD_LIBRARY(algorithms OBJECT
)
SET_PROPERTY(TARGET algorithms PROPERTY FOLDER common)
-
-
+SET_PROPERTY(TARGET algorithms APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/cmake/msvc.cmake b/common/cmake/msvc.cmake
index 939ec325a..55bd7d2be 100644
--- a/common/cmake/msvc.cmake
+++ b/common/cmake/msvc.cmake
@@ -33,7 +33,7 @@ MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "/GS-")
ENDIF()
ENDMACRO()
-SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} ${FLAGS_SSE2}")
+SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMMON_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
diff --git a/common/lexers/CMakeLists.txt b/common/lexers/CMakeLists.txt
index 77809eddd..a637ad5e9 100644
--- a/common/lexers/CMakeLists.txt
+++ b/common/lexers/CMakeLists.txt
@@ -20,3 +20,5 @@ ADD_LIBRARY(lexers STATIC
)
TARGET_LINK_LIBRARIES(lexers sys math)
SET_PROPERTY(TARGET lexers PROPERTY FOLDER common)
+SET_PROPERTY(TARGET lexers APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/math/CMakeLists.txt b/common/math/CMakeLists.txt
index 8a56adea1..872e427ce 100644
--- a/common/math/CMakeLists.txt
+++ b/common/math/CMakeLists.txt
@@ -16,3 +16,5 @@
ADD_LIBRARY(math STATIC constants.cpp)
SET_PROPERTY(TARGET math PROPERTY FOLDER common)
+SET_PROPERTY(TARGET math APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/simd/CMakeLists.txt b/common/simd/CMakeLists.txt
index bc5c1f208..fc462098e 100644
--- a/common/simd/CMakeLists.txt
+++ b/common/simd/CMakeLists.txt
@@ -16,4 +16,5 @@
ADD_LIBRARY(simd STATIC sse.cpp)
SET_PROPERTY(TARGET simd PROPERTY FOLDER common)
-
+SET_PROPERTY(TARGET simd APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/sys/CMakeLists.txt b/common/sys/CMakeLists.txt
index c953ffb8f..9701a6e5e 100644
--- a/common/sys/CMakeLists.txt
+++ b/common/sys/CMakeLists.txt
@@ -32,3 +32,5 @@ ADD_LIBRARY(sys STATIC
TARGET_LINK_LIBRARIES(sys ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
SET_PROPERTY(TARGET sys PROPERTY FOLDER common)
+SET_PROPERTY(TARGET sys APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/tasking/CMakeLists.txt b/common/tasking/CMakeLists.txt
index 1e779310e..0b4003676 100644
--- a/common/tasking/CMakeLists.txt
+++ b/common/tasking/CMakeLists.txt
@@ -16,16 +16,14 @@
IF (TASKING_INTERNAL)
ADD_LIBRARY(tasking STATIC taskschedulerinternal.cpp)
-ENDIF()
-
-IF (TASKING_TBB)
+ELSEIF (TASKING_TBB)
ADD_LIBRARY(tasking STATIC taskschedulertbb.cpp)
TARGET_LINK_LIBRARIES(tasking sys math ${TBB_LIBRARIES})
-ENDIF()
-
-IF (TASKING_PPL)
+ELSEIF (TASKING_PPL)
ADD_LIBRARY(tasking STATIC taskschedulerppl.cpp)
TARGET_LINK_LIBRARIES(tasking sys math ${PPL_LIBRARIES})
ENDIF()
SET_PROPERTY(TARGET tasking PROPERTY FOLDER common)
+SET_PROPERTY(TARGET tasking APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
--
2.14.3
From c9a3b4925d1faa285c82744267a78f6230716d52 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon, 5 Mar 2018 09:22:22 -0600
Subject: [PATCH 1/3] Use compiler ID for cmake options file name
---
CMakeLists.txt | 16 +++++++---------
common/cmake/{gcc.cmake => gnu.cmake} | 0
common/cmake/{icc.cmake => intel.cmake} | 0
3 files changed, 7 insertions(+), 9 deletions(-)
rename common/cmake/{gcc.cmake => gnu.cmake} (100%)
rename common/cmake/{icc.cmake => intel.cmake} (100%)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07fa0a61f..3091d9df0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -262,15 +262,13 @@ IF (WIN32)
ELSE (WIN32)
IF(CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
- INCLUDE(crayprgenv)
- ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
- INCLUDE (gcc)
- ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
- INCLUDE (clang)
- ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
- INCLUDE (icc)
- ELSE ()
- MESSAGE(FATAL_ERROR "Unsupported compiler: " ${CMAKE_CXX_COMPILER_ID})
+ INCLUDE (crayprgenv)
+ ELSE()
+ STRING(TOLOWER "${CMAKE_CXX_COMPILER_ID}" _LOWER_CXX_COMPILER_ID)
+ INCLUDE(${_LOWER_CXX_COMPILER_ID} OPTIONAL RESULT_VARIABLE COMPILER_FOUND)
+ IF (NOT COMPILER_FOUND)
+ MESSAGE(FATAL_ERROR "Unsupported compiler: " ${CMAKE_CXX_COMPILER_ID})
+ ENDIF ()
ENDIF ()
IF(NOT CMAKE_BUILD_TYPE)
diff --git a/common/cmake/gcc.cmake b/common/cmake/gnu.cmake
similarity index 100%
rename from common/cmake/gcc.cmake
rename to common/cmake/gnu.cmake
diff --git a/common/cmake/icc.cmake b/common/cmake/intel.cmake
similarity index 100%
rename from common/cmake/icc.cmake
rename to common/cmake/intel.cmake
--
2.14.3
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