You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2015/05/03 16:04:10 UTC

[05/12] incubator-singa git commit: Transfer code from nusinga repo to singa apache repo. New commuinication framework is implemented to unify the frameworks of existing distributed deep learning systems. Communication is now implmented using ZeroMQ. API

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/b2dc51d2/src/proto/cluster.pb.h
----------------------------------------------------------------------
diff --git a/src/proto/cluster.pb.h b/src/proto/cluster.pb.h
new file mode 100644
index 0000000..fce32b8
--- /dev/null
+++ b/src/proto/cluster.pb.h
@@ -0,0 +1,989 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: cluster.proto
+
+#ifndef PROTOBUF_cluster_2eproto__INCLUDED
+#define PROTOBUF_cluster_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#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 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.
+#endif
+
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/message.h>
+#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/extension_set.h>
+#include <google/protobuf/unknown_field_set.h>
+// @@protoc_insertion_point(includes)
+
+namespace singa {
+
+// Internal implementation detail -- do not call these.
+void  protobuf_AddDesc_cluster_2eproto();
+void protobuf_AssignDesc_cluster_2eproto();
+void protobuf_ShutdownFile_cluster_2eproto();
+
+class ClusterProto;
+class ServerTopology;
+
+// ===================================================================
+
+class ClusterProto : public ::google::protobuf::Message {
+ public:
+  ClusterProto();
+  virtual ~ClusterProto();
+
+  ClusterProto(const ClusterProto& from);
+
+  inline ClusterProto& operator=(const ClusterProto& from) {
+    CopyFrom(from);
+    return *this;
+  }
+
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ClusterProto& default_instance();
+
+  void Swap(ClusterProto* other);
+
+  // implements Message ----------------------------------------------
+
+  ClusterProto* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ClusterProto& from);
+  void MergeFrom(const ClusterProto& from);
+  void Clear();
+  bool IsInitialized() const;
+
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // optional int32 nworker_groups = 1;
+  inline bool has_nworker_groups() const;
+  inline void clear_nworker_groups();
+  static const int kNworkerGroupsFieldNumber = 1;
+  inline ::google::protobuf::int32 nworker_groups() const;
+  inline void set_nworker_groups(::google::protobuf::int32 value);
+
+  // optional int32 nserver_groups = 2;
+  inline bool has_nserver_groups() const;
+  inline void clear_nserver_groups();
+  static const int kNserverGroupsFieldNumber = 2;
+  inline ::google::protobuf::int32 nserver_groups() const;
+  inline void set_nserver_groups(::google::protobuf::int32 value);
+
+  // optional int32 nworkers_per_group = 3 [default = 1];
+  inline bool has_nworkers_per_group() const;
+  inline void clear_nworkers_per_group();
+  static const int kNworkersPerGroupFieldNumber = 3;
+  inline ::google::protobuf::int32 nworkers_per_group() const;
+  inline void set_nworkers_per_group(::google::protobuf::int32 value);
+
+  // optional int32 nservers_per_group = 4 [default = 1];
+  inline bool has_nservers_per_group() const;
+  inline void clear_nservers_per_group();
+  static const int kNserversPerGroupFieldNumber = 4;
+  inline ::google::protobuf::int32 nservers_per_group() const;
+  inline void set_nservers_per_group(::google::protobuf::int32 value);
+
+  // optional int32 nworkers_per_procs = 5 [default = 1];
+  inline bool has_nworkers_per_procs() const;
+  inline void clear_nworkers_per_procs();
+  static const int kNworkersPerProcsFieldNumber = 5;
+  inline ::google::protobuf::int32 nworkers_per_procs() const;
+  inline void set_nworkers_per_procs(::google::protobuf::int32 value);
+
+  // optional int32 nservers_per_procs = 6 [default = 1];
+  inline bool has_nservers_per_procs() const;
+  inline void clear_nservers_per_procs();
+  static const int kNserversPerProcsFieldNumber = 6;
+  inline ::google::protobuf::int32 nservers_per_procs() const;
+  inline void set_nservers_per_procs(::google::protobuf::int32 value);
+
+  // optional string hostfile = 10;
+  inline bool has_hostfile() const;
+  inline void clear_hostfile();
+  static const int kHostfileFieldNumber = 10;
+  inline const ::std::string& hostfile() const;
+  inline void set_hostfile(const ::std::string& value);
+  inline void set_hostfile(const char* value);
+  inline void set_hostfile(const char* value, size_t size);
+  inline ::std::string* mutable_hostfile();
+  inline ::std::string* release_hostfile();
+  inline void set_allocated_hostfile(::std::string* hostfile);
+
+  // optional bool server_worker_separate = 11 [default = false];
+  inline bool has_server_worker_separate() const;
+  inline void clear_server_worker_separate();
+  static const int kServerWorkerSeparateFieldNumber = 11;
+  inline bool server_worker_separate() const;
+  inline void set_server_worker_separate(bool value);
+
+  // optional int32 nprocs = 12;
+  inline bool has_nprocs() const;
+  inline void clear_nprocs();
+  static const int kNprocsFieldNumber = 12;
+  inline ::google::protobuf::int32 nprocs() const;
+  inline void set_nprocs(::google::protobuf::int32 value);
+
+  // optional int32 start_port = 13 [default = 6723];
+  inline bool has_start_port() const;
+  inline void clear_start_port();
+  static const int kStartPortFieldNumber = 13;
+  inline ::google::protobuf::int32 start_port() const;
+  inline void set_start_port(::google::protobuf::int32 value);
+
+  // required string workspace = 14;
+  inline bool has_workspace() const;
+  inline void clear_workspace();
+  static const int kWorkspaceFieldNumber = 14;
+  inline const ::std::string& workspace() const;
+  inline void set_workspace(const ::std::string& value);
+  inline void set_workspace(const char* value);
+  inline void set_workspace(const char* value, size_t size);
+  inline ::std::string* mutable_workspace();
+  inline ::std::string* release_workspace();
+  inline void set_allocated_workspace(::std::string* workspace);
+
+  // optional string log_dir = 15;
+  inline bool has_log_dir() const;
+  inline void clear_log_dir();
+  static const int kLogDirFieldNumber = 15;
+  inline const ::std::string& log_dir() const;
+  inline void set_log_dir(const ::std::string& value);
+  inline void set_log_dir(const char* value);
+  inline void set_log_dir(const char* value, size_t size);
+  inline ::std::string* mutable_log_dir();
+  inline ::std::string* release_log_dir();
+  inline void set_allocated_log_dir(::std::string* log_dir);
+
+  // repeated .singa.ServerTopology server_group = 20;
+  inline int server_group_size() const;
+  inline void clear_server_group();
+  static const int kServerGroupFieldNumber = 20;
+  inline const ::singa::ServerTopology& server_group(int index) const;
+  inline ::singa::ServerTopology* mutable_server_group(int index);
+  inline ::singa::ServerTopology* add_server_group();
+  inline const ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology >&
+      server_group() const;
+  inline ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology >*
+      mutable_server_group();
+
+  // optional int32 stub_timeout = 30 [default = 5000];
+  inline bool has_stub_timeout() const;
+  inline void clear_stub_timeout();
+  static const int kStubTimeoutFieldNumber = 30;
+  inline ::google::protobuf::int32 stub_timeout() const;
+  inline void set_stub_timeout(::google::protobuf::int32 value);
+
+  // optional int32 worker_timeout = 31 [default = 5000];
+  inline bool has_worker_timeout() const;
+  inline void clear_worker_timeout();
+  static const int kWorkerTimeoutFieldNumber = 31;
+  inline ::google::protobuf::int32 worker_timeout() const;
+  inline void set_worker_timeout(::google::protobuf::int32 value);
+
+  // optional int32 server_timeout = 32 [default = 5000];
+  inline bool has_server_timeout() const;
+  inline void clear_server_timeout();
+  static const int kServerTimeoutFieldNumber = 32;
+  inline ::google::protobuf::int32 server_timeout() const;
+  inline void set_server_timeout(::google::protobuf::int32 value);
+
+  // @@protoc_insertion_point(class_scope:singa.ClusterProto)
+ private:
+  inline void set_has_nworker_groups();
+  inline void clear_has_nworker_groups();
+  inline void set_has_nserver_groups();
+  inline void clear_has_nserver_groups();
+  inline void set_has_nworkers_per_group();
+  inline void clear_has_nworkers_per_group();
+  inline void set_has_nservers_per_group();
+  inline void clear_has_nservers_per_group();
+  inline void set_has_nworkers_per_procs();
+  inline void clear_has_nworkers_per_procs();
+  inline void set_has_nservers_per_procs();
+  inline void clear_has_nservers_per_procs();
+  inline void set_has_hostfile();
+  inline void clear_has_hostfile();
+  inline void set_has_server_worker_separate();
+  inline void clear_has_server_worker_separate();
+  inline void set_has_nprocs();
+  inline void clear_has_nprocs();
+  inline void set_has_start_port();
+  inline void clear_has_start_port();
+  inline void set_has_workspace();
+  inline void clear_has_workspace();
+  inline void set_has_log_dir();
+  inline void clear_has_log_dir();
+  inline void set_has_stub_timeout();
+  inline void clear_has_stub_timeout();
+  inline void set_has_worker_timeout();
+  inline void clear_has_worker_timeout();
+  inline void set_has_server_timeout();
+  inline void clear_has_server_timeout();
+
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+
+  ::google::protobuf::int32 nworker_groups_;
+  ::google::protobuf::int32 nserver_groups_;
+  ::google::protobuf::int32 nworkers_per_group_;
+  ::google::protobuf::int32 nservers_per_group_;
+  ::google::protobuf::int32 nworkers_per_procs_;
+  ::google::protobuf::int32 nservers_per_procs_;
+  ::std::string* hostfile_;
+  bool server_worker_separate_;
+  ::google::protobuf::int32 nprocs_;
+  ::std::string* workspace_;
+  ::std::string* log_dir_;
+  ::google::protobuf::int32 start_port_;
+  ::google::protobuf::int32 stub_timeout_;
+  ::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();
+
+  void InitAsDefaultInstance();
+  static ClusterProto* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class ServerTopology : public ::google::protobuf::Message {
+ public:
+  ServerTopology();
+  virtual ~ServerTopology();
+
+  ServerTopology(const ServerTopology& from);
+
+  inline ServerTopology& operator=(const ServerTopology& from) {
+    CopyFrom(from);
+    return *this;
+  }
+
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ServerTopology& default_instance();
+
+  void Swap(ServerTopology* other);
+
+  // implements Message ----------------------------------------------
+
+  ServerTopology* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ServerTopology& from);
+  void MergeFrom(const ServerTopology& from);
+  void Clear();
+  bool IsInitialized() const;
+
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // required int32 id = 1;
+  inline bool has_id() const;
+  inline void clear_id();
+  static const int kIdFieldNumber = 1;
+  inline ::google::protobuf::int32 id() const;
+  inline void set_id(::google::protobuf::int32 value);
+
+  // optional int32 sync_interval = 2;
+  inline bool has_sync_interval() const;
+  inline void clear_sync_interval();
+  static const int kSyncIntervalFieldNumber = 2;
+  inline ::google::protobuf::int32 sync_interval() const;
+  inline void set_sync_interval(::google::protobuf::int32 value);
+
+  // repeated int32 neighbor = 3;
+  inline int neighbor_size() const;
+  inline void clear_neighbor();
+  static const int kNeighborFieldNumber = 3;
+  inline ::google::protobuf::int32 neighbor(int index) const;
+  inline void set_neighbor(int index, ::google::protobuf::int32 value);
+  inline void add_neighbor(::google::protobuf::int32 value);
+  inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+      neighbor() const;
+  inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+      mutable_neighbor();
+
+  // @@protoc_insertion_point(class_scope:singa.ServerTopology)
+ private:
+  inline void set_has_id();
+  inline void clear_has_id();
+  inline void set_has_sync_interval();
+  inline void clear_has_sync_interval();
+
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+
+  ::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();
+
+  void InitAsDefaultInstance();
+  static ServerTopology* default_instance_;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+// ClusterProto
+
+// optional int32 nworker_groups = 1;
+inline bool ClusterProto::has_nworker_groups() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void ClusterProto::set_has_nworker_groups() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void ClusterProto::clear_has_nworker_groups() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void ClusterProto::clear_nworker_groups() {
+  nworker_groups_ = 0;
+  clear_has_nworker_groups();
+}
+inline ::google::protobuf::int32 ClusterProto::nworker_groups() const {
+  return nworker_groups_;
+}
+inline void ClusterProto::set_nworker_groups(::google::protobuf::int32 value) {
+  set_has_nworker_groups();
+  nworker_groups_ = value;
+}
+
+// optional int32 nserver_groups = 2;
+inline bool ClusterProto::has_nserver_groups() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void ClusterProto::set_has_nserver_groups() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void ClusterProto::clear_has_nserver_groups() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void ClusterProto::clear_nserver_groups() {
+  nserver_groups_ = 0;
+  clear_has_nserver_groups();
+}
+inline ::google::protobuf::int32 ClusterProto::nserver_groups() const {
+  return nserver_groups_;
+}
+inline void ClusterProto::set_nserver_groups(::google::protobuf::int32 value) {
+  set_has_nserver_groups();
+  nserver_groups_ = value;
+}
+
+// optional int32 nworkers_per_group = 3 [default = 1];
+inline bool ClusterProto::has_nworkers_per_group() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void ClusterProto::set_has_nworkers_per_group() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void ClusterProto::clear_has_nworkers_per_group() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void ClusterProto::clear_nworkers_per_group() {
+  nworkers_per_group_ = 1;
+  clear_has_nworkers_per_group();
+}
+inline ::google::protobuf::int32 ClusterProto::nworkers_per_group() const {
+  return nworkers_per_group_;
+}
+inline void ClusterProto::set_nworkers_per_group(::google::protobuf::int32 value) {
+  set_has_nworkers_per_group();
+  nworkers_per_group_ = value;
+}
+
+// optional int32 nservers_per_group = 4 [default = 1];
+inline bool ClusterProto::has_nservers_per_group() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void ClusterProto::set_has_nservers_per_group() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void ClusterProto::clear_has_nservers_per_group() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void ClusterProto::clear_nservers_per_group() {
+  nservers_per_group_ = 1;
+  clear_has_nservers_per_group();
+}
+inline ::google::protobuf::int32 ClusterProto::nservers_per_group() const {
+  return nservers_per_group_;
+}
+inline void ClusterProto::set_nservers_per_group(::google::protobuf::int32 value) {
+  set_has_nservers_per_group();
+  nservers_per_group_ = value;
+}
+
+// optional int32 nworkers_per_procs = 5 [default = 1];
+inline bool ClusterProto::has_nworkers_per_procs() const {
+  return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void ClusterProto::set_has_nworkers_per_procs() {
+  _has_bits_[0] |= 0x00000010u;
+}
+inline void ClusterProto::clear_has_nworkers_per_procs() {
+  _has_bits_[0] &= ~0x00000010u;
+}
+inline void ClusterProto::clear_nworkers_per_procs() {
+  nworkers_per_procs_ = 1;
+  clear_has_nworkers_per_procs();
+}
+inline ::google::protobuf::int32 ClusterProto::nworkers_per_procs() const {
+  return nworkers_per_procs_;
+}
+inline void ClusterProto::set_nworkers_per_procs(::google::protobuf::int32 value) {
+  set_has_nworkers_per_procs();
+  nworkers_per_procs_ = value;
+}
+
+// optional int32 nservers_per_procs = 6 [default = 1];
+inline bool ClusterProto::has_nservers_per_procs() const {
+  return (_has_bits_[0] & 0x00000020u) != 0;
+}
+inline void ClusterProto::set_has_nservers_per_procs() {
+  _has_bits_[0] |= 0x00000020u;
+}
+inline void ClusterProto::clear_has_nservers_per_procs() {
+  _has_bits_[0] &= ~0x00000020u;
+}
+inline void ClusterProto::clear_nservers_per_procs() {
+  nservers_per_procs_ = 1;
+  clear_has_nservers_per_procs();
+}
+inline ::google::protobuf::int32 ClusterProto::nservers_per_procs() const {
+  return nservers_per_procs_;
+}
+inline void ClusterProto::set_nservers_per_procs(::google::protobuf::int32 value) {
+  set_has_nservers_per_procs();
+  nservers_per_procs_ = value;
+}
+
+// optional string hostfile = 10;
+inline bool ClusterProto::has_hostfile() const {
+  return (_has_bits_[0] & 0x00000040u) != 0;
+}
+inline void ClusterProto::set_has_hostfile() {
+  _has_bits_[0] |= 0x00000040u;
+}
+inline void ClusterProto::clear_has_hostfile() {
+  _has_bits_[0] &= ~0x00000040u;
+}
+inline void ClusterProto::clear_hostfile() {
+  if (hostfile_ != &::google::protobuf::internal::kEmptyString) {
+    hostfile_->clear();
+  }
+  clear_has_hostfile();
+}
+inline const ::std::string& ClusterProto::hostfile() const {
+  return *hostfile_;
+}
+inline void ClusterProto::set_hostfile(const ::std::string& value) {
+  set_has_hostfile();
+  if (hostfile_ == &::google::protobuf::internal::kEmptyString) {
+    hostfile_ = new ::std::string;
+  }
+  hostfile_->assign(value);
+}
+inline void ClusterProto::set_hostfile(const char* value) {
+  set_has_hostfile();
+  if (hostfile_ == &::google::protobuf::internal::kEmptyString) {
+    hostfile_ = new ::std::string;
+  }
+  hostfile_->assign(value);
+}
+inline void ClusterProto::set_hostfile(const char* value, size_t size) {
+  set_has_hostfile();
+  if (hostfile_ == &::google::protobuf::internal::kEmptyString) {
+    hostfile_ = new ::std::string;
+  }
+  hostfile_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* ClusterProto::mutable_hostfile() {
+  set_has_hostfile();
+  if (hostfile_ == &::google::protobuf::internal::kEmptyString) {
+    hostfile_ = new ::std::string;
+  }
+  return hostfile_;
+}
+inline ::std::string* ClusterProto::release_hostfile() {
+  clear_has_hostfile();
+  if (hostfile_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = hostfile_;
+    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::kEmptyString) {
+    delete hostfile_;
+  }
+  if (hostfile) {
+    set_has_hostfile();
+    hostfile_ = hostfile;
+  } else {
+    clear_has_hostfile();
+    hostfile_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// optional bool server_worker_separate = 11 [default = false];
+inline bool ClusterProto::has_server_worker_separate() const {
+  return (_has_bits_[0] & 0x00000080u) != 0;
+}
+inline void ClusterProto::set_has_server_worker_separate() {
+  _has_bits_[0] |= 0x00000080u;
+}
+inline void ClusterProto::clear_has_server_worker_separate() {
+  _has_bits_[0] &= ~0x00000080u;
+}
+inline void ClusterProto::clear_server_worker_separate() {
+  server_worker_separate_ = false;
+  clear_has_server_worker_separate();
+}
+inline bool ClusterProto::server_worker_separate() const {
+  return server_worker_separate_;
+}
+inline void ClusterProto::set_server_worker_separate(bool value) {
+  set_has_server_worker_separate();
+  server_worker_separate_ = value;
+}
+
+// optional int32 nprocs = 12;
+inline bool ClusterProto::has_nprocs() const {
+  return (_has_bits_[0] & 0x00000100u) != 0;
+}
+inline void ClusterProto::set_has_nprocs() {
+  _has_bits_[0] |= 0x00000100u;
+}
+inline void ClusterProto::clear_has_nprocs() {
+  _has_bits_[0] &= ~0x00000100u;
+}
+inline void ClusterProto::clear_nprocs() {
+  nprocs_ = 0;
+  clear_has_nprocs();
+}
+inline ::google::protobuf::int32 ClusterProto::nprocs() const {
+  return nprocs_;
+}
+inline void ClusterProto::set_nprocs(::google::protobuf::int32 value) {
+  set_has_nprocs();
+  nprocs_ = value;
+}
+
+// optional int32 start_port = 13 [default = 6723];
+inline bool ClusterProto::has_start_port() const {
+  return (_has_bits_[0] & 0x00000200u) != 0;
+}
+inline void ClusterProto::set_has_start_port() {
+  _has_bits_[0] |= 0x00000200u;
+}
+inline void ClusterProto::clear_has_start_port() {
+  _has_bits_[0] &= ~0x00000200u;
+}
+inline void ClusterProto::clear_start_port() {
+  start_port_ = 6723;
+  clear_has_start_port();
+}
+inline ::google::protobuf::int32 ClusterProto::start_port() const {
+  return start_port_;
+}
+inline void ClusterProto::set_start_port(::google::protobuf::int32 value) {
+  set_has_start_port();
+  start_port_ = value;
+}
+
+// required string workspace = 14;
+inline bool ClusterProto::has_workspace() const {
+  return (_has_bits_[0] & 0x00000400u) != 0;
+}
+inline void ClusterProto::set_has_workspace() {
+  _has_bits_[0] |= 0x00000400u;
+}
+inline void ClusterProto::clear_has_workspace() {
+  _has_bits_[0] &= ~0x00000400u;
+}
+inline void ClusterProto::clear_workspace() {
+  if (workspace_ != &::google::protobuf::internal::kEmptyString) {
+    workspace_->clear();
+  }
+  clear_has_workspace();
+}
+inline const ::std::string& ClusterProto::workspace() const {
+  return *workspace_;
+}
+inline void ClusterProto::set_workspace(const ::std::string& value) {
+  set_has_workspace();
+  if (workspace_ == &::google::protobuf::internal::kEmptyString) {
+    workspace_ = new ::std::string;
+  }
+  workspace_->assign(value);
+}
+inline void ClusterProto::set_workspace(const char* value) {
+  set_has_workspace();
+  if (workspace_ == &::google::protobuf::internal::kEmptyString) {
+    workspace_ = new ::std::string;
+  }
+  workspace_->assign(value);
+}
+inline void ClusterProto::set_workspace(const char* value, size_t size) {
+  set_has_workspace();
+  if (workspace_ == &::google::protobuf::internal::kEmptyString) {
+    workspace_ = new ::std::string;
+  }
+  workspace_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* ClusterProto::mutable_workspace() {
+  set_has_workspace();
+  if (workspace_ == &::google::protobuf::internal::kEmptyString) {
+    workspace_ = new ::std::string;
+  }
+  return workspace_;
+}
+inline ::std::string* ClusterProto::release_workspace() {
+  clear_has_workspace();
+  if (workspace_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = workspace_;
+    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::kEmptyString) {
+    delete workspace_;
+  }
+  if (workspace) {
+    set_has_workspace();
+    workspace_ = workspace;
+  } else {
+    clear_has_workspace();
+    workspace_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// optional string log_dir = 15;
+inline bool ClusterProto::has_log_dir() const {
+  return (_has_bits_[0] & 0x00000800u) != 0;
+}
+inline void ClusterProto::set_has_log_dir() {
+  _has_bits_[0] |= 0x00000800u;
+}
+inline void ClusterProto::clear_has_log_dir() {
+  _has_bits_[0] &= ~0x00000800u;
+}
+inline void ClusterProto::clear_log_dir() {
+  if (log_dir_ != &::google::protobuf::internal::kEmptyString) {
+    log_dir_->clear();
+  }
+  clear_has_log_dir();
+}
+inline const ::std::string& ClusterProto::log_dir() const {
+  return *log_dir_;
+}
+inline void ClusterProto::set_log_dir(const ::std::string& value) {
+  set_has_log_dir();
+  if (log_dir_ == &::google::protobuf::internal::kEmptyString) {
+    log_dir_ = new ::std::string;
+  }
+  log_dir_->assign(value);
+}
+inline void ClusterProto::set_log_dir(const char* value) {
+  set_has_log_dir();
+  if (log_dir_ == &::google::protobuf::internal::kEmptyString) {
+    log_dir_ = new ::std::string;
+  }
+  log_dir_->assign(value);
+}
+inline void ClusterProto::set_log_dir(const char* value, size_t size) {
+  set_has_log_dir();
+  if (log_dir_ == &::google::protobuf::internal::kEmptyString) {
+    log_dir_ = new ::std::string;
+  }
+  log_dir_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* ClusterProto::mutable_log_dir() {
+  set_has_log_dir();
+  if (log_dir_ == &::google::protobuf::internal::kEmptyString) {
+    log_dir_ = new ::std::string;
+  }
+  return log_dir_;
+}
+inline ::std::string* ClusterProto::release_log_dir() {
+  clear_has_log_dir();
+  if (log_dir_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = log_dir_;
+    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::kEmptyString) {
+    delete log_dir_;
+  }
+  if (log_dir) {
+    set_has_log_dir();
+    log_dir_ = log_dir;
+  } else {
+    clear_has_log_dir();
+    log_dir_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// repeated .singa.ServerTopology server_group = 20;
+inline int ClusterProto::server_group_size() const {
+  return server_group_.size();
+}
+inline void ClusterProto::clear_server_group() {
+  server_group_.Clear();
+}
+inline const ::singa::ServerTopology& ClusterProto::server_group(int index) const {
+  return server_group_.Get(index);
+}
+inline ::singa::ServerTopology* ClusterProto::mutable_server_group(int index) {
+  return server_group_.Mutable(index);
+}
+inline ::singa::ServerTopology* ClusterProto::add_server_group() {
+  return server_group_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology >&
+ClusterProto::server_group() const {
+  return server_group_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology >*
+ClusterProto::mutable_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;
+}
+inline void ClusterProto::set_has_stub_timeout() {
+  _has_bits_[0] |= 0x00002000u;
+}
+inline void ClusterProto::clear_has_stub_timeout() {
+  _has_bits_[0] &= ~0x00002000u;
+}
+inline void ClusterProto::clear_stub_timeout() {
+  stub_timeout_ = 5000;
+  clear_has_stub_timeout();
+}
+inline ::google::protobuf::int32 ClusterProto::stub_timeout() const {
+  return stub_timeout_;
+}
+inline void ClusterProto::set_stub_timeout(::google::protobuf::int32 value) {
+  set_has_stub_timeout();
+  stub_timeout_ = value;
+}
+
+// optional int32 worker_timeout = 31 [default = 5000];
+inline bool ClusterProto::has_worker_timeout() const {
+  return (_has_bits_[0] & 0x00004000u) != 0;
+}
+inline void ClusterProto::set_has_worker_timeout() {
+  _has_bits_[0] |= 0x00004000u;
+}
+inline void ClusterProto::clear_has_worker_timeout() {
+  _has_bits_[0] &= ~0x00004000u;
+}
+inline void ClusterProto::clear_worker_timeout() {
+  worker_timeout_ = 5000;
+  clear_has_worker_timeout();
+}
+inline ::google::protobuf::int32 ClusterProto::worker_timeout() const {
+  return worker_timeout_;
+}
+inline void ClusterProto::set_worker_timeout(::google::protobuf::int32 value) {
+  set_has_worker_timeout();
+  worker_timeout_ = value;
+}
+
+// optional int32 server_timeout = 32 [default = 5000];
+inline bool ClusterProto::has_server_timeout() const {
+  return (_has_bits_[0] & 0x00008000u) != 0;
+}
+inline void ClusterProto::set_has_server_timeout() {
+  _has_bits_[0] |= 0x00008000u;
+}
+inline void ClusterProto::clear_has_server_timeout() {
+  _has_bits_[0] &= ~0x00008000u;
+}
+inline void ClusterProto::clear_server_timeout() {
+  server_timeout_ = 5000;
+  clear_has_server_timeout();
+}
+inline ::google::protobuf::int32 ClusterProto::server_timeout() const {
+  return server_timeout_;
+}
+inline void ClusterProto::set_server_timeout(::google::protobuf::int32 value) {
+  set_has_server_timeout();
+  server_timeout_ = value;
+}
+
+// -------------------------------------------------------------------
+
+// ServerTopology
+
+// required int32 id = 1;
+inline bool ServerTopology::has_id() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void ServerTopology::set_has_id() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void ServerTopology::clear_has_id() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void ServerTopology::clear_id() {
+  id_ = 0;
+  clear_has_id();
+}
+inline ::google::protobuf::int32 ServerTopology::id() const {
+  return id_;
+}
+inline void ServerTopology::set_id(::google::protobuf::int32 value) {
+  set_has_id();
+  id_ = value;
+}
+
+// optional int32 sync_interval = 2;
+inline bool ServerTopology::has_sync_interval() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void ServerTopology::set_has_sync_interval() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void ServerTopology::clear_has_sync_interval() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void ServerTopology::clear_sync_interval() {
+  sync_interval_ = 0;
+  clear_has_sync_interval();
+}
+inline ::google::protobuf::int32 ServerTopology::sync_interval() const {
+  return sync_interval_;
+}
+inline void ServerTopology::set_sync_interval(::google::protobuf::int32 value) {
+  set_has_sync_interval();
+  sync_interval_ = value;
+}
+
+// repeated int32 neighbor = 3;
+inline int ServerTopology::neighbor_size() const {
+  return neighbor_.size();
+}
+inline void ServerTopology::clear_neighbor() {
+  neighbor_.Clear();
+}
+inline ::google::protobuf::int32 ServerTopology::neighbor(int index) const {
+  return neighbor_.Get(index);
+}
+inline void ServerTopology::set_neighbor(int index, ::google::protobuf::int32 value) {
+  neighbor_.Set(index, value);
+}
+inline void ServerTopology::add_neighbor(::google::protobuf::int32 value) {
+  neighbor_.Add(value);
+}
+inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+ServerTopology::neighbor() const {
+  return neighbor_;
+}
+inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+ServerTopology::mutable_neighbor() {
+  return &neighbor_;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace singa
+
+#ifndef SWIG
+namespace google {
+namespace protobuf {
+
+
+}  // namespace google
+}  // namespace protobuf
+#endif  // SWIG
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_cluster_2eproto__INCLUDED

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/b2dc51d2/src/proto/cluster.proto
----------------------------------------------------------------------
diff --git a/src/proto/cluster.proto b/src/proto/cluster.proto
new file mode 100644
index 0000000..05e1e70
--- /dev/null
+++ b/src/proto/cluster.proto
@@ -0,0 +1,45 @@
+package singa;
+
+message ClusterProto{
+  optional int32 nworker_groups=1;
+  optional int32 nserver_groups=2;
+  optional int32 nworkers_per_group=3 [default=1];
+  optional int32 nservers_per_group=4 [default=1];
+  optional int32 nworkers_per_procs=5 [default=1];
+  optional int32 nservers_per_procs=6 [default=1];
+
+  // Used in standalone mode, one ip or hostname per line
+  // For YARN or Mesos version, the processes are allocted dynamically,
+  // hence no need to specify the hosts statically
+  optional string hostfile=10;
+
+  // servers and workers in different processes?
+  optional bool server_worker_separate=11 [default=false];
+
+  // if configured, must be consistent with the one computed from 1-6
+  optional int32 nprocs=12;
+
+  // port number is used by ZeroMQ
+  optional int32 start_port=13 [default=6723];
+  // local workspace, train/val/test shards, checkpoint files
+  required string workspace=14;
+  // relative path to workspace. if not set, use the default dir of glog
+  optional string log_dir=15;
+  // message size limit, default 1MB
+  // optional int32 largest_message=20 [default=1048576];
+  // optional float bandwidth=21 [default=100];//MB/s
+
+	repeated ServerTopology server_group = 20;
+
+  optional int32 stub_timeout=30 [default=5000];
+  optional int32 worker_timeout=31 [default=5000];
+  optional int32 server_timeout=32 [default=5000];
+}
+
+message ServerTopology{
+  // group id
+	required int32 id = 1;
+	optional int32 sync_interval = 2;
+  // neighbor group id
+	repeated int32 neighbor = 3;
+}