SINGA-255 Compile mandatory depedent libaries together with SINGA code Change .gitmodules and default options.
SINGA-255 Compile mandatory depedent libaries together with SINGA code Move cnmem to exportproject instead of git submodules. Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/a98446f3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/a98446f3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/a98446f3 Branch: refs/heads/master Commit: a98446f30467069648e1e52b4633e99677a85246 Parents: 932a0cd Author: xiezl <[email protected]> Authored: Sun Oct 23 01:36:55 2016 +0800 Committer: xiezl <[email protected]> Committed: Tue Oct 25 14:52:22 2016 +0800 ---------------------------------------------------------------------- .gitmodules | 9 --------- CMakeLists.txt | 33 ++++++++++++++++++++++++++------- lib/cnmem | 1 - 3 files changed, 26 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/a98446f3/.gitmodules ---------------------------------------------------------------------- diff --git a/.gitmodules b/.gitmodules index fc8ce49..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +0,0 @@ -[submodule "lib/cnmem"] - path = lib/cnmem - url = https://github.com/NVIDIA/cnmem.git -[submodule "lib/protobuf"] - path = lib/protobuf - url = https://github.com/google/protobuf.git -[submodule "lib/OpenBLAS"] - path = lib/OpenBLAS - url = https://github.com/xianyi/OpenBLAS.git http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/a98446f3/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 464f8d5..f67c7af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,13 +50,13 @@ OPTION(USE_CUDA "Use Cuda libs" OFF) OPTION(USE_CUDNN "Use Cudnn libs" ON) OPTION(USE_OPENCV "Use opencv" OFF) OPTION(USE_LMDB "Use LMDB libs" OFF) -OPTION(USE_PYTHON "Generate py wrappers" ON) +OPTION(USE_PYTHON "Generate py wrappers" OFF) OPTION(USE_JAVA "Generate java wrappers" OFF) OPTION(USE_OPENCL "Use OpenCL" OFF) OPTION(ENABLE_DIST "enable distributed training" OFF) OPTION(DISABLE_WARNINGS "disable warnings under windows" ON) -OPTION(USE_MODULES "Use submodules to compile" ON) -OPTION(USE_SHARED_LIBS "Use shared library" OFF) +OPTION(USE_MODULES "Use submodules to compile" OFF) +OPTION(BUILD_SHARED_LIBS "Use shared library" OFF) INCLUDE("cmake/Dependencies.cmake") #INCLUDE("cmake/Utils.cmake") @@ -74,9 +74,18 @@ SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) IF (USE_CUDA) - ADD_SUBDIRECTORY(lib/cnmem) - LIST(APPEND SINGA_LINKER_LIBS cnmem) - SET(global_cuda_objs "") + include(ExternalProject) + ExternalProject_Add(cnmem + GIT_REPOSITORY "https://github.com/NVIDIA/cnmem.git" + GIT_TAG "master" + SOURCE_DIR "cnmem/" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" + "-H${CMAKE_BINARY_DIR}/cnmem" "-B." + "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}" + ) + #ADD_SUBDIRECTORY(lib/cnmem) + #LIST(APPEND SINGA_LINKER_LIBS cnmem) + #SET(global_cuda_objs "") ENDIF() # TODO(wangwei) detect the ev lib @@ -88,7 +97,7 @@ IF (USE_MODULES) include(ExternalProject) #ADD_SUBDIRECTORY(lib/protobuf/cmake) #ADD_SUBDIRECTORY(lib/OpenBLAS) - IF(USE_SHARED_LIBS) + IF(BUILD_SHARED_LIBS) ExternalProject_Add(protobuf GIT_REPOSITORY "https://github.com/google/protobuf.git" GIT_TAG "2.7.0" @@ -122,6 +131,16 @@ IF (USE_MODULES) BUILD_COMMAND "make" "ONLY_CBLAS=1" INSTALL_COMMAND "make" "PREFIX=${CMAKE_BINARY_DIR}/" "install" ) + IF(USE_CUDA) + ExternalProject_Add(cnmem + GIT_REPOSITORY "https://github.com/NVIDIA/cnmem.git" + GIT_TAG "master" + SOURCE_DIR "cnmem/" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" + "-H${CMAKE_BINARY_DIR}/cnmem" "-B." + "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}" + ) + ENDIF() ENDIF() INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/include") http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/a98446f3/lib/cnmem ---------------------------------------------------------------------- diff --git a/lib/cnmem b/lib/cnmem deleted file mode 160000 index 28a182d..0000000 --- a/lib/cnmem +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 28a182d49529da49f4ac4e3941cec3edf16b3540
