Add cluster runtime component implementation based on zookeeper
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/e2b8abe2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/e2b8abe2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/e2b8abe2 Branch: refs/heads/master Commit: e2b8abe2962d44791ea8fffe25488cd1d070a0a6 Parents: 6b1e65e Author: wangsheng1001 <[email protected]> Authored: Mon May 25 22:27:02 2015 +0800 Committer: wangsheng1001 <[email protected]> Committed: Mon May 25 22:27:02 2015 +0800 ---------------------------------------------------------------------- Makefile.example | 9 +- include/utils/cluster_rt.h | 32 +- src/proto/cluster.pb.h | 128 +++++-- src/proto/model.pb.h | 811 +++++++++++++++++++++++++++++----------- src/test/test_cluster.cc | 18 +- src/utils/cluster_rt.cc | 135 ++++++- 6 files changed, 860 insertions(+), 273 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e2b8abe2/Makefile.example ---------------------------------------------------------------------- diff --git a/Makefile.example b/Makefile.example index 80dfc26..582e8d7 100644 --- a/Makefile.example +++ b/Makefile.example @@ -1,24 +1,25 @@ ###################User Config Varaibles ############################# # third-party library installation folder -HOME_DIR := /usr/ +HOME_DIR := /usr # Lib folder for system and external libs. You may need to change it. LIBRARY_DIRS := $(HOME_DIR)/lib64 $(HOME_DIR)/lib $(HOME_DIR)/local/lib # Header folder for system and external libs. You may need to change it. -INCLUDE_DIRS := $(HOME_DIR)/include ./include +INCLUDE_DIRS := $(HOME_DIR)/include ./include $(HOME_DIR)/local/include/zookeeper # g++ location, should support c++11, tested with 4.8.1 CXX := g++ ######################Setting Varialbes####################################### LIBRARIES := glog gflags protobuf rt opencv_highgui opencv_imgproc opencv_core\ - lmdb openblas zmq czmq + lmdb openblas zmq czmq zookeeper_mt LDFLAGS := $(foreach librarydir, $(LIBRARY_DIRS), -L$(librarydir))\ $(foreach library, $(LIBRARIES), -l$(library)) # Folder to store compiled files BUILD_DIR := build MSHADOW_FLAGS :=-DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 +ZK_FLAGS :=-DTHREADED -fpermissive CXXFLAGS := -O3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ - $(MSHADOW_FLAGS) -DCPU_ONLY=1 \ + $(MSHADOW_FLAGS) -DCPU_ONLY=1 $(ZK_FLAGS)\ -funroll-loops $(foreach includedir, $(INCLUDE_DIRS), -I$(includedir)) # find user defined .proto file, and then compute the corresponding .h, .cc http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e2b8abe2/include/utils/cluster_rt.h ---------------------------------------------------------------------- diff --git a/include/utils/cluster_rt.h b/include/utils/cluster_rt.h index d9587ce..1430119 100644 --- a/include/utils/cluster_rt.h +++ b/include/utils/cluster_rt.h @@ -2,9 +2,12 @@ #define INCLUDE_UTILS_CLUSTER_RT_H_ #include <glog/logging.h> #include <string> +#include <vector> #include <utility> +#include <zookeeper/zookeeper.h> using std::string; +using std::vector; namespace singa { @@ -14,6 +17,9 @@ namespace singa { * 1) Provide running status of each server/worker * 1) Translate process id to (hostname:port) */ + +typedef void (*rt_callback)(void *contest); + class ClusterRuntime{ public: ClusterRuntime(){} @@ -22,12 +28,12 @@ class ClusterRuntime{ /** * Initialize the runtime instance */ - virtual bool Init(){return false;} + virtual bool Init(){ return false;} /** * Server: watch all workers in a server group, will be notified when all workers have left */ - virtual bool sWatchSGroup(int gid, int sid){ return false;} + virtual bool sWatchSGroup(int gid, int sid, rt_callback fn, void *ctx){ return false;} /** * Worker: join a server group (i.e. start to read/update these servers) @@ -41,17 +47,33 @@ class ClusterRuntime{ }; + class ZKClusterRT : public ClusterRuntime{ public: - ZKClusterRT(string host); + ZKClusterRT(string host, int timeout = 30000); ~ZKClusterRT(); bool Init(); - bool sWatchSGroup(int gid, int sid); + bool sWatchSGroup(int gid, int sid, rt_callback fn, void *ctx); bool wJoinSGroup(int gid, int wid, int s_group); bool wLeaveSGroup(int gid, int wid, int s_group); - + static void watcherGlobal(zhandle_t * zh, int type, int state, const char *path, void *watcherCtx); + private: + static void childChanges(zhandle_t *zh, int type, int state, const char *path, void *watcherCtx); + string getSGroupPath(int gid); + string getWorkerPath(int gid, int wid); + + struct RTCallback{ + rt_callback fn; + void* ctx; + }; + string host_; + int timeout_; + zhandle_t *zkhandle_; + vector<RTCallback *> cb_vec_; + + const int MAX_BUF_LEN = 50; }; } // namespace singa http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e2b8abe2/src/proto/cluster.pb.h ---------------------------------------------------------------------- diff --git a/src/proto/cluster.pb.h b/src/proto/cluster.pb.h index fce32b8..5784587 100644 --- a/src/proto/cluster.pb.h +++ b/src/proto/cluster.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 2005000 +#if GOOGLE_PROTOBUF_VERSION < 2006000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 2006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -85,7 +85,6 @@ class ClusterProto : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -259,6 +258,8 @@ class ClusterProto : public ::google::protobuf::Message { ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::int32 nworker_groups_; ::google::protobuf::int32 nserver_groups_; ::google::protobuf::int32 nworkers_per_group_; @@ -275,10 +276,6 @@ class ClusterProto : public ::google::protobuf::Message { ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology > server_group_; ::google::protobuf::int32 worker_timeout_; ::google::protobuf::int32 server_timeout_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(16 + 31) / 32]; - friend void protobuf_AddDesc_cluster_2eproto(); friend void protobuf_AssignDesc_cluster_2eproto(); friend void protobuf_ShutdownFile_cluster_2eproto(); @@ -335,7 +332,6 @@ class ServerTopology : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -377,13 +373,11 @@ class ServerTopology : public ::google::protobuf::Message { ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::int32 id_; ::google::protobuf::int32 sync_interval_; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > neighbor_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - friend void protobuf_AddDesc_cluster_2eproto(); friend void protobuf_AssignDesc_cluster_2eproto(); friend void protobuf_ShutdownFile_cluster_2eproto(); @@ -413,11 +407,13 @@ inline void ClusterProto::clear_nworker_groups() { clear_has_nworker_groups(); } inline ::google::protobuf::int32 ClusterProto::nworker_groups() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.nworker_groups) return nworker_groups_; } inline void ClusterProto::set_nworker_groups(::google::protobuf::int32 value) { set_has_nworker_groups(); nworker_groups_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.nworker_groups) } // optional int32 nserver_groups = 2; @@ -435,11 +431,13 @@ inline void ClusterProto::clear_nserver_groups() { clear_has_nserver_groups(); } inline ::google::protobuf::int32 ClusterProto::nserver_groups() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.nserver_groups) return nserver_groups_; } inline void ClusterProto::set_nserver_groups(::google::protobuf::int32 value) { set_has_nserver_groups(); nserver_groups_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.nserver_groups) } // optional int32 nworkers_per_group = 3 [default = 1]; @@ -457,11 +455,13 @@ inline void ClusterProto::clear_nworkers_per_group() { clear_has_nworkers_per_group(); } inline ::google::protobuf::int32 ClusterProto::nworkers_per_group() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.nworkers_per_group) return nworkers_per_group_; } inline void ClusterProto::set_nworkers_per_group(::google::protobuf::int32 value) { set_has_nworkers_per_group(); nworkers_per_group_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.nworkers_per_group) } // optional int32 nservers_per_group = 4 [default = 1]; @@ -479,11 +479,13 @@ inline void ClusterProto::clear_nservers_per_group() { clear_has_nservers_per_group(); } inline ::google::protobuf::int32 ClusterProto::nservers_per_group() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.nservers_per_group) return nservers_per_group_; } inline void ClusterProto::set_nservers_per_group(::google::protobuf::int32 value) { set_has_nservers_per_group(); nservers_per_group_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.nservers_per_group) } // optional int32 nworkers_per_procs = 5 [default = 1]; @@ -501,11 +503,13 @@ inline void ClusterProto::clear_nworkers_per_procs() { clear_has_nworkers_per_procs(); } inline ::google::protobuf::int32 ClusterProto::nworkers_per_procs() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.nworkers_per_procs) return nworkers_per_procs_; } inline void ClusterProto::set_nworkers_per_procs(::google::protobuf::int32 value) { set_has_nworkers_per_procs(); nworkers_per_procs_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.nworkers_per_procs) } // optional int32 nservers_per_procs = 6 [default = 1]; @@ -523,11 +527,13 @@ inline void ClusterProto::clear_nservers_per_procs() { clear_has_nservers_per_procs(); } inline ::google::protobuf::int32 ClusterProto::nservers_per_procs() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.nservers_per_procs) return nservers_per_procs_; } inline void ClusterProto::set_nservers_per_procs(::google::protobuf::int32 value) { set_has_nservers_per_procs(); nservers_per_procs_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.nservers_per_procs) } // optional string hostfile = 10; @@ -541,54 +547,59 @@ inline void ClusterProto::clear_has_hostfile() { _has_bits_[0] &= ~0x00000040u; } inline void ClusterProto::clear_hostfile() { - if (hostfile_ != &::google::protobuf::internal::kEmptyString) { + if (hostfile_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { hostfile_->clear(); } clear_has_hostfile(); } inline const ::std::string& ClusterProto::hostfile() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.hostfile) return *hostfile_; } inline void ClusterProto::set_hostfile(const ::std::string& value) { set_has_hostfile(); - if (hostfile_ == &::google::protobuf::internal::kEmptyString) { + if (hostfile_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { hostfile_ = new ::std::string; } hostfile_->assign(value); + // @@protoc_insertion_point(field_set:singa.ClusterProto.hostfile) } inline void ClusterProto::set_hostfile(const char* value) { set_has_hostfile(); - if (hostfile_ == &::google::protobuf::internal::kEmptyString) { + if (hostfile_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { hostfile_ = new ::std::string; } hostfile_->assign(value); + // @@protoc_insertion_point(field_set_char:singa.ClusterProto.hostfile) } inline void ClusterProto::set_hostfile(const char* value, size_t size) { set_has_hostfile(); - if (hostfile_ == &::google::protobuf::internal::kEmptyString) { + if (hostfile_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { hostfile_ = new ::std::string; } hostfile_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:singa.ClusterProto.hostfile) } inline ::std::string* ClusterProto::mutable_hostfile() { set_has_hostfile(); - if (hostfile_ == &::google::protobuf::internal::kEmptyString) { + if (hostfile_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { hostfile_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:singa.ClusterProto.hostfile) return hostfile_; } inline ::std::string* ClusterProto::release_hostfile() { clear_has_hostfile(); - if (hostfile_ == &::google::protobuf::internal::kEmptyString) { + if (hostfile_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = hostfile_; - hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void ClusterProto::set_allocated_hostfile(::std::string* hostfile) { - if (hostfile_ != &::google::protobuf::internal::kEmptyString) { + if (hostfile_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete hostfile_; } if (hostfile) { @@ -596,8 +607,9 @@ inline void ClusterProto::set_allocated_hostfile(::std::string* hostfile) { hostfile_ = hostfile; } else { clear_has_hostfile(); - hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.hostfile) } // optional bool server_worker_separate = 11 [default = false]; @@ -615,11 +627,13 @@ inline void ClusterProto::clear_server_worker_separate() { clear_has_server_worker_separate(); } inline bool ClusterProto::server_worker_separate() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.server_worker_separate) return server_worker_separate_; } inline void ClusterProto::set_server_worker_separate(bool value) { set_has_server_worker_separate(); server_worker_separate_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.server_worker_separate) } // optional int32 nprocs = 12; @@ -637,11 +651,13 @@ inline void ClusterProto::clear_nprocs() { clear_has_nprocs(); } inline ::google::protobuf::int32 ClusterProto::nprocs() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.nprocs) return nprocs_; } inline void ClusterProto::set_nprocs(::google::protobuf::int32 value) { set_has_nprocs(); nprocs_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.nprocs) } // optional int32 start_port = 13 [default = 6723]; @@ -659,11 +675,13 @@ inline void ClusterProto::clear_start_port() { clear_has_start_port(); } inline ::google::protobuf::int32 ClusterProto::start_port() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.start_port) return start_port_; } inline void ClusterProto::set_start_port(::google::protobuf::int32 value) { set_has_start_port(); start_port_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.start_port) } // required string workspace = 14; @@ -677,54 +695,59 @@ inline void ClusterProto::clear_has_workspace() { _has_bits_[0] &= ~0x00000400u; } inline void ClusterProto::clear_workspace() { - if (workspace_ != &::google::protobuf::internal::kEmptyString) { + if (workspace_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { workspace_->clear(); } clear_has_workspace(); } inline const ::std::string& ClusterProto::workspace() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.workspace) return *workspace_; } inline void ClusterProto::set_workspace(const ::std::string& value) { set_has_workspace(); - if (workspace_ == &::google::protobuf::internal::kEmptyString) { + if (workspace_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { workspace_ = new ::std::string; } workspace_->assign(value); + // @@protoc_insertion_point(field_set:singa.ClusterProto.workspace) } inline void ClusterProto::set_workspace(const char* value) { set_has_workspace(); - if (workspace_ == &::google::protobuf::internal::kEmptyString) { + if (workspace_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { workspace_ = new ::std::string; } workspace_->assign(value); + // @@protoc_insertion_point(field_set_char:singa.ClusterProto.workspace) } inline void ClusterProto::set_workspace(const char* value, size_t size) { set_has_workspace(); - if (workspace_ == &::google::protobuf::internal::kEmptyString) { + if (workspace_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { workspace_ = new ::std::string; } workspace_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:singa.ClusterProto.workspace) } inline ::std::string* ClusterProto::mutable_workspace() { set_has_workspace(); - if (workspace_ == &::google::protobuf::internal::kEmptyString) { + if (workspace_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { workspace_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:singa.ClusterProto.workspace) return workspace_; } inline ::std::string* ClusterProto::release_workspace() { clear_has_workspace(); - if (workspace_ == &::google::protobuf::internal::kEmptyString) { + if (workspace_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = workspace_; - workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void ClusterProto::set_allocated_workspace(::std::string* workspace) { - if (workspace_ != &::google::protobuf::internal::kEmptyString) { + if (workspace_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete workspace_; } if (workspace) { @@ -732,8 +755,9 @@ inline void ClusterProto::set_allocated_workspace(::std::string* workspace) { workspace_ = workspace; } else { clear_has_workspace(); - workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.workspace) } // optional string log_dir = 15; @@ -747,54 +771,59 @@ inline void ClusterProto::clear_has_log_dir() { _has_bits_[0] &= ~0x00000800u; } inline void ClusterProto::clear_log_dir() { - if (log_dir_ != &::google::protobuf::internal::kEmptyString) { + if (log_dir_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { log_dir_->clear(); } clear_has_log_dir(); } inline const ::std::string& ClusterProto::log_dir() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.log_dir) return *log_dir_; } inline void ClusterProto::set_log_dir(const ::std::string& value) { set_has_log_dir(); - if (log_dir_ == &::google::protobuf::internal::kEmptyString) { + if (log_dir_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { log_dir_ = new ::std::string; } log_dir_->assign(value); + // @@protoc_insertion_point(field_set:singa.ClusterProto.log_dir) } inline void ClusterProto::set_log_dir(const char* value) { set_has_log_dir(); - if (log_dir_ == &::google::protobuf::internal::kEmptyString) { + if (log_dir_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { log_dir_ = new ::std::string; } log_dir_->assign(value); + // @@protoc_insertion_point(field_set_char:singa.ClusterProto.log_dir) } inline void ClusterProto::set_log_dir(const char* value, size_t size) { set_has_log_dir(); - if (log_dir_ == &::google::protobuf::internal::kEmptyString) { + if (log_dir_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { log_dir_ = new ::std::string; } log_dir_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:singa.ClusterProto.log_dir) } inline ::std::string* ClusterProto::mutable_log_dir() { set_has_log_dir(); - if (log_dir_ == &::google::protobuf::internal::kEmptyString) { + if (log_dir_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { log_dir_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:singa.ClusterProto.log_dir) return log_dir_; } inline ::std::string* ClusterProto::release_log_dir() { clear_has_log_dir(); - if (log_dir_ == &::google::protobuf::internal::kEmptyString) { + if (log_dir_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = log_dir_; - log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void ClusterProto::set_allocated_log_dir(::std::string* log_dir) { - if (log_dir_ != &::google::protobuf::internal::kEmptyString) { + if (log_dir_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete log_dir_; } if (log_dir) { @@ -802,8 +831,9 @@ inline void ClusterProto::set_allocated_log_dir(::std::string* log_dir) { log_dir_ = log_dir; } else { clear_has_log_dir(); - log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.log_dir) } // repeated .singa.ServerTopology server_group = 20; @@ -814,20 +844,25 @@ inline void ClusterProto::clear_server_group() { server_group_.Clear(); } inline const ::singa::ServerTopology& ClusterProto::server_group(int index) const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.server_group) return server_group_.Get(index); } inline ::singa::ServerTopology* ClusterProto::mutable_server_group(int index) { + // @@protoc_insertion_point(field_mutable:singa.ClusterProto.server_group) return server_group_.Mutable(index); } inline ::singa::ServerTopology* ClusterProto::add_server_group() { + // @@protoc_insertion_point(field_add:singa.ClusterProto.server_group) return server_group_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology >& ClusterProto::server_group() const { + // @@protoc_insertion_point(field_list:singa.ClusterProto.server_group) return server_group_; } inline ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology >* ClusterProto::mutable_server_group() { + // @@protoc_insertion_point(field_mutable_list:singa.ClusterProto.server_group) return &server_group_; } @@ -846,11 +881,13 @@ inline void ClusterProto::clear_stub_timeout() { clear_has_stub_timeout(); } inline ::google::protobuf::int32 ClusterProto::stub_timeout() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.stub_timeout) return stub_timeout_; } inline void ClusterProto::set_stub_timeout(::google::protobuf::int32 value) { set_has_stub_timeout(); stub_timeout_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.stub_timeout) } // optional int32 worker_timeout = 31 [default = 5000]; @@ -868,11 +905,13 @@ inline void ClusterProto::clear_worker_timeout() { clear_has_worker_timeout(); } inline ::google::protobuf::int32 ClusterProto::worker_timeout() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.worker_timeout) return worker_timeout_; } inline void ClusterProto::set_worker_timeout(::google::protobuf::int32 value) { set_has_worker_timeout(); worker_timeout_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.worker_timeout) } // optional int32 server_timeout = 32 [default = 5000]; @@ -890,11 +929,13 @@ inline void ClusterProto::clear_server_timeout() { clear_has_server_timeout(); } inline ::google::protobuf::int32 ClusterProto::server_timeout() const { + // @@protoc_insertion_point(field_get:singa.ClusterProto.server_timeout) return server_timeout_; } inline void ClusterProto::set_server_timeout(::google::protobuf::int32 value) { set_has_server_timeout(); server_timeout_ = value; + // @@protoc_insertion_point(field_set:singa.ClusterProto.server_timeout) } // ------------------------------------------------------------------- @@ -916,11 +957,13 @@ inline void ServerTopology::clear_id() { clear_has_id(); } inline ::google::protobuf::int32 ServerTopology::id() const { + // @@protoc_insertion_point(field_get:singa.ServerTopology.id) return id_; } inline void ServerTopology::set_id(::google::protobuf::int32 value) { set_has_id(); id_ = value; + // @@protoc_insertion_point(field_set:singa.ServerTopology.id) } // optional int32 sync_interval = 2; @@ -938,11 +981,13 @@ inline void ServerTopology::clear_sync_interval() { clear_has_sync_interval(); } inline ::google::protobuf::int32 ServerTopology::sync_interval() const { + // @@protoc_insertion_point(field_get:singa.ServerTopology.sync_interval) return sync_interval_; } inline void ServerTopology::set_sync_interval(::google::protobuf::int32 value) { set_has_sync_interval(); sync_interval_ = value; + // @@protoc_insertion_point(field_set:singa.ServerTopology.sync_interval) } // repeated int32 neighbor = 3; @@ -953,20 +998,25 @@ inline void ServerTopology::clear_neighbor() { neighbor_.Clear(); } inline ::google::protobuf::int32 ServerTopology::neighbor(int index) const { + // @@protoc_insertion_point(field_get:singa.ServerTopology.neighbor) return neighbor_.Get(index); } inline void ServerTopology::set_neighbor(int index, ::google::protobuf::int32 value) { neighbor_.Set(index, value); + // @@protoc_insertion_point(field_set:singa.ServerTopology.neighbor) } inline void ServerTopology::add_neighbor(::google::protobuf::int32 value) { neighbor_.Add(value); + // @@protoc_insertion_point(field_add:singa.ServerTopology.neighbor) } inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& ServerTopology::neighbor() const { + // @@protoc_insertion_point(field_list:singa.ServerTopology.neighbor) return neighbor_; } inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* ServerTopology::mutable_neighbor() { + // @@protoc_insertion_point(field_mutable_list:singa.ServerTopology.neighbor) return &neighbor_; }
