Repository: incubator-singa Updated Branches: refs/heads/master 7d9c0fb4b -> cce3aebef
SINGA-27 Generate python modules for proto objects Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/132eaa3e Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/132eaa3e Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/132eaa3e Branch: refs/heads/master Commit: 132eaa3e14c1078b067c04c0c3b634c5a30fc92e Parents: 9dc0567 Author: xiezl <[email protected]> Authored: Sat Jun 27 23:45:10 2015 +0800 Committer: xiezl <[email protected]> Committed: Sat Jun 27 23:45:10 2015 +0800 ---------------------------------------------------------------------- Makefile.am | 4 ++++ Makefile.in | 4 ++++ README.md | 15 ++++++++++++++- tool/plot/model_pb2.pyc | Bin 0 -> 40658 bytes 4 files changed, 22 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/132eaa3e/Makefile.am ---------------------------------------------------------------------- diff --git a/Makefile.am b/Makefile.am index 1125c01..f0fcfe4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,6 +14,7 @@ PROTOS := $(top_srcdir)/src/proto/cluster.proto $(top_srcdir)/src/proto/model.pr PROTO_SRCS := src/proto/cluster.pb.cc src/proto/model.pb.cc src/proto/common.pb.cc PROTO_HDRS := src/proto/cluster.pb.h src/proto/model.pb.h src/proto/common.pb.h PROTO_OBJS := src/proto/cluster.pb.o src/proto/model.pb.o src/proto/common.pb.o +PROTO_PYS := tool/plot/cluster_pb2.py tool/plot/model_pb2.py tool/plot/common_pb2.py SINGA_SRCS := src/utils/cluster.cc \ src/utils/cluster_rt.cc \ @@ -118,10 +119,13 @@ singa_LDFLAGS = -I./include \ clean-local: rm -rf $(PROTO_SRCS) $(PROTO_HDRS) + rm -rf $(PROTO_PYS) $(PROTO_HDRS) $(PROTO_SRCS): $(PROTOS) + echo $(top_srcdir) protoc --proto_path=$(top_srcdir)/src/proto --cpp_out=$(top_srcdir)/src/proto $(PROTOS) + protoc --proto_path=$(top_srcdir)/src/proto --python_out=$(top_srcdir)/tool/plot $(PROTOS) mkdir -p $(top_srcdir)/include/proto/ cp $(top_srcdir)/src/proto/*.pb.h $(top_srcdir)/include/proto/ @echo http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/132eaa3e/Makefile.in ---------------------------------------------------------------------- diff --git a/Makefile.in b/Makefile.in index cbb46b0..4f59a0d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -326,6 +326,7 @@ PROTOS := $(top_srcdir)/src/proto/cluster.proto $(top_srcdir)/src/proto/model.pr PROTO_SRCS := src/proto/cluster.pb.cc src/proto/model.pb.cc src/proto/common.pb.cc PROTO_HDRS := src/proto/cluster.pb.h src/proto/model.pb.h src/proto/common.pb.h PROTO_OBJS := src/proto/cluster.pb.o src/proto/model.pb.o src/proto/common.pb.o +PROTO_PYS := tool/plot/cluster_pb2.py tool/plot/model_pb2.py tool/plot/common_pb2.py SINGA_SRCS := src/utils/cluster.cc \ src/utils/cluster_rt.cc \ src/utils/graph.cc \ @@ -1292,9 +1293,12 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES clean-local: rm -rf $(PROTO_SRCS) $(PROTO_HDRS) + rm -rf $(PROTO_PYS) $(PROTO_HDRS) $(PROTO_SRCS): $(PROTOS) + echo $(top_srcdir) protoc --proto_path=$(top_srcdir)/src/proto --cpp_out=$(top_srcdir)/src/proto $(PROTOS) + protoc --proto_path=$(top_srcdir)/src/proto --python_out=$(top_srcdir)/tool/plot $(PROTOS) mkdir -p $(top_srcdir)/include/proto/ cp $(top_srcdir)/src/proto/*.pb.h $(top_srcdir)/include/proto/ @echo http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/132eaa3e/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index b8eab1f..3a4e1f9 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ For libraries like openblas, opencv, older versions may also work, because we do ###Building SINGA From Sources -The build system of SINGA is based on GNU autotools. To build singa, you need gcc version >= 4.8.2. +The build system of SINGA is based on GNU autotools. To build singa, you need gcc version >= 4.8.2. To support visualization, you need python2.7.x. The common steps to build SINGA can be: 1.Extract source files; @@ -125,3 +125,16 @@ A3:Since OpenBLAS library is installed in /opt folder by default or /other/folde Or as an alternative option, you can also edit LIBRARY_PATH to figure it out. # + +Q4:I get ImportError from google.protobuf.internal when I try to import .py files. (ImportError: cannot import name enum_type_wrapper) + +A4:After install google protobuf by "make install", we should install python runtime libraries. Go to protobuf source directory, run: + + $ cd /PROTOBUF/SOURCE/FOLDER + $ cd python + $ python setup.py build + $ python setup.py install + +You may need "sudo" when you try to install python runtime libraries in system folder. + +# http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/132eaa3e/tool/plot/model_pb2.pyc ---------------------------------------------------------------------- diff --git a/tool/plot/model_pb2.pyc b/tool/plot/model_pb2.pyc new file mode 100644 index 0000000..fe59913 Binary files /dev/null and b/tool/plot/model_pb2.pyc differ
