You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by cj...@apache.org on 2018/01/12 16:10:28 UTC

[incubator-mxnet] branch master updated: Fix C++ unit tests (#9349)

This is an automated email from the ASF dual-hosted git repository.

cjolivier01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 1732460  Fix C++ unit tests (#9349)
1732460 is described below

commit 1732460424444a1a2ac3dddab4d9f19d3a0ff053
Author: Anton Chernov <me...@gmail.com>
AuthorDate: Fri Jan 12 17:10:22 2018 +0100

    Fix C++ unit tests (#9349)
    
    * Removed tabs from CMakeLists.txt
    
    * Fixed symbol linking in unit tests
---
 CMakeLists.txt | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e6b178..bbbb51d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -186,7 +186,7 @@ endif()
 list(APPEND mxnet_LINKER_LIBS ${mshadow_LINKER_LIBS})
 
 foreach(var ${C_CXX_INCLUDE_DIRECTORIES})
- 	include_directories(${var})
+    include_directories(${var})
 endforeach()
 
 include_directories("include")
@@ -201,9 +201,13 @@ include_directories("dlpack/include")
 #  add_subdirectory(dlpack)
 #endif()
 
+# Prevent stripping out symbols (operator registrations, for example)
 if(NOT MSVC AND NOT APPLE)
   set(BEGIN_WHOLE_ARCHIVE -Wl,--whole-archive)
   set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  # using regular Clang or AppleClang
+  set(BEGIN_WHOLE_ARCHIVE -Wl,-force_load)
 endif()
 
 if(UNIX)
@@ -332,7 +336,7 @@ if(USE_CUDNN AND USE_CUDA)
     add_definitions(-DUSE_CUDNN)
     include_directories(SYSTEM ${CUDNN_INCLUDE})
     list(APPEND mxnet_LINKER_LIBS ${CUDNN_LIBRARY})
-	  add_definitions(-DMSHADOW_USE_CUDNN=1)
+      add_definitions(-DMSHADOW_USE_CUDNN=1)
   endif()
 endif()
 
@@ -372,17 +376,17 @@ assign_source_group("Include" ${GROUP_Include})
 assign_source_group("CUDA" ${GROUP_CUDA})
 
 if(USE_PLUGINS_WARPCTC)
-	set(WARPCTC_INCLUDE  "" CACHE PATH "WARPCTC include")
+    set(WARPCTC_INCLUDE  "" CACHE PATH "WARPCTC include")
     set(WARPCTC_LIB_DEBUG  "" CACHE FILEPATH "WARPCTC lib")
     set(WARPCTC_LIB_RELEASE  "" CACHE FILEPATH "WARPCTC lib")
 
 
-	include_directories(SYSTEM ${WARPCTC_INCLUDE})
-	list(APPEND mxnet_LINKER_LIBS ${WARPCTC_LIB})
-	FILE(GLOB_RECURSE PLUGINS_SOURCE "plugin/warpctc/*.cc" "plugin/warpctc/*.h")
-	FILE(GLOB_RECURSE PLUGINS_CUSRC "plugin/warpctc/*.cu")
-	list(APPEND SOURCE ${PLUGINS_SOURCE})
-	list(APPEND CUDA ${PLUGINS_CUSRC})
+    include_directories(SYSTEM ${WARPCTC_INCLUDE})
+    list(APPEND mxnet_LINKER_LIBS ${WARPCTC_LIB})
+    FILE(GLOB_RECURSE PLUGINS_SOURCE "plugin/warpctc/*.cc" "plugin/warpctc/*.h")
+    FILE(GLOB_RECURSE PLUGINS_CUSRC "plugin/warpctc/*.cu")
+    list(APPEND SOURCE ${PLUGINS_SOURCE})
+    list(APPEND CUDA ${PLUGINS_CUSRC})
 endif()
 
 if(USE_OPERATOR_TUNING)
@@ -425,11 +429,11 @@ if(USE_PLUGIN_CAFFE)
 endif()
 
 if (NOT (EXTRA_OPERATORS STREQUAL ""))
-	mxnet_source_group("Extra"   GLOB_RECURSE "${EXTRA_OPERATORS}/*.cc")
-	mxnet_source_group("Extra\\Cuda"   GLOB_RECURSE "${EXTRA_OPERATORS}/*.cu")
-	FILE(GLOB_RECURSE EXTRA_SRC "${EXTRA_OPERATORS}/*.cc")
-	FILE(GLOB_RECURSE EXTRA_CUSRC "${EXTRA_OPERATORS}/*.cu")
-	list(APPEND SOURCE ${EXTRA_SRC} ${EXTRA_CUSRC})
+    mxnet_source_group("Extra"   GLOB_RECURSE "${EXTRA_OPERATORS}/*.cc")
+    mxnet_source_group("Extra\\Cuda"   GLOB_RECURSE "${EXTRA_OPERATORS}/*.cu")
+    FILE(GLOB_RECURSE EXTRA_SRC "${EXTRA_OPERATORS}/*.cc")
+    FILE(GLOB_RECURSE EXTRA_CUSRC "${EXTRA_OPERATORS}/*.cu")
+    list(APPEND SOURCE ${EXTRA_SRC} ${EXTRA_CUSRC})
 endif()
 
 if(MSVC)
@@ -567,7 +571,7 @@ if(MSVC AND USE_MXNET_LIB_NAMING)
 endif()
 
 if(USE_PROFILER)
-	add_definitions(-DMXNET_USE_PROFILER)
+    add_definitions(-DMXNET_USE_PROFILER)
 endif()
 
 add_subdirectory(tests)
@@ -585,7 +589,7 @@ if (INSTALL_EXAMPLES)
 endif()
 
 if (USE_SIGNAL_HANDLER)
-	add_definitions(-DMXNET_USE_SIGNAL_HANDLER=1)
+    add_definitions(-DMXNET_USE_SIGNAL_HANDLER=1)
 endif()
 
 # AUTO_INSTALL_DIR -> Optional: specify post-build install direcory

-- 
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].