singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject [2/4] incubator-singa git commit: SINGA-156 Remove the dependency on ZMQ for single process training
Date Mon, 04 Apr 2016 09:09:45 GMT
SINGA-156 Remove the dependency on ZMQ for single process training

Update compiler arguments. Zookeeper and zmq will be used when "-enable-dist" is employed.


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

Branch: refs/heads/master
Commit: 65b8c8dfceca42d0e9bcda4300c6ac70054c4d48
Parents: d8dffdf
Author: xiezl <xiezhongle@comp.nus.edu.sg>
Authored: Sun Apr 3 22:28:45 2016 +0800
Committer: xiezl <xiezhongle@comp.nus.edu.sg>
Committed: Sun Apr 3 22:28:45 2016 +0800

----------------------------------------------------------------------
 Makefile.am              | 26 +++++++++---------
 configure.ac             | 61 ++++++++++++++++++++++---------------------
 include/singa/comm/msg.h |  2 +-
 3 files changed, 44 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/65b8c8df/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 95f7e81..f16d35a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -195,10 +195,10 @@ libsinga_la_SOURCES += $(CUDNN_SRCS)
 libsinga_la_CXXFLAGS += $(CUDNN_CFLAGS)
 libsinga_la_LDFLAGS += $(CUDNN_LDFLAGS) $(CUDNN_LIBS)
 endif
-if DZOOKEEPER
+if DDIST
 libsinga_la_SOURCES += $(ZOOKEEPER_SRCS)
-libsinga_la_CXXFLAGS += $(ZOOKEEPER_CFLAGS)
-libsinga_la_LDFLAGS += $(ZOOKEEPER_LDFLAGS) $(ZOOKEEPER_LIBS)
+libsinga_la_CXXFLAGS += $(DIST_CFLAGS)
+libsinga_la_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS)
 endif
 
 if DHDFS
@@ -214,7 +214,6 @@ singa_LDFLAGS = -lsinga \
                 -lglog  \
                 -lprotobuf \
                 -lopenblas \
-                -lzmq \
                 -lczmq 
 if LMDB
 singa_LDFLAGS += -llmdb
@@ -226,10 +225,10 @@ singa_CXXFLAGS += $(CUDA_CFLAGS)
 singa_LDFLAGS += $(CUDA_LDFLAGS) $(CUDA_LIBS)
 endif
 
-if DZOOKEEPER
+if DDIST
 singa_SOURCES += $(ZOOKEEPER_SRCS)
-singa_CXXFLAGS += $(ZOOKEEPER_CFLAGS)
-singa_LDFLAGS += $(ZOOKEEPER_LDFLAGS) $(ZOOKEEPER_LIBS)
+singa_CXXFLAGS += $(DIST_CFLAGS)
+singa_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS)
 endif
 
 if DCUDNN
@@ -251,10 +250,10 @@ singatool_LDFLAGS = -lsinga \
                     -lglog  \
                     -lprotobuf 
 
-if DZOOKEEPER
+if DDIST
 singatool_SOURCES += $(ZOOKEEPER_SRCS)
-singatool_CXXFLAGS += $(ZOOKEEPER_CFLAGS)
-singatool_LDFLAGS += $(ZOOKEEPER_LDFLAGS) $(ZOOKEEPER_LIBS)
+singatool_CXXFLAGS += $(DIST_CFLAGS)
+singatool_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS)
 endif
 
 #lib_LTLIBRARIES += libgtest.la
@@ -274,7 +273,6 @@ singatest_LDFLAGS = -lsinga \
                 -lglog  \
                 -lprotobuf \
                 -lopenblas \
-                -lzmq \
                 -lczmq \
                 -lgtest
 if LMDB
@@ -293,10 +291,10 @@ singatest_CXXFLAGS += $(CUDNN_CFLAGS)
 singatest_LDFLAGS += $(CUDNN_LDFLAGS) $(CUDNN_LIBS)
 endif
 
-if DZOOKEEPER
+if DDIST
 singatest_SOURCES += $(ZOOKEEPER_SRCS)
-singatest_CXXFLAGS += $(ZOOKEEPER_CFLAGS)
-singatest_LDFLAGS += $(ZOOKEEPER_LDFLAGS) $(ZOOKEEPER_LIBS)
+singatest_CXXFLAGS += $(DIST_CFLAGS)
+singatest_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS)
 endif
 
 _driver_la_SOURCES = $(PY_SRCS)

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/65b8c8df/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index af80c1e..2de8720 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,9 +40,6 @@ AC_PROG_LIBTOOL
 AC_SEARCH_LIBS([cblas_sgemm], [openblas], [], [
   AC_MSG_ERROR([unable to find cblas_sgemm() function])
   ])
-AC_SEARCH_LIBS([zmq_ctx_new], [zmq], [], [
-  AC_MSG_ERROR([unable to find zmq_ctx_new() function])
-    ])
 AC_SEARCH_LIBS([zmsg_new], [czmq], [], [
   AC_MSG_ERROR([unable to find zmsg_new() function])
   ])
@@ -116,7 +113,7 @@ AC_SUBST(CUDA_CFLAGS)
 # Setup custom CUDNN paths
 AC_ARG_ENABLE([cudnn],
     [AS_HELP_STRING(--enable-cudnn,enable CUDNN support)],
-    [enable_cudnn=yes], [enable_cudnn=no])
+    [enable_cudnn="yes"], [enable_cudnn="no"])
 AM_CONDITIONAL(DCUDNN, [test "$enable_cudnn" = "yes"])
 AC_ARG_WITH([cudnn],
     [AS_HELP_STRING([--with-cudnn=PATH], [prefix where CUDNN is installed])],
@@ -147,37 +144,41 @@ AC_SUBST(CUDNN_LDFLAGS)
 AC_SUBST(CUDNN_LIBS)
 
 # Setup custom zookeeper paths 
-AC_ARG_ENABLE(zookeeper,
-  AS_HELP_STRING([--enable-zookeeper],[enable zookeeper support]),
-  [enable_zookeeper=yes],[enable_zookeeper=no])
-AM_CONDITIONAL(DZOOKEEPER, test "$enable_zookeeper" = yes)
-AC_ARG_WITH([zookeeper],
-    [AS_HELP_STRING([--with-zookeeper=PATH], [prefix where zookeeper is installed])],
-    [zookeeper_prefix=$withval], [zookeeper_prefix="/usr/local"])
-if test "$zookeeper_prefix" == "yes"; then
+AC_ARG_ENABLE(dist,
+  AS_HELP_STRING([--enable-dist],[enable dist support]),
+  [enable_dist="yes"],[enable_dist="no"])
+AM_CONDITIONAL(DDIST, test "$enable_dist" = "yes")
+AC_ARG_WITH([dist],
+    [AS_HELP_STRING([--with-dist=PATH], [prefix where dist libraries,i.e.
+     zookeeper/zmq is installed])],
+    [dist_prefix=$withval], [dist_prefix="/usr/local"])
+if test "$dist_prefix" == "yes"; then
     if test "$withval" == "yes"; then
-        cudnn_prefix="/usr/local"
+        dist_prefix="/usr/local"
     fi
 fi
-if test x"$enable_zookeeper" != x"no"; then
-  ZOOKEEPER_CFLAGS="-I$zookeeper_prefix/include"
-  ZOOKEEPER_LDFLAGS="-L$zookeeper_prefix/lib"
-  ZOOKEEPER_LIBS="-lzookeeper_mt"
-  LIBS="$LIBS $ZOOKEEPER_LIBS"
-  LDFLAGS="$LDFLAGS $ZOOKEEPER_LDFLAGS"
-  DEBUG+=" -DUSE_ZOOKEEPER"
-  AC_DEFINE(DZOOKEEPER,[1],[Defined if zookeeper should be used])
-  AC_CHECK_LIB([zookeeper_mt], [main], [], [
-      AC_MSG_ERROR([unable to find zookeeper library])
-      ])
+if test x"$enable_dist" == x"yes"; then
+  AC_CHECK_LIB([zookeeper_mt], [main], [], [ 
+                AC_MSG_ERROR([unable to find zookeeper library])
+        ])
+  AC_SEARCH_LIBS([zmq_ctx_new], [zmq], [], [ 
+                  AC_MSG_ERROR([unable to find zmq_ctx_new() function])
+        ])
+  DIST_CFLAGS="-I$dist_prefix/include"
+  DIST_LDFLAGS="-L$dist_prefix/lib"
+  DIST_LIBS="-lzookeeper_mt -lzmq"
+  LIBS="$LIBS $DIST_LIBS"
+  LDFLAGS="$LDFLAGS $DIST_LDFLAGS"
+  DEBUG+=" -DUSE_ZOOKEEPER -DUSE_ZMQ"
+  AC_DEFINE(DDIST,[1],[Defined if dist should be used])
 else
-  ZOOKEEPER_CFLAGS=""
-  ZOOKEEPER_LDFLAGS=""
-  ZOOKEEPER_LIBS=""
+  DIST_CFLAGS=""
+  DIST_LDFLAGS=""
+  DIST_LIBS=""
 fi
-AC_SUBST(ZOOKEEPER_CFLAGS)
-AC_SUBST(ZOOKEEPER_LDFLAGS)
-AC_SUBST(ZOOKEEPER_LIBS)
+AC_SUBST(DIST_CFLAGS)
+AC_SUBST(DIST_LDFLAGS)
+AC_SUBST(DIST_LIBS)
 
 # Setup custom lmdb paths 
 AC_ARG_ENABLE(lmdb,

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/65b8c8df/include/singa/comm/msg.h
----------------------------------------------------------------------
diff --git a/include/singa/comm/msg.h b/include/singa/comm/msg.h
index ade7fc8..8e03cd5 100644
--- a/include/singa/comm/msg.h
+++ b/include/singa/comm/msg.h
@@ -25,7 +25,7 @@
 #include <utility>
 
 // TODO(wangwei): make it a compiler argument
-#define USE_ZMQ
+// #define USE_ZMQ
 
 #include <vector>
 #ifdef USE_ZMQ


Mime
View raw message