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/27 16:39:16 UTC
[15/22] incubator-singa git commit: add scripts for running singa job;
it start/stop zookeeper service automatically;
add scripts for running singa job; it start/stop zookeeper service automatically;
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/9827f4f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/9827f4f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/9827f4f6
Branch: refs/heads/master
Commit: 9827f4f612ce8f6024229ae01d543a4b96cf7b42
Parents: 96121ba
Author: wang sheng <wa...@gmail.com>
Authored: Tue May 26 21:53:06 2015 +0800
Committer: wang sheng <wa...@gmail.com>
Committed: Tue May 26 21:53:06 2015 +0800
----------------------------------------------------------------------
bin/singa-cleanup.sh | 36 ++
bin/singa-run.sh | 52 +++
bin/zk-service.sh | 72 ++++
examples/cifar10/cluster.conf | 4 +-
include/utils/cluster_rt.h | 2 +
src/proto/cluster.pb.h | 136 +++++--
src/proto/model.pb.h | 811 +++++++++++++++++++++++++++----------
src/utils/cluster_rt.cc | 23 +-
8 files changed, 875 insertions(+), 261 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9827f4f6/bin/singa-cleanup.sh
----------------------------------------------------------------------
diff --git a/bin/singa-cleanup.sh b/bin/singa-cleanup.sh
new file mode 100755
index 0000000..7355a2b
--- /dev/null
+++ b/bin/singa-cleanup.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Copyright 2015 The Apache Software Foundation
+# *
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+#
+# Manage a zookeeper service
+#
+
+usage="Usage: singa-cleanup.sh"
+
+#if [ $# -le 0 ]; then
+# echo $usage
+# exit 1
+#fi
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin">/dev/null; pwd`
+
+$bin/zk-service.sh stop
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9827f4f6/bin/singa-run.sh
----------------------------------------------------------------------
diff --git a/bin/singa-run.sh b/bin/singa-run.sh
new file mode 100755
index 0000000..5b7462b
--- /dev/null
+++ b/bin/singa-run.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Copyright 2015 The Apache Software Foundation
+# *
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+#
+# Run a Singa job
+#
+
+usage="Usage: singa-run.sh"
+
+#if [ $# -le 0 ]; then
+# echo $usage
+# exit 1
+#fi
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin">/dev/null; pwd`
+
+#get argument
+cmd=$1
+
+#$bin/singa-cleanup.sh
+
+cd $bin
+$bin/zk-service.sh start
+
+#wait for zk service to be up
+sleep 3
+
+#echo $@
+cd $bin/..
+./singa $@
+
+cd $bin
+$bin/zk-service.sh stop
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9827f4f6/bin/zk-service.sh
----------------------------------------------------------------------
diff --git a/bin/zk-service.sh b/bin/zk-service.sh
new file mode 100755
index 0000000..8c7f10c
--- /dev/null
+++ b/bin/zk-service.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Copyright 2015 The Apache Software Foundation
+# *
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+#
+# Manage a zookeeper service
+#
+
+usage="Usage: zk-service.sh (start|stop)"
+
+if [ $# -le 0 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin">/dev/null; pwd`
+zkbin=$bin/../thirdparty/zookeeper-3.4.6/bin
+
+#echo $zkbin
+
+if [ "$SINGA_MANAGES_ZK" = "" ]; then
+ SINGA_MANAGES_ZK=true
+fi
+
+#echo 'SINGA_MANAGES_ZK='$SINGA_MANAGES_ZK
+
+#get argument
+cmd=$1
+
+case $cmd in
+
+(start)
+ #start zk service
+ if [ "$SINGA_MANAGES_ZK" = "true" ]; then
+ #check zoo,cfg
+ if [ ! -f $zkbin/../conf/zoo.cfg ]; then
+ echo 'zoo.cfg not found, create from sample.cfg'
+ cp $zkbin/../conf/zoo_sample.cfg $zkbin/../conf/zoo.cfg
+ fi
+ #echo 'starting zookeeper service...'
+ $zkbin/zkServer.sh start
+ fi
+ ;;
+
+(stop)
+ #stop zk service
+ if [ "$SINGA_MANAGES_ZK" = "true" ]; then
+ #echo 'stopping zookeeper service...'
+ $zkbin/zkServer.sh stop
+ fi
+ ;;
+
+esac
+
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9827f4f6/examples/cifar10/cluster.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/cluster.conf b/examples/cifar10/cluster.conf
index eaad0c8..88c3d4b 100644
--- a/examples/cifar10/cluster.conf
+++ b/examples/cifar10/cluster.conf
@@ -1,6 +1,6 @@
nworker_groups: 1
nserver_groups: 1
nservers_per_group: 1
-nworkers_per_group: 4
-nworkers_per_procs: 4
+nworkers_per_group: 2
+nworkers_per_procs: 2
workspace: "examples/cifar10/"
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9827f4f6/include/utils/cluster_rt.h
----------------------------------------------------------------------
diff --git a/include/utils/cluster_rt.h b/include/utils/cluster_rt.h
index 54a13c5..7b5f361 100644
--- a/include/utils/cluster_rt.h
+++ b/include/utils/cluster_rt.h
@@ -76,6 +76,8 @@ class ZKClusterRT : public ClusterRuntime{
const int MAX_BUF_LEN = 50;
const int RETRY_NUM = 10;
const int SLEEP_SEC = 1;
+ const string ZK_P_SINGA = "/singa";
+ const string ZK_P_STATUS = "/status";
};
} // namespace singa
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9827f4f6/src/proto/cluster.pb.h
----------------------------------------------------------------------
diff --git a/src/proto/cluster.pb.h b/src/proto/cluster.pb.h
index 564be1f..7468c31 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 ----------------------------------------------------
@@ -273,6 +272,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_;
@@ -286,15 +287,11 @@ 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_;
+ ::std::string* 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();
@@ -351,7 +348,6 @@ class ServerTopology : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
-
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -393,13 +389,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();
@@ -429,11 +423,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;
@@ -451,11 +447,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];
@@ -473,11 +471,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];
@@ -495,11 +495,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];
@@ -517,11 +519,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];
@@ -539,11 +543,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;
@@ -557,54 +563,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) {
@@ -612,8 +623,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];
@@ -631,11 +643,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;
@@ -653,11 +667,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];
@@ -675,11 +691,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;
@@ -693,54 +711,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) {
@@ -748,8 +771,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;
@@ -763,54 +787,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) {
@@ -818,8 +847,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)
}
// optional string zookeeper_host = 16 [default = "localhost:2181"];
@@ -839,6 +869,7 @@ inline void ClusterProto::clear_zookeeper_host() {
clear_has_zookeeper_host();
}
inline const ::std::string& ClusterProto::zookeeper_host() const {
+ // @@protoc_insertion_point(field_get:singa.ClusterProto.zookeeper_host)
return *zookeeper_host_;
}
inline void ClusterProto::set_zookeeper_host(const ::std::string& value) {
@@ -847,6 +878,7 @@ inline void ClusterProto::set_zookeeper_host(const ::std::string& value) {
zookeeper_host_ = new ::std::string;
}
zookeeper_host_->assign(value);
+ // @@protoc_insertion_point(field_set:singa.ClusterProto.zookeeper_host)
}
inline void ClusterProto::set_zookeeper_host(const char* value) {
set_has_zookeeper_host();
@@ -854,6 +886,7 @@ inline void ClusterProto::set_zookeeper_host(const char* value) {
zookeeper_host_ = new ::std::string;
}
zookeeper_host_->assign(value);
+ // @@protoc_insertion_point(field_set_char:singa.ClusterProto.zookeeper_host)
}
inline void ClusterProto::set_zookeeper_host(const char* value, size_t size) {
set_has_zookeeper_host();
@@ -861,12 +894,14 @@ inline void ClusterProto::set_zookeeper_host(const char* value, size_t size) {
zookeeper_host_ = new ::std::string;
}
zookeeper_host_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:singa.ClusterProto.zookeeper_host)
}
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_);
}
+ // @@protoc_insertion_point(field_mutable:singa.ClusterProto.zookeeper_host)
return zookeeper_host_;
}
inline ::std::string* ClusterProto::release_zookeeper_host() {
@@ -890,6 +925,7 @@ inline void ClusterProto::set_allocated_zookeeper_host(::std::string* zookeeper_
clear_has_zookeeper_host();
zookeeper_host_ = const_cast< ::std::string*>(_default_zookeeper_host_);
}
+ // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.zookeeper_host)
}
// repeated .singa.ServerTopology server_group = 20;
@@ -900,20 +936,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_;
}
@@ -932,11 +973,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];
@@ -954,11 +997,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];
@@ -976,11 +1021,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)
}
// -------------------------------------------------------------------
@@ -1002,11 +1049,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;
@@ -1024,11 +1073,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;
@@ -1039,20 +1090,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_;
}