singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wang...@apache.org
Subject [5/6] incubator-singa git commit: SINGA-255 Compile mandatory depedent libaries together with SINGA code
Date Tue, 25 Oct 2016 08:43:41 GMT
SINGA-255 Compile mandatory depedent libaries together with SINGA code

Add To-do to pass the test.

SINGA-255 Compile mandatory depedent libaries together with SINGA code

Fix comments and change cnmem repo address.

SINGA-255 Compile mandatory depedent libaries together with SINGA code

Find protobuf lib paths automatically.

SINGA-255 Compile mandatory depedent libaries together with SINGA code

Add protobuf 2.6.1.

Remove protobuf-2.7.

Make cudnn ON by default.


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/4826d40a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/4826d40a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/4826d40a

Branch: refs/heads/master
Commit: 4826d40a1a6b67dd322fec5d3f6a5af1a17dc73d
Parents: f2c0b84
Author: xiezl <xiezhongle@comp.nus.edu.sg>
Authored: Mon Oct 24 13:58:06 2016 +0800
Committer: xiezl <xiezhongle@comp.nus.edu.sg>
Committed: Tue Oct 25 14:54:00 2016 +0800

----------------------------------------------------------------------
 CMakeLists.txt           | 41 +++++++++++++++++++++-------------------
 cmake/Dependencies.cmake | 44 +++++++++++++++++++++----------------------
 2 files changed, 44 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4826d40a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58244c7..a07b694 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,14 +49,17 @@ 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" OFF)
+OPTION(USE_PYTHON "Generate py wrappers" ON)
 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" OFF)
+OPTION(ENABLE_DIST "Enable distributed training" OFF)
+OPTION(DISABLE_WARNINGS "Disable warnings under windows" ON)
+OPTION(USE_MODULES "Compile dependent libs as submodules together with singa" OFF)
 #OPTION(USE_SHARED_LIBS "Use shared library" OFF)
 
+# TODO: remove all USE_CBLAS in codes
+SET(USE_CBLAS ON)
+
 INCLUDE("cmake/Dependencies.cmake")
 #INCLUDE("cmake/Utils.cmake")
 ADD_DEFINITIONS(-DUSE_CMAKE)
@@ -75,8 +78,8 @@ SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
 IF (USE_CUDA)
     include(ExternalProject)
     ExternalProject_Add(cnmem
-        GIT_REPOSITORY "https://github.com/NVIDIA/cnmem.git"
-        GIT_TAG "28a182d"
+        GIT_REPOSITORY "https://github.com/nusdbsystem/cnmem.git"
+        GIT_TAG "master"
         SOURCE_DIR "cnmem/"
         CONFIGURE_COMMAND "${CMAKE_COMMAND}"
         "-H${CMAKE_BINARY_DIR}/cnmem" "-B."
@@ -107,19 +110,19 @@ IF (USE_MODULES)
     #        BUILD_COMMAND "${CMAKE_COMMAND}" --build "." 
     #        )
     #ELSE()
-        ExternalProject_Add(protobuf
-            GIT_REPOSITORY "https://github.com/google/protobuf.git"
-            #GIT_TAG "2.7.0"
-            GIT_TAG "f56542f"
-            SOURCE_DIR "protobuf/" 
-            CONFIGURE_COMMAND "${CMAKE_COMMAND}"
-            "-H${CMAKE_BINARY_DIR}/protobuf/cmake" "-B."
-            "-Dprotobuf_BUILD_TESTS=OFF" "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}"
-            "-Dprotobuf_BUILD_SHARED_LIBS=OFF" "-DCMAKE_C_FLAGS=-fPIC"
-            "-DCMAKE_CXX_FLAGS=-fPIC"
-            BUILD_COMMAND "${CMAKE_COMMAND}" --build "." 
-            )
-        #ENDIF()
+    #ENDIF()
+    ExternalProject_Add(protobuf
+        DOWNLOAD_COMMAND "wget"
+        "http://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz"
+        "-O" "protobuf-2.6.1.tar.gz"
+        UPDATE_COMMAND "tar" "zxvf"
+        "${CMAKE_BINARY_DIR}/protobuf-prefix/src/protobuf-2.6.1.tar.gz" "-C" ".."
+        SOURCE_DIR "protobuf-2.6.1/" 
+        BUILD_IN_SOURCE 1
+        CONFIGURE_COMMAND "./configure" "--disable-shared"
+        "--prefix=${CMAKE_BINARY_DIR}/" "CXXFLAGS=-fPIC"
+        INSTALL_COMMAND "make" "install"
+        )
     ExternalProject_Add(openblas
         GIT_REPOSITORY "https://github.com/xianyi/OpenBLAS.git"
         #GIT_TAG "develop"

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4826d40a/cmake/Dependencies.cmake
----------------------------------------------------------------------
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index ed49eaf..d5bfbd9 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -34,32 +34,32 @@ IF(USE_MODULES)
     #        SET(CBLAS_LIBRARIES "${CMAKE_BINARY_DIR}/lib/libopenblas.so")
     #        INCLUDE_DIRECTORIES(SYSTEM ${CBLAS_INCLUDE_DIR})
     #        LIST(APPEND SINGA_LINKER_LIBS ${CBLAS_LIBRARIES})
-            #ENDIF()
-            #ELSE()
-        include(FindProtobuf)
-        SET(PROTOBUF_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include")
-        SET(PROTOBUF_LIBRARY "${CMAKE_BINARY_DIR}/lib/libprotobuf.a")
-        SET(PROTOBUF_PROTOC_LIBRARY "${CMAKE_BINARY_DIR}/lib/libprotoc.a")
-        SET(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_BINARY_DIR}/bin/protoc")
-        INCLUDE_DIRECTORIES(SYSTEM ${PROTOBUF_INCLUDE_DIR})
-        LIST(APPEND SINGA_LINKER_LIBS ${PROTOBUF_LIBRARY})
-        #IF(USE_CBLAS)
-            SET(CBLAS_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include")
-            SET(CBLAS_LIBRARIES "${CMAKE_BINARY_DIR}/lib/libopenblas.a")
-            INCLUDE_DIRECTORIES(SYSTEM ${CBLAS_INCLUDE_DIR})
-            LIST(APPEND SINGA_LINKER_LIBS ${CBLAS_LIBRARIES})
-            #ENDIF()
-            #ENDIF()
+    #ENDIF()
+    #ELSE()
+    include(FindProtobuf)
+    SET(PROTOBUF_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include")
+    SET(PROTOBUF_LIBRARY "${CMAKE_BINARY_DIR}/lib/libprotobuf.a")
+    SET(PROTOBUF_PROTOC_LIBRARY "${CMAKE_BINARY_DIR}/lib/libprotobuf.a")
+    SET(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_BINARY_DIR}/bin/protoc")
+    INCLUDE_DIRECTORIES(SYSTEM ${PROTOBUF_INCLUDE_DIR})
+    LIST(APPEND SINGA_LINKER_LIBS ${PROTOBUF_LIBRARY})
+    #IF(USE_CBLAS)
+    SET(CBLAS_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include")
+    SET(CBLAS_LIBRARIES "${CMAKE_BINARY_DIR}/lib/libopenblas.a")
+    INCLUDE_DIRECTORIES(SYSTEM ${CBLAS_INCLUDE_DIR})
+    LIST(APPEND SINGA_LINKER_LIBS ${CBLAS_LIBRARIES})
+    #ENDIF()
+    #ENDIF()
 ELSE()
     FIND_PACKAGE( Protobuf REQUIRED )
     #MESSAGE(STATUS "proto libs " ${PROTOBUF_LIBRARY})
     LIST(APPEND SINGA_LINKER_LIBS ${PROTOBUF_LIBRARY})
     #IF(USE_CBLAS)
-        FIND_PACKAGE(CBLAS REQUIRED)
-        INCLUDE_DIRECTORIES(SYSTEM ${CBLAS_INCLUDE_DIR})
-        LIST(APPEND SINGA_LINKER_LIBS ${CBLAS_LIBRARIES})
-        #MESSAGE(STATUS "Found cblas at ${CBLAS_LIBRARIES}")
-        #ENDIF()
+    FIND_PACKAGE(CBLAS REQUIRED)
+    INCLUDE_DIRECTORIES(SYSTEM ${CBLAS_INCLUDE_DIR})
+    LIST(APPEND SINGA_LINKER_LIBS ${CBLAS_LIBRARIES})
+    #MESSAGE(STATUS "Found cblas at ${CBLAS_LIBRARIES}")
+    #ENDIF()
 ENDIF()
 
 #INCLUDE("cmake/ProtoBuf.cmake")
@@ -83,7 +83,7 @@ ENDIF()
 IF(USE_CUDA)
     INCLUDE("cmake/Cuda.cmake")
     SET(CNMEM_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include")
-    SET(CNMEM_LIBRARY "${CMAKE_BINARY_DIR}/lib/libcnmem.so")
+    SET(CNMEM_LIBRARY "${CMAKE_BINARY_DIR}/lib/libcnmem.a")
     LIST(APPEND SINGA_LINKER_LIBS ${CNMEM_LIBRARY})
 ELSE()
     SET(USE_CUDNN FALSE)


Mime
View raw message