From 583a2bb37190a8d300615bc9a79c553075ad6ce8 Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Wed, 21 Aug 2019 14:12:49 -0700 Subject: [PATCH 1/4] Add option to choose between OMP implementations --- 3rdparty/dmlc-core | 2 +- CMakeLists.txt | 19 +++++++++++-------- cmake/cmake_options.yml | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/3rdparty/dmlc-core b/3rdparty/dmlc-core index f1ff6cc117f4..1c2d18b7debc 160000 --- a/3rdparty/dmlc-core +++ b/3rdparty/dmlc-core @@ -1 +1 @@ -Subproject commit f1ff6cc117f4e95169a9f62be549c8fe3e15c20f +Subproject commit 1c2d18b7debc1f314b5a054f0920ab8dbc4aab60 diff --git a/CMakeLists.txt b/CMakeLists.txt index f441e9b0bd3b..aac61e90e2da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ mxnet_option(USE_CUDA "Build with CUDA support" ON) mxnet_option(USE_OLDCMAKECUDA "Build with old cmake cuda" OFF) mxnet_option(USE_NCCL "Use NVidia NCCL with CUDA" OFF) mxnet_option(USE_OPENCV "Build with OpenCV support" ON) -mxnet_option(USE_OPENMP "Build with Openmp support" ON) +mxnet_option(USE_OPENMP "Build with Openmp support" ON) # OFF | ON | PLATFORM | BUNDLED mxnet_option(USE_CUDNN "Build with cudnn support" ON) # one could set CUDNN_ROOT for search path mxnet_option(USE_SSE "Build with x86 SSE instruction support" ON IF NOT ARM) mxnet_option(USE_F16C "Build with x86 F16C instruction support" ON) # autodetects support if ON @@ -432,14 +432,13 @@ endif() # ---[ OpenMP if(USE_OPENMP) - find_package(OpenMP REQUIRED) # This should build on Windows, but there's some problem and I don't have a Windows box, so # could a Windows user please fix? - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/openmp/CMakeLists.txt - AND SYSTEM_ARCHITECTURE STREQUAL "x86_64" - AND NOT MSVC - AND NOT CMAKE_CROSSCOMPILING) - + if(USE_OPENMP STREQUAL "BUNDLED" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/openmp/CMakeLists.txt + AND SYSTEM_ARCHITECTURE STREQUAL "x86_64" + AND NOT MSVC + AND NOT CMAKE_CROSSCOMPILING) + message("Using bundlded LLVM OpenMP from 3rdparty") # Intel/llvm OpenMP: https://github.com/llvm-mirror/openmp set(OPENMP_STANDALONE_BUILD TRUE) set(LIBOMP_ENABLE_SHARED TRUE) @@ -452,7 +451,9 @@ if(USE_OPENMP) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") add_definitions(-DMXNET_USE_OPENMP=1) - else() + elseif(USE_OPENMP STREQUAL "PLATFORM" OR USE_OPENMP STREQUAL "ON") + find_package(OpenMP REQUIRED) + message("Using platform provided OpenMP") if(OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") @@ -460,6 +461,8 @@ if(USE_OPENMP) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") add_definitions(-DMXNET_USE_OPENMP=1) endif() + else() + message(FATAL_ERROR "USE_OPENMP takes values [PLATFORM, BUNDLED, OFF]") endif() elseif(UNIX AND NOT ANDROID) list(APPEND mxnet_LINKER_LIBS pthread) diff --git a/cmake/cmake_options.yml b/cmake/cmake_options.yml index 81138241dfc6..05268a3d5745 100644 --- a/cmake/cmake_options.yml +++ b/cmake/cmake_options.yml @@ -20,7 +20,7 @@ USE_CUDA: "OFF" # Build with CUDA support USE_OLDCMAKECUDA: "OFF" # Build with old cmake cuda USE_NCCL: "OFF" # Use NVidia NCCL with CUDA USE_OPENCV: "ON" # Build with OpenCV support -USE_OPENMP: "ON" # Build with Openmp support +USE_OPENMP: "ON" # Build with Openmp support USE_CUDNN: "ON" # Build with cudnn support) # one could set CUDNN_ROOT for search path USE_SSE: "ON" # Build with x86 SSE instruction support IF NOT ARM USE_F16C: "ON" # Build with x86 F16C instruction support) # autodetects support if "ON" From c7fd3a80b29f26a88f81cbaafd8f654e3b6015ca Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Thu, 29 Aug 2019 22:06:53 +0000 Subject: [PATCH 2/4] Switch submodule for CI --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 90ef157f0eec..7ee71ace443c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "3rdparty/dmlc-core"] path = 3rdparty/dmlc-core - url = https://github.com/dmlc/dmlc-core.git + url = https://github.com/larroy/dmlc-core.git [submodule "3rdparty/ps-lite"] path = 3rdparty/ps-lite url = https://github.com/dmlc/ps-lite From 80d2216ea20e957980b63c81f21805e12c37c479 Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Fri, 6 Sep 2019 13:51:28 -0700 Subject: [PATCH 3/4] remove ws --- cmake/cmake_options.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/cmake_options.yml b/cmake/cmake_options.yml index 05268a3d5745..81138241dfc6 100644 --- a/cmake/cmake_options.yml +++ b/cmake/cmake_options.yml @@ -20,7 +20,7 @@ USE_CUDA: "OFF" # Build with CUDA support USE_OLDCMAKECUDA: "OFF" # Build with old cmake cuda USE_NCCL: "OFF" # Use NVidia NCCL with CUDA USE_OPENCV: "ON" # Build with OpenCV support -USE_OPENMP: "ON" # Build with Openmp support +USE_OPENMP: "ON" # Build with Openmp support USE_CUDNN: "ON" # Build with cudnn support) # one could set CUDNN_ROOT for search path USE_SSE: "ON" # Build with x86 SSE instruction support IF NOT ARM USE_F16C: "ON" # Build with x86 F16C instruction support) # autodetects support if "ON" From 27a2a12b9d797b314843a4c056cdc9a0c7d8e8df Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Fri, 6 Sep 2019 14:49:00 -0700 Subject: [PATCH 4/4] retrigger ci