detect worker status through ClusterRuntime which calls zookeeper. stop servers when all workers finish; stop stub when all workers and servers finish
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/c318a98c Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/c318a98c Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/c318a98c Branch: refs/heads/master Commit: c318a98cb6fbcd85de4cd59368d6fd7aa8b0fe67 Parents: bd1d91c Author: wang wei <[email protected]> Authored: Tue May 26 13:39:39 2015 +0800 Committer: wang wei <[email protected]> Committed: Tue May 26 13:39:39 2015 +0800 ---------------------------------------------------------------------- examples/cifar10/model.conf | 8 +- include/trainer/trainer.h | 3 +- include/trainer/worker.h | 2 + include/utils/cluster.h | 7 +- src/proto/cluster.pb.h | 232 ++++++----- src/proto/cluster.proto | 2 + src/proto/model.pb.h | 816 +++++++++++---------------------------- src/proto/model.proto | 1 + src/trainer/server.cc | 8 +- src/trainer/trainer.cc | 55 ++- src/trainer/worker.cc | 21 +- src/utils/cluster.cc | 3 + src/utils/cluster_rt.cc | 20 +- 13 files changed, 457 insertions(+), 721 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c318a98c/examples/cifar10/model.conf ---------------------------------------------------------------------- diff --git a/examples/cifar10/model.conf b/examples/cifar10/model.conf index 76ce8db..86b05af 100644 --- a/examples/cifar10/model.conf +++ b/examples/cifar10/model.conf @@ -1,8 +1,8 @@ name: "cifar10-convnet" -train_steps: 70000 -test_steps:100 -test_frequency:1000 -display_frequency:30 +train_steps: 5 +test_steps:0 +test_frequency:0 +display_frequency:2 updater{ momentum:0.9 weight_decay:0.004 http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c318a98c/include/trainer/trainer.h ---------------------------------------------------------------------- diff --git a/include/trainer/trainer.h b/include/trainer/trainer.h index f5d2591..57fee8c 100644 --- a/include/trainer/trainer.h +++ b/include/trainer/trainer.h @@ -86,7 +86,8 @@ class Trainer{ // point. protected: - void Run(const std::map<int, shared_ptr<ParamShard>>& shards); + void Run(int nworkers, int nservers, + const std::map<int, shared_ptr<ParamShard>>& shards); /** * Register default implementations for all base classes used in the system, * e.g., the Updater, BaseMsg, etc. http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c318a98c/include/trainer/worker.h ---------------------------------------------------------------------- diff --git a/include/trainer/worker.h b/include/trainer/worker.h index a202e93..2c7ce04 100644 --- a/include/trainer/worker.h +++ b/include/trainer/worker.h @@ -27,6 +27,8 @@ class Worker { validation_net_=val_net; } + + void Stop(); int Put(shared_ptr<Param> param, int step); int Get(shared_ptr<Param> param, int step); int Update(shared_ptr<Param> param, int step); http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c318a98c/include/utils/cluster.h ---------------------------------------------------------------------- diff --git a/include/utils/cluster.h b/include/utils/cluster.h index cd1ca76..563045d 100644 --- a/include/utils/cluster.h +++ b/include/utils/cluster.h @@ -6,7 +6,7 @@ #include <memory> #include <vector> #include "proto/cluster.pb.h" -#include "cluster_rt.h" +#include "utils/cluster_rt.h" using std::shared_ptr; using std::string; @@ -122,6 +122,10 @@ class Cluster { return false; } + shared_ptr<ClusterRuntime> runtime() const { + return cluster_rt_; + } + private: Cluster(const ClusterProto &cluster, int procs_id) ; void SetupFolders(const ClusterProto &cluster); @@ -131,6 +135,7 @@ class Cluster { std::vector<std::string> endpoints_; // cluster config proto ClusterProto cluster_; + shared_ptr<ClusterRuntime> cluster_rt_; // make this class a singlton static shared_ptr<Cluster> instance_; }; http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c318a98c/src/proto/cluster.pb.h ---------------------------------------------------------------------- diff --git a/src/proto/cluster.pb.h b/src/proto/cluster.pb.h index 5784587..564be1f 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 < 2006000 +#if GOOGLE_PROTOBUF_VERSION < 2005000 #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 2006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 2005000 < 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,6 +85,7 @@ class ClusterProto : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -190,6 +191,18 @@ class ClusterProto : public ::google::protobuf::Message { inline ::std::string* release_log_dir(); inline void set_allocated_log_dir(::std::string* log_dir); + // optional string zookeeper_host = 16 [default = "localhost:2181"]; + inline bool has_zookeeper_host() const; + inline void clear_zookeeper_host(); + static const int kZookeeperHostFieldNumber = 16; + inline const ::std::string& zookeeper_host() const; + inline void set_zookeeper_host(const ::std::string& value); + inline void set_zookeeper_host(const char* value); + inline void set_zookeeper_host(const char* value, size_t size); + inline ::std::string* mutable_zookeeper_host(); + inline ::std::string* release_zookeeper_host(); + inline void set_allocated_zookeeper_host(::std::string* zookeeper_host); + // repeated .singa.ServerTopology server_group = 20; inline int server_group_size() const; inline void clear_server_group(); @@ -249,6 +262,8 @@ class ClusterProto : public ::google::protobuf::Message { inline void clear_has_workspace(); inline void set_has_log_dir(); inline void clear_has_log_dir(); + inline void set_has_zookeeper_host(); + inline void clear_has_zookeeper_host(); inline void set_has_stub_timeout(); inline void clear_has_stub_timeout(); inline void set_has_worker_timeout(); @@ -258,8 +273,6 @@ 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_; @@ -273,9 +286,15 @@ class ClusterProto : public ::google::protobuf::Message { ::std::string* log_dir_; ::google::protobuf::int32 start_port_; ::google::protobuf::int32 stub_timeout_; + ::std::string* zookeeper_host_; + static ::std::string* _default_zookeeper_host_; ::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_[(17 + 31) / 32]; + friend void protobuf_AddDesc_cluster_2eproto(); friend void protobuf_AssignDesc_cluster_2eproto(); friend void protobuf_ShutdownFile_cluster_2eproto(); @@ -332,6 +351,7 @@ class ServerTopology : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -373,11 +393,13 @@ 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(); @@ -407,13 +429,11 @@ 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; @@ -431,13 +451,11 @@ 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]; @@ -455,13 +473,11 @@ 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,13 +495,11 @@ 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]; @@ -503,13 +517,11 @@ 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]; @@ -527,13 +539,11 @@ 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; @@ -547,59 +557,54 @@ inline void ClusterProto::clear_has_hostfile() { _has_bits_[0] &= ~0x00000040u; } inline void ClusterProto::clear_hostfile() { - if (hostfile_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + if (hostfile_ != &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (hostfile_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (hostfile_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (hostfile_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (hostfile_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (hostfile_ == &::google::protobuf::internal::kEmptyString) { return NULL; } else { ::std::string* temp = hostfile_; - hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); return temp; } } inline void ClusterProto::set_allocated_hostfile(::std::string* hostfile) { - if (hostfile_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + if (hostfile_ != &::google::protobuf::internal::kEmptyString) { delete hostfile_; } if (hostfile) { @@ -607,9 +612,8 @@ inline void ClusterProto::set_allocated_hostfile(::std::string* hostfile) { hostfile_ = hostfile; } else { clear_has_hostfile(); - hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); } - // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.hostfile) } // optional bool server_worker_separate = 11 [default = false]; @@ -627,13 +631,11 @@ 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; @@ -651,13 +653,11 @@ 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]; @@ -675,13 +675,11 @@ 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; @@ -695,59 +693,54 @@ inline void ClusterProto::clear_has_workspace() { _has_bits_[0] &= ~0x00000400u; } inline void ClusterProto::clear_workspace() { - if (workspace_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + if (workspace_ != &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (workspace_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (workspace_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (workspace_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (workspace_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (workspace_ == &::google::protobuf::internal::kEmptyString) { return NULL; } else { ::std::string* temp = workspace_; - workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); return temp; } } inline void ClusterProto::set_allocated_workspace(::std::string* workspace) { - if (workspace_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + if (workspace_ != &::google::protobuf::internal::kEmptyString) { delete workspace_; } if (workspace) { @@ -755,9 +748,8 @@ inline void ClusterProto::set_allocated_workspace(::std::string* workspace) { workspace_ = workspace; } else { clear_has_workspace(); - workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); } - // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.workspace) } // optional string log_dir = 15; @@ -771,59 +763,54 @@ inline void ClusterProto::clear_has_log_dir() { _has_bits_[0] &= ~0x00000800u; } inline void ClusterProto::clear_log_dir() { - if (log_dir_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + if (log_dir_ != &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (log_dir_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (log_dir_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (log_dir_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (log_dir_ == &::google::protobuf::internal::kEmptyString) { 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::GetEmptyStringAlreadyInited()) { + if (log_dir_ == &::google::protobuf::internal::kEmptyString) { return NULL; } else { ::std::string* temp = log_dir_; - log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); return temp; } } inline void ClusterProto::set_allocated_log_dir(::std::string* log_dir) { - if (log_dir_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + if (log_dir_ != &::google::protobuf::internal::kEmptyString) { delete log_dir_; } if (log_dir) { @@ -831,9 +818,78 @@ 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::GetEmptyStringAlreadyInited()); + log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// optional string zookeeper_host = 16 [default = "localhost:2181"]; +inline bool ClusterProto::has_zookeeper_host() const { + return (_has_bits_[0] & 0x00001000u) != 0; +} +inline void ClusterProto::set_has_zookeeper_host() { + _has_bits_[0] |= 0x00001000u; +} +inline void ClusterProto::clear_has_zookeeper_host() { + _has_bits_[0] &= ~0x00001000u; +} +inline void ClusterProto::clear_zookeeper_host() { + if (zookeeper_host_ != _default_zookeeper_host_) { + zookeeper_host_->assign(*_default_zookeeper_host_); + } + clear_has_zookeeper_host(); +} +inline const ::std::string& ClusterProto::zookeeper_host() const { + return *zookeeper_host_; +} +inline void ClusterProto::set_zookeeper_host(const ::std::string& value) { + set_has_zookeeper_host(); + if (zookeeper_host_ == _default_zookeeper_host_) { + zookeeper_host_ = new ::std::string; + } + zookeeper_host_->assign(value); +} +inline void ClusterProto::set_zookeeper_host(const char* value) { + set_has_zookeeper_host(); + if (zookeeper_host_ == _default_zookeeper_host_) { + zookeeper_host_ = new ::std::string; + } + zookeeper_host_->assign(value); +} +inline void ClusterProto::set_zookeeper_host(const char* value, size_t size) { + set_has_zookeeper_host(); + if (zookeeper_host_ == _default_zookeeper_host_) { + zookeeper_host_ = new ::std::string; + } + zookeeper_host_->assign(reinterpret_cast<const char*>(value), size); +} +inline ::std::string* ClusterProto::mutable_zookeeper_host() { + set_has_zookeeper_host(); + if (zookeeper_host_ == _default_zookeeper_host_) { + zookeeper_host_ = new ::std::string(*_default_zookeeper_host_); + } + return zookeeper_host_; +} +inline ::std::string* ClusterProto::release_zookeeper_host() { + clear_has_zookeeper_host(); + if (zookeeper_host_ == _default_zookeeper_host_) { + return NULL; + } else { + ::std::string* temp = zookeeper_host_; + zookeeper_host_ = const_cast< ::std::string*>(_default_zookeeper_host_); + return temp; + } +} +inline void ClusterProto::set_allocated_zookeeper_host(::std::string* zookeeper_host) { + if (zookeeper_host_ != _default_zookeeper_host_) { + delete zookeeper_host_; + } + if (zookeeper_host) { + set_has_zookeeper_host(); + zookeeper_host_ = zookeeper_host; + } else { + clear_has_zookeeper_host(); + zookeeper_host_ = const_cast< ::std::string*>(_default_zookeeper_host_); } - // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.log_dir) } // repeated .singa.ServerTopology server_group = 20; @@ -844,98 +900,87 @@ 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_; } // optional int32 stub_timeout = 30 [default = 5000]; inline bool ClusterProto::has_stub_timeout() const { - return (_has_bits_[0] & 0x00002000u) != 0; + return (_has_bits_[0] & 0x00004000u) != 0; } inline void ClusterProto::set_has_stub_timeout() { - _has_bits_[0] |= 0x00002000u; + _has_bits_[0] |= 0x00004000u; } inline void ClusterProto::clear_has_stub_timeout() { - _has_bits_[0] &= ~0x00002000u; + _has_bits_[0] &= ~0x00004000u; } inline void ClusterProto::clear_stub_timeout() { stub_timeout_ = 5000; 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]; inline bool ClusterProto::has_worker_timeout() const { - return (_has_bits_[0] & 0x00004000u) != 0; + return (_has_bits_[0] & 0x00008000u) != 0; } inline void ClusterProto::set_has_worker_timeout() { - _has_bits_[0] |= 0x00004000u; + _has_bits_[0] |= 0x00008000u; } inline void ClusterProto::clear_has_worker_timeout() { - _has_bits_[0] &= ~0x00004000u; + _has_bits_[0] &= ~0x00008000u; } inline void ClusterProto::clear_worker_timeout() { worker_timeout_ = 5000; 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]; inline bool ClusterProto::has_server_timeout() const { - return (_has_bits_[0] & 0x00008000u) != 0; + return (_has_bits_[0] & 0x00010000u) != 0; } inline void ClusterProto::set_has_server_timeout() { - _has_bits_[0] |= 0x00008000u; + _has_bits_[0] |= 0x00010000u; } inline void ClusterProto::clear_has_server_timeout() { - _has_bits_[0] &= ~0x00008000u; + _has_bits_[0] &= ~0x00010000u; } inline void ClusterProto::clear_server_timeout() { server_timeout_ = 5000; 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) } // ------------------------------------------------------------------- @@ -957,13 +1002,11 @@ 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; @@ -981,13 +1024,11 @@ 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; @@ -998,25 +1039,20 @@ 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_; } http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/c318a98c/src/proto/cluster.proto ---------------------------------------------------------------------- diff --git a/src/proto/cluster.proto b/src/proto/cluster.proto index 05e1e70..ec7ac7f 100644 --- a/src/proto/cluster.proto +++ b/src/proto/cluster.proto @@ -25,6 +25,8 @@ message ClusterProto{ required string workspace=14; // relative path to workspace. if not set, use the default dir of glog optional string log_dir=15; + // ip/hostname : port [, ip/hostname : port] + optional string zookeeper_host=16 [default="localhost:2181"]; // message size limit, default 1MB // optional int32 largest_message=20 [default=1048576]; // optional float bandwidth=21 [default=100];//MB/s
