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/06/15 08:42:29 UTC
[01/10] incubator-singa git commit: implement shared memory hogwild.
update param at worker side
Repository: incubator-singa
Updated Branches:
refs/heads/master 856fc1fbe -> 4df2bb5a8
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/src/trainer/trainer.cc
----------------------------------------------------------------------
diff --git a/src/trainer/trainer.cc b/src/trainer/trainer.cc
index 3f343af..dbf8a48 100644
--- a/src/trainer/trainer.cc
+++ b/src/trainer/trainer.cc
@@ -180,7 +180,7 @@ void Trainer::Start(const ModelProto& mproto, const ClusterProto& cproto,
threads.push_back(std::thread(&Server::Run,server.get()));
for(auto worker: workers)
threads.push_back(std::thread(&Worker::Run,worker.get()));
- Run(servers.size(), workers.size(), shards);
+ Run(workers.size(), servers.size(), shards);
for(auto& thread: threads)
thread.join();
}
@@ -191,8 +191,6 @@ void Trainer::Run(int nworkers, int nservers,
procs_id_=cluster->procs_id();
map<int, shared_ptr<Dealer>> interprocs_dealers;
Metric perf;
- int perf_step=-1;
- string perf_prefix;
bool stop=false;
while(!stop){
Msg* msg=router_->Receive();
@@ -209,9 +207,9 @@ void Trainer::Run(int nworkers, int nservers,
msg =HandleConnect(&msg);
}else if(type==kStop){
if(msg->src_flag()==kServer)
- nworkers--;
- else if (msg->src_flag()==kWorkerParam)
nservers--;
+ else if (msg->src_flag()==kWorkerParam)
+ nworkers--;
delete msg;
msg=nullptr;
if(nworkers==0&&nservers==0){
@@ -219,26 +217,19 @@ void Trainer::Run(int nworkers, int nservers,
break;
}
}else if(type==kMetric){
- int step=msg->target_first();
- string prefix((char*)msg->frame_data(), msg->frame_size());
- if(step!=perf_step||perf_prefix!=prefix){
- if(perf_step>=0){
- perf.Avg();
- LOG(ERROR)<<perf_prefix<<" step-"
- <<perf_step<<", "<<perf.ToString();
- perf.Reset();
- }
- perf_step=step;
- perf_prefix=prefix;
+ if(msg->src_first()==0){
+ int step=msg->target_first();
+ string prefix((char*)msg->frame_data(), msg->frame_size());
+ msg->next_frame();
+ Metric cur;
+ cur.ParseString(string((char*)msg->frame_data(), msg->frame_size()));
+ perf.AddMetrics(cur);
+ LOG(ERROR)<<prefix<<" step-" <<step<<", "<<perf.ToString();
+ perf.Reset();
}
- msg->next_frame();
- Metric cur;
- cur.ParseString(string((char*)msg->frame_data(), msg->frame_size()));
- perf.AddMetrics(cur);
- perf.Inc();
delete msg;
msg=nullptr;
- }else {
+ }else if(cluster->nserver_groups()>1){
int group_id=msg->src_first();
int paramid=msg->target_first();
auto entry=shards.at(group_id)->at(paramid);
@@ -261,6 +252,9 @@ void Trainer::Run(int nworkers, int nservers,
default:
break;
}
+ }else{
+ delete msg;
+ msg=nullptr;
}
}else{
int dst_procs_id;
@@ -282,9 +276,11 @@ void Trainer::Run(int nworkers, int nservers,
}
}
}
+ /*
perf.Avg();
if(perf_step>=0)
LOG(ERROR)<<perf_prefix<<" step-"<<perf_step<<", "<<perf.ToString();
+ */
}
Msg* Trainer::HandleConnect(Msg** msg){
string ping((char*)(*msg)->frame_data(), (*msg)->frame_size());
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/src/trainer/worker.cc
----------------------------------------------------------------------
diff --git a/src/trainer/worker.cc b/src/trainer/worker.cc
index abfcdf0..3d400ee 100644
--- a/src/trainer/worker.cc
+++ b/src/trainer/worker.cc
@@ -22,6 +22,11 @@ void Worker::Setup(const ModelProto& model,
auto cluster=Cluster::Get();
int sgid=group_id_/cluster->nworker_groups_per_server_group();
CHECK(cluster->runtime()->wJoinSGroup(group_id_, worker_id_, sgid));
+ if(model.hogwild()){
+ updater_=shared_ptr<Updater>(Singleton<Factory<Updater>>::Instance()
+ ->Create("Updater"));
+ updater_->Init(model.updater());
+ }
}
void Worker::Run(){
@@ -124,12 +129,17 @@ int Worker::Get(shared_ptr<Param> param, int step){
return 1;
}
int Worker::Update(shared_ptr<Param> param, int step){
- Msg* msg=new Msg();
- msg->set_src(group_id_, worker_id_, kWorkerParam);
- msg->set_dst(-1, -1, kStub);
- msg->set_type(kUpdate);
- msg->set_target(param->owner(), step);
- param_dealer_->Send(&msg);
+ if(updater_){
+ updater_->Update(step, param);
+ param->set_version(param->version()+1);
+ }else{
+ Msg* msg=new Msg();
+ msg->set_src(group_id_, worker_id_, kWorkerParam);
+ msg->set_dst(-1, -1, kStub);
+ msg->set_type(kUpdate);
+ msg->set_target(param->owner(), step);
+ param_dealer_->Send(&msg);
+ }
return 1;
}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/src/utils/param.cc
----------------------------------------------------------------------
diff --git a/src/utils/param.cc b/src/utils/param.cc
index ac5566c..e616a1c 100644
--- a/src/utils/param.cc
+++ b/src/utils/param.cc
@@ -175,6 +175,116 @@ void Param::Init(int v){
set_version(v);
}
+/********************HogwildParam***************************/
+Msg* HogwildParam::GenPutMsg(void* arg){
+ char buf[128];
+ sprintf(buf, "%d %f %f %p", size(),
+ learning_rate_multiplier(), weight_decay_multiplier(), mutable_cpu_data());
+ Msg* msg=new Msg();
+ msg->set_type(kPut);
+ int v=version();
+ if(arg!=nullptr)
+ v=*(int*)arg;
+ msg->set_target(owner(), v);
+ msg->add_frame(buf, strlen(buf));
+ return msg;
+}
+
+Msg* HogwildParam::GenGetMsg(void* arg){
+ Msg* msg=new Msg();
+ msg->set_type(kGet);
+ int v=version();
+ if(arg!=nullptr)
+ v=*(int*)arg;
+ msg->set_target(owner(), v);
+ return msg;
+}
+
+Msg* HogwildParam::GenUpdateMsg(void* arg){
+ Msg* msg=new Msg();
+ msg->set_type(kUpdate);
+ int v=version();
+ if(arg!=nullptr)
+ v=*(int*)arg;
+ msg->set_target(owner(), v);
+ void* p=mutable_cpu_grad();
+ msg->add_frame(p, sizeof(void*));
+ return msg;
+}
+
+Msg* HogwildParam::GenSyncMsg(void* arg){
+ return nullptr;
+}
+
+Msg* HogwildParam::HandlePutMsg(Msg** msg){
+ int size;
+ float lr, wc;
+ sscanf(static_cast<char*>((*msg)->frame_data()), "%d %f %f",
+ &size, &lr, &wc);
+ proto_.set_learning_rate_multiplier(lr);
+ proto_.set_weight_decay_multiplier(wc);
+ CHECK((*msg)->next_frame());
+ vector<int> shape{size};
+ // set pointer
+ data_=std::make_shared<Blob<float>>(shape);
+ data_->set_version((*msg)->target_second());
+ grad_.Reshape(shape);
+ history_.Reshape(shape);
+ delete (*msg);
+ *msg=nullptr;
+ return nullptr;
+}
+
+Msg* HogwildParam::HandleGetMsg(Msg** msg){
+ if((*msg)->target_second()<=version()){
+ (*msg)->add_frame(mutable_cpu_data(), sizeof(float)*size());
+ (*msg)->SwapAddr();
+ (*msg)->set_type(kRGet);
+ }
+ return *msg;
+}
+
+int HogwildParam::ParseUpdateMsg(Msg** msg){
+ delete (*msg);
+ *msg=nullptr;
+ return 1;
+}
+
+Msg* HogwildParam::GenUpdateResponseMsg(void* arg){
+ Msg* msg=new Msg();
+ msg->set_type(kRUpdate);
+ int v=version();
+ if(arg!=nullptr)
+ v=*(int*)arg;
+ msg->set_target(owner(), v);
+ return msg;
+}
+
+Msg* HogwildParam::HandleSyncMsg(Msg** msg){
+ delete *msg;
+ *msg=nullptr;
+ return nullptr;
+}
+
+int HogwildParam::ParseSyncResponseMsg(Msg** msg){
+ delete *msg;
+ *msg=nullptr;
+ return 1;
+}
+int HogwildParam::ParsePutResponseMsg(Msg **msg){
+ return ParseSyncResponseMsg(msg);
+}
+int HogwildParam::ParseGetResponseMsg(Msg **msg){
+ // must be set after all other settings are done!
+ set_version((*msg)->target_second());
+ delete *msg;
+ *msg=nullptr;
+ return 1;
+}
+int HogwildParam::ParseUpdateResponseMsg(Msg **msg){
+ return ParseGetResponseMsg(msg);
+}
+
/**************************RandomSyncParam********************************
const vector<int> RandomSyncParam::RandomSample(int seed, int m, int n){
vector<int> samples(m);
[02/10] incubator-singa git commit: implement shared memory hogwild.
update param at worker side
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/src/proto/model.pb.h
----------------------------------------------------------------------
diff --git a/src/proto/model.pb.h b/src/proto/model.pb.h
index 6f1dc1d..9ac1e54 100644
--- a/src/proto/model.pb.h
+++ b/src/proto/model.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.
@@ -360,6 +360,7 @@ class ModelProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -626,15 +627,13 @@ class ModelProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::std::string* name_;
- static ::std::string* _default_train_folder_;
::std::string* train_folder_;
- static ::std::string* _default_test_folder_;
+ static ::std::string* _default_train_folder_;
::std::string* test_folder_;
- static ::std::string* _default_validation_folder_;
+ static ::std::string* _default_test_folder_;
::std::string* validation_folder_;
+ static ::std::string* _default_validation_folder_;
::google::protobuf::int32 display_after_steps_;
::google::protobuf::int32 display_frequency_;
::google::protobuf::int32 validation_after_steps_;
@@ -654,6 +653,10 @@ class ModelProto : public ::google::protobuf::Message {
int alg_;
::singa::NetProto* neuralnet_;
::google::protobuf::int32 warmup_steps_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(23 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -710,6 +713,7 @@ class NetProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -742,10 +746,12 @@ class NetProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::singa::LayerProto > layer_;
int partition_type_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -802,6 +808,7 @@ class ParamProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -976,8 +983,6 @@ class ParamProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::std::string* name_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > shape_;
::google::protobuf::int32 id_;
@@ -992,6 +997,10 @@ class ParamProto : public ::google::protobuf::Message {
float std_;
float learning_rate_multiplier_;
float weight_decay_multiplier_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(14 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -1048,6 +1057,7 @@ class BlobProtos : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -1099,11 +1109,13 @@ class BlobProtos : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::RepeatedPtrField< ::singa::BlobProto > blobs_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > ids_;
::google::protobuf::RepeatedPtrField< ::std::string> names_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -1160,6 +1172,7 @@ class LayerProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -1476,8 +1489,6 @@ class LayerProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::std::string* name_;
::std::string* type_;
::google::protobuf::RepeatedPtrField< ::std::string> srclayers_;
@@ -1504,6 +1515,10 @@ class LayerProto : public ::google::protobuf::Message {
::singa::SoftmaxLossProto* softmaxloss_param_;
::singa::TanhProto* tanh_param_;
int partition_type_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(26 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -1560,6 +1575,7 @@ class RGBImage : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -1612,12 +1628,14 @@ class RGBImage : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
float scale_;
::google::protobuf::int32 cropsize_;
::std::string* meanfile_;
bool mirror_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -1674,6 +1692,7 @@ class SplitProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -1694,9 +1713,11 @@ class SplitProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::int32 num_splits_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -1753,6 +1774,7 @@ class TanhProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -1782,10 +1804,12 @@ class TanhProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
float outer_scale_;
float inner_scale_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -1842,6 +1866,7 @@ class SoftmaxLossProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -1871,10 +1896,12 @@ class SoftmaxLossProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::int32 topk_;
float scale_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -1931,6 +1958,7 @@ class ConvolutionProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -1987,13 +2015,15 @@ class ConvolutionProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::uint32 num_filters_;
bool bias_term_;
::google::protobuf::uint32 pad_;
::google::protobuf::uint32 stride_;
::google::protobuf::uint32 kernel_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2050,6 +2080,7 @@ class ConcateProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2079,10 +2110,12 @@ class ConcateProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::int32 concate_dimension_;
::google::protobuf::int32 concate_num_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2139,6 +2172,7 @@ class DataProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2196,12 +2230,14 @@ class DataProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::std::string* source_;
::std::string* path_;
::google::protobuf::uint32 batchsize_;
::google::protobuf::uint32 random_skip_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2258,6 +2294,7 @@ class MnistProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2350,8 +2387,6 @@ class MnistProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::int32 kernel_;
float sigma_;
float alpha_;
@@ -2361,6 +2396,10 @@ class MnistProto : public ::google::protobuf::Message {
::google::protobuf::int32 elastic_freq_;
float norm_a_;
float norm_b_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2417,6 +2456,7 @@ class DropoutProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2437,9 +2477,11 @@ class DropoutProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
float dropout_ratio_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2496,6 +2538,7 @@ class InnerProductProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2525,10 +2568,12 @@ class InnerProductProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::uint32 num_output_;
bool bias_term_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2585,6 +2630,7 @@ class LRNProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2665,13 +2711,15 @@ class LRNProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::uint32 local_size_;
float alpha_;
float beta_;
int norm_region_;
float knorm_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2728,6 +2776,7 @@ class PoolingProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2799,12 +2848,14 @@ class PoolingProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
int pool_;
::google::protobuf::uint32 kernel_;
::google::protobuf::uint32 pad_;
::google::protobuf::uint32 stride_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2861,6 +2912,7 @@ class SliceProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2890,10 +2942,12 @@ class SliceProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::int32 slice_dimension_;
::google::protobuf::int32 slice_num_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -2950,6 +3004,7 @@ class ReLUProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -2970,9 +3025,11 @@ class ReLUProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
float negative_slope_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -3029,6 +3086,7 @@ class Record : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -3083,10 +3141,12 @@ class Record : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::singa::SingleLabelImageRecord* image_;
int type_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -3143,6 +3203,7 @@ class Datum : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -3225,8 +3286,6 @@ class Datum : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::int32 channels_;
::google::protobuf::int32 height_;
::std::string* data_;
@@ -3234,6 +3293,10 @@ class Datum : public ::google::protobuf::Message {
::google::protobuf::int32 label_;
::google::protobuf::RepeatedField< float > float_data_;
bool encoded_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -3290,6 +3353,7 @@ class SingleLabelImageRecord : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -3348,12 +3412,14 @@ class SingleLabelImageRecord : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > shape_;
::std::string* pixel_;
::google::protobuf::RepeatedField< float > data_;
::google::protobuf::int32 label_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -3410,6 +3476,7 @@ class UpdaterProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -3596,8 +3663,6 @@ class UpdaterProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
float momentum_;
float weight_decay_;
float gamma_;
@@ -3610,10 +3675,14 @@ class UpdaterProto : public ::google::protobuf::Message {
int learning_rate_change_method_;
::google::protobuf::int32 sync_frequency_;
float moving_rate_;
- static ::std::string* _default_param_type_;
::std::string* param_type_;
+ static ::std::string* _default_param_type_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > step_;
::google::protobuf::RepeatedField< float > step_lr_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(15 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -3670,6 +3739,7 @@ class BlobProto : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -3741,8 +3811,6 @@ class BlobProto : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
- ::google::protobuf::uint32 _has_bits_[1];
- mutable int _cached_size_;
::google::protobuf::int32 num_;
::google::protobuf::int32 channels_;
::google::protobuf::int32 height_;
@@ -3751,6 +3819,10 @@ class BlobProto : public ::google::protobuf::Message {
mutable int _data_cached_byte_size_;
::google::protobuf::RepeatedField< float > diff_;
mutable int _diff_cached_byte_size_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(6 + 31) / 32];
+
friend void protobuf_AddDesc_model_2eproto();
friend void protobuf_AssignDesc_model_2eproto();
friend void protobuf_ShutdownFile_model_2eproto();
@@ -3776,59 +3848,54 @@ inline void ModelProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ModelProto::clear_name() {
- if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
clear_has_name();
}
inline const ::std::string& ModelProto::name() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.name)
return *name_;
}
inline void ModelProto::set_name(const ::std::string& value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
- // @@protoc_insertion_point(field_set:singa.ModelProto.name)
}
inline void ModelProto::set_name(const char* value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.ModelProto.name)
}
inline void ModelProto::set_name(const char* value, size_t size) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.ModelProto.name)
}
inline ::std::string* ModelProto::mutable_name() {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
- // @@protoc_insertion_point(field_mutable:singa.ModelProto.name)
return name_;
}
inline ::std::string* ModelProto::release_name() {
clear_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = name_;
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void ModelProto::set_allocated_name(::std::string* name) {
- if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (name) {
@@ -3836,9 +3903,8 @@ inline void ModelProto::set_allocated_name(::std::string* name) {
name_ = name;
} else {
clear_has_name();
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
- // @@protoc_insertion_point(field_set_allocated:singa.ModelProto.name)
}
// optional string train_folder = 2 [default = "train"];
@@ -3858,7 +3924,6 @@ inline void ModelProto::clear_train_folder() {
clear_has_train_folder();
}
inline const ::std::string& ModelProto::train_folder() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.train_folder)
return *train_folder_;
}
inline void ModelProto::set_train_folder(const ::std::string& value) {
@@ -3867,7 +3932,6 @@ inline void ModelProto::set_train_folder(const ::std::string& value) {
train_folder_ = new ::std::string;
}
train_folder_->assign(value);
- // @@protoc_insertion_point(field_set:singa.ModelProto.train_folder)
}
inline void ModelProto::set_train_folder(const char* value) {
set_has_train_folder();
@@ -3875,7 +3939,6 @@ inline void ModelProto::set_train_folder(const char* value) {
train_folder_ = new ::std::string;
}
train_folder_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.ModelProto.train_folder)
}
inline void ModelProto::set_train_folder(const char* value, size_t size) {
set_has_train_folder();
@@ -3883,14 +3946,12 @@ inline void ModelProto::set_train_folder(const char* value, size_t size) {
train_folder_ = new ::std::string;
}
train_folder_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.ModelProto.train_folder)
}
inline ::std::string* ModelProto::mutable_train_folder() {
set_has_train_folder();
if (train_folder_ == _default_train_folder_) {
train_folder_ = new ::std::string(*_default_train_folder_);
}
- // @@protoc_insertion_point(field_mutable:singa.ModelProto.train_folder)
return train_folder_;
}
inline ::std::string* ModelProto::release_train_folder() {
@@ -3914,7 +3975,6 @@ inline void ModelProto::set_allocated_train_folder(::std::string* train_folder)
clear_has_train_folder();
train_folder_ = const_cast< ::std::string*>(_default_train_folder_);
}
- // @@protoc_insertion_point(field_set_allocated:singa.ModelProto.train_folder)
}
// optional string test_folder = 3 [default = "test"];
@@ -3934,7 +3994,6 @@ inline void ModelProto::clear_test_folder() {
clear_has_test_folder();
}
inline const ::std::string& ModelProto::test_folder() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.test_folder)
return *test_folder_;
}
inline void ModelProto::set_test_folder(const ::std::string& value) {
@@ -3943,7 +4002,6 @@ inline void ModelProto::set_test_folder(const ::std::string& value) {
test_folder_ = new ::std::string;
}
test_folder_->assign(value);
- // @@protoc_insertion_point(field_set:singa.ModelProto.test_folder)
}
inline void ModelProto::set_test_folder(const char* value) {
set_has_test_folder();
@@ -3951,7 +4009,6 @@ inline void ModelProto::set_test_folder(const char* value) {
test_folder_ = new ::std::string;
}
test_folder_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.ModelProto.test_folder)
}
inline void ModelProto::set_test_folder(const char* value, size_t size) {
set_has_test_folder();
@@ -3959,14 +4016,12 @@ inline void ModelProto::set_test_folder(const char* value, size_t size) {
test_folder_ = new ::std::string;
}
test_folder_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.ModelProto.test_folder)
}
inline ::std::string* ModelProto::mutable_test_folder() {
set_has_test_folder();
if (test_folder_ == _default_test_folder_) {
test_folder_ = new ::std::string(*_default_test_folder_);
}
- // @@protoc_insertion_point(field_mutable:singa.ModelProto.test_folder)
return test_folder_;
}
inline ::std::string* ModelProto::release_test_folder() {
@@ -3990,7 +4045,6 @@ inline void ModelProto::set_allocated_test_folder(::std::string* test_folder) {
clear_has_test_folder();
test_folder_ = const_cast< ::std::string*>(_default_test_folder_);
}
- // @@protoc_insertion_point(field_set_allocated:singa.ModelProto.test_folder)
}
// optional string validation_folder = 4 [default = "validation"];
@@ -4010,7 +4064,6 @@ inline void ModelProto::clear_validation_folder() {
clear_has_validation_folder();
}
inline const ::std::string& ModelProto::validation_folder() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.validation_folder)
return *validation_folder_;
}
inline void ModelProto::set_validation_folder(const ::std::string& value) {
@@ -4019,7 +4072,6 @@ inline void ModelProto::set_validation_folder(const ::std::string& value) {
validation_folder_ = new ::std::string;
}
validation_folder_->assign(value);
- // @@protoc_insertion_point(field_set:singa.ModelProto.validation_folder)
}
inline void ModelProto::set_validation_folder(const char* value) {
set_has_validation_folder();
@@ -4027,7 +4079,6 @@ inline void ModelProto::set_validation_folder(const char* value) {
validation_folder_ = new ::std::string;
}
validation_folder_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.ModelProto.validation_folder)
}
inline void ModelProto::set_validation_folder(const char* value, size_t size) {
set_has_validation_folder();
@@ -4035,14 +4086,12 @@ inline void ModelProto::set_validation_folder(const char* value, size_t size) {
validation_folder_ = new ::std::string;
}
validation_folder_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.ModelProto.validation_folder)
}
inline ::std::string* ModelProto::mutable_validation_folder() {
set_has_validation_folder();
if (validation_folder_ == _default_validation_folder_) {
validation_folder_ = new ::std::string(*_default_validation_folder_);
}
- // @@protoc_insertion_point(field_mutable:singa.ModelProto.validation_folder)
return validation_folder_;
}
inline ::std::string* ModelProto::release_validation_folder() {
@@ -4066,7 +4115,6 @@ inline void ModelProto::set_allocated_validation_folder(::std::string* validatio
clear_has_validation_folder();
validation_folder_ = const_cast< ::std::string*>(_default_validation_folder_);
}
- // @@protoc_insertion_point(field_set_allocated:singa.ModelProto.validation_folder)
}
// optional int32 display_after_steps = 6 [default = 0];
@@ -4084,13 +4132,11 @@ inline void ModelProto::clear_display_after_steps() {
clear_has_display_after_steps();
}
inline ::google::protobuf::int32 ModelProto::display_after_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.display_after_steps)
return display_after_steps_;
}
inline void ModelProto::set_display_after_steps(::google::protobuf::int32 value) {
set_has_display_after_steps();
display_after_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.display_after_steps)
}
// optional int32 display_frequency = 7 [default = 0];
@@ -4108,13 +4154,11 @@ inline void ModelProto::clear_display_frequency() {
clear_has_display_frequency();
}
inline ::google::protobuf::int32 ModelProto::display_frequency() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.display_frequency)
return display_frequency_;
}
inline void ModelProto::set_display_frequency(::google::protobuf::int32 value) {
set_has_display_frequency();
display_frequency_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.display_frequency)
}
// optional int32 validation_after_steps = 10 [default = 0];
@@ -4132,13 +4176,11 @@ inline void ModelProto::clear_validation_after_steps() {
clear_has_validation_after_steps();
}
inline ::google::protobuf::int32 ModelProto::validation_after_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.validation_after_steps)
return validation_after_steps_;
}
inline void ModelProto::set_validation_after_steps(::google::protobuf::int32 value) {
set_has_validation_after_steps();
validation_after_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.validation_after_steps)
}
// optional int32 validation_frequency = 11 [default = 0];
@@ -4156,13 +4198,11 @@ inline void ModelProto::clear_validation_frequency() {
clear_has_validation_frequency();
}
inline ::google::protobuf::int32 ModelProto::validation_frequency() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.validation_frequency)
return validation_frequency_;
}
inline void ModelProto::set_validation_frequency(::google::protobuf::int32 value) {
set_has_validation_frequency();
validation_frequency_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.validation_frequency)
}
// optional int32 test_after_steps = 13 [default = 0];
@@ -4180,13 +4220,11 @@ inline void ModelProto::clear_test_after_steps() {
clear_has_test_after_steps();
}
inline ::google::protobuf::int32 ModelProto::test_after_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.test_after_steps)
return test_after_steps_;
}
inline void ModelProto::set_test_after_steps(::google::protobuf::int32 value) {
set_has_test_after_steps();
test_after_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.test_after_steps)
}
// optional int32 test_frequency = 14 [default = 0];
@@ -4204,13 +4242,11 @@ inline void ModelProto::clear_test_frequency() {
clear_has_test_frequency();
}
inline ::google::protobuf::int32 ModelProto::test_frequency() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.test_frequency)
return test_frequency_;
}
inline void ModelProto::set_test_frequency(::google::protobuf::int32 value) {
set_has_test_frequency();
test_frequency_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.test_frequency)
}
// optional int32 checkpoint_after_steps = 15 [default = 0];
@@ -4228,13 +4264,11 @@ inline void ModelProto::clear_checkpoint_after_steps() {
clear_has_checkpoint_after_steps();
}
inline ::google::protobuf::int32 ModelProto::checkpoint_after_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.checkpoint_after_steps)
return checkpoint_after_steps_;
}
inline void ModelProto::set_checkpoint_after_steps(::google::protobuf::int32 value) {
set_has_checkpoint_after_steps();
checkpoint_after_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.checkpoint_after_steps)
}
// optional int32 checkpoint_frequency = 16 [default = 0];
@@ -4252,13 +4286,11 @@ inline void ModelProto::clear_checkpoint_frequency() {
clear_has_checkpoint_frequency();
}
inline ::google::protobuf::int32 ModelProto::checkpoint_frequency() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.checkpoint_frequency)
return checkpoint_frequency_;
}
inline void ModelProto::set_checkpoint_frequency(::google::protobuf::int32 value) {
set_has_checkpoint_frequency();
checkpoint_frequency_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.checkpoint_frequency)
}
// optional bool prefetch = 18 [default = true];
@@ -4276,13 +4308,11 @@ inline void ModelProto::clear_prefetch() {
clear_has_prefetch();
}
inline bool ModelProto::prefetch() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.prefetch)
return prefetch_;
}
inline void ModelProto::set_prefetch(bool value) {
set_has_prefetch();
prefetch_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.prefetch)
}
// optional int32 train_steps = 20;
@@ -4300,13 +4330,11 @@ inline void ModelProto::clear_train_steps() {
clear_has_train_steps();
}
inline ::google::protobuf::int32 ModelProto::train_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.train_steps)
return train_steps_;
}
inline void ModelProto::set_train_steps(::google::protobuf::int32 value) {
set_has_train_steps();
train_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.train_steps)
}
// optional int32 validation_steps = 21;
@@ -4324,13 +4352,11 @@ inline void ModelProto::clear_validation_steps() {
clear_has_validation_steps();
}
inline ::google::protobuf::int32 ModelProto::validation_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.validation_steps)
return validation_steps_;
}
inline void ModelProto::set_validation_steps(::google::protobuf::int32 value) {
set_has_validation_steps();
validation_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.validation_steps)
}
// optional int32 test_steps = 22;
@@ -4348,13 +4374,11 @@ inline void ModelProto::clear_test_steps() {
clear_has_test_steps();
}
inline ::google::protobuf::int32 ModelProto::test_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.test_steps)
return test_steps_;
}
inline void ModelProto::set_test_steps(::google::protobuf::int32 value) {
set_has_test_steps();
test_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.test_steps)
}
// optional int32 step = 29 [default = 0];
@@ -4372,13 +4396,11 @@ inline void ModelProto::clear_step() {
clear_has_step();
}
inline ::google::protobuf::int32 ModelProto::step() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.step)
return step_;
}
inline void ModelProto::set_step(::google::protobuf::int32 value) {
set_has_step();
step_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.step)
}
// optional .singa.UpdaterProto updater = 31;
@@ -4396,13 +4418,11 @@ inline void ModelProto::clear_updater() {
clear_has_updater();
}
inline const ::singa::UpdaterProto& ModelProto::updater() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.updater)
return updater_ != NULL ? *updater_ : *default_instance_->updater_;
}
inline ::singa::UpdaterProto* ModelProto::mutable_updater() {
set_has_updater();
if (updater_ == NULL) updater_ = new ::singa::UpdaterProto;
- // @@protoc_insertion_point(field_mutable:singa.ModelProto.updater)
return updater_;
}
inline ::singa::UpdaterProto* ModelProto::release_updater() {
@@ -4419,7 +4439,6 @@ inline void ModelProto::set_allocated_updater(::singa::UpdaterProto* updater) {
} else {
clear_has_updater();
}
- // @@protoc_insertion_point(field_set_allocated:singa.ModelProto.updater)
}
// optional .singa.ModelProto.GradCalcAlg alg = 32 [default = kBackPropagation];
@@ -4437,14 +4456,12 @@ inline void ModelProto::clear_alg() {
clear_has_alg();
}
inline ::singa::ModelProto_GradCalcAlg ModelProto::alg() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.alg)
return static_cast< ::singa::ModelProto_GradCalcAlg >(alg_);
}
inline void ModelProto::set_alg(::singa::ModelProto_GradCalcAlg value) {
assert(::singa::ModelProto_GradCalcAlg_IsValid(value));
set_has_alg();
alg_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.alg)
}
// optional bool hogwild = 33 [default = false];
@@ -4462,13 +4479,11 @@ inline void ModelProto::clear_hogwild() {
clear_has_hogwild();
}
inline bool ModelProto::hogwild() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.hogwild)
return hogwild_;
}
inline void ModelProto::set_hogwild(bool value) {
set_has_hogwild();
hogwild_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.hogwild)
}
// optional .singa.NetProto neuralnet = 40;
@@ -4486,13 +4501,11 @@ inline void ModelProto::clear_neuralnet() {
clear_has_neuralnet();
}
inline const ::singa::NetProto& ModelProto::neuralnet() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.neuralnet)
return neuralnet_ != NULL ? *neuralnet_ : *default_instance_->neuralnet_;
}
inline ::singa::NetProto* ModelProto::mutable_neuralnet() {
set_has_neuralnet();
if (neuralnet_ == NULL) neuralnet_ = new ::singa::NetProto;
- // @@protoc_insertion_point(field_mutable:singa.ModelProto.neuralnet)
return neuralnet_;
}
inline ::singa::NetProto* ModelProto::release_neuralnet() {
@@ -4509,7 +4522,6 @@ inline void ModelProto::set_allocated_neuralnet(::singa::NetProto* neuralnet) {
} else {
clear_has_neuralnet();
}
- // @@protoc_insertion_point(field_set_allocated:singa.ModelProto.neuralnet)
}
// optional bool debug = 41 [default = false];
@@ -4527,13 +4539,11 @@ inline void ModelProto::clear_debug() {
clear_has_debug();
}
inline bool ModelProto::debug() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.debug)
return debug_;
}
inline void ModelProto::set_debug(bool value) {
set_has_debug();
debug_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.debug)
}
// optional int32 warmup_steps = 50 [default = 0];
@@ -4551,13 +4561,11 @@ inline void ModelProto::clear_warmup_steps() {
clear_has_warmup_steps();
}
inline ::google::protobuf::int32 ModelProto::warmup_steps() const {
- // @@protoc_insertion_point(field_get:singa.ModelProto.warmup_steps)
return warmup_steps_;
}
inline void ModelProto::set_warmup_steps(::google::protobuf::int32 value) {
set_has_warmup_steps();
warmup_steps_ = value;
- // @@protoc_insertion_point(field_set:singa.ModelProto.warmup_steps)
}
// -------------------------------------------------------------------
@@ -4572,25 +4580,20 @@ inline void NetProto::clear_layer() {
layer_.Clear();
}
inline const ::singa::LayerProto& NetProto::layer(int index) const {
- // @@protoc_insertion_point(field_get:singa.NetProto.layer)
return layer_.Get(index);
}
inline ::singa::LayerProto* NetProto::mutable_layer(int index) {
- // @@protoc_insertion_point(field_mutable:singa.NetProto.layer)
return layer_.Mutable(index);
}
inline ::singa::LayerProto* NetProto::add_layer() {
- // @@protoc_insertion_point(field_add:singa.NetProto.layer)
return layer_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >&
NetProto::layer() const {
- // @@protoc_insertion_point(field_list:singa.NetProto.layer)
return layer_;
}
inline ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >*
NetProto::mutable_layer() {
- // @@protoc_insertion_point(field_mutable_list:singa.NetProto.layer)
return &layer_;
}
@@ -4609,14 +4612,12 @@ inline void NetProto::clear_partition_type() {
clear_has_partition_type();
}
inline ::singa::PartitionType NetProto::partition_type() const {
- // @@protoc_insertion_point(field_get:singa.NetProto.partition_type)
return static_cast< ::singa::PartitionType >(partition_type_);
}
inline void NetProto::set_partition_type(::singa::PartitionType value) {
assert(::singa::PartitionType_IsValid(value));
set_has_partition_type();
partition_type_ = value;
- // @@protoc_insertion_point(field_set:singa.NetProto.partition_type)
}
// -------------------------------------------------------------------
@@ -4634,59 +4635,54 @@ inline void ParamProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ParamProto::clear_name() {
- if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
clear_has_name();
}
inline const ::std::string& ParamProto::name() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.name)
return *name_;
}
inline void ParamProto::set_name(const ::std::string& value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
- // @@protoc_insertion_point(field_set:singa.ParamProto.name)
}
inline void ParamProto::set_name(const char* value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.ParamProto.name)
}
inline void ParamProto::set_name(const char* value, size_t size) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.ParamProto.name)
}
inline ::std::string* ParamProto::mutable_name() {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
- // @@protoc_insertion_point(field_mutable:singa.ParamProto.name)
return name_;
}
inline ::std::string* ParamProto::release_name() {
clear_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = name_;
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void ParamProto::set_allocated_name(::std::string* name) {
- if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (name) {
@@ -4694,9 +4690,8 @@ inline void ParamProto::set_allocated_name(::std::string* name) {
name_ = name;
} else {
clear_has_name();
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
- // @@protoc_insertion_point(field_set_allocated:singa.ParamProto.name)
}
// optional int32 id = 2;
@@ -4714,13 +4709,11 @@ inline void ParamProto::clear_id() {
clear_has_id();
}
inline ::google::protobuf::int32 ParamProto::id() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.id)
return id_;
}
inline void ParamProto::set_id(::google::protobuf::int32 value) {
set_has_id();
id_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.id)
}
// repeated int32 shape = 3;
@@ -4731,25 +4724,20 @@ inline void ParamProto::clear_shape() {
shape_.Clear();
}
inline ::google::protobuf::int32 ParamProto::shape(int index) const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.shape)
return shape_.Get(index);
}
inline void ParamProto::set_shape(int index, ::google::protobuf::int32 value) {
shape_.Set(index, value);
- // @@protoc_insertion_point(field_set:singa.ParamProto.shape)
}
inline void ParamProto::add_shape(::google::protobuf::int32 value) {
shape_.Add(value);
- // @@protoc_insertion_point(field_add:singa.ParamProto.shape)
}
inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
ParamProto::shape() const {
- // @@protoc_insertion_point(field_list:singa.ParamProto.shape)
return shape_;
}
inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
ParamProto::mutable_shape() {
- // @@protoc_insertion_point(field_mutable_list:singa.ParamProto.shape)
return &shape_;
}
@@ -4768,13 +4756,11 @@ inline void ParamProto::clear_split_threshold() {
clear_has_split_threshold();
}
inline ::google::protobuf::int32 ParamProto::split_threshold() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.split_threshold)
return split_threshold_;
}
inline void ParamProto::set_split_threshold(::google::protobuf::int32 value) {
set_has_split_threshold();
split_threshold_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.split_threshold)
}
// optional int32 partition_dim = 5 [default = -1];
@@ -4792,13 +4778,11 @@ inline void ParamProto::clear_partition_dim() {
clear_has_partition_dim();
}
inline ::google::protobuf::int32 ParamProto::partition_dim() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.partition_dim)
return partition_dim_;
}
inline void ParamProto::set_partition_dim(::google::protobuf::int32 value) {
set_has_partition_dim();
partition_dim_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.partition_dim)
}
// optional int32 owner = 6;
@@ -4816,13 +4800,11 @@ inline void ParamProto::clear_owner() {
clear_has_owner();
}
inline ::google::protobuf::int32 ParamProto::owner() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.owner)
return owner_;
}
inline void ParamProto::set_owner(::google::protobuf::int32 value) {
set_has_owner();
owner_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.owner)
}
// optional .singa.ParamProto.InitMethod init_method = 7 [default = kConstant];
@@ -4840,14 +4822,12 @@ inline void ParamProto::clear_init_method() {
clear_has_init_method();
}
inline ::singa::ParamProto_InitMethod ParamProto::init_method() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.init_method)
return static_cast< ::singa::ParamProto_InitMethod >(init_method_);
}
inline void ParamProto::set_init_method(::singa::ParamProto_InitMethod value) {
assert(::singa::ParamProto_InitMethod_IsValid(value));
set_has_init_method();
init_method_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.init_method)
}
// optional float value = 8 [default = 1];
@@ -4865,13 +4845,11 @@ inline void ParamProto::clear_value() {
clear_has_value();
}
inline float ParamProto::value() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.value)
return value_;
}
inline void ParamProto::set_value(float value) {
set_has_value();
value_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.value)
}
// optional float low = 9 [default = -1];
@@ -4889,13 +4867,11 @@ inline void ParamProto::clear_low() {
clear_has_low();
}
inline float ParamProto::low() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.low)
return low_;
}
inline void ParamProto::set_low(float value) {
set_has_low();
low_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.low)
}
// optional float high = 10 [default = 1];
@@ -4913,13 +4889,11 @@ inline void ParamProto::clear_high() {
clear_has_high();
}
inline float ParamProto::high() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.high)
return high_;
}
inline void ParamProto::set_high(float value) {
set_has_high();
high_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.high)
}
// optional float mean = 11 [default = 0];
@@ -4937,13 +4911,11 @@ inline void ParamProto::clear_mean() {
clear_has_mean();
}
inline float ParamProto::mean() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.mean)
return mean_;
}
inline void ParamProto::set_mean(float value) {
set_has_mean();
mean_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.mean)
}
// optional float std = 12 [default = 1];
@@ -4961,13 +4933,11 @@ inline void ParamProto::clear_std() {
clear_has_std();
}
inline float ParamProto::std() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.std)
return std_;
}
inline void ParamProto::set_std(float value) {
set_has_std();
std_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.std)
}
// optional float learning_rate_multiplier = 13 [default = 1];
@@ -4985,13 +4955,11 @@ inline void ParamProto::clear_learning_rate_multiplier() {
clear_has_learning_rate_multiplier();
}
inline float ParamProto::learning_rate_multiplier() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.learning_rate_multiplier)
return learning_rate_multiplier_;
}
inline void ParamProto::set_learning_rate_multiplier(float value) {
set_has_learning_rate_multiplier();
learning_rate_multiplier_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.learning_rate_multiplier)
}
// optional float weight_decay_multiplier = 14 [default = 1];
@@ -5009,13 +4977,11 @@ inline void ParamProto::clear_weight_decay_multiplier() {
clear_has_weight_decay_multiplier();
}
inline float ParamProto::weight_decay_multiplier() const {
- // @@protoc_insertion_point(field_get:singa.ParamProto.weight_decay_multiplier)
return weight_decay_multiplier_;
}
inline void ParamProto::set_weight_decay_multiplier(float value) {
set_has_weight_decay_multiplier();
weight_decay_multiplier_ = value;
- // @@protoc_insertion_point(field_set:singa.ParamProto.weight_decay_multiplier)
}
// -------------------------------------------------------------------
@@ -5030,25 +4996,20 @@ inline void BlobProtos::clear_blobs() {
blobs_.Clear();
}
inline const ::singa::BlobProto& BlobProtos::blobs(int index) const {
- // @@protoc_insertion_point(field_get:singa.BlobProtos.blobs)
return blobs_.Get(index);
}
inline ::singa::BlobProto* BlobProtos::mutable_blobs(int index) {
- // @@protoc_insertion_point(field_mutable:singa.BlobProtos.blobs)
return blobs_.Mutable(index);
}
inline ::singa::BlobProto* BlobProtos::add_blobs() {
- // @@protoc_insertion_point(field_add:singa.BlobProtos.blobs)
return blobs_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::singa::BlobProto >&
BlobProtos::blobs() const {
- // @@protoc_insertion_point(field_list:singa.BlobProtos.blobs)
return blobs_;
}
inline ::google::protobuf::RepeatedPtrField< ::singa::BlobProto >*
BlobProtos::mutable_blobs() {
- // @@protoc_insertion_point(field_mutable_list:singa.BlobProtos.blobs)
return &blobs_;
}
@@ -5060,25 +5021,20 @@ inline void BlobProtos::clear_ids() {
ids_.Clear();
}
inline ::google::protobuf::int32 BlobProtos::ids(int index) const {
- // @@protoc_insertion_point(field_get:singa.BlobProtos.ids)
return ids_.Get(index);
}
inline void BlobProtos::set_ids(int index, ::google::protobuf::int32 value) {
ids_.Set(index, value);
- // @@protoc_insertion_point(field_set:singa.BlobProtos.ids)
}
inline void BlobProtos::add_ids(::google::protobuf::int32 value) {
ids_.Add(value);
- // @@protoc_insertion_point(field_add:singa.BlobProtos.ids)
}
inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
BlobProtos::ids() const {
- // @@protoc_insertion_point(field_list:singa.BlobProtos.ids)
return ids_;
}
inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
BlobProtos::mutable_ids() {
- // @@protoc_insertion_point(field_mutable_list:singa.BlobProtos.ids)
return &ids_;
}
@@ -5090,49 +5046,39 @@ inline void BlobProtos::clear_names() {
names_.Clear();
}
inline const ::std::string& BlobProtos::names(int index) const {
- // @@protoc_insertion_point(field_get:singa.BlobProtos.names)
return names_.Get(index);
}
inline ::std::string* BlobProtos::mutable_names(int index) {
- // @@protoc_insertion_point(field_mutable:singa.BlobProtos.names)
return names_.Mutable(index);
}
inline void BlobProtos::set_names(int index, const ::std::string& value) {
- // @@protoc_insertion_point(field_set:singa.BlobProtos.names)
names_.Mutable(index)->assign(value);
}
inline void BlobProtos::set_names(int index, const char* value) {
names_.Mutable(index)->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.BlobProtos.names)
}
inline void BlobProtos::set_names(int index, const char* value, size_t size) {
names_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.BlobProtos.names)
}
inline ::std::string* BlobProtos::add_names() {
return names_.Add();
}
inline void BlobProtos::add_names(const ::std::string& value) {
names_.Add()->assign(value);
- // @@protoc_insertion_point(field_add:singa.BlobProtos.names)
}
inline void BlobProtos::add_names(const char* value) {
names_.Add()->assign(value);
- // @@protoc_insertion_point(field_add_char:singa.BlobProtos.names)
}
inline void BlobProtos::add_names(const char* value, size_t size) {
names_.Add()->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_add_pointer:singa.BlobProtos.names)
}
inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
BlobProtos::names() const {
- // @@protoc_insertion_point(field_list:singa.BlobProtos.names)
return names_;
}
inline ::google::protobuf::RepeatedPtrField< ::std::string>*
BlobProtos::mutable_names() {
- // @@protoc_insertion_point(field_mutable_list:singa.BlobProtos.names)
return &names_;
}
@@ -5151,59 +5097,54 @@ inline void LayerProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void LayerProto::clear_name() {
- if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
clear_has_name();
}
inline const ::std::string& LayerProto::name() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.name)
return *name_;
}
inline void LayerProto::set_name(const ::std::string& value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
- // @@protoc_insertion_point(field_set:singa.LayerProto.name)
}
inline void LayerProto::set_name(const char* value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.LayerProto.name)
}
inline void LayerProto::set_name(const char* value, size_t size) {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.LayerProto.name)
}
inline ::std::string* LayerProto::mutable_name() {
set_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.name)
return name_;
}
inline ::std::string* LayerProto::release_name() {
clear_has_name();
- if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = name_;
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void LayerProto::set_allocated_name(::std::string* name) {
- if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (name) {
@@ -5211,9 +5152,8 @@ inline void LayerProto::set_allocated_name(::std::string* name) {
name_ = name;
} else {
clear_has_name();
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.name)
}
// optional string type = 2;
@@ -5227,59 +5167,54 @@ inline void LayerProto::clear_has_type() {
_has_bits_[0] &= ~0x00000002u;
}
inline void LayerProto::clear_type() {
- if (type_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (type_ != &::google::protobuf::internal::kEmptyString) {
type_->clear();
}
clear_has_type();
}
inline const ::std::string& LayerProto::type() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.type)
return *type_;
}
inline void LayerProto::set_type(const ::std::string& value) {
set_has_type();
- if (type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (type_ == &::google::protobuf::internal::kEmptyString) {
type_ = new ::std::string;
}
type_->assign(value);
- // @@protoc_insertion_point(field_set:singa.LayerProto.type)
}
inline void LayerProto::set_type(const char* value) {
set_has_type();
- if (type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (type_ == &::google::protobuf::internal::kEmptyString) {
type_ = new ::std::string;
}
type_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.LayerProto.type)
}
inline void LayerProto::set_type(const char* value, size_t size) {
set_has_type();
- if (type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (type_ == &::google::protobuf::internal::kEmptyString) {
type_ = new ::std::string;
}
type_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.LayerProto.type)
}
inline ::std::string* LayerProto::mutable_type() {
set_has_type();
- if (type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (type_ == &::google::protobuf::internal::kEmptyString) {
type_ = new ::std::string;
}
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.type)
return type_;
}
inline ::std::string* LayerProto::release_type() {
clear_has_type();
- if (type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (type_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = type_;
- type_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void LayerProto::set_allocated_type(::std::string* type) {
- if (type_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (type_ != &::google::protobuf::internal::kEmptyString) {
delete type_;
}
if (type) {
@@ -5287,9 +5222,8 @@ inline void LayerProto::set_allocated_type(::std::string* type) {
type_ = type;
} else {
clear_has_type();
- type_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.type)
}
// repeated string srclayers = 3;
@@ -5300,49 +5234,39 @@ inline void LayerProto::clear_srclayers() {
srclayers_.Clear();
}
inline const ::std::string& LayerProto::srclayers(int index) const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.srclayers)
return srclayers_.Get(index);
}
inline ::std::string* LayerProto::mutable_srclayers(int index) {
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.srclayers)
return srclayers_.Mutable(index);
}
inline void LayerProto::set_srclayers(int index, const ::std::string& value) {
- // @@protoc_insertion_point(field_set:singa.LayerProto.srclayers)
srclayers_.Mutable(index)->assign(value);
}
inline void LayerProto::set_srclayers(int index, const char* value) {
srclayers_.Mutable(index)->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.LayerProto.srclayers)
}
inline void LayerProto::set_srclayers(int index, const char* value, size_t size) {
srclayers_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.LayerProto.srclayers)
}
inline ::std::string* LayerProto::add_srclayers() {
return srclayers_.Add();
}
inline void LayerProto::add_srclayers(const ::std::string& value) {
srclayers_.Add()->assign(value);
- // @@protoc_insertion_point(field_add:singa.LayerProto.srclayers)
}
inline void LayerProto::add_srclayers(const char* value) {
srclayers_.Add()->assign(value);
- // @@protoc_insertion_point(field_add_char:singa.LayerProto.srclayers)
}
inline void LayerProto::add_srclayers(const char* value, size_t size) {
srclayers_.Add()->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_add_pointer:singa.LayerProto.srclayers)
}
inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
LayerProto::srclayers() const {
- // @@protoc_insertion_point(field_list:singa.LayerProto.srclayers)
return srclayers_;
}
inline ::google::protobuf::RepeatedPtrField< ::std::string>*
LayerProto::mutable_srclayers() {
- // @@protoc_insertion_point(field_mutable_list:singa.LayerProto.srclayers)
return &srclayers_;
}
@@ -5361,13 +5285,11 @@ inline void LayerProto::clear_locationid() {
clear_has_locationid();
}
inline ::google::protobuf::int32 LayerProto::locationid() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.locationid)
return locationid_;
}
inline void LayerProto::set_locationid(::google::protobuf::int32 value) {
set_has_locationid();
locationid_ = value;
- // @@protoc_insertion_point(field_set:singa.LayerProto.locationid)
}
// optional int32 partitionid = 5 [default = 0];
@@ -5385,13 +5307,11 @@ inline void LayerProto::clear_partitionid() {
clear_has_partitionid();
}
inline ::google::protobuf::int32 LayerProto::partitionid() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.partitionid)
return partitionid_;
}
inline void LayerProto::set_partitionid(::google::protobuf::int32 value) {
set_has_partitionid();
partitionid_ = value;
- // @@protoc_insertion_point(field_set:singa.LayerProto.partitionid)
}
// optional .singa.PartitionType partition_type = 6;
@@ -5409,14 +5329,12 @@ inline void LayerProto::clear_partition_type() {
clear_has_partition_type();
}
inline ::singa::PartitionType LayerProto::partition_type() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.partition_type)
return static_cast< ::singa::PartitionType >(partition_type_);
}
inline void LayerProto::set_partition_type(::singa::PartitionType value) {
assert(::singa::PartitionType_IsValid(value));
set_has_partition_type();
partition_type_ = value;
- // @@protoc_insertion_point(field_set:singa.LayerProto.partition_type)
}
// optional string datablob = 7;
@@ -5430,59 +5348,54 @@ inline void LayerProto::clear_has_datablob() {
_has_bits_[0] &= ~0x00000040u;
}
inline void LayerProto::clear_datablob() {
- if (datablob_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (datablob_ != &::google::protobuf::internal::kEmptyString) {
datablob_->clear();
}
clear_has_datablob();
}
inline const ::std::string& LayerProto::datablob() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.datablob)
return *datablob_;
}
inline void LayerProto::set_datablob(const ::std::string& value) {
set_has_datablob();
- if (datablob_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (datablob_ == &::google::protobuf::internal::kEmptyString) {
datablob_ = new ::std::string;
}
datablob_->assign(value);
- // @@protoc_insertion_point(field_set:singa.LayerProto.datablob)
}
inline void LayerProto::set_datablob(const char* value) {
set_has_datablob();
- if (datablob_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (datablob_ == &::google::protobuf::internal::kEmptyString) {
datablob_ = new ::std::string;
}
datablob_->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.LayerProto.datablob)
}
inline void LayerProto::set_datablob(const char* value, size_t size) {
set_has_datablob();
- if (datablob_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (datablob_ == &::google::protobuf::internal::kEmptyString) {
datablob_ = new ::std::string;
}
datablob_->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.LayerProto.datablob)
}
inline ::std::string* LayerProto::mutable_datablob() {
set_has_datablob();
- if (datablob_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (datablob_ == &::google::protobuf::internal::kEmptyString) {
datablob_ = new ::std::string;
}
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.datablob)
return datablob_;
}
inline ::std::string* LayerProto::release_datablob() {
clear_has_datablob();
- if (datablob_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (datablob_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = datablob_;
- datablob_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ datablob_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void LayerProto::set_allocated_datablob(::std::string* datablob) {
- if (datablob_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ if (datablob_ != &::google::protobuf::internal::kEmptyString) {
delete datablob_;
}
if (datablob) {
@@ -5490,9 +5403,8 @@ inline void LayerProto::set_allocated_datablob(::std::string* datablob) {
datablob_ = datablob;
} else {
clear_has_datablob();
- datablob_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ datablob_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.datablob)
}
// repeated string share_ary = 11;
@@ -5503,49 +5415,39 @@ inline void LayerProto::clear_share_ary() {
share_ary_.Clear();
}
inline const ::std::string& LayerProto::share_ary(int index) const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.share_ary)
return share_ary_.Get(index);
}
inline ::std::string* LayerProto::mutable_share_ary(int index) {
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.share_ary)
return share_ary_.Mutable(index);
}
inline void LayerProto::set_share_ary(int index, const ::std::string& value) {
- // @@protoc_insertion_point(field_set:singa.LayerProto.share_ary)
share_ary_.Mutable(index)->assign(value);
}
inline void LayerProto::set_share_ary(int index, const char* value) {
share_ary_.Mutable(index)->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.LayerProto.share_ary)
}
inline void LayerProto::set_share_ary(int index, const char* value, size_t size) {
share_ary_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.LayerProto.share_ary)
}
inline ::std::string* LayerProto::add_share_ary() {
return share_ary_.Add();
}
inline void LayerProto::add_share_ary(const ::std::string& value) {
share_ary_.Add()->assign(value);
- // @@protoc_insertion_point(field_add:singa.LayerProto.share_ary)
}
inline void LayerProto::add_share_ary(const char* value) {
share_ary_.Add()->assign(value);
- // @@protoc_insertion_point(field_add_char:singa.LayerProto.share_ary)
}
inline void LayerProto::add_share_ary(const char* value, size_t size) {
share_ary_.Add()->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_add_pointer:singa.LayerProto.share_ary)
}
inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
LayerProto::share_ary() const {
- // @@protoc_insertion_point(field_list:singa.LayerProto.share_ary)
return share_ary_;
}
inline ::google::protobuf::RepeatedPtrField< ::std::string>*
LayerProto::mutable_share_ary() {
- // @@protoc_insertion_point(field_mutable_list:singa.LayerProto.share_ary)
return &share_ary_;
}
@@ -5557,25 +5459,20 @@ inline void LayerProto::clear_param() {
param_.Clear();
}
inline const ::singa::ParamProto& LayerProto::param(int index) const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.param)
return param_.Get(index);
}
inline ::singa::ParamProto* LayerProto::mutable_param(int index) {
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.param)
return param_.Mutable(index);
}
inline ::singa::ParamProto* LayerProto::add_param() {
- // @@protoc_insertion_point(field_add:singa.LayerProto.param)
return param_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::singa::ParamProto >&
LayerProto::param() const {
- // @@protoc_insertion_point(field_list:singa.LayerProto.param)
return param_;
}
inline ::google::protobuf::RepeatedPtrField< ::singa::ParamProto >*
LayerProto::mutable_param() {
- // @@protoc_insertion_point(field_mutable_list:singa.LayerProto.param)
return ¶m_;
}
@@ -5587,49 +5484,39 @@ inline void LayerProto::clear_share_param() {
share_param_.Clear();
}
inline const ::std::string& LayerProto::share_param(int index) const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.share_param)
return share_param_.Get(index);
}
inline ::std::string* LayerProto::mutable_share_param(int index) {
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.share_param)
return share_param_.Mutable(index);
}
inline void LayerProto::set_share_param(int index, const ::std::string& value) {
- // @@protoc_insertion_point(field_set:singa.LayerProto.share_param)
share_param_.Mutable(index)->assign(value);
}
inline void LayerProto::set_share_param(int index, const char* value) {
share_param_.Mutable(index)->assign(value);
- // @@protoc_insertion_point(field_set_char:singa.LayerProto.share_param)
}
inline void LayerProto::set_share_param(int index, const char* value, size_t size) {
share_param_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_set_pointer:singa.LayerProto.share_param)
}
inline ::std::string* LayerProto::add_share_param() {
return share_param_.Add();
}
inline void LayerProto::add_share_param(const ::std::string& value) {
share_param_.Add()->assign(value);
- // @@protoc_insertion_point(field_add:singa.LayerProto.share_param)
}
inline void LayerProto::add_share_param(const char* value) {
share_param_.Add()->assign(value);
- // @@protoc_insertion_point(field_add_char:singa.LayerProto.share_param)
}
inline void LayerProto::add_share_param(const char* value, size_t size) {
share_param_.Add()->assign(reinterpret_cast<const char*>(value), size);
- // @@protoc_insertion_point(field_add_pointer:singa.LayerProto.share_param)
}
inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
LayerProto::share_param() const {
- // @@protoc_insertion_point(field_list:singa.LayerProto.share_param)
return share_param_;
}
inline ::google::protobuf::RepeatedPtrField< ::std::string>*
LayerProto::mutable_share_param() {
- // @@protoc_insertion_point(field_mutable_list:singa.LayerProto.share_param)
return &share_param_;
}
@@ -5641,27 +5528,22 @@ inline void LayerProto::clear_exclude() {
exclude_.Clear();
}
inline ::singa::Phase LayerProto::exclude(int index) const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.exclude)
return static_cast< ::singa::Phase >(exclude_.Get(index));
}
inline void LayerProto::set_exclude(int index, ::singa::Phase value) {
assert(::singa::Phase_IsValid(value));
exclude_.Set(index, value);
- // @@protoc_insertion_point(field_set:singa.LayerProto.exclude)
}
inline void LayerProto::add_exclude(::singa::Phase value) {
assert(::singa::Phase_IsValid(value));
exclude_.Add(value);
- // @@protoc_insertion_point(field_add:singa.LayerProto.exclude)
}
inline const ::google::protobuf::RepeatedField<int>&
LayerProto::exclude() const {
- // @@protoc_insertion_point(field_list:singa.LayerProto.exclude)
return exclude_;
}
inline ::google::protobuf::RepeatedField<int>*
LayerProto::mutable_exclude() {
- // @@protoc_insertion_point(field_mutable_list:singa.LayerProto.exclude)
return &exclude_;
}
@@ -5680,13 +5562,11 @@ inline void LayerProto::clear_convolution_param() {
clear_has_convolution_param();
}
inline const ::singa::ConvolutionProto& LayerProto::convolution_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.convolution_param)
return convolution_param_ != NULL ? *convolution_param_ : *default_instance_->convolution_param_;
}
inline ::singa::ConvolutionProto* LayerProto::mutable_convolution_param() {
set_has_convolution_param();
if (convolution_param_ == NULL) convolution_param_ = new ::singa::ConvolutionProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.convolution_param)
return convolution_param_;
}
inline ::singa::ConvolutionProto* LayerProto::release_convolution_param() {
@@ -5703,7 +5583,6 @@ inline void LayerProto::set_allocated_convolution_param(::singa::ConvolutionProt
} else {
clear_has_convolution_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.convolution_param)
}
// optional .singa.ConcateProto concate_param = 31;
@@ -5721,13 +5600,11 @@ inline void LayerProto::clear_concate_param() {
clear_has_concate_param();
}
inline const ::singa::ConcateProto& LayerProto::concate_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.concate_param)
return concate_param_ != NULL ? *concate_param_ : *default_instance_->concate_param_;
}
inline ::singa::ConcateProto* LayerProto::mutable_concate_param() {
set_has_concate_param();
if (concate_param_ == NULL) concate_param_ = new ::singa::ConcateProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.concate_param)
return concate_param_;
}
inline ::singa::ConcateProto* LayerProto::release_concate_param() {
@@ -5744,7 +5621,6 @@ inline void LayerProto::set_allocated_concate_param(::singa::ConcateProto* conca
} else {
clear_has_concate_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.concate_param)
}
// optional .singa.DataProto data_param = 22;
@@ -5762,13 +5638,11 @@ inline void LayerProto::clear_data_param() {
clear_has_data_param();
}
inline const ::singa::DataProto& LayerProto::data_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.data_param)
return data_param_ != NULL ? *data_param_ : *default_instance_->data_param_;
}
inline ::singa::DataProto* LayerProto::mutable_data_param() {
set_has_data_param();
if (data_param_ == NULL) data_param_ = new ::singa::DataProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.data_param)
return data_param_;
}
inline ::singa::DataProto* LayerProto::release_data_param() {
@@ -5785,7 +5659,6 @@ inline void LayerProto::set_allocated_data_param(::singa::DataProto* data_param)
} else {
clear_has_data_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.data_param)
}
// optional .singa.DropoutProto dropout_param = 23;
@@ -5803,13 +5676,11 @@ inline void LayerProto::clear_dropout_param() {
clear_has_dropout_param();
}
inline const ::singa::DropoutProto& LayerProto::dropout_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.dropout_param)
return dropout_param_ != NULL ? *dropout_param_ : *default_instance_->dropout_param_;
}
inline ::singa::DropoutProto* LayerProto::mutable_dropout_param() {
set_has_dropout_param();
if (dropout_param_ == NULL) dropout_param_ = new ::singa::DropoutProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.dropout_param)
return dropout_param_;
}
inline ::singa::DropoutProto* LayerProto::release_dropout_param() {
@@ -5826,7 +5697,6 @@ inline void LayerProto::set_allocated_dropout_param(::singa::DropoutProto* dropo
} else {
clear_has_dropout_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.dropout_param)
}
// optional .singa.InnerProductProto inner_product_param = 24;
@@ -5844,13 +5714,11 @@ inline void LayerProto::clear_inner_product_param() {
clear_has_inner_product_param();
}
inline const ::singa::InnerProductProto& LayerProto::inner_product_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.inner_product_param)
return inner_product_param_ != NULL ? *inner_product_param_ : *default_instance_->inner_product_param_;
}
inline ::singa::InnerProductProto* LayerProto::mutable_inner_product_param() {
set_has_inner_product_param();
if (inner_product_param_ == NULL) inner_product_param_ = new ::singa::InnerProductProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.inner_product_param)
return inner_product_param_;
}
inline ::singa::InnerProductProto* LayerProto::release_inner_product_param() {
@@ -5867,7 +5735,6 @@ inline void LayerProto::set_allocated_inner_product_param(::singa::InnerProductP
} else {
clear_has_inner_product_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.inner_product_param)
}
// optional .singa.LRNProto lrn_param = 25;
@@ -5885,13 +5752,11 @@ inline void LayerProto::clear_lrn_param() {
clear_has_lrn_param();
}
inline const ::singa::LRNProto& LayerProto::lrn_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.lrn_param)
return lrn_param_ != NULL ? *lrn_param_ : *default_instance_->lrn_param_;
}
inline ::singa::LRNProto* LayerProto::mutable_lrn_param() {
set_has_lrn_param();
if (lrn_param_ == NULL) lrn_param_ = new ::singa::LRNProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.lrn_param)
return lrn_param_;
}
inline ::singa::LRNProto* LayerProto::release_lrn_param() {
@@ -5908,7 +5773,6 @@ inline void LayerProto::set_allocated_lrn_param(::singa::LRNProto* lrn_param) {
} else {
clear_has_lrn_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.lrn_param)
}
// optional .singa.MnistProto mnist_param = 26;
@@ -5926,13 +5790,11 @@ inline void LayerProto::clear_mnist_param() {
clear_has_mnist_param();
}
inline const ::singa::MnistProto& LayerProto::mnist_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.mnist_param)
return mnist_param_ != NULL ? *mnist_param_ : *default_instance_->mnist_param_;
}
inline ::singa::MnistProto* LayerProto::mutable_mnist_param() {
set_has_mnist_param();
if (mnist_param_ == NULL) mnist_param_ = new ::singa::MnistProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.mnist_param)
return mnist_param_;
}
inline ::singa::MnistProto* LayerProto::release_mnist_param() {
@@ -5949,7 +5811,6 @@ inline void LayerProto::set_allocated_mnist_param(::singa::MnistProto* mnist_par
} else {
clear_has_mnist_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.mnist_param)
}
// optional .singa.PoolingProto pooling_param = 27;
@@ -5967,13 +5828,11 @@ inline void LayerProto::clear_pooling_param() {
clear_has_pooling_param();
}
inline const ::singa::PoolingProto& LayerProto::pooling_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.pooling_param)
return pooling_param_ != NULL ? *pooling_param_ : *default_instance_->pooling_param_;
}
inline ::singa::PoolingProto* LayerProto::mutable_pooling_param() {
set_has_pooling_param();
if (pooling_param_ == NULL) pooling_param_ = new ::singa::PoolingProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.pooling_param)
return pooling_param_;
}
inline ::singa::PoolingProto* LayerProto::release_pooling_param() {
@@ -5990,7 +5849,6 @@ inline void LayerProto::set_allocated_pooling_param(::singa::PoolingProto* pooli
} else {
clear_has_pooling_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.pooling_param)
}
// repeated .singa.LayerProto sublayers = 35;
@@ -6001,25 +5859,20 @@ inline void LayerProto::clear_sublayers() {
sublayers_.Clear();
}
inline const ::singa::LayerProto& LayerProto::sublayers(int index) const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.sublayers)
return sublayers_.Get(index);
}
inline ::singa::LayerProto* LayerProto::mutable_sublayers(int index) {
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.sublayers)
return sublayers_.Mutable(index);
}
inline ::singa::LayerProto* LayerProto::add_sublayers() {
- // @@protoc_insertion_point(field_add:singa.LayerProto.sublayers)
return sublayers_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >&
LayerProto::sublayers() const {
- // @@protoc_insertion_point(field_list:singa.LayerProto.sublayers)
return sublayers_;
}
inline ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >*
LayerProto::mutable_sublayers() {
- // @@protoc_insertion_point(field_mutable_list:singa.LayerProto.sublayers)
return &sublayers_;
}
@@ -6038,13 +5891,11 @@ inline void LayerProto::clear_slice_param() {
clear_has_slice_param();
}
inline const ::singa::SliceProto& LayerProto::slice_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.slice_param)
return slice_param_ != NULL ? *slice_param_ : *default_instance_->slice_param_;
}
inline ::singa::SliceProto* LayerProto::mutable_slice_param() {
set_has_slice_param();
if (slice_param_ == NULL) slice_param_ = new ::singa::SliceProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.slice_param)
return slice_param_;
}
inline ::singa::SliceProto* LayerProto::release_slice_param() {
@@ -6061,7 +5912,6 @@ inline void LayerProto::set_allocated_slice_param(::singa::SliceProto* slice_par
} else {
clear_has_slice_param();
}
- // @@protoc_insertion_point(field_set_allocated:singa.LayerProto.slice_param)
}
// optional .singa.SplitProto split_param = 33;
@@ -6079,13 +5929,11 @@ inline void LayerProto::clear_split_param() {
clear_has_split_param();
}
inline const ::singa::SplitProto& LayerProto::split_param() const {
- // @@protoc_insertion_point(field_get:singa.LayerProto.split_param)
return split_param_ != NULL ? *split_param_ : *default_instance_->split_param_;
}
inline ::singa::SplitProto* LayerProto::mutable_split_param() {
set_has_split_param();
if (split_param_ == NULL) split_param_ = new ::singa::SplitProto;
- // @@protoc_insertion_point(field_mutable:singa.LayerProto.split_param)
return split_param_;
}
inline ::singa::SplitProto* LayerProto::release_split_param() {
@@ -6102,7 +5950,6 @@ inline void LayerProto::set_allocated_split_param(::singa::SplitProto* split_par
} else {
clear_has_split_param();
<TRUNCATED>
[03/10] incubator-singa git commit: implement shared memory hogwild.
update param at worker side
Posted by wa...@apache.org.
implement shared memory hogwild. update param at worker side
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/806826eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/806826eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/806826eb
Branch: refs/heads/master
Commit: 806826eb1877ef33d6b9b231f3c206300ec36ab1
Parents: b9680a2
Author: wang wei <wa...@comp.nus.edu.sg>
Authored: Tue Jun 9 20:16:46 2015 +0800
Committer: wang wei <wa...@comp.nus.edu.sg>
Committed: Tue Jun 9 20:16:46 2015 +0800
----------------------------------------------------------------------
examples/cifar10/cluster.conf | 4 +-
examples/cifar10/model.conf | 12 +-
include/trainer/worker.h | 2 +
include/utils/param.h | 49 +--
src/proto/cluster.pb.h | 136 ++-----
src/proto/model.pb.h | 811 ++++++++++---------------------------
src/trainer/trainer.cc | 40 +-
src/trainer/worker.cc | 22 +-
src/utils/param.cc | 110 +++++
9 files changed, 432 insertions(+), 754 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/examples/cifar10/cluster.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/cluster.conf b/examples/cifar10/cluster.conf
index 97c64fd..734350d 100644
--- a/examples/cifar10/cluster.conf
+++ b/examples/cifar10/cluster.conf
@@ -1,6 +1,6 @@
-nworker_groups: 1
+nworker_groups: 4
nserver_groups: 1
nservers_per_group: 1
nworkers_per_group: 1
-nworkers_per_procs: 1
+nworkers_per_procs: 4
workspace: "examples/cifar10/"
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/examples/cifar10/model.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/model.conf b/examples/cifar10/model.conf
index 72ebf8e..c809e06 100644
--- a/examples/cifar10/model.conf
+++ b/examples/cifar10/model.conf
@@ -1,10 +1,11 @@
name: "cifar10-convnet"
-train_steps: 70000
+train_steps: 60000
test_steps:100
test_frequency:1000
-display_frequency:30
+display_frequency:100
+hogwild: true
updater{
- momentum:0.9
+ momentum:0.0
weight_decay:0.004
learning_rate_change_method:kFixedStep
step:0
@@ -21,7 +22,8 @@ layer{
type: "kShardData"
data_param {
path: "examples/cifar10/cifar10_train_shard"
- batchsize: 128
+ batchsize: 16
+ random_skip: 10000
}
exclude: kTest
}
@@ -30,7 +32,7 @@ layer{
type: "kShardData"
data_param {
path: "examples/cifar10/cifar10_test_shard"
- batchsize: 128
+ batchsize: 100
}
exclude: kTrain
}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/include/trainer/worker.h
----------------------------------------------------------------------
diff --git a/include/trainer/worker.h b/include/trainer/worker.h
index 87be83b..09262e6 100644
--- a/include/trainer/worker.h
+++ b/include/trainer/worker.h
@@ -5,6 +5,7 @@
#include "neuralnet/neuralnet.h"
#include "proto/model.pb.h"
#include "utils/cluster.h"
+#include "utils/updater.h"
#include "communication/socket.h"
#include "communication/msg.h"
@@ -148,6 +149,7 @@ class Worker {
shared_ptr<NeuralNet> train_net_, test_net_, validation_net_;
shared_ptr<Dealer> layer_dealer_, param_dealer_;
Poller layer_poller_, param_poller_;
+ shared_ptr<Updater> updater_;
};
class BPWorker: public Worker{
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/include/utils/param.h
----------------------------------------------------------------------
diff --git a/include/utils/param.h b/include/utils/param.h
index 0574b2c..529c349 100644
--- a/include/utils/param.h
+++ b/include/utils/param.h
@@ -133,39 +133,32 @@ class Param {
int fan_in_;
};
/**
- * Sync with server by randomly sampling some parameters for every sync.
-class RandomSyncParam: public Param{
+ * To support the shared memory and distributed Hogwild algorithm.
+ * Each worker group has one worker. Workers from the same process share the
+ * memory space for parameter values. Each process has one server group which
+ * also shares the same memory space. Messages except synchronization messages
+ * only transfer pointers to parameter value or gradient space. Hence memory
+ * copy is avoided for intra-process communication.
+ */
+class HogwildParam: public Param{
public:
- virtual zmsg_t* HandleSyncMsg(zmsg_t** msg);
- virtual zmsg_t *GenSyncMsgFromWorker(float sample_ratio);
- virtual void ParseSyncMsgFromPS(zmsg_t** msg);
- virtual void Setup(const ParamProto& proto, const vector<int>& shape, int fan_in);
- virtual void Init();
-
- float* mutable_cpu_snapshot(){
- return snapshot_.mutable_cpu_data();
- }
- const float* cpu_snapshot(){
- return snapshot_.cpu_data();
- }
+ virtual Msg* GenGetMsg(void* arg=nullptr);
+ virtual Msg* GenPutMsg(void* arg=nullptr);
+ virtual Msg* GenUpdateMsg(void* arg=nullptr);
+ virtual Msg* GenSyncMsg(void* arg=nullptr);
- protected:
- const vector<int> RandomSample(int seed, int m, int n);
+ virtual Msg* HandleGetMsg(Msg** msg);
+ virtual Msg* HandlePutMsg(Msg** msg);
+ virtual int ParseUpdateMsg(Msg** msg);
+ virtual Msg* GenUpdateResponseMsg(void* arg=nullptr);
+ virtual Msg* HandleSyncMsg(Msg** msg);
+ virtual int ParseGetResponseMsg(Msg** msg);
+ virtual int ParsePutResponseMsg(Msg** msg);
+ virtual int ParseUpdateResponseMsg(Msg** msg);
+ virtual int ParseSyncResponseMsg(Msg** msg);
- Blob<float> snapshot_;
};
- */
-/**
- * Sync with server by elastic SGD see http://arxiv.org/abs/1412.6651.
-class ElasticParam: public Param{
- public:
- virtual zmsg_t* HandleSyncMsg(zmsg_t** msg);
- virtual zmsg_t *GenSyncMsgFromWorker(float moving_rate);
- virtual void ParseSyncMsgFromPS(zmsg_t** msg);
-};
- */
-
} // namespace singa
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/806826eb/src/proto/cluster.pb.h
----------------------------------------------------------------------
diff --git a/src/proto/cluster.pb.h b/src/proto/cluster.pb.h
index 7468c31..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 ----------------------------------------------------
@@ -272,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_;
@@ -287,11 +286,15 @@ class ClusterProto : public ::google::protobuf::Message {
::std::string* log_dir_;
::google::protobuf::int32 start_port_;
::google::protobuf::int32 stub_timeout_;
- static ::std::string* _default_zookeeper_host_;
::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();
@@ -348,6 +351,7 @@ class ServerTopology : public ::google::protobuf::Message {
void SharedDtor();
void SetCachedSize(int size) const;
public:
+
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
@@ -389,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();
@@ -423,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;
@@ -447,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];
@@ -471,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];
@@ -495,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];
@@ -519,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];
@@ -543,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;
@@ -563,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) {
@@ -623,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];
@@ -643,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;
@@ -667,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];
@@ -691,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;
@@ -711,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) {
@@ -771,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;
@@ -787,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) {
@@ -847,9 +818,8 @@ 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);
}
- // @@protoc_insertion_point(field_set_allocated:singa.ClusterProto.log_dir)
}
// optional string zookeeper_host = 16 [default = "localhost:2181"];
@@ -869,7 +839,6 @@ 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) {
@@ -878,7 +847,6 @@ 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();
@@ -886,7 +854,6 @@ 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();
@@ -894,14 +861,12 @@ 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() {
@@ -925,7 +890,6 @@ 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;
@@ -936,25 +900,20 @@ 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_;
}
@@ -973,13 +932,11 @@ 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];
@@ -997,13 +954,11 @@ 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];
@@ -1021,13 +976,11 @@ 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)
}
// -------------------------------------------------------------------
@@ -1049,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;
@@ -1073,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;
@@ -1090,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_;
}
[08/10] incubator-singa git commit: Merge branch 'pull4'
Posted by wa...@apache.org.
Merge branch 'pull4'
Conflicts:
examples/cifar10/model.conf.example
SINGA-7 Implement shared memory Hogwild algorithm
merge pull request 4
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/bfc09c13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/bfc09c13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/bfc09c13
Branch: refs/heads/master
Commit: bfc09c13eacdc6d79eadaebfbebaed1f70feb236
Parents: e990442 d5f9b9c
Author: wang sheng <wa...@gmail.com>
Authored: Mon Jun 15 14:28:51 2015 +0800
Committer: wang sheng <wa...@gmail.com>
Committed: Mon Jun 15 14:28:51 2015 +0800
----------------------------------------------------------------------
.gitignore | 1 -
examples/cifar10/cluster.conf.example | 6 -
examples/cifar10/model-lmdb.conf.example | 218 -
examples/cifar10/model-prefetch.conf.example | 241 -
examples/cifar10/model.conf.example | 218 -
examples/mnist/cluster.conf.example | 5 -
examples/mnist/conv.conf.example | 175 -
examples/mnist/mlp-lmdb.conf.example | 223 -
examples/mnist/mlp.conf.example | 221 -
include/communication/msg.h | 6 +-
include/trainer/trainer.h | 7 +-
include/trainer/worker.h | 59 +-
include/utils/cluster.h | 8 +
include/utils/param.h | 71 +-
src/proto/cluster.pb.h | 1131 ---
src/proto/cluster.proto | 5 +
src/proto/model.pb.h | 8671 ---------------------
src/trainer/server.cc | 7 +-
src/trainer/trainer.cc | 85 +-
src/trainer/worker.cc | 130 +-
src/utils/param.cc | 278 +-
21 files changed, 246 insertions(+), 11520 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bfc09c13/.gitignore
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bfc09c13/src/trainer/worker.cc
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bfc09c13/src/utils/param.cc
----------------------------------------------------------------------
[04/10] incubator-singa git commit: SINGA-7 Add support for shared
memory hogwild training in single process (node). hogwild training is enabled
by setting share_memory to true (i.e.,
worker groups share memory space for parameter values) in cluster.conf
Posted by wa...@apache.org.
SINGA-7
Add support for shared memory hogwild training in single process (node).
hogwild training is enabled by setting share_memory to true (i.e., worker groups share memory space for parameter values) in cluster.conf.
Depending on the configurations of cluster.conf, there are two places to do the update:
1. if sever_update is true (default) and there is at least one server group, workers send gradients to servers
which conduct the update based on sending worker's running iteration.
2. otherwise, workers update parameters locally.
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/40a86abe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/40a86abe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/40a86abe
Branch: refs/heads/master
Commit: 40a86abebeb923ef39a19cb3f03c445305c3eddc
Parents: 806826e
Author: wang wei <wa...@comp.nus.edu.sg>
Authored: Sat Jun 13 11:38:42 2015 +0800
Committer: wang wei <wa...@comp.nus.edu.sg>
Committed: Sat Jun 13 11:38:42 2015 +0800
----------------------------------------------------------------------
include/communication/msg.h | 6 +-
include/trainer/trainer.h | 7 +-
include/trainer/worker.h | 57 +-----
include/utils/cluster.h | 8 +
include/utils/param.h | 50 ++---
src/proto/cluster.pb.h | 72 +++++++-
src/proto/cluster.proto | 5 +
src/trainer/server.cc | 7 +-
src/trainer/trainer.cc | 47 ++---
src/trainer/worker.cc | 112 ++++++-----
src/utils/param.cc | 390 ++++++++-------------------------------
11 files changed, 276 insertions(+), 485 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/include/communication/msg.h
----------------------------------------------------------------------
diff --git a/include/communication/msg.h b/include/communication/msg.h
index 21ac78e..61cbd01 100644
--- a/include/communication/msg.h
+++ b/include/communication/msg.h
@@ -51,7 +51,6 @@ class BaseMsg{
*/
virtual bool next_frame()=0;
};
-
// TODO make it a compiler argument
#define USE_ZMQ
@@ -186,6 +185,11 @@ class Msg : public BaseMsg{
zframe_t *frame_;
};
#endif
+inline void DeleteMsg(Msg** msg){
+ delete *msg;
+ *msg=nullptr;
+}
+
} /* singa */
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/include/trainer/trainer.h
----------------------------------------------------------------------
diff --git a/include/trainer/trainer.h b/include/trainer/trainer.h
index 37d7106..18250af 100644
--- a/include/trainer/trainer.h
+++ b/include/trainer/trainer.h
@@ -54,14 +54,11 @@ class Trainer{
* otherwise
* @param owner the procs id of the worker who ownes this Param object
*/
- void AddParam(shared_ptr<Param> p, int local, int owner){
+ void AddParam(shared_ptr<Param> p, bool local){
num_local+=local;
num_total+=1;
- if(owner>-1)
- owner_procs=owner;
- if(local>0){
+ if(local)
shares.push_back(p);
- }
}
int num_update, next_version; //!< all counters are atomic
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/include/trainer/worker.h
----------------------------------------------------------------------
diff --git a/include/trainer/worker.h b/include/trainer/worker.h
index 09262e6..7481ebd 100644
--- a/include/trainer/worker.h
+++ b/include/trainer/worker.h
@@ -28,7 +28,6 @@ class Worker {
validation_net_=val_net;
}
-
void Stop();
int Put(shared_ptr<Param> param, int step);
int Get(shared_ptr<Param> param, int step);
@@ -50,14 +49,13 @@ class Worker {
/**
* Test/validate one mini-batch.
*/
- virtual void TestOneBatch(shared_ptr<NeuralNet> net, int step, Phase phase)=0;
+ virtual void TestOneBatch(int step, Phase phase, shared_ptr<NeuralNet> net)=0;
/**
* Test the perforance of the learned model on validation or test dataset.
* Test is done by the first group.
* @param net, neural network
- * @param phase kValidation or kTest.
*/
- void Test(shared_ptr<NeuralNet> net, int nsteps, const string &prefix);
+ void Test(int nsteps, Phase phase, shared_ptr<NeuralNet> net);
/**
* Main function of Worker.
@@ -66,12 +64,6 @@ class Worker {
*/
virtual void Run();
-
- /**
- * Pull data from layers resident on other nodes due to Model Partition.
- void Pull(zsock_t* pull, shared_ptr<NeuralNet> net);
- */
-
/**
* Check is it time to display training info, e.g., loss and precison.
*/
@@ -130,63 +122,30 @@ class Worker {
% modelproto_.validation_frequency() == 0));
}
-
- /**
- * start training from scratch.
- * setup training/test/validation neuralnets, then call Run().
- void Start(ModelProto model);
- */
/**
* TODO Resume from snapshot
void Resume();
*/
void ReceiveBlobs(shared_ptr<NeuralNet> net);
void SendBlob();
+ void ConnectStub(shared_ptr<Dealer> dealer);
protected:
int thread_id_, group_id_, worker_id_;
int step_;
ModelProto modelproto_;
shared_ptr<NeuralNet> train_net_, test_net_, validation_net_;
- shared_ptr<Dealer> layer_dealer_, param_dealer_;
- Poller layer_poller_, param_poller_;
+ shared_ptr<Dealer> layer_dealer_, dealer_;
shared_ptr<Updater> updater_;
};
class BPWorker: public Worker{
public:
+ BPWorker(int thread_id, int group_id, int worker_id);
~BPWorker(){}
- BPWorker(int thread_id, int group_id, int worker_id):Worker(thread_id, group_id, worker_id){}
virtual void TrainOneBatch(int step);
- virtual void TestOneBatch(shared_ptr<NeuralNet> net, int step, Phase phase);
- void Forward(shared_ptr<NeuralNet> net, int step, bool training);
- void Backward(shared_ptr<NeuralNet> net, int step);
- /**
- * Profiling the time cost of training one batch.
- string TimerInfo(){
- char buf[1024];
- float ticks=ticks_*1000;
- float tf=tForward_/ticks, tb=tBackward_/ticks,
- td=tSyncData_/ticks, tp=tSyncParam_/ticks;
- float total=tf+tb+td+tp;
- sprintf(buf,
- "Total\t%6.2f\tforward\t%6.2f\tbackward\t%6.2f\t"
- // syncdata\t%6.2f\tsyncparam\t%6.2f\n"
- , total,tf,tb);
- float gensync=Param::worker_gen_sync/ticks;
- float handlesync=Param::worker_handle_sync/ticks;
- sprintf(buf+strlen(buf),
- "worker_gen_sync\t%6.2f\tworker_handle_sync\t%6.2f\n",
- gensync, handlesync);
- Param::worker_gen_sync=0;
- Param::worker_handle_sync=0;
- tForward_=0;
- tBackward_=0;
- tSyncData_=0;
- tSyncData_=0;
- ticks_=0;
- return string(buf);
- }
- */
+ virtual void TestOneBatch(int step, Phase phase, shared_ptr<NeuralNet> net);
+ void Forward(int step, Phase phase, shared_ptr<NeuralNet> net);
+ void Backward(int step, shared_ptr<NeuralNet> net);
};
} // namespace singa
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/include/utils/cluster.h
----------------------------------------------------------------------
diff --git a/include/utils/cluster.h b/include/utils/cluster.h
index d7ac365..fcdb241 100644
--- a/include/utils/cluster.h
+++ b/include/utils/cluster.h
@@ -102,6 +102,14 @@ class Cluster {
return cluster_.server_timeout();
}
+ const bool server_update() const {
+ return cluster_.server_update();
+ }
+
+ const bool share_memory() const {
+ return cluster_.share_memory();
+ }
+
/**
* bandwidth MB/s
float bandwidth() const {
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/include/utils/param.h
----------------------------------------------------------------------
diff --git a/include/utils/param.h b/include/utils/param.h
index 529c349..e55480b 100644
--- a/include/utils/param.h
+++ b/include/utils/param.h
@@ -11,19 +11,20 @@
namespace singa {
class Param {
public:
- Param():data_(nullptr){}
+ Param();
virtual ~Param(){};
- virtual Msg* GenGetMsg(void* arg=nullptr);
- virtual Msg* GenPutMsg(void* arg=nullptr);
- virtual Msg* GenUpdateMsg(void* arg=nullptr);
- virtual Msg* GenSyncMsg(void* arg=nullptr);
+ virtual Msg* GenGetMsg(bool copy, int v=-1);
+ virtual Msg* GenPutMsg(bool copy, int v=-1);
+ virtual Msg* GenUpdateMsg(bool copy, int v=-1);
+ virtual Msg* GenSyncMsg(bool copy, int v=-1);
virtual Msg* HandleGetMsg(Msg** msg);
virtual Msg* HandlePutMsg(Msg** msg);
- virtual int ParseUpdateMsg(Msg** msg);
- virtual Msg* GenUpdateResponseMsg(void* arg=nullptr);
virtual Msg* HandleSyncMsg(Msg** msg);
+ virtual const std::pair<bool, int> ParseUpdateMsg(Msg** msg);
+ virtual Msg* GenUpdateResponseMsg(bool copy, int v=-1);
+
virtual int ParseGetResponseMsg(Msg** msg);
virtual int ParsePutResponseMsg(Msg** msg);
@@ -74,12 +75,27 @@ class Param {
proto_.set_owner(id);
}
+ /**
+ * return the version of the parameter value shared by multiple workers
+ */
int version() const {
- return data_->version(); // TODO store version in data blob
+ return data_->version();
}
+
void set_version(int v) {
data_->set_version(v); // TODO read version from data blob
}
+
+ /**
+ * return the version of the parameter value local to a worker
+ */
+ int local_version() const {
+ return local_version_;
+ }
+
+ void set_local_version(int v){
+ local_version_=v;
+ }
/**
* @return num of floats.
*/
@@ -131,6 +147,7 @@ class Param {
Blob<float> grad_, history_;
ParamProto proto_;
int fan_in_;
+ int local_version_;
};
/**
* To support the shared memory and distributed Hogwild algorithm.
@@ -141,23 +158,6 @@ class Param {
* copy is avoided for intra-process communication.
*/
class HogwildParam: public Param{
- public:
- virtual Msg* GenGetMsg(void* arg=nullptr);
- virtual Msg* GenPutMsg(void* arg=nullptr);
- virtual Msg* GenUpdateMsg(void* arg=nullptr);
- virtual Msg* GenSyncMsg(void* arg=nullptr);
-
- virtual Msg* HandleGetMsg(Msg** msg);
- virtual Msg* HandlePutMsg(Msg** msg);
- virtual int ParseUpdateMsg(Msg** msg);
- virtual Msg* GenUpdateResponseMsg(void* arg=nullptr);
- virtual Msg* HandleSyncMsg(Msg** msg);
-
- virtual int ParseGetResponseMsg(Msg** msg);
- virtual int ParsePutResponseMsg(Msg** msg);
- virtual int ParseUpdateResponseMsg(Msg** msg);
- virtual int ParseSyncResponseMsg(Msg** msg);
-
};
} // namespace singa
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/src/proto/cluster.pb.h
----------------------------------------------------------------------
diff --git a/src/proto/cluster.pb.h b/src/proto/cluster.pb.h
index 564be1f..82ee8b2 100644
--- a/src/proto/cluster.pb.h
+++ b/src/proto/cluster.pb.h
@@ -236,6 +236,20 @@ class ClusterProto : public ::google::protobuf::Message {
inline ::google::protobuf::int32 server_timeout() const;
inline void set_server_timeout(::google::protobuf::int32 value);
+ // optional bool server_update = 40 [default = true];
+ inline bool has_server_update() const;
+ inline void clear_server_update();
+ static const int kServerUpdateFieldNumber = 40;
+ inline bool server_update() const;
+ inline void set_server_update(bool value);
+
+ // optional bool share_memory = 41 [default = true];
+ inline bool has_share_memory() const;
+ inline void clear_share_memory();
+ static const int kShareMemoryFieldNumber = 41;
+ inline bool share_memory() const;
+ inline void set_share_memory(bool value);
+
// @@protoc_insertion_point(class_scope:singa.ClusterProto)
private:
inline void set_has_nworker_groups();
@@ -270,6 +284,10 @@ class ClusterProto : public ::google::protobuf::Message {
inline void clear_has_worker_timeout();
inline void set_has_server_timeout();
inline void clear_has_server_timeout();
+ inline void set_has_server_update();
+ inline void clear_has_server_update();
+ inline void set_has_share_memory();
+ inline void clear_has_share_memory();
::google::protobuf::UnknownFieldSet _unknown_fields_;
@@ -280,20 +298,22 @@ class ClusterProto : public ::google::protobuf::Message {
::google::protobuf::int32 nworkers_per_procs_;
::google::protobuf::int32 nservers_per_procs_;
::std::string* hostfile_;
- bool server_worker_separate_;
::google::protobuf::int32 nprocs_;
+ ::google::protobuf::int32 start_port_;
::std::string* workspace_;
::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 stub_timeout_;
+ bool server_worker_separate_;
+ bool server_update_;
+ bool share_memory_;
::google::protobuf::int32 worker_timeout_;
::google::protobuf::int32 server_timeout_;
mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(17 + 31) / 32];
+ ::google::protobuf::uint32 _has_bits_[(19 + 31) / 32];
friend void protobuf_AddDesc_cluster_2eproto();
friend void protobuf_AssignDesc_cluster_2eproto();
@@ -983,6 +1003,50 @@ inline void ClusterProto::set_server_timeout(::google::protobuf::int32 value) {
server_timeout_ = value;
}
+// optional bool server_update = 40 [default = true];
+inline bool ClusterProto::has_server_update() const {
+ return (_has_bits_[0] & 0x00020000u) != 0;
+}
+inline void ClusterProto::set_has_server_update() {
+ _has_bits_[0] |= 0x00020000u;
+}
+inline void ClusterProto::clear_has_server_update() {
+ _has_bits_[0] &= ~0x00020000u;
+}
+inline void ClusterProto::clear_server_update() {
+ server_update_ = true;
+ clear_has_server_update();
+}
+inline bool ClusterProto::server_update() const {
+ return server_update_;
+}
+inline void ClusterProto::set_server_update(bool value) {
+ set_has_server_update();
+ server_update_ = value;
+}
+
+// optional bool share_memory = 41 [default = true];
+inline bool ClusterProto::has_share_memory() const {
+ return (_has_bits_[0] & 0x00040000u) != 0;
+}
+inline void ClusterProto::set_has_share_memory() {
+ _has_bits_[0] |= 0x00040000u;
+}
+inline void ClusterProto::clear_has_share_memory() {
+ _has_bits_[0] &= ~0x00040000u;
+}
+inline void ClusterProto::clear_share_memory() {
+ share_memory_ = true;
+ clear_has_share_memory();
+}
+inline bool ClusterProto::share_memory() const {
+ return share_memory_;
+}
+inline void ClusterProto::set_share_memory(bool value) {
+ set_has_share_memory();
+ share_memory_ = value;
+}
+
// -------------------------------------------------------------------
// ServerTopology
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/src/proto/cluster.proto
----------------------------------------------------------------------
diff --git a/src/proto/cluster.proto b/src/proto/cluster.proto
index ec7ac7f..f79d7d4 100644
--- a/src/proto/cluster.proto
+++ b/src/proto/cluster.proto
@@ -36,6 +36,11 @@ message ClusterProto{
optional int32 stub_timeout=30 [default=5000];
optional int32 worker_timeout=31 [default=5000];
optional int32 server_timeout=32 [default=5000];
+
+ // conduct updates at server side; otherwise do it at worker side
+ optional bool server_update=40 [default=true];
+ // share memory space between worker groups in one procs
+ optional bool share_memory=41 [default=true];
}
message ServerTopology{
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/src/trainer/server.cc
----------------------------------------------------------------------
diff --git a/src/trainer/server.cc b/src/trainer/server.cc
index 5d530da..e0fcb48 100644
--- a/src/trainer/server.cc
+++ b/src/trainer/server.cc
@@ -110,11 +110,10 @@ Msg* Server::HandleGet(shared_ptr<Param> param, Msg **msg){
Msg* Server::HandleUpdate(shared_ptr<Param> param, Msg **msg) {
//repsonse of the format: <identity><type: kData><paramId><param content>
auto* tmp=static_cast<Msg*>((*msg)->CopyAddr());
- int v=(*msg)->target_second()+1;
- param->ParseUpdateMsg(msg);
- updater_->Update(param->version(), param);
+ const std::pair<bool, int> copy_step=param->ParseUpdateMsg(msg);
+ updater_->Update(copy_step.second, param);
param->set_version(param->version()+1);
- auto response=param->GenUpdateResponseMsg(&v);
+ auto response=param->GenUpdateResponseMsg(copy_step.first, param->version());
tmp->SwapAddr();
response->SetAddr(tmp);
delete tmp;
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/src/trainer/trainer.cc
----------------------------------------------------------------------
diff --git a/src/trainer/trainer.cc b/src/trainer/trainer.cc
index dbf8a48..3d69249 100644
--- a/src/trainer/trainer.cc
+++ b/src/trainer/trainer.cc
@@ -65,7 +65,7 @@ void Trainer::Start(const ModelProto& mproto, const ClusterProto& cproto,
vector<shared_ptr<Server>> servers;
vector<HandleContext> ctx;
int nthreads=1; // the first socket is the router
- if(cluster->has_server()){
+ if(cluster->has_server()){ // todo move sever creation to a method
int pid=cluster->procs_id();
if(cluster->server_worker_separate())
pid-=cluster->nworker_procs();
@@ -88,11 +88,10 @@ void Trainer::Start(const ModelProto& mproto, const ClusterProto& cproto,
}
}
}
-
// create workers
vector<shared_ptr<Worker>> workers;
std::map<int, shared_ptr<Trainer::ParamShard>> shards;
- if(cluster->has_worker()){
+ if(cluster->has_worker()){ //move worker creation to a method
auto net=NeuralNet::SetupNeuralNet(mproto.neuralnet(), kTrain,
cluster->nworkers_per_group());
//LOG(ERROR)<<net->ToString();
@@ -123,7 +122,7 @@ void Trainer::Start(const ModelProto& mproto, const ClusterProto& cproto,
cluster->nworkers_per_group());
// the train net for other groups may share parameter values from the
// first group
- if(mproto.hogwild())
+ if(cluster->share_memory())
train_net->ShareParams(net, kValueOnly);
}
if(gid==0){
@@ -146,13 +145,14 @@ void Trainer::Start(const ModelProto& mproto, const ClusterProto& cproto,
shards[gid]=shard;
for(auto layer: train_net->layers()){
int procsid=ProcsIDOf(gid, layer->partitionid(),kWorkerParam);
- int local=procsid==cluster->procs_id();
+ bool local=procsid==cluster->procs_id();
for(auto param: layer->GetParams()){
- int owner=param->owner()<0||param->owner()==param->id()?procsid:-1;
+ int owner_procs=param->owner()==param->id()?procsid:procs_id_;
if(shard->find(param->owner())==shard->end())
- (*shard)[param->owner()]=make_shared<ParamInfo>(param, local, owner);
+ (*shard)[param->owner()]=
+ make_shared<ParamInfo>(param, local, owner_procs);
else
- shard->at(param->owner())->AddParam(param, local, owner);
+ shard->at(param->owner())->AddParam(param, local);
}
}
for(int wid=wstart;wid<wend;wid++){
@@ -229,7 +229,7 @@ void Trainer::Run(int nworkers, int nservers,
}
delete msg;
msg=nullptr;
- }else if(cluster->nserver_groups()>1){
+ }else if(cluster->nserver_groups()>0){
int group_id=msg->src_first();
int paramid=msg->target_first();
auto entry=shards.at(group_id)->at(paramid);
@@ -328,11 +328,13 @@ Msg* Trainer::HandleGet(shared_ptr<ParamInfo> pi, Msg** msg){
}
}else if(version>pi->next_version){
pi->next_version=version;
- reply=pi->shares.at(0)->GenGetMsg(&version);
int gid=msgg->src_first(), pid=msgg->target_first();
+ int dstgroup=gid/Cluster::Get()->nworker_groups_per_server_group();
+ int dstid=Sharding(pid);
+ int dstprocs=ProcsIDOf(dstgroup, dstid, kServer);
+ reply=pi->shares.at(0)->GenGetMsg(dstprocs!=procs_id_);
reply->set_src(procs_id_, gid, kStub);
- reply->set_dst(gid/Cluster::Get()->nworker_groups_per_server_group(),
- Sharding(pid), kServer);
+ reply->set_dst(dstgroup, dstid, kServer);
}
return reply;
}
@@ -345,6 +347,7 @@ Msg* Trainer::HandleGetResponse(shared_ptr<ParamInfo>pi, Msg** msg){
Msg* Trainer::HandleUpdate(shared_ptr<ParamInfo>pi, Msg** msg){
Msg* msgg=*msg, *update=nullptr;
+ int step= msgg->target_second();
if(msgg->src_flag()==kStub){
if(pi->num_update<pi->num_local)
return *msg; //wait unitl local updates are ready
@@ -366,8 +369,7 @@ Msg* Trainer::HandleUpdate(shared_ptr<ParamInfo>pi, Msg** msg){
}
agg/=pi->num_total;
if(pi->num_local<pi->num_total){
- int v=msgg->target_second();
- update=pi->shares.at(0)->GenUpdateMsg(&v);
+ update=pi->shares.at(0)->GenUpdateMsg(pi->owner_procs!=procs_id_, step);
int gid=msgg->src_first();
update->set_src(procs_id_, gid,kStub);
update->set_dst(pi->owner_procs, gid, kStub);
@@ -375,12 +377,13 @@ Msg* Trainer::HandleUpdate(shared_ptr<ParamInfo>pi, Msg** msg){
}
}
if(pi->num_update==pi->num_total){
- int v=msgg->target_second();
- update=pi->shares.at(0)->GenUpdateMsg(&v);
int gid=msgg->src_first();
+ int dstgroup=gid/Cluster::Get()->nworker_groups_per_server_group();
+ int dstid=Sharding(msgg->target_first());
+ int dstprocs=ProcsIDOf(dstgroup, dstid, kServer);
+ update=pi->shares.at(0)->GenUpdateMsg(dstprocs!=procs_id_, step);
update->set_src(procs_id_, gid, kStub);
- update->set_dst(gid/Cluster::Get()->nworker_groups_per_server_group(),
- Sharding((*msg)->target_first()), kServer);
+ update->set_dst(dstgroup, dstid, kServer);
pi->num_update=0;
}
delete *msg;
@@ -395,12 +398,14 @@ int Trainer::HandleUpdateResponse(shared_ptr<Trainer::ParamInfo> pi, Msg** msg){
Msg* Trainer::HandlePut(shared_ptr<Trainer::ParamInfo>pi, Msg** msg){
CHECK_NE((*msg)->src_flag(), kStub);
- Msg* put=pi->shares.at(0)->GenPutMsg();
int gid=(*msg)->src_first();
int id=(*msg)->target_first();
+ int dstgroup=gid/Cluster::Get()->nworker_groups_per_server_group();
+ int dstid=Sharding(id);
+ int dstprocs=ProcsIDOf(dstgroup, dstid, kServer);
+ Msg* put=pi->shares.at(0)->GenPutMsg(dstprocs!=procs_id_);
put->set_src(procs_id_, gid , kStub);
- put->set_dst(gid/Cluster::Get()->nworker_groups_per_server_group(),
- Sharding(id), kServer);
+ put->set_dst(dstgroup, dstid, kServer);
delete *msg;
*msg=NULL;
return put;
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/src/trainer/worker.cc
----------------------------------------------------------------------
diff --git a/src/trainer/worker.cc b/src/trainer/worker.cc
index 3d400ee..1a2c265 100644
--- a/src/trainer/worker.cc
+++ b/src/trainer/worker.cc
@@ -12,7 +12,6 @@ using std::thread;
namespace singa {
Worker::Worker(int thread_id, int group_id, int worker_id):
thread_id_(thread_id), group_id_(group_id), worker_id_(worker_id){
-
}
void Worker::Setup(const ModelProto& model,
@@ -20,72 +19,58 @@ void Worker::Setup(const ModelProto& model,
train_net_=train_net;
modelproto_=model;
auto cluster=Cluster::Get();
- int sgid=group_id_/cluster->nworker_groups_per_server_group();
- CHECK(cluster->runtime()->wJoinSGroup(group_id_, worker_id_, sgid));
- if(model.hogwild()){
+ if(cluster->nserver_groups()&&cluster->server_update()){
+ int sgid=group_id_/cluster->nworker_groups_per_server_group();
+ CHECK(cluster->runtime()->wJoinSGroup(group_id_, worker_id_, sgid));
+ }else{
updater_=shared_ptr<Updater>(Singleton<Factory<Updater>>::Instance()
->Create("Updater"));
updater_->Init(model.updater());
}
}
-void Worker::Run(){
- param_dealer_=make_shared<Dealer>(2*thread_id_);
- param_dealer_->Connect(kInprocRouterEndpoint);
- param_poller_.Add(param_dealer_.get());
- layer_dealer_=make_shared<Dealer>(2*thread_id_+1);
- layer_dealer_->Connect(kInprocRouterEndpoint);
-
- { // TODO remove waiting pong msg
+void Worker::ConnectStub(shared_ptr<Dealer> dealer){
+ dealer->Connect(kInprocRouterEndpoint);
Msg* ping=new Msg();
ping->set_src(group_id_, worker_id_, kWorkerParam);
ping->set_dst(-1,-1,kStub);
ping->set_type(kConnect);
ping->add_frame("PING", 4);
- param_dealer_->Send(&ping);
- ping=param_dealer_->Receive();
+ dealer->Send(&ping);
+ ping=dealer->Receive();
string pong((char*)ping->frame_data(), ping->frame_size());
CHECK_STREQ("PONG", pong.c_str());
delete ping;
- }
+}
- {
- Msg* ping=new Msg();
- ping->set_src(group_id_, worker_id_, kWorkerLayer);
- ping->set_dst(-1,-1,kStub);
- ping->set_type(kConnect);
- ping->add_frame("PING", 4);
- layer_dealer_->Send(&ping);
- ping=layer_dealer_->Receive();
- string pong((char*)ping->frame_data(), ping->frame_size());
- CHECK_STREQ("PONG", pong.c_str());
- delete ping;
- }
+void Worker::Run(){
+ dealer_=make_shared<Dealer>(2*thread_id_);
+ ConnectStub(dealer_);
+ for(auto layer: train_net_->layers())
+ if(layer->partitionid()==worker_id_)
+ if(layer->is_bridgedstlayer()||layer->is_bridgesrclayer()){
+ layer_dealer_=make_shared<Dealer>(2*thread_id_+1);
+ ConnectStub(layer_dealer_);
+ break;
+ }
step_=modelproto_.step();
- //layer_dealer_=std::make_shared<Dealer>(thread_id_*2);
// init params
for(auto layer: train_net_->layers()){
- //LOG(ERROR)<<layer->partitionid()<<" : "<<layer->name();
if(layer->partitionid()==worker_id_)
for(auto param: layer->GetParams()){
- if(group_id_==0){
- if(param->owner()==param->id()){
+ if(param->owner() == param->id()){
+ if(group_id_==0)
param->Init(0);
- Put(param, step_);
- }else{
- Get(param, 0);
- }
- }else{
- Get(param, modelproto_.warmup_steps());
+ else
+ Get(param, modelproto_.warmup_steps());
}
}
}
Metric perf;
- if(group_id_==0&&step_<modelproto_.warmup_steps()){
+ if(group_id_==0){
for(step_=0;step_<modelproto_.warmup_steps();step_++)
RunOneBatch(step_, &perf);
for(auto layer: train_net_->layers()){
- //LOG(ERROR)<<layer->partitionid()<<" : "<<layer->name();
if(layer->partitionid()==worker_id_)
for(auto param: layer->GetParams())
if(param->owner()==param->id())
@@ -108,7 +93,7 @@ void Worker::Stop(){
msg->set_src(group_id_, worker_id_, kWorkerParam);
msg->set_dst(-1,-1, kStub);
msg->set_type(kStop);
- param_dealer_->Send(&msg);
+ dealer_->Send(&msg); // use param dealer to send the stop msg
}
int Worker::Put(shared_ptr<Param> param, int step){
Msg* msg=new Msg();
@@ -116,7 +101,7 @@ int Worker::Put(shared_ptr<Param> param, int step){
msg->set_dst(-1, -1, kStub);
msg->set_type(kPut);
msg->set_target(param->owner(), step);
- param_dealer_->Send(&msg);
+ dealer_->Send(&msg);
return 1;
}
int Worker::Get(shared_ptr<Param> param, int step){
@@ -125,10 +110,11 @@ int Worker::Get(shared_ptr<Param> param, int step){
msg->set_dst(-1, -1, kStub);
msg->set_type(kGet);
msg->set_target(param->owner(), step);
- param_dealer_->Send(&msg);
+ dealer_->Send(&msg);
return 1;
}
int Worker::Update(shared_ptr<Param> param, int step){
+ param->set_local_version(param->version());
if(updater_){
updater_->Update(step, param);
param->set_version(param->version()+1);
@@ -138,7 +124,7 @@ int Worker::Update(shared_ptr<Param> param, int step){
msg->set_dst(-1, -1, kStub);
msg->set_type(kUpdate);
msg->set_target(param->owner(), step);
- param_dealer_->Send(&msg);
+ dealer_->Send(&msg);
}
return 1;
}
@@ -154,7 +140,7 @@ int Worker::CollectAll(shared_ptr<NeuralNet> net, int step){
return 1;
}
int Worker::Collect(shared_ptr<Param> param, int step){
- while(param->version()<step){
+ while(param->version()<=param->local_version()){
std::this_thread::sleep_for(std::chrono::milliseconds(kCollectSleepTime));
}
return 1;
@@ -168,7 +154,7 @@ const void Worker::DisplayPerformance(const Metric & perf, const string& prefix)
const string disp=perf.ToString();
msg->add_frame(prefix.c_str(), prefix.length());
msg->add_frame(disp.c_str(), disp.length());
- param_dealer_->Send(&msg);
+ dealer_->Send(&msg);
//LOG(ERROR)<<prefix<<" "<<perf.ToString();
}
@@ -176,12 +162,12 @@ void Worker::RunOneBatch(int step, Metric* perf){
if(ValidateNow(step)){
//LOG(ERROR)<<"Validation at step "<<step;
CollectAll(validation_net_, step);
- Test(validation_net_, modelproto_.validation_steps(), "Validation");
+ Test(modelproto_.validation_steps(),kValidation, validation_net_);
}
if(TestNow(step)){
//LOG(ERROR)<<"Test at step "<<step;
CollectAll(test_net_, step);
- Test(test_net_, modelproto_.test_steps(), "Test");
+ Test(modelproto_.test_steps(), kTest, test_net_);
}
TrainOneBatch(step);
//LOG(ERROR)<<"Train "<<step;
@@ -214,11 +200,11 @@ void Worker::ReceiveBlobs(shared_ptr<NeuralNet> net){
void Worker::SendBlob(){
}
-void Worker::Test(shared_ptr<NeuralNet> net, int nsteps, const string& prefix){
+void Worker::Test(int nsteps, Phase phase, shared_ptr<NeuralNet> net){
const auto& losslayers=net->losslayers();
Metric perf;
for(int step=0;step<nsteps;step++){
- TestOneBatch(net, step, kTest);
+ TestOneBatch(step, phase, net);
for(auto layer: losslayers){
if(layer->partitionid()==worker_id_){
const float * ptr=layer->metric().cpu_data();
@@ -229,12 +215,19 @@ void Worker::Test(shared_ptr<NeuralNet> net, int nsteps, const string& prefix){
perf.Inc();
}
perf.Avg();
- DisplayPerformance(perf, prefix);
+ if(phase==kValidation)
+ DisplayPerformance(perf, "Validation");
+ else if (phase==kTest)
+ DisplayPerformance(perf, "Test");
}
/****************************BPWorker**********************************/
-void BPWorker::Forward(shared_ptr<NeuralNet> net, int step, bool training){
+BPWorker::BPWorker(int thread_id, int group_id, int worker_id):
+ Worker(thread_id, group_id, worker_id){
+}
+
+void BPWorker::Forward(int step, Phase phase, shared_ptr<NeuralNet> net){
auto& layers=net->layers();
for(auto& layer: layers){
if(layer->partitionid()==worker_id_){
@@ -254,13 +247,13 @@ void BPWorker::Forward(shared_ptr<NeuralNet> net, int step, bool training){
delete msg;
}
}
- if(training){
+ if(phase==kTrain){
for(shared_ptr<Param> p: layer->GetParams()){
Collect(p, step);
}
}
//clock_t s=clock();
- layer->ComputeFeature(training);
+ layer->ComputeFeature(phase==kTrain);
//LOG(ERROR)<<layer->name()<<":"<<(clock()-s)*1.0/CLOCKS_PER_SEC;
if(layer->is_bridgesrclayer()){
auto dst=layer->dstlayers().at(0);
@@ -272,7 +265,8 @@ void BPWorker::Forward(shared_ptr<NeuralNet> net, int step, bool training){
msg->add_frame(blob.cpu_data(), blob.count()*sizeof(float));
layer_dealer_->Send(&msg);
}
- if(training&&DisplayDebugInfo(step)&&layer->mutable_data(nullptr)!=nullptr){
+ if(phase==kTrain&&DisplayDebugInfo(step)
+ &&layer->mutable_data(nullptr)!=nullptr){
LOG(INFO)<<StringPrintf("Forward layer %10s data norm1 %13.9f",
layer->name().c_str(), layer->data(nullptr).asum_data());
}
@@ -280,7 +274,7 @@ void BPWorker::Forward(shared_ptr<NeuralNet> net, int step, bool training){
}
}
-void BPWorker::Backward(shared_ptr<NeuralNet> net, int step){
+void BPWorker::Backward(int step, shared_ptr<NeuralNet> net){
auto& layers=net->layers();
for (auto it = layers.rbegin(); it != layers.rend(); it++){
shared_ptr<Layer> layer=*it;
@@ -310,12 +304,12 @@ void BPWorker::Backward(shared_ptr<NeuralNet> net, int step){
}
void BPWorker::TrainOneBatch(int step){
- Forward(train_net_, step, true);
- Backward(train_net_, step);
+ Forward(step, kTrain, train_net_);
+ Backward(step, train_net_);
}
-void BPWorker::TestOneBatch(shared_ptr<NeuralNet> net,int step, Phase phase){
- Forward(net, step, false);
+void BPWorker::TestOneBatch(int step, Phase phase, shared_ptr<NeuralNet> net){
+ Forward(step, phase, net);
}
} // namespace singa
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/40a86abe/src/utils/param.cc
----------------------------------------------------------------------
diff --git a/src/utils/param.cc b/src/utils/param.cc
index e616a1c..c109a88 100644
--- a/src/utils/param.cc
+++ b/src/utils/param.cc
@@ -10,115 +10,138 @@ using std::vector;
using std::string;
namespace singa {
-Msg* Param::GenPutMsg(void* arg){
+Param::Param():data_(nullptr), local_version_(-1){}
+
+Msg* Param::GenPutMsg(bool copy, int v){
+ Msg* msg=new Msg();
+ msg->set_type(kPut);
+ msg->set_target(owner(), version());
char buf[128];
sprintf(buf, "%d %f %f", size(),
learning_rate_multiplier(), weight_decay_multiplier());
- Msg* msg=new Msg();
- msg->set_type(kPut);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
- msg->set_target(owner(), v);
- msg->add_frame(buf, strlen(buf));
- msg->add_frame(mutable_cpu_data(), size()*sizeof(float));
+ if(copy){
+ sprintf(buf+strlen(buf), " %p", nullptr);
+ msg->add_frame(buf, strlen(buf));
+ msg->add_frame(mutable_cpu_data(), size()*sizeof(float));
+ }else{
+ //share the data blob which includes the blob version
+ sprintf(buf+strlen(buf), " %p", data_.get());
+ msg->add_frame(buf, strlen(buf));
+ }
return msg;
}
-Msg* Param::GenGetMsg(void* arg){
+Msg* Param::GenGetMsg(bool copy, int v){
Msg* msg=new Msg();
msg->set_type(kGet);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
- msg->set_target(owner(), v);
+ msg->set_target(owner(), local_version()+1);
+ msg->add_frame(©, sizeof(bool));
return msg;
}
-Msg* Param::GenUpdateMsg(void* arg){
+Msg* Param::GenUpdateMsg(bool copy, int v){
Msg* msg=new Msg();
msg->set_type(kUpdate);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
msg->set_target(owner(), v);
- msg->add_frame(mutable_cpu_grad(), size()*sizeof(float));
+ msg->add_frame(©, sizeof(bool));
+ if(copy)
+ msg->add_frame(mutable_cpu_grad(), size()*sizeof(float));
+ else{ // to share values of grad blob
+ char buf[32]; sprintf(buf, "%p", &grad_);
+ msg->add_frame(buf, strlen(buf));
+ //LOG(ERROR)<<"param id="<<id()<<" ptr="<<buf;
+ }
return msg;
}
-Msg* Param::GenSyncMsg(void* arg){
+Msg* Param::GenSyncMsg(bool copy, int v){
return nullptr;
}
Msg* Param::HandlePutMsg(Msg** msg){
int size;
float lr, wc;
- sscanf(static_cast<char*>((*msg)->frame_data()), "%d %f %f",
- &size, &lr, &wc);
+ void* ptr;
+ sscanf(static_cast<char*>((*msg)->frame_data()), "%d %f %f %p",
+ &size, &lr, &wc, &ptr);
proto_.set_learning_rate_multiplier(lr);
proto_.set_weight_decay_multiplier(wc);
- CHECK((*msg)->next_frame());
vector<int> shape{size};
- data_=std::make_shared<Blob<float>>(shape);
- data_->set_version((*msg)->target_second());
grad_.Reshape(shape);
history_.Reshape(shape);
- CHECK_EQ(size* sizeof(float), (*msg)->frame_size());
- memcpy(mutable_cpu_data(), (*msg)->frame_data(), size*sizeof(float));
- delete (*msg);
- *msg=nullptr;
+ data_=std::make_shared<Blob<float>>(shape);
+ if(ptr==nullptr){
+ data_->set_version((*msg)->target_second());
+ CHECK((*msg)->next_frame());
+ CHECK_EQ(size* sizeof(float), (*msg)->frame_size());
+ memcpy(mutable_cpu_data(), (*msg)->frame_data(), size*sizeof(float));
+ } else{
+ data_->ShareData(*static_cast<Blob<float>*>(ptr));
+ }
+ DeleteMsg(msg);
return nullptr;
}
Msg* Param::HandleGetMsg(Msg** msg){
if((*msg)->target_second()<=version()){
- (*msg)->add_frame(mutable_cpu_data(), sizeof(float)*size());
+ bool* copy=static_cast<bool*>((*msg)->frame_data());
+ (*msg)->next_frame();
+ if(*copy)
+ (*msg)->add_frame(mutable_cpu_data(), sizeof(float)*size());
(*msg)->SwapAddr();
(*msg)->set_type(kRGet);
}
return *msg;
}
-int Param::ParseUpdateMsg(Msg** msg){
- CHECK((*msg)->frame_size());
- memcpy(mutable_cpu_grad(), (*msg)->frame_data(),(*msg)->frame_size());
- delete (*msg);
- *msg=nullptr;
- return 1;
+const std::pair<bool, int> Param::ParseUpdateMsg(Msg** msg){
+ int step=(*msg)->target_second();
+ bool* copy=static_cast<bool*>((*msg)->frame_data());
+ (*msg)->next_frame();
+ if(*copy){
+ CHECK((*msg)->frame_size());
+ memcpy(mutable_cpu_grad(), (*msg)->frame_data(),(*msg)->frame_size());
+ }else {// use the same data field of the grad blob
+ Blob<float>* ptr=nullptr;
+ sscanf(static_cast<char*>((*msg)->frame_data()), "%p", &ptr);
+ //LOG(ERROR)<<"id="<<id()<<" ptr="<<ptr;
+ grad_.ShareData(*ptr);
+ }
+ DeleteMsg(msg);
+ return std::make_pair(*copy, step);
}
-Msg* Param::GenUpdateResponseMsg(void* arg){
+Msg* Param::GenUpdateResponseMsg(bool copy, int v){
Msg* msg=new Msg();
msg->set_type(kRUpdate);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
msg->set_target(owner(), v);
- msg->add_frame(mutable_cpu_data(), size()*sizeof(float));
+ msg->add_frame(©, sizeof(bool));
+ if(copy)
+ msg->add_frame(mutable_cpu_data(), size()*sizeof(float));
return msg;
}
Msg* Param::HandleSyncMsg(Msg** msg){
- delete *msg;
- *msg=nullptr;
+ DeleteMsg(msg);
return nullptr;
}
int Param::ParseSyncResponseMsg(Msg** msg){
- delete *msg;
- *msg=nullptr;
+ DeleteMsg(msg);
return 1;
}
int Param::ParsePutResponseMsg(Msg **msg){
return ParseSyncResponseMsg(msg);
}
int Param::ParseGetResponseMsg(Msg **msg){
- CHECK((*msg)->frame_size());
- memcpy(mutable_cpu_data(), (*msg)->frame_data(), (*msg)->frame_size());
- // must be set after all other settings are done!
+ bool *copy=static_cast<bool*>((*msg)->frame_data());
+ (*msg)->next_frame();
+ if(*copy){
+ CHECK((*msg)->frame_size());
+ memcpy(mutable_cpu_data(), (*msg)->frame_data(), (*msg)->frame_size());
+ } // must be set after all other settings are done!
set_version((*msg)->target_second());
- delete *msg;
- *msg=nullptr;
+ DeleteMsg(msg);
return 1;
}
int Param::ParseUpdateResponseMsg(Msg **msg){
@@ -174,271 +197,4 @@ void Param::Init(int v){
}
set_version(v);
}
-
-/********************HogwildParam***************************/
-Msg* HogwildParam::GenPutMsg(void* arg){
- char buf[128];
- sprintf(buf, "%d %f %f %p", size(),
- learning_rate_multiplier(), weight_decay_multiplier(), mutable_cpu_data());
- Msg* msg=new Msg();
- msg->set_type(kPut);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
- msg->set_target(owner(), v);
- msg->add_frame(buf, strlen(buf));
- return msg;
-}
-
-Msg* HogwildParam::GenGetMsg(void* arg){
- Msg* msg=new Msg();
- msg->set_type(kGet);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
- msg->set_target(owner(), v);
- return msg;
-}
-
-Msg* HogwildParam::GenUpdateMsg(void* arg){
- Msg* msg=new Msg();
- msg->set_type(kUpdate);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
- msg->set_target(owner(), v);
- void* p=mutable_cpu_grad();
- msg->add_frame(p, sizeof(void*));
- return msg;
-}
-
-Msg* HogwildParam::GenSyncMsg(void* arg){
- return nullptr;
-}
-
-Msg* HogwildParam::HandlePutMsg(Msg** msg){
- int size;
- float lr, wc;
- sscanf(static_cast<char*>((*msg)->frame_data()), "%d %f %f",
- &size, &lr, &wc);
- proto_.set_learning_rate_multiplier(lr);
- proto_.set_weight_decay_multiplier(wc);
- CHECK((*msg)->next_frame());
- vector<int> shape{size};
- // set pointer
- data_=std::make_shared<Blob<float>>(shape);
- data_->set_version((*msg)->target_second());
- grad_.Reshape(shape);
- history_.Reshape(shape);
- delete (*msg);
- *msg=nullptr;
- return nullptr;
-}
-
-Msg* HogwildParam::HandleGetMsg(Msg** msg){
- if((*msg)->target_second()<=version()){
- (*msg)->add_frame(mutable_cpu_data(), sizeof(float)*size());
- (*msg)->SwapAddr();
- (*msg)->set_type(kRGet);
- }
- return *msg;
-}
-
-int HogwildParam::ParseUpdateMsg(Msg** msg){
- delete (*msg);
- *msg=nullptr;
- return 1;
-}
-
-Msg* HogwildParam::GenUpdateResponseMsg(void* arg){
- Msg* msg=new Msg();
- msg->set_type(kRUpdate);
- int v=version();
- if(arg!=nullptr)
- v=*(int*)arg;
- msg->set_target(owner(), v);
- return msg;
-}
-
-Msg* HogwildParam::HandleSyncMsg(Msg** msg){
- delete *msg;
- *msg=nullptr;
- return nullptr;
-}
-
-int HogwildParam::ParseSyncResponseMsg(Msg** msg){
- delete *msg;
- *msg=nullptr;
- return 1;
-}
-int HogwildParam::ParsePutResponseMsg(Msg **msg){
- return ParseSyncResponseMsg(msg);
-}
-int HogwildParam::ParseGetResponseMsg(Msg **msg){
- // must be set after all other settings are done!
- set_version((*msg)->target_second());
- delete *msg;
- *msg=nullptr;
- return 1;
-}
-int HogwildParam::ParseUpdateResponseMsg(Msg **msg){
- return ParseGetResponseMsg(msg);
-}
-
-/**************************RandomSyncParam********************************
-const vector<int> RandomSyncParam::RandomSample(int seed, int m, int n){
- vector<int> samples(m);
- std::mt19937 gen(seed);
- std::uniform_real_distribution<float> dist(0.f,1.f);
- for(int i=0,k=0;i<n&&k<m;i++)
- if((m-k)*1.0f/(n-i)>dist(gen)){
- samples[k++]=i;
- }
- return samples;
-}
-
-zmsg_t* RandomSyncParam::HandleSyncMsg(zmsg_t** msg){
- int64_t start=zclock_mono();
- char* control=zframe_strdup(zmsg_first(*msg));
- int seed, count;
- sscanf(control, "%d-%d", &seed,&count);
- delete control;
- zframe_t* syncframe=zmsg_next(*msg);
- CHECK_EQ(zframe_size(syncframe), count*sizeof(float));
- float* syncptr=(float*)zframe_data(syncframe);
- float* dptr=data_.mutable_cpu_data();
- int k=0;
- if(count==data_.count()){
- for(int idx=0;idx<count;idx++){
- float x=dptr[idx];
- dptr[idx]+=syncptr[k];
- syncptr[k]=x;
- k++;
- }
- }else{
- for(int idx: RandomSample(seed, count, data_.count())){
- float x=dptr[idx];
- dptr[idx]+=syncptr[k];
- syncptr[k]=x;
- k++;
- }
- }
- CHECK_EQ(k,count);
- CHECK_EQ(zframe_size(syncframe), count*sizeof(float));
- return *msg;
-}
-
-zmsg_t *RandomSyncParam::GenSyncMsgFromWorker(float sample_ratio){
- int64_t start=zclock_mono();
- zmsg_t* msg=zmsg_new();
- unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
- int m=data_.count()*sample_ratio;
- zmsg_addstrf(msg, "%u-%d", seed, m);
- float* updateptr=new float[m];
- float* dptr=data_.mutable_cpu_data();
- float* sdptr=snapshot_.mutable_cpu_data();
- int k=0;
- if(m==data_.count()){
- for(int idx=0;idx<m;idx++)
- updateptr[k++]=dptr[idx]-sdptr[idx];
- }else{
- const vector<int> samples=RandomSample(seed, m, data_.count());
- for(int idx:samples){
- updateptr[k++]=dptr[idx]-sdptr[idx];
- }
- }
- CHECK_EQ(k,m);
- zframe_t* frame=zframe_new(updateptr, sizeof(float)*m);
- zmsg_append(msg, &frame);
- delete updateptr;
- worker_gen_sync+=zclock_mono()-start;
- return msg;
-}
-
-void RandomSyncParam::ParseSyncMsgFromPS(zmsg_t** msg){
- int64_t start=zclock_mono();
- //LOG(ERROR)<<"worker sync "<<id();
- char* control=zmsg_popstr(*msg);
- int seed, count;
- sscanf(control, "%u-%d", &seed, &count);
- //LOG(ERROR)<<"worker sync "<<id()<<" "<<control;
- delete control;
- zframe_t* psdataframe=zmsg_pop(*msg);
- CHECK_EQ(zframe_size(psdataframe), count*sizeof(float));
- float* psdptr=(float*)zframe_data(psdataframe);
- float* dptr=data_.mutable_cpu_data();
- float* sdptr=snapshot_.mutable_cpu_data();
- int k=0;
- if(count==data_.count()){
- for(int idx=0;idx<count;idx++){
- dptr[idx]+=psdptr[k++]-sdptr[idx];
- sdptr[idx]=dptr[idx];
- }
- }else{
- for(int idx: RandomSample(seed, count, data_.count())){
- dptr[idx]+=psdptr[k++]-sdptr[idx];
- sdptr[idx]=dptr[idx];
- }
- }
- zframe_destroy(&psdataframe);
- worker_handle_sync+=zclock_mono()-start;
- zmsg_destroy(msg);
-}
-
-
-void RandomSyncParam::Setup(const ParamProto& proto, const vector<int>& shape,
- int fan_in){
- Param::Setup(proto, shape, fan_in);
- snapshot_.Reshape(shape);
-}
-
-void RandomSyncParam::Init(){
- Param::Init();
- memcpy(snapshot_.mutable_cpu_data(), data_.mutable_cpu_data(),
- sizeof(float)*data_.count());
-}
-*/
-
-/***************************ElasticParam************************************
-zmsg_t* ElasticParam::HandleSyncMsg(zmsg_t** msg){
- int64_t start=zclock_mono();
- char* control=zframe_strdup(zmsg_first(*msg));
- float alpha;int count;
- sscanf(control, "%f-%d", &alpha,&count);
- delete control;
- zframe_t* syncframe=zmsg_next(*msg);
- CHECK_EQ(size(), count);
- Tensor<cpu, 1> server(data_.mutable_cpu_data(), Shape1(count));
- Tensor<cpu, 1> worker((float*)zframe_data(syncframe), Shape1(count));
- worker=(worker-server)*alpha;
- server+=worker;
- return *msg;
-}
-
-zmsg_t *ElasticParam::GenSyncMsgFromWorker(float alpha){
- int64_t start=zclock_mono();
- zmsg_t* msg=zmsg_new();
- zmsg_addstrf(msg, "%f-%d", alpha, size());
- zmsg_addmem(msg, mutable_cpu_data(), sizeof(float)*size());
- worker_gen_sync+=zclock_mono()-start;
- return msg;
-}
-
-void ElasticParam::ParseSyncMsgFromPS(zmsg_t** msg){
- int64_t start=zclock_mono();
- //LOG(ERROR)<<"worker sync "<<id();
- char* control=zmsg_popstr(*msg);
- float alpha;int count;
- sscanf(control, "%f-%d", &alpha, &count);
- delete control;
- zframe_t* frame=zmsg_pop(*msg);
- CHECK_EQ(zframe_size(frame), count*sizeof(float));
- Tensor<cpu, 1> diff((float*)zframe_data(frame), Shape1(count));
- Tensor<cpu, 1> data(mutable_cpu_data(), Shape1(count));
- data-=diff;
- zframe_destroy(&frame);
- zmsg_destroy(msg);
- worker_handle_sync+=zclock_mono()-start;
-}
-*/
} // namespace singa
[05/10] incubator-singa git commit: SINGA-7 Implement shared memory
Hogwild algorithm
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d5f9b9cd/src/utils/param.cc
----------------------------------------------------------------------
diff --git a/src/utils/param.cc b/src/utils/param.cc
index c109a88..c00c64d 100644
--- a/src/utils/param.cc
+++ b/src/utils/param.cc
@@ -20,12 +20,12 @@ Msg* Param::GenPutMsg(bool copy, int v){
sprintf(buf, "%d %f %f", size(),
learning_rate_multiplier(), weight_decay_multiplier());
if(copy){
- sprintf(buf+strlen(buf), " %p", nullptr);
+ sprintf(buf+strlen(buf), " %p ", nullptr);
msg->add_frame(buf, strlen(buf));
msg->add_frame(mutable_cpu_data(), size()*sizeof(float));
}else{
//share the data blob which includes the blob version
- sprintf(buf+strlen(buf), " %p", data_.get());
+ sprintf(buf+strlen(buf), " %p ", data_.get());
msg->add_frame(buf, strlen(buf));
}
return msg;
@@ -47,9 +47,8 @@ Msg* Param::GenUpdateMsg(bool copy, int v){
if(copy)
msg->add_frame(mutable_cpu_grad(), size()*sizeof(float));
else{ // to share values of grad blob
- char buf[32]; sprintf(buf, "%p", &grad_);
+ char buf[32]; sprintf(buf, " %p ", &grad_);
msg->add_frame(buf, strlen(buf));
- //LOG(ERROR)<<"param id="<<id()<<" ptr="<<buf;
}
return msg;
}
@@ -62,7 +61,7 @@ Msg* Param::HandlePutMsg(Msg** msg){
int size;
float lr, wc;
void* ptr;
- sscanf(static_cast<char*>((*msg)->frame_data()), "%d %f %f %p",
+ sscanf(static_cast<char*>((*msg)->frame_data()), "%d %f %f %p ",
&size, &lr, &wc, &ptr);
proto_.set_learning_rate_multiplier(lr);
proto_.set_weight_decay_multiplier(wc);
@@ -103,8 +102,7 @@ const std::pair<bool, int> Param::ParseUpdateMsg(Msg** msg){
memcpy(mutable_cpu_grad(), (*msg)->frame_data(),(*msg)->frame_size());
}else {// use the same data field of the grad blob
Blob<float>* ptr=nullptr;
- sscanf(static_cast<char*>((*msg)->frame_data()), "%p", &ptr);
- //LOG(ERROR)<<"id="<<id()<<" ptr="<<ptr;
+ sscanf(static_cast<char*>((*msg)->frame_data()), " %p ", &ptr);
grad_.ShareData(*ptr);
}
DeleteMsg(msg);
[06/10] incubator-singa git commit: SINGA-7 Implement shared memory
Hogwild algorithm
Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d5f9b9cd/src/proto/model.pb.h
----------------------------------------------------------------------
diff --git a/src/proto/model.pb.h b/src/proto/model.pb.h
deleted file mode 100644
index 9ac1e54..0000000
--- a/src/proto/model.pb.h
+++ /dev/null
@@ -1,8292 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: model.proto
-
-#ifndef PROTOBUF_model_2eproto__INCLUDED
-#define PROTOBUF_model_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/generated_enum_reflection.h>
-#include <google/protobuf/unknown_field_set.h>
-// @@protoc_insertion_point(includes)
-
-namespace singa {
-
-// Internal implementation detail -- do not call these.
-void protobuf_AddDesc_model_2eproto();
-void protobuf_AssignDesc_model_2eproto();
-void protobuf_ShutdownFile_model_2eproto();
-
-class ModelProto;
-class NetProto;
-class ParamProto;
-class BlobProtos;
-class LayerProto;
-class RGBImage;
-class SplitProto;
-class TanhProto;
-class SoftmaxLossProto;
-class ConvolutionProto;
-class ConcateProto;
-class DataProto;
-class MnistProto;
-class DropoutProto;
-class InnerProductProto;
-class LRNProto;
-class PoolingProto;
-class SliceProto;
-class ReLUProto;
-class Record;
-class Datum;
-class SingleLabelImageRecord;
-class UpdaterProto;
-class BlobProto;
-
-enum ModelProto_GradCalcAlg {
- ModelProto_GradCalcAlg_kBackPropagation = 1,
- ModelProto_GradCalcAlg_kContrastiveDivergence = 2
-};
-bool ModelProto_GradCalcAlg_IsValid(int value);
-const ModelProto_GradCalcAlg ModelProto_GradCalcAlg_GradCalcAlg_MIN = ModelProto_GradCalcAlg_kBackPropagation;
-const ModelProto_GradCalcAlg ModelProto_GradCalcAlg_GradCalcAlg_MAX = ModelProto_GradCalcAlg_kContrastiveDivergence;
-const int ModelProto_GradCalcAlg_GradCalcAlg_ARRAYSIZE = ModelProto_GradCalcAlg_GradCalcAlg_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* ModelProto_GradCalcAlg_descriptor();
-inline const ::std::string& ModelProto_GradCalcAlg_Name(ModelProto_GradCalcAlg value) {
- return ::google::protobuf::internal::NameOfEnum(
- ModelProto_GradCalcAlg_descriptor(), value);
-}
-inline bool ModelProto_GradCalcAlg_Parse(
- const ::std::string& name, ModelProto_GradCalcAlg* value) {
- return ::google::protobuf::internal::ParseNamedEnum<ModelProto_GradCalcAlg>(
- ModelProto_GradCalcAlg_descriptor(), name, value);
-}
-enum ParamProto_InitMethod {
- ParamProto_InitMethod_kConstant = 0,
- ParamProto_InitMethod_kGaussian = 1,
- ParamProto_InitMethod_kUniform = 2,
- ParamProto_InitMethod_kPretrained = 3,
- ParamProto_InitMethod_kGaussainSqrtFanIn = 4,
- ParamProto_InitMethod_kUniformSqrtFanIn = 5,
- ParamProto_InitMethod_kUniformSqrtFanInOut = 6
-};
-bool ParamProto_InitMethod_IsValid(int value);
-const ParamProto_InitMethod ParamProto_InitMethod_InitMethod_MIN = ParamProto_InitMethod_kConstant;
-const ParamProto_InitMethod ParamProto_InitMethod_InitMethod_MAX = ParamProto_InitMethod_kUniformSqrtFanInOut;
-const int ParamProto_InitMethod_InitMethod_ARRAYSIZE = ParamProto_InitMethod_InitMethod_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* ParamProto_InitMethod_descriptor();
-inline const ::std::string& ParamProto_InitMethod_Name(ParamProto_InitMethod value) {
- return ::google::protobuf::internal::NameOfEnum(
- ParamProto_InitMethod_descriptor(), value);
-}
-inline bool ParamProto_InitMethod_Parse(
- const ::std::string& name, ParamProto_InitMethod* value) {
- return ::google::protobuf::internal::ParseNamedEnum<ParamProto_InitMethod>(
- ParamProto_InitMethod_descriptor(), name, value);
-}
-enum LRNProto_NormRegion {
- LRNProto_NormRegion_ACROSS_CHANNELS = 0,
- LRNProto_NormRegion_WITHIN_CHANNEL = 1
-};
-bool LRNProto_NormRegion_IsValid(int value);
-const LRNProto_NormRegion LRNProto_NormRegion_NormRegion_MIN = LRNProto_NormRegion_ACROSS_CHANNELS;
-const LRNProto_NormRegion LRNProto_NormRegion_NormRegion_MAX = LRNProto_NormRegion_WITHIN_CHANNEL;
-const int LRNProto_NormRegion_NormRegion_ARRAYSIZE = LRNProto_NormRegion_NormRegion_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* LRNProto_NormRegion_descriptor();
-inline const ::std::string& LRNProto_NormRegion_Name(LRNProto_NormRegion value) {
- return ::google::protobuf::internal::NameOfEnum(
- LRNProto_NormRegion_descriptor(), value);
-}
-inline bool LRNProto_NormRegion_Parse(
- const ::std::string& name, LRNProto_NormRegion* value) {
- return ::google::protobuf::internal::ParseNamedEnum<LRNProto_NormRegion>(
- LRNProto_NormRegion_descriptor(), name, value);
-}
-enum PoolingProto_PoolMethod {
- PoolingProto_PoolMethod_MAX = 0,
- PoolingProto_PoolMethod_AVE = 1
-};
-bool PoolingProto_PoolMethod_IsValid(int value);
-const PoolingProto_PoolMethod PoolingProto_PoolMethod_PoolMethod_MIN = PoolingProto_PoolMethod_MAX;
-const PoolingProto_PoolMethod PoolingProto_PoolMethod_PoolMethod_MAX = PoolingProto_PoolMethod_AVE;
-const int PoolingProto_PoolMethod_PoolMethod_ARRAYSIZE = PoolingProto_PoolMethod_PoolMethod_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* PoolingProto_PoolMethod_descriptor();
-inline const ::std::string& PoolingProto_PoolMethod_Name(PoolingProto_PoolMethod value) {
- return ::google::protobuf::internal::NameOfEnum(
- PoolingProto_PoolMethod_descriptor(), value);
-}
-inline bool PoolingProto_PoolMethod_Parse(
- const ::std::string& name, PoolingProto_PoolMethod* value) {
- return ::google::protobuf::internal::ParseNamedEnum<PoolingProto_PoolMethod>(
- PoolingProto_PoolMethod_descriptor(), name, value);
-}
-enum Record_Type {
- Record_Type_kSingleLabelImage = 0
-};
-bool Record_Type_IsValid(int value);
-const Record_Type Record_Type_Type_MIN = Record_Type_kSingleLabelImage;
-const Record_Type Record_Type_Type_MAX = Record_Type_kSingleLabelImage;
-const int Record_Type_Type_ARRAYSIZE = Record_Type_Type_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* Record_Type_descriptor();
-inline const ::std::string& Record_Type_Name(Record_Type value) {
- return ::google::protobuf::internal::NameOfEnum(
- Record_Type_descriptor(), value);
-}
-inline bool Record_Type_Parse(
- const ::std::string& name, Record_Type* value) {
- return ::google::protobuf::internal::ParseNamedEnum<Record_Type>(
- Record_Type_descriptor(), name, value);
-}
-enum UpdaterProto_ChangeProto {
- UpdaterProto_ChangeProto_kFixed = 0,
- UpdaterProto_ChangeProto_kInverse_t = 1,
- UpdaterProto_ChangeProto_kInverse = 2,
- UpdaterProto_ChangeProto_kExponential = 3,
- UpdaterProto_ChangeProto_kLinear = 4,
- UpdaterProto_ChangeProto_kStep = 5,
- UpdaterProto_ChangeProto_kFixedStep = 6
-};
-bool UpdaterProto_ChangeProto_IsValid(int value);
-const UpdaterProto_ChangeProto UpdaterProto_ChangeProto_ChangeProto_MIN = UpdaterProto_ChangeProto_kFixed;
-const UpdaterProto_ChangeProto UpdaterProto_ChangeProto_ChangeProto_MAX = UpdaterProto_ChangeProto_kFixedStep;
-const int UpdaterProto_ChangeProto_ChangeProto_ARRAYSIZE = UpdaterProto_ChangeProto_ChangeProto_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* UpdaterProto_ChangeProto_descriptor();
-inline const ::std::string& UpdaterProto_ChangeProto_Name(UpdaterProto_ChangeProto value) {
- return ::google::protobuf::internal::NameOfEnum(
- UpdaterProto_ChangeProto_descriptor(), value);
-}
-inline bool UpdaterProto_ChangeProto_Parse(
- const ::std::string& name, UpdaterProto_ChangeProto* value) {
- return ::google::protobuf::internal::ParseNamedEnum<UpdaterProto_ChangeProto>(
- UpdaterProto_ChangeProto_descriptor(), name, value);
-}
-enum MsgType {
- kGet = 0,
- kPut = 1,
- kSync = 2,
- kUpdate = 3,
- kSyncRequest = 4,
- kSyncResponse = 5,
- kStop = 6,
- kData = 7,
- kRGet = 8,
- kRUpdate = 9,
- kConnect = 10,
- kMetric = 11
-};
-bool MsgType_IsValid(int value);
-const MsgType MsgType_MIN = kGet;
-const MsgType MsgType_MAX = kMetric;
-const int MsgType_ARRAYSIZE = MsgType_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* MsgType_descriptor();
-inline const ::std::string& MsgType_Name(MsgType value) {
- return ::google::protobuf::internal::NameOfEnum(
- MsgType_descriptor(), value);
-}
-inline bool MsgType_Parse(
- const ::std::string& name, MsgType* value) {
- return ::google::protobuf::internal::ParseNamedEnum<MsgType>(
- MsgType_descriptor(), name, value);
-}
-enum EntityType {
- kWorkerParam = 0,
- kWorkerLayer = 1,
- kServer = 2,
- kStub = 3,
- kRuntime = 4
-};
-bool EntityType_IsValid(int value);
-const EntityType EntityType_MIN = kWorkerParam;
-const EntityType EntityType_MAX = kRuntime;
-const int EntityType_ARRAYSIZE = EntityType_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* EntityType_descriptor();
-inline const ::std::string& EntityType_Name(EntityType value) {
- return ::google::protobuf::internal::NameOfEnum(
- EntityType_descriptor(), value);
-}
-inline bool EntityType_Parse(
- const ::std::string& name, EntityType* value) {
- return ::google::protobuf::internal::ParseNamedEnum<EntityType>(
- EntityType_descriptor(), name, value);
-}
-enum Phase {
- kTrain = 0,
- kValidation = 1,
- kTest = 2
-};
-bool Phase_IsValid(int value);
-const Phase Phase_MIN = kTrain;
-const Phase Phase_MAX = kTest;
-const int Phase_ARRAYSIZE = Phase_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* Phase_descriptor();
-inline const ::std::string& Phase_Name(Phase value) {
- return ::google::protobuf::internal::NameOfEnum(
- Phase_descriptor(), value);
-}
-inline bool Phase_Parse(
- const ::std::string& name, Phase* value) {
- return ::google::protobuf::internal::ParseNamedEnum<Phase>(
- Phase_descriptor(), name, value);
-}
-enum ShareOption {
- kValueOnly = 0,
- kWhole = 1
-};
-bool ShareOption_IsValid(int value);
-const ShareOption ShareOption_MIN = kValueOnly;
-const ShareOption ShareOption_MAX = kWhole;
-const int ShareOption_ARRAYSIZE = ShareOption_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* ShareOption_descriptor();
-inline const ::std::string& ShareOption_Name(ShareOption value) {
- return ::google::protobuf::internal::NameOfEnum(
- ShareOption_descriptor(), value);
-}
-inline bool ShareOption_Parse(
- const ::std::string& name, ShareOption* value) {
- return ::google::protobuf::internal::ParseNamedEnum<ShareOption>(
- ShareOption_descriptor(), name, value);
-}
-enum PartitionType {
- kDataPartition = 0,
- kLayerPartition = 1,
- kNone = 2
-};
-bool PartitionType_IsValid(int value);
-const PartitionType PartitionType_MIN = kDataPartition;
-const PartitionType PartitionType_MAX = kNone;
-const int PartitionType_ARRAYSIZE = PartitionType_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* PartitionType_descriptor();
-inline const ::std::string& PartitionType_Name(PartitionType value) {
- return ::google::protobuf::internal::NameOfEnum(
- PartitionType_descriptor(), value);
-}
-inline bool PartitionType_Parse(
- const ::std::string& name, PartitionType* value) {
- return ::google::protobuf::internal::ParseNamedEnum<PartitionType>(
- PartitionType_descriptor(), name, value);
-}
-enum ConnectionType {
- kOneToOne = 0,
- kOneToAll = 1
-};
-bool ConnectionType_IsValid(int value);
-const ConnectionType ConnectionType_MIN = kOneToOne;
-const ConnectionType ConnectionType_MAX = kOneToAll;
-const int ConnectionType_ARRAYSIZE = ConnectionType_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* ConnectionType_descriptor();
-inline const ::std::string& ConnectionType_Name(ConnectionType value) {
- return ::google::protobuf::internal::NameOfEnum(
- ConnectionType_descriptor(), value);
-}
-inline bool ConnectionType_Parse(
- const ::std::string& name, ConnectionType* value) {
- return ::google::protobuf::internal::ParseNamedEnum<ConnectionType>(
- ConnectionType_descriptor(), name, value);
-}
-// ===================================================================
-
-class ModelProto : public ::google::protobuf::Message {
- public:
- ModelProto();
- virtual ~ModelProto();
-
- ModelProto(const ModelProto& from);
-
- inline ModelProto& operator=(const ModelProto& 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 ModelProto& default_instance();
-
- void Swap(ModelProto* other);
-
- // implements Message ----------------------------------------------
-
- ModelProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const ModelProto& from);
- void MergeFrom(const ModelProto& 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 ----------------------------------------------------
-
- typedef ModelProto_GradCalcAlg GradCalcAlg;
- static const GradCalcAlg kBackPropagation = ModelProto_GradCalcAlg_kBackPropagation;
- static const GradCalcAlg kContrastiveDivergence = ModelProto_GradCalcAlg_kContrastiveDivergence;
- static inline bool GradCalcAlg_IsValid(int value) {
- return ModelProto_GradCalcAlg_IsValid(value);
- }
- static const GradCalcAlg GradCalcAlg_MIN =
- ModelProto_GradCalcAlg_GradCalcAlg_MIN;
- static const GradCalcAlg GradCalcAlg_MAX =
- ModelProto_GradCalcAlg_GradCalcAlg_MAX;
- static const int GradCalcAlg_ARRAYSIZE =
- ModelProto_GradCalcAlg_GradCalcAlg_ARRAYSIZE;
- static inline const ::google::protobuf::EnumDescriptor*
- GradCalcAlg_descriptor() {
- return ModelProto_GradCalcAlg_descriptor();
- }
- static inline const ::std::string& GradCalcAlg_Name(GradCalcAlg value) {
- return ModelProto_GradCalcAlg_Name(value);
- }
- static inline bool GradCalcAlg_Parse(const ::std::string& name,
- GradCalcAlg* value) {
- return ModelProto_GradCalcAlg_Parse(name, value);
- }
-
- // accessors -------------------------------------------------------
-
- // optional string name = 1;
- inline bool has_name() const;
- inline void clear_name();
- static const int kNameFieldNumber = 1;
- inline const ::std::string& name() const;
- inline void set_name(const ::std::string& value);
- inline void set_name(const char* value);
- inline void set_name(const char* value, size_t size);
- inline ::std::string* mutable_name();
- inline ::std::string* release_name();
- inline void set_allocated_name(::std::string* name);
-
- // optional string train_folder = 2 [default = "train"];
- inline bool has_train_folder() const;
- inline void clear_train_folder();
- static const int kTrainFolderFieldNumber = 2;
- inline const ::std::string& train_folder() const;
- inline void set_train_folder(const ::std::string& value);
- inline void set_train_folder(const char* value);
- inline void set_train_folder(const char* value, size_t size);
- inline ::std::string* mutable_train_folder();
- inline ::std::string* release_train_folder();
- inline void set_allocated_train_folder(::std::string* train_folder);
-
- // optional string test_folder = 3 [default = "test"];
- inline bool has_test_folder() const;
- inline void clear_test_folder();
- static const int kTestFolderFieldNumber = 3;
- inline const ::std::string& test_folder() const;
- inline void set_test_folder(const ::std::string& value);
- inline void set_test_folder(const char* value);
- inline void set_test_folder(const char* value, size_t size);
- inline ::std::string* mutable_test_folder();
- inline ::std::string* release_test_folder();
- inline void set_allocated_test_folder(::std::string* test_folder);
-
- // optional string validation_folder = 4 [default = "validation"];
- inline bool has_validation_folder() const;
- inline void clear_validation_folder();
- static const int kValidationFolderFieldNumber = 4;
- inline const ::std::string& validation_folder() const;
- inline void set_validation_folder(const ::std::string& value);
- inline void set_validation_folder(const char* value);
- inline void set_validation_folder(const char* value, size_t size);
- inline ::std::string* mutable_validation_folder();
- inline ::std::string* release_validation_folder();
- inline void set_allocated_validation_folder(::std::string* validation_folder);
-
- // optional int32 display_after_steps = 6 [default = 0];
- inline bool has_display_after_steps() const;
- inline void clear_display_after_steps();
- static const int kDisplayAfterStepsFieldNumber = 6;
- inline ::google::protobuf::int32 display_after_steps() const;
- inline void set_display_after_steps(::google::protobuf::int32 value);
-
- // optional int32 display_frequency = 7 [default = 0];
- inline bool has_display_frequency() const;
- inline void clear_display_frequency();
- static const int kDisplayFrequencyFieldNumber = 7;
- inline ::google::protobuf::int32 display_frequency() const;
- inline void set_display_frequency(::google::protobuf::int32 value);
-
- // optional int32 validation_after_steps = 10 [default = 0];
- inline bool has_validation_after_steps() const;
- inline void clear_validation_after_steps();
- static const int kValidationAfterStepsFieldNumber = 10;
- inline ::google::protobuf::int32 validation_after_steps() const;
- inline void set_validation_after_steps(::google::protobuf::int32 value);
-
- // optional int32 validation_frequency = 11 [default = 0];
- inline bool has_validation_frequency() const;
- inline void clear_validation_frequency();
- static const int kValidationFrequencyFieldNumber = 11;
- inline ::google::protobuf::int32 validation_frequency() const;
- inline void set_validation_frequency(::google::protobuf::int32 value);
-
- // optional int32 test_after_steps = 13 [default = 0];
- inline bool has_test_after_steps() const;
- inline void clear_test_after_steps();
- static const int kTestAfterStepsFieldNumber = 13;
- inline ::google::protobuf::int32 test_after_steps() const;
- inline void set_test_after_steps(::google::protobuf::int32 value);
-
- // optional int32 test_frequency = 14 [default = 0];
- inline bool has_test_frequency() const;
- inline void clear_test_frequency();
- static const int kTestFrequencyFieldNumber = 14;
- inline ::google::protobuf::int32 test_frequency() const;
- inline void set_test_frequency(::google::protobuf::int32 value);
-
- // optional int32 checkpoint_after_steps = 15 [default = 0];
- inline bool has_checkpoint_after_steps() const;
- inline void clear_checkpoint_after_steps();
- static const int kCheckpointAfterStepsFieldNumber = 15;
- inline ::google::protobuf::int32 checkpoint_after_steps() const;
- inline void set_checkpoint_after_steps(::google::protobuf::int32 value);
-
- // optional int32 checkpoint_frequency = 16 [default = 0];
- inline bool has_checkpoint_frequency() const;
- inline void clear_checkpoint_frequency();
- static const int kCheckpointFrequencyFieldNumber = 16;
- inline ::google::protobuf::int32 checkpoint_frequency() const;
- inline void set_checkpoint_frequency(::google::protobuf::int32 value);
-
- // optional bool prefetch = 18 [default = true];
- inline bool has_prefetch() const;
- inline void clear_prefetch();
- static const int kPrefetchFieldNumber = 18;
- inline bool prefetch() const;
- inline void set_prefetch(bool value);
-
- // optional int32 train_steps = 20;
- inline bool has_train_steps() const;
- inline void clear_train_steps();
- static const int kTrainStepsFieldNumber = 20;
- inline ::google::protobuf::int32 train_steps() const;
- inline void set_train_steps(::google::protobuf::int32 value);
-
- // optional int32 validation_steps = 21;
- inline bool has_validation_steps() const;
- inline void clear_validation_steps();
- static const int kValidationStepsFieldNumber = 21;
- inline ::google::protobuf::int32 validation_steps() const;
- inline void set_validation_steps(::google::protobuf::int32 value);
-
- // optional int32 test_steps = 22;
- inline bool has_test_steps() const;
- inline void clear_test_steps();
- static const int kTestStepsFieldNumber = 22;
- inline ::google::protobuf::int32 test_steps() const;
- inline void set_test_steps(::google::protobuf::int32 value);
-
- // optional int32 step = 29 [default = 0];
- inline bool has_step() const;
- inline void clear_step();
- static const int kStepFieldNumber = 29;
- inline ::google::protobuf::int32 step() const;
- inline void set_step(::google::protobuf::int32 value);
-
- // optional .singa.UpdaterProto updater = 31;
- inline bool has_updater() const;
- inline void clear_updater();
- static const int kUpdaterFieldNumber = 31;
- inline const ::singa::UpdaterProto& updater() const;
- inline ::singa::UpdaterProto* mutable_updater();
- inline ::singa::UpdaterProto* release_updater();
- inline void set_allocated_updater(::singa::UpdaterProto* updater);
-
- // optional .singa.ModelProto.GradCalcAlg alg = 32 [default = kBackPropagation];
- inline bool has_alg() const;
- inline void clear_alg();
- static const int kAlgFieldNumber = 32;
- inline ::singa::ModelProto_GradCalcAlg alg() const;
- inline void set_alg(::singa::ModelProto_GradCalcAlg value);
-
- // optional bool hogwild = 33 [default = false];
- inline bool has_hogwild() const;
- inline void clear_hogwild();
- static const int kHogwildFieldNumber = 33;
- inline bool hogwild() const;
- inline void set_hogwild(bool value);
-
- // optional .singa.NetProto neuralnet = 40;
- inline bool has_neuralnet() const;
- inline void clear_neuralnet();
- static const int kNeuralnetFieldNumber = 40;
- inline const ::singa::NetProto& neuralnet() const;
- inline ::singa::NetProto* mutable_neuralnet();
- inline ::singa::NetProto* release_neuralnet();
- inline void set_allocated_neuralnet(::singa::NetProto* neuralnet);
-
- // optional bool debug = 41 [default = false];
- inline bool has_debug() const;
- inline void clear_debug();
- static const int kDebugFieldNumber = 41;
- inline bool debug() const;
- inline void set_debug(bool value);
-
- // optional int32 warmup_steps = 50 [default = 0];
- inline bool has_warmup_steps() const;
- inline void clear_warmup_steps();
- static const int kWarmupStepsFieldNumber = 50;
- inline ::google::protobuf::int32 warmup_steps() const;
- inline void set_warmup_steps(::google::protobuf::int32 value);
-
- // @@protoc_insertion_point(class_scope:singa.ModelProto)
- private:
- inline void set_has_name();
- inline void clear_has_name();
- inline void set_has_train_folder();
- inline void clear_has_train_folder();
- inline void set_has_test_folder();
- inline void clear_has_test_folder();
- inline void set_has_validation_folder();
- inline void clear_has_validation_folder();
- inline void set_has_display_after_steps();
- inline void clear_has_display_after_steps();
- inline void set_has_display_frequency();
- inline void clear_has_display_frequency();
- inline void set_has_validation_after_steps();
- inline void clear_has_validation_after_steps();
- inline void set_has_validation_frequency();
- inline void clear_has_validation_frequency();
- inline void set_has_test_after_steps();
- inline void clear_has_test_after_steps();
- inline void set_has_test_frequency();
- inline void clear_has_test_frequency();
- inline void set_has_checkpoint_after_steps();
- inline void clear_has_checkpoint_after_steps();
- inline void set_has_checkpoint_frequency();
- inline void clear_has_checkpoint_frequency();
- inline void set_has_prefetch();
- inline void clear_has_prefetch();
- inline void set_has_train_steps();
- inline void clear_has_train_steps();
- inline void set_has_validation_steps();
- inline void clear_has_validation_steps();
- inline void set_has_test_steps();
- inline void clear_has_test_steps();
- inline void set_has_step();
- inline void clear_has_step();
- inline void set_has_updater();
- inline void clear_has_updater();
- inline void set_has_alg();
- inline void clear_has_alg();
- inline void set_has_hogwild();
- inline void clear_has_hogwild();
- inline void set_has_neuralnet();
- inline void clear_has_neuralnet();
- inline void set_has_debug();
- inline void clear_has_debug();
- inline void set_has_warmup_steps();
- inline void clear_has_warmup_steps();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::std::string* name_;
- ::std::string* train_folder_;
- static ::std::string* _default_train_folder_;
- ::std::string* test_folder_;
- static ::std::string* _default_test_folder_;
- ::std::string* validation_folder_;
- static ::std::string* _default_validation_folder_;
- ::google::protobuf::int32 display_after_steps_;
- ::google::protobuf::int32 display_frequency_;
- ::google::protobuf::int32 validation_after_steps_;
- ::google::protobuf::int32 validation_frequency_;
- ::google::protobuf::int32 test_after_steps_;
- ::google::protobuf::int32 test_frequency_;
- ::google::protobuf::int32 checkpoint_after_steps_;
- ::google::protobuf::int32 checkpoint_frequency_;
- ::google::protobuf::int32 train_steps_;
- ::google::protobuf::int32 validation_steps_;
- ::google::protobuf::int32 test_steps_;
- ::google::protobuf::int32 step_;
- ::singa::UpdaterProto* updater_;
- bool prefetch_;
- bool hogwild_;
- bool debug_;
- int alg_;
- ::singa::NetProto* neuralnet_;
- ::google::protobuf::int32 warmup_steps_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(23 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static ModelProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class NetProto : public ::google::protobuf::Message {
- public:
- NetProto();
- virtual ~NetProto();
-
- NetProto(const NetProto& from);
-
- inline NetProto& operator=(const NetProto& 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 NetProto& default_instance();
-
- void Swap(NetProto* other);
-
- // implements Message ----------------------------------------------
-
- NetProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const NetProto& from);
- void MergeFrom(const NetProto& 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 -------------------------------------------------------
-
- // repeated .singa.LayerProto layer = 1;
- inline int layer_size() const;
- inline void clear_layer();
- static const int kLayerFieldNumber = 1;
- inline const ::singa::LayerProto& layer(int index) const;
- inline ::singa::LayerProto* mutable_layer(int index);
- inline ::singa::LayerProto* add_layer();
- inline const ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >&
- layer() const;
- inline ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >*
- mutable_layer();
-
- // optional .singa.PartitionType partition_type = 3 [default = kNone];
- inline bool has_partition_type() const;
- inline void clear_partition_type();
- static const int kPartitionTypeFieldNumber = 3;
- inline ::singa::PartitionType partition_type() const;
- inline void set_partition_type(::singa::PartitionType value);
-
- // @@protoc_insertion_point(class_scope:singa.NetProto)
- private:
- inline void set_has_partition_type();
- inline void clear_has_partition_type();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::RepeatedPtrField< ::singa::LayerProto > layer_;
- int partition_type_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static NetProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class ParamProto : public ::google::protobuf::Message {
- public:
- ParamProto();
- virtual ~ParamProto();
-
- ParamProto(const ParamProto& from);
-
- inline ParamProto& operator=(const ParamProto& 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 ParamProto& default_instance();
-
- void Swap(ParamProto* other);
-
- // implements Message ----------------------------------------------
-
- ParamProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const ParamProto& from);
- void MergeFrom(const ParamProto& 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 ----------------------------------------------------
-
- typedef ParamProto_InitMethod InitMethod;
- static const InitMethod kConstant = ParamProto_InitMethod_kConstant;
- static const InitMethod kGaussian = ParamProto_InitMethod_kGaussian;
- static const InitMethod kUniform = ParamProto_InitMethod_kUniform;
- static const InitMethod kPretrained = ParamProto_InitMethod_kPretrained;
- static const InitMethod kGaussainSqrtFanIn = ParamProto_InitMethod_kGaussainSqrtFanIn;
- static const InitMethod kUniformSqrtFanIn = ParamProto_InitMethod_kUniformSqrtFanIn;
- static const InitMethod kUniformSqrtFanInOut = ParamProto_InitMethod_kUniformSqrtFanInOut;
- static inline bool InitMethod_IsValid(int value) {
- return ParamProto_InitMethod_IsValid(value);
- }
- static const InitMethod InitMethod_MIN =
- ParamProto_InitMethod_InitMethod_MIN;
- static const InitMethod InitMethod_MAX =
- ParamProto_InitMethod_InitMethod_MAX;
- static const int InitMethod_ARRAYSIZE =
- ParamProto_InitMethod_InitMethod_ARRAYSIZE;
- static inline const ::google::protobuf::EnumDescriptor*
- InitMethod_descriptor() {
- return ParamProto_InitMethod_descriptor();
- }
- static inline const ::std::string& InitMethod_Name(InitMethod value) {
- return ParamProto_InitMethod_Name(value);
- }
- static inline bool InitMethod_Parse(const ::std::string& name,
- InitMethod* value) {
- return ParamProto_InitMethod_Parse(name, value);
- }
-
- // accessors -------------------------------------------------------
-
- // optional string name = 1;
- inline bool has_name() const;
- inline void clear_name();
- static const int kNameFieldNumber = 1;
- inline const ::std::string& name() const;
- inline void set_name(const ::std::string& value);
- inline void set_name(const char* value);
- inline void set_name(const char* value, size_t size);
- inline ::std::string* mutable_name();
- inline ::std::string* release_name();
- inline void set_allocated_name(::std::string* name);
-
- // optional int32 id = 2;
- inline bool has_id() const;
- inline void clear_id();
- static const int kIdFieldNumber = 2;
- inline ::google::protobuf::int32 id() const;
- inline void set_id(::google::protobuf::int32 value);
-
- // repeated int32 shape = 3;
- inline int shape_size() const;
- inline void clear_shape();
- static const int kShapeFieldNumber = 3;
- inline ::google::protobuf::int32 shape(int index) const;
- inline void set_shape(int index, ::google::protobuf::int32 value);
- inline void add_shape(::google::protobuf::int32 value);
- inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
- shape() const;
- inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
- mutable_shape();
-
- // optional int32 split_threshold = 4 [default = 5000000];
- inline bool has_split_threshold() const;
- inline void clear_split_threshold();
- static const int kSplitThresholdFieldNumber = 4;
- inline ::google::protobuf::int32 split_threshold() const;
- inline void set_split_threshold(::google::protobuf::int32 value);
-
- // optional int32 partition_dim = 5 [default = -1];
- inline bool has_partition_dim() const;
- inline void clear_partition_dim();
- static const int kPartitionDimFieldNumber = 5;
- inline ::google::protobuf::int32 partition_dim() const;
- inline void set_partition_dim(::google::protobuf::int32 value);
-
- // optional int32 owner = 6;
- inline bool has_owner() const;
- inline void clear_owner();
- static const int kOwnerFieldNumber = 6;
- inline ::google::protobuf::int32 owner() const;
- inline void set_owner(::google::protobuf::int32 value);
-
- // optional .singa.ParamProto.InitMethod init_method = 7 [default = kConstant];
- inline bool has_init_method() const;
- inline void clear_init_method();
- static const int kInitMethodFieldNumber = 7;
- inline ::singa::ParamProto_InitMethod init_method() const;
- inline void set_init_method(::singa::ParamProto_InitMethod value);
-
- // optional float value = 8 [default = 1];
- inline bool has_value() const;
- inline void clear_value();
- static const int kValueFieldNumber = 8;
- inline float value() const;
- inline void set_value(float value);
-
- // optional float low = 9 [default = -1];
- inline bool has_low() const;
- inline void clear_low();
- static const int kLowFieldNumber = 9;
- inline float low() const;
- inline void set_low(float value);
-
- // optional float high = 10 [default = 1];
- inline bool has_high() const;
- inline void clear_high();
- static const int kHighFieldNumber = 10;
- inline float high() const;
- inline void set_high(float value);
-
- // optional float mean = 11 [default = 0];
- inline bool has_mean() const;
- inline void clear_mean();
- static const int kMeanFieldNumber = 11;
- inline float mean() const;
- inline void set_mean(float value);
-
- // optional float std = 12 [default = 1];
- inline bool has_std() const;
- inline void clear_std();
- static const int kStdFieldNumber = 12;
- inline float std() const;
- inline void set_std(float value);
-
- // optional float learning_rate_multiplier = 13 [default = 1];
- inline bool has_learning_rate_multiplier() const;
- inline void clear_learning_rate_multiplier();
- static const int kLearningRateMultiplierFieldNumber = 13;
- inline float learning_rate_multiplier() const;
- inline void set_learning_rate_multiplier(float value);
-
- // optional float weight_decay_multiplier = 14 [default = 1];
- inline bool has_weight_decay_multiplier() const;
- inline void clear_weight_decay_multiplier();
- static const int kWeightDecayMultiplierFieldNumber = 14;
- inline float weight_decay_multiplier() const;
- inline void set_weight_decay_multiplier(float value);
-
- // @@protoc_insertion_point(class_scope:singa.ParamProto)
- private:
- inline void set_has_name();
- inline void clear_has_name();
- inline void set_has_id();
- inline void clear_has_id();
- inline void set_has_split_threshold();
- inline void clear_has_split_threshold();
- inline void set_has_partition_dim();
- inline void clear_has_partition_dim();
- inline void set_has_owner();
- inline void clear_has_owner();
- inline void set_has_init_method();
- inline void clear_has_init_method();
- inline void set_has_value();
- inline void clear_has_value();
- inline void set_has_low();
- inline void clear_has_low();
- inline void set_has_high();
- inline void clear_has_high();
- inline void set_has_mean();
- inline void clear_has_mean();
- inline void set_has_std();
- inline void clear_has_std();
- inline void set_has_learning_rate_multiplier();
- inline void clear_has_learning_rate_multiplier();
- inline void set_has_weight_decay_multiplier();
- inline void clear_has_weight_decay_multiplier();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::std::string* name_;
- ::google::protobuf::RepeatedField< ::google::protobuf::int32 > shape_;
- ::google::protobuf::int32 id_;
- ::google::protobuf::int32 split_threshold_;
- ::google::protobuf::int32 partition_dim_;
- ::google::protobuf::int32 owner_;
- int init_method_;
- float value_;
- float low_;
- float high_;
- float mean_;
- float std_;
- float learning_rate_multiplier_;
- float weight_decay_multiplier_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(14 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static ParamProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class BlobProtos : public ::google::protobuf::Message {
- public:
- BlobProtos();
- virtual ~BlobProtos();
-
- BlobProtos(const BlobProtos& from);
-
- inline BlobProtos& operator=(const BlobProtos& 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 BlobProtos& default_instance();
-
- void Swap(BlobProtos* other);
-
- // implements Message ----------------------------------------------
-
- BlobProtos* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const BlobProtos& from);
- void MergeFrom(const BlobProtos& 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 -------------------------------------------------------
-
- // repeated .singa.BlobProto blobs = 1;
- inline int blobs_size() const;
- inline void clear_blobs();
- static const int kBlobsFieldNumber = 1;
- inline const ::singa::BlobProto& blobs(int index) const;
- inline ::singa::BlobProto* mutable_blobs(int index);
- inline ::singa::BlobProto* add_blobs();
- inline const ::google::protobuf::RepeatedPtrField< ::singa::BlobProto >&
- blobs() const;
- inline ::google::protobuf::RepeatedPtrField< ::singa::BlobProto >*
- mutable_blobs();
-
- // repeated int32 ids = 2;
- inline int ids_size() const;
- inline void clear_ids();
- static const int kIdsFieldNumber = 2;
- inline ::google::protobuf::int32 ids(int index) const;
- inline void set_ids(int index, ::google::protobuf::int32 value);
- inline void add_ids(::google::protobuf::int32 value);
- inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
- ids() const;
- inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
- mutable_ids();
-
- // repeated string names = 3;
- inline int names_size() const;
- inline void clear_names();
- static const int kNamesFieldNumber = 3;
- inline const ::std::string& names(int index) const;
- inline ::std::string* mutable_names(int index);
- inline void set_names(int index, const ::std::string& value);
- inline void set_names(int index, const char* value);
- inline void set_names(int index, const char* value, size_t size);
- inline ::std::string* add_names();
- inline void add_names(const ::std::string& value);
- inline void add_names(const char* value);
- inline void add_names(const char* value, size_t size);
- inline const ::google::protobuf::RepeatedPtrField< ::std::string>& names() const;
- inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_names();
-
- // @@protoc_insertion_point(class_scope:singa.BlobProtos)
- private:
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::RepeatedPtrField< ::singa::BlobProto > blobs_;
- ::google::protobuf::RepeatedField< ::google::protobuf::int32 > ids_;
- ::google::protobuf::RepeatedPtrField< ::std::string> names_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static BlobProtos* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class LayerProto : public ::google::protobuf::Message {
- public:
- LayerProto();
- virtual ~LayerProto();
-
- LayerProto(const LayerProto& from);
-
- inline LayerProto& operator=(const LayerProto& 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 LayerProto& default_instance();
-
- void Swap(LayerProto* other);
-
- // implements Message ----------------------------------------------
-
- LayerProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const LayerProto& from);
- void MergeFrom(const LayerProto& 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 string name = 1;
- inline bool has_name() const;
- inline void clear_name();
- static const int kNameFieldNumber = 1;
- inline const ::std::string& name() const;
- inline void set_name(const ::std::string& value);
- inline void set_name(const char* value);
- inline void set_name(const char* value, size_t size);
- inline ::std::string* mutable_name();
- inline ::std::string* release_name();
- inline void set_allocated_name(::std::string* name);
-
- // optional string type = 2;
- inline bool has_type() const;
- inline void clear_type();
- static const int kTypeFieldNumber = 2;
- inline const ::std::string& type() const;
- inline void set_type(const ::std::string& value);
- inline void set_type(const char* value);
- inline void set_type(const char* value, size_t size);
- inline ::std::string* mutable_type();
- inline ::std::string* release_type();
- inline void set_allocated_type(::std::string* type);
-
- // repeated string srclayers = 3;
- inline int srclayers_size() const;
- inline void clear_srclayers();
- static const int kSrclayersFieldNumber = 3;
- inline const ::std::string& srclayers(int index) const;
- inline ::std::string* mutable_srclayers(int index);
- inline void set_srclayers(int index, const ::std::string& value);
- inline void set_srclayers(int index, const char* value);
- inline void set_srclayers(int index, const char* value, size_t size);
- inline ::std::string* add_srclayers();
- inline void add_srclayers(const ::std::string& value);
- inline void add_srclayers(const char* value);
- inline void add_srclayers(const char* value, size_t size);
- inline const ::google::protobuf::RepeatedPtrField< ::std::string>& srclayers() const;
- inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_srclayers();
-
- // optional int32 locationid = 4 [default = 0];
- inline bool has_locationid() const;
- inline void clear_locationid();
- static const int kLocationidFieldNumber = 4;
- inline ::google::protobuf::int32 locationid() const;
- inline void set_locationid(::google::protobuf::int32 value);
-
- // optional int32 partitionid = 5 [default = 0];
- inline bool has_partitionid() const;
- inline void clear_partitionid();
- static const int kPartitionidFieldNumber = 5;
- inline ::google::protobuf::int32 partitionid() const;
- inline void set_partitionid(::google::protobuf::int32 value);
-
- // optional .singa.PartitionType partition_type = 6;
- inline bool has_partition_type() const;
- inline void clear_partition_type();
- static const int kPartitionTypeFieldNumber = 6;
- inline ::singa::PartitionType partition_type() const;
- inline void set_partition_type(::singa::PartitionType value);
-
- // optional string datablob = 7;
- inline bool has_datablob() const;
- inline void clear_datablob();
- static const int kDatablobFieldNumber = 7;
- inline const ::std::string& datablob() const;
- inline void set_datablob(const ::std::string& value);
- inline void set_datablob(const char* value);
- inline void set_datablob(const char* value, size_t size);
- inline ::std::string* mutable_datablob();
- inline ::std::string* release_datablob();
- inline void set_allocated_datablob(::std::string* datablob);
-
- // repeated string share_ary = 11;
- inline int share_ary_size() const;
- inline void clear_share_ary();
- static const int kShareAryFieldNumber = 11;
- inline const ::std::string& share_ary(int index) const;
- inline ::std::string* mutable_share_ary(int index);
- inline void set_share_ary(int index, const ::std::string& value);
- inline void set_share_ary(int index, const char* value);
- inline void set_share_ary(int index, const char* value, size_t size);
- inline ::std::string* add_share_ary();
- inline void add_share_ary(const ::std::string& value);
- inline void add_share_ary(const char* value);
- inline void add_share_ary(const char* value, size_t size);
- inline const ::google::protobuf::RepeatedPtrField< ::std::string>& share_ary() const;
- inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_share_ary();
-
- // repeated .singa.ParamProto param = 12;
- inline int param_size() const;
- inline void clear_param();
- static const int kParamFieldNumber = 12;
- inline const ::singa::ParamProto& param(int index) const;
- inline ::singa::ParamProto* mutable_param(int index);
- inline ::singa::ParamProto* add_param();
- inline const ::google::protobuf::RepeatedPtrField< ::singa::ParamProto >&
- param() const;
- inline ::google::protobuf::RepeatedPtrField< ::singa::ParamProto >*
- mutable_param();
-
- // repeated string share_param = 13;
- inline int share_param_size() const;
- inline void clear_share_param();
- static const int kShareParamFieldNumber = 13;
- inline const ::std::string& share_param(int index) const;
- inline ::std::string* mutable_share_param(int index);
- inline void set_share_param(int index, const ::std::string& value);
- inline void set_share_param(int index, const char* value);
- inline void set_share_param(int index, const char* value, size_t size);
- inline ::std::string* add_share_param();
- inline void add_share_param(const ::std::string& value);
- inline void add_share_param(const char* value);
- inline void add_share_param(const char* value, size_t size);
- inline const ::google::protobuf::RepeatedPtrField< ::std::string>& share_param() const;
- inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_share_param();
-
- // repeated .singa.Phase exclude = 20;
- inline int exclude_size() const;
- inline void clear_exclude();
- static const int kExcludeFieldNumber = 20;
- inline ::singa::Phase exclude(int index) const;
- inline void set_exclude(int index, ::singa::Phase value);
- inline void add_exclude(::singa::Phase value);
- inline const ::google::protobuf::RepeatedField<int>& exclude() const;
- inline ::google::protobuf::RepeatedField<int>* mutable_exclude();
-
- // optional .singa.ConvolutionProto convolution_param = 21;
- inline bool has_convolution_param() const;
- inline void clear_convolution_param();
- static const int kConvolutionParamFieldNumber = 21;
- inline const ::singa::ConvolutionProto& convolution_param() const;
- inline ::singa::ConvolutionProto* mutable_convolution_param();
- inline ::singa::ConvolutionProto* release_convolution_param();
- inline void set_allocated_convolution_param(::singa::ConvolutionProto* convolution_param);
-
- // optional .singa.ConcateProto concate_param = 31;
- inline bool has_concate_param() const;
- inline void clear_concate_param();
- static const int kConcateParamFieldNumber = 31;
- inline const ::singa::ConcateProto& concate_param() const;
- inline ::singa::ConcateProto* mutable_concate_param();
- inline ::singa::ConcateProto* release_concate_param();
- inline void set_allocated_concate_param(::singa::ConcateProto* concate_param);
-
- // optional .singa.DataProto data_param = 22;
- inline bool has_data_param() const;
- inline void clear_data_param();
- static const int kDataParamFieldNumber = 22;
- inline const ::singa::DataProto& data_param() const;
- inline ::singa::DataProto* mutable_data_param();
- inline ::singa::DataProto* release_data_param();
- inline void set_allocated_data_param(::singa::DataProto* data_param);
-
- // optional .singa.DropoutProto dropout_param = 23;
- inline bool has_dropout_param() const;
- inline void clear_dropout_param();
- static const int kDropoutParamFieldNumber = 23;
- inline const ::singa::DropoutProto& dropout_param() const;
- inline ::singa::DropoutProto* mutable_dropout_param();
- inline ::singa::DropoutProto* release_dropout_param();
- inline void set_allocated_dropout_param(::singa::DropoutProto* dropout_param);
-
- // optional .singa.InnerProductProto inner_product_param = 24;
- inline bool has_inner_product_param() const;
- inline void clear_inner_product_param();
- static const int kInnerProductParamFieldNumber = 24;
- inline const ::singa::InnerProductProto& inner_product_param() const;
- inline ::singa::InnerProductProto* mutable_inner_product_param();
- inline ::singa::InnerProductProto* release_inner_product_param();
- inline void set_allocated_inner_product_param(::singa::InnerProductProto* inner_product_param);
-
- // optional .singa.LRNProto lrn_param = 25;
- inline bool has_lrn_param() const;
- inline void clear_lrn_param();
- static const int kLrnParamFieldNumber = 25;
- inline const ::singa::LRNProto& lrn_param() const;
- inline ::singa::LRNProto* mutable_lrn_param();
- inline ::singa::LRNProto* release_lrn_param();
- inline void set_allocated_lrn_param(::singa::LRNProto* lrn_param);
-
- // optional .singa.MnistProto mnist_param = 26;
- inline bool has_mnist_param() const;
- inline void clear_mnist_param();
- static const int kMnistParamFieldNumber = 26;
- inline const ::singa::MnistProto& mnist_param() const;
- inline ::singa::MnistProto* mutable_mnist_param();
- inline ::singa::MnistProto* release_mnist_param();
- inline void set_allocated_mnist_param(::singa::MnistProto* mnist_param);
-
- // optional .singa.PoolingProto pooling_param = 27;
- inline bool has_pooling_param() const;
- inline void clear_pooling_param();
- static const int kPoolingParamFieldNumber = 27;
- inline const ::singa::PoolingProto& pooling_param() const;
- inline ::singa::PoolingProto* mutable_pooling_param();
- inline ::singa::PoolingProto* release_pooling_param();
- inline void set_allocated_pooling_param(::singa::PoolingProto* pooling_param);
-
- // repeated .singa.LayerProto sublayers = 35;
- inline int sublayers_size() const;
- inline void clear_sublayers();
- static const int kSublayersFieldNumber = 35;
- inline const ::singa::LayerProto& sublayers(int index) const;
- inline ::singa::LayerProto* mutable_sublayers(int index);
- inline ::singa::LayerProto* add_sublayers();
- inline const ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >&
- sublayers() const;
- inline ::google::protobuf::RepeatedPtrField< ::singa::LayerProto >*
- mutable_sublayers();
-
- // optional .singa.SliceProto slice_param = 32;
- inline bool has_slice_param() const;
- inline void clear_slice_param();
- static const int kSliceParamFieldNumber = 32;
- inline const ::singa::SliceProto& slice_param() const;
- inline ::singa::SliceProto* mutable_slice_param();
- inline ::singa::SliceProto* release_slice_param();
- inline void set_allocated_slice_param(::singa::SliceProto* slice_param);
-
- // optional .singa.SplitProto split_param = 33;
- inline bool has_split_param() const;
- inline void clear_split_param();
- static const int kSplitParamFieldNumber = 33;
- inline const ::singa::SplitProto& split_param() const;
- inline ::singa::SplitProto* mutable_split_param();
- inline ::singa::SplitProto* release_split_param();
- inline void set_allocated_split_param(::singa::SplitProto* split_param);
-
- // optional .singa.ReLUProto relu_param = 28;
- inline bool has_relu_param() const;
- inline void clear_relu_param();
- static const int kReluParamFieldNumber = 28;
- inline const ::singa::ReLUProto& relu_param() const;
- inline ::singa::ReLUProto* mutable_relu_param();
- inline ::singa::ReLUProto* release_relu_param();
- inline void set_allocated_relu_param(::singa::ReLUProto* relu_param);
-
- // optional .singa.RGBImage rgbimage_param = 34;
- inline bool has_rgbimage_param() const;
- inline void clear_rgbimage_param();
- static const int kRgbimageParamFieldNumber = 34;
- inline const ::singa::RGBImage& rgbimage_param() const;
- inline ::singa::RGBImage* mutable_rgbimage_param();
- inline ::singa::RGBImage* release_rgbimage_param();
- inline void set_allocated_rgbimage_param(::singa::RGBImage* rgbimage_param);
-
- // optional .singa.SoftmaxLossProto softmaxloss_param = 29;
- inline bool has_softmaxloss_param() const;
- inline void clear_softmaxloss_param();
- static const int kSoftmaxlossParamFieldNumber = 29;
- inline const ::singa::SoftmaxLossProto& softmaxloss_param() const;
- inline ::singa::SoftmaxLossProto* mutable_softmaxloss_param();
- inline ::singa::SoftmaxLossProto* release_softmaxloss_param();
- inline void set_allocated_softmaxloss_param(::singa::SoftmaxLossProto* softmaxloss_param);
-
- // optional .singa.TanhProto tanh_param = 30;
- inline bool has_tanh_param() const;
- inline void clear_tanh_param();
- static const int kTanhParamFieldNumber = 30;
- inline const ::singa::TanhProto& tanh_param() const;
- inline ::singa::TanhProto* mutable_tanh_param();
- inline ::singa::TanhProto* release_tanh_param();
- inline void set_allocated_tanh_param(::singa::TanhProto* tanh_param);
-
- // @@protoc_insertion_point(class_scope:singa.LayerProto)
- private:
- inline void set_has_name();
- inline void clear_has_name();
- inline void set_has_type();
- inline void clear_has_type();
- inline void set_has_locationid();
- inline void clear_has_locationid();
- inline void set_has_partitionid();
- inline void clear_has_partitionid();
- inline void set_has_partition_type();
- inline void clear_has_partition_type();
- inline void set_has_datablob();
- inline void clear_has_datablob();
- inline void set_has_convolution_param();
- inline void clear_has_convolution_param();
- inline void set_has_concate_param();
- inline void clear_has_concate_param();
- inline void set_has_data_param();
- inline void clear_has_data_param();
- inline void set_has_dropout_param();
- inline void clear_has_dropout_param();
- inline void set_has_inner_product_param();
- inline void clear_has_inner_product_param();
- inline void set_has_lrn_param();
- inline void clear_has_lrn_param();
- inline void set_has_mnist_param();
- inline void clear_has_mnist_param();
- inline void set_has_pooling_param();
- inline void clear_has_pooling_param();
- inline void set_has_slice_param();
- inline void clear_has_slice_param();
- inline void set_has_split_param();
- inline void clear_has_split_param();
- inline void set_has_relu_param();
- inline void clear_has_relu_param();
- inline void set_has_rgbimage_param();
- inline void clear_has_rgbimage_param();
- inline void set_has_softmaxloss_param();
- inline void clear_has_softmaxloss_param();
- inline void set_has_tanh_param();
- inline void clear_has_tanh_param();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::std::string* name_;
- ::std::string* type_;
- ::google::protobuf::RepeatedPtrField< ::std::string> srclayers_;
- ::google::protobuf::int32 locationid_;
- ::google::protobuf::int32 partitionid_;
- ::std::string* datablob_;
- ::google::protobuf::RepeatedPtrField< ::std::string> share_ary_;
- ::google::protobuf::RepeatedPtrField< ::singa::ParamProto > param_;
- ::google::protobuf::RepeatedPtrField< ::std::string> share_param_;
- ::google::protobuf::RepeatedField<int> exclude_;
- ::singa::ConvolutionProto* convolution_param_;
- ::singa::ConcateProto* concate_param_;
- ::singa::DataProto* data_param_;
- ::singa::DropoutProto* dropout_param_;
- ::singa::InnerProductProto* inner_product_param_;
- ::singa::LRNProto* lrn_param_;
- ::singa::MnistProto* mnist_param_;
- ::singa::PoolingProto* pooling_param_;
- ::google::protobuf::RepeatedPtrField< ::singa::LayerProto > sublayers_;
- ::singa::SliceProto* slice_param_;
- ::singa::SplitProto* split_param_;
- ::singa::ReLUProto* relu_param_;
- ::singa::RGBImage* rgbimage_param_;
- ::singa::SoftmaxLossProto* softmaxloss_param_;
- ::singa::TanhProto* tanh_param_;
- int partition_type_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(26 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static LayerProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class RGBImage : public ::google::protobuf::Message {
- public:
- RGBImage();
- virtual ~RGBImage();
-
- RGBImage(const RGBImage& from);
-
- inline RGBImage& operator=(const RGBImage& 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 RGBImage& default_instance();
-
- void Swap(RGBImage* other);
-
- // implements Message ----------------------------------------------
-
- RGBImage* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const RGBImage& from);
- void MergeFrom(const RGBImage& 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 float scale = 1 [default = 1];
- inline bool has_scale() const;
- inline void clear_scale();
- static const int kScaleFieldNumber = 1;
- inline float scale() const;
- inline void set_scale(float value);
-
- // optional int32 cropsize = 2 [default = 0];
- inline bool has_cropsize() const;
- inline void clear_cropsize();
- static const int kCropsizeFieldNumber = 2;
- inline ::google::protobuf::int32 cropsize() const;
- inline void set_cropsize(::google::protobuf::int32 value);
-
- // optional bool mirror = 3 [default = false];
- inline bool has_mirror() const;
- inline void clear_mirror();
- static const int kMirrorFieldNumber = 3;
- inline bool mirror() const;
- inline void set_mirror(bool value);
-
- // optional string meanfile = 4;
- inline bool has_meanfile() const;
- inline void clear_meanfile();
- static const int kMeanfileFieldNumber = 4;
- inline const ::std::string& meanfile() const;
- inline void set_meanfile(const ::std::string& value);
- inline void set_meanfile(const char* value);
- inline void set_meanfile(const char* value, size_t size);
- inline ::std::string* mutable_meanfile();
- inline ::std::string* release_meanfile();
- inline void set_allocated_meanfile(::std::string* meanfile);
-
- // @@protoc_insertion_point(class_scope:singa.RGBImage)
- private:
- inline void set_has_scale();
- inline void clear_has_scale();
- inline void set_has_cropsize();
- inline void clear_has_cropsize();
- inline void set_has_mirror();
- inline void clear_has_mirror();
- inline void set_has_meanfile();
- inline void clear_has_meanfile();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- float scale_;
- ::google::protobuf::int32 cropsize_;
- ::std::string* meanfile_;
- bool mirror_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static RGBImage* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class SplitProto : public ::google::protobuf::Message {
- public:
- SplitProto();
- virtual ~SplitProto();
-
- SplitProto(const SplitProto& from);
-
- inline SplitProto& operator=(const SplitProto& 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 SplitProto& default_instance();
-
- void Swap(SplitProto* other);
-
- // implements Message ----------------------------------------------
-
- SplitProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const SplitProto& from);
- void MergeFrom(const SplitProto& 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 num_splits = 1;
- inline bool has_num_splits() const;
- inline void clear_num_splits();
- static const int kNumSplitsFieldNumber = 1;
- inline ::google::protobuf::int32 num_splits() const;
- inline void set_num_splits(::google::protobuf::int32 value);
-
- // @@protoc_insertion_point(class_scope:singa.SplitProto)
- private:
- inline void set_has_num_splits();
- inline void clear_has_num_splits();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::int32 num_splits_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static SplitProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class TanhProto : public ::google::protobuf::Message {
- public:
- TanhProto();
- virtual ~TanhProto();
-
- TanhProto(const TanhProto& from);
-
- inline TanhProto& operator=(const TanhProto& 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 TanhProto& default_instance();
-
- void Swap(TanhProto* other);
-
- // implements Message ----------------------------------------------
-
- TanhProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const TanhProto& from);
- void MergeFrom(const TanhProto& 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 float outer_scale = 1 [default = 1];
- inline bool has_outer_scale() const;
- inline void clear_outer_scale();
- static const int kOuterScaleFieldNumber = 1;
- inline float outer_scale() const;
- inline void set_outer_scale(float value);
-
- // optional float inner_scale = 2 [default = 1];
- inline bool has_inner_scale() const;
- inline void clear_inner_scale();
- static const int kInnerScaleFieldNumber = 2;
- inline float inner_scale() const;
- inline void set_inner_scale(float value);
-
- // @@protoc_insertion_point(class_scope:singa.TanhProto)
- private:
- inline void set_has_outer_scale();
- inline void clear_has_outer_scale();
- inline void set_has_inner_scale();
- inline void clear_has_inner_scale();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- float outer_scale_;
- float inner_scale_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static TanhProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class SoftmaxLossProto : public ::google::protobuf::Message {
- public:
- SoftmaxLossProto();
- virtual ~SoftmaxLossProto();
-
- SoftmaxLossProto(const SoftmaxLossProto& from);
-
- inline SoftmaxLossProto& operator=(const SoftmaxLossProto& 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 SoftmaxLossProto& default_instance();
-
- void Swap(SoftmaxLossProto* other);
-
- // implements Message ----------------------------------------------
-
- SoftmaxLossProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const SoftmaxLossProto& from);
- void MergeFrom(const SoftmaxLossProto& 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 topk = 1 [default = 1];
- inline bool has_topk() const;
- inline void clear_topk();
- static const int kTopkFieldNumber = 1;
- inline ::google::protobuf::int32 topk() const;
- inline void set_topk(::google::protobuf::int32 value);
-
- // optional float scale = 2 [default = 1];
- inline bool has_scale() const;
- inline void clear_scale();
- static const int kScaleFieldNumber = 2;
- inline float scale() const;
- inline void set_scale(float value);
-
- // @@protoc_insertion_point(class_scope:singa.SoftmaxLossProto)
- private:
- inline void set_has_topk();
- inline void clear_has_topk();
- inline void set_has_scale();
- inline void clear_has_scale();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::int32 topk_;
- float scale_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static SoftmaxLossProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class ConvolutionProto : public ::google::protobuf::Message {
- public:
- ConvolutionProto();
- virtual ~ConvolutionProto();
-
- ConvolutionProto(const ConvolutionProto& from);
-
- inline ConvolutionProto& operator=(const ConvolutionProto& 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 ConvolutionProto& default_instance();
-
- void Swap(ConvolutionProto* other);
-
- // implements Message ----------------------------------------------
-
- ConvolutionProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const ConvolutionProto& from);
- void MergeFrom(const ConvolutionProto& 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 uint32 num_filters = 1;
- inline bool has_num_filters() const;
- inline void clear_num_filters();
- static const int kNumFiltersFieldNumber = 1;
- inline ::google::protobuf::uint32 num_filters() const;
- inline void set_num_filters(::google::protobuf::uint32 value);
-
- // optional bool bias_term = 2 [default = true];
- inline bool has_bias_term() const;
- inline void clear_bias_term();
- static const int kBiasTermFieldNumber = 2;
- inline bool bias_term() const;
- inline void set_bias_term(bool value);
-
- // optional uint32 pad = 3 [default = 0];
- inline bool has_pad() const;
- inline void clear_pad();
- static const int kPadFieldNumber = 3;
- inline ::google::protobuf::uint32 pad() const;
- inline void set_pad(::google::protobuf::uint32 value);
-
- // optional uint32 stride = 4 [default = 1];
- inline bool has_stride() const;
- inline void clear_stride();
- static const int kStrideFieldNumber = 4;
- inline ::google::protobuf::uint32 stride() const;
- inline void set_stride(::google::protobuf::uint32 value);
-
- // required uint32 kernel = 5;
- inline bool has_kernel() const;
- inline void clear_kernel();
- static const int kKernelFieldNumber = 5;
- inline ::google::protobuf::uint32 kernel() const;
- inline void set_kernel(::google::protobuf::uint32 value);
-
- // @@protoc_insertion_point(class_scope:singa.ConvolutionProto)
- private:
- inline void set_has_num_filters();
- inline void clear_has_num_filters();
- inline void set_has_bias_term();
- inline void clear_has_bias_term();
- inline void set_has_pad();
- inline void clear_has_pad();
- inline void set_has_stride();
- inline void clear_has_stride();
- inline void set_has_kernel();
- inline void clear_has_kernel();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::uint32 num_filters_;
- bool bias_term_;
- ::google::protobuf::uint32 pad_;
- ::google::protobuf::uint32 stride_;
- ::google::protobuf::uint32 kernel_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static ConvolutionProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class ConcateProto : public ::google::protobuf::Message {
- public:
- ConcateProto();
- virtual ~ConcateProto();
-
- ConcateProto(const ConcateProto& from);
-
- inline ConcateProto& operator=(const ConcateProto& 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 ConcateProto& default_instance();
-
- void Swap(ConcateProto* other);
-
- // implements Message ----------------------------------------------
-
- ConcateProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const ConcateProto& from);
- void MergeFrom(const ConcateProto& 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 concate_dimension = 1;
- inline bool has_concate_dimension() const;
- inline void clear_concate_dimension();
- static const int kConcateDimensionFieldNumber = 1;
- inline ::google::protobuf::int32 concate_dimension() const;
- inline void set_concate_dimension(::google::protobuf::int32 value);
-
- // optional int32 concate_num = 2;
- inline bool has_concate_num() const;
- inline void clear_concate_num();
- static const int kConcateNumFieldNumber = 2;
- inline ::google::protobuf::int32 concate_num() const;
- inline void set_concate_num(::google::protobuf::int32 value);
-
- // @@protoc_insertion_point(class_scope:singa.ConcateProto)
- private:
- inline void set_has_concate_dimension();
- inline void clear_has_concate_dimension();
- inline void set_has_concate_num();
- inline void clear_has_concate_num();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::int32 concate_dimension_;
- ::google::protobuf::int32 concate_num_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static ConcateProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class DataProto : public ::google::protobuf::Message {
- public:
- DataProto();
- virtual ~DataProto();
-
- DataProto(const DataProto& from);
-
- inline DataProto& operator=(const DataProto& 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 DataProto& default_instance();
-
- void Swap(DataProto* other);
-
- // implements Message ----------------------------------------------
-
- DataProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const DataProto& from);
- void MergeFrom(const DataProto& 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 string source = 1;
- inline bool has_source() const;
- inline void clear_source();
- static const int kSourceFieldNumber = 1;
- inline const ::std::string& source() const;
- inline void set_source(const ::std::string& value);
- inline void set_source(const char* value);
- inline void set_source(const char* value, size_t size);
- inline ::std::string* mutable_source();
- inline ::std::string* release_source();
- inline void set_allocated_source(::std::string* source);
-
- // optional string path = 2;
- inline bool has_path() const;
- inline void clear_path();
- static const int kPathFieldNumber = 2;
- inline const ::std::string& path() const;
- inline void set_path(const ::std::string& value);
- inline void set_path(const char* value);
- inline void set_path(const char* value, size_t size);
- inline ::std::string* mutable_path();
- inline ::std::string* release_path();
- inline void set_allocated_path(::std::string* path);
-
- // optional uint32 batchsize = 4;
- inline bool has_batchsize() const;
- inline void clear_batchsize();
- static const int kBatchsizeFieldNumber = 4;
- inline ::google::protobuf::uint32 batchsize() const;
- inline void set_batchsize(::google::protobuf::uint32 value);
-
- // optional uint32 random_skip = 5 [default = 0];
- inline bool has_random_skip() const;
- inline void clear_random_skip();
- static const int kRandomSkipFieldNumber = 5;
- inline ::google::protobuf::uint32 random_skip() const;
- inline void set_random_skip(::google::protobuf::uint32 value);
-
- // @@protoc_insertion_point(class_scope:singa.DataProto)
- private:
- inline void set_has_source();
- inline void clear_has_source();
- inline void set_has_path();
- inline void clear_has_path();
- inline void set_has_batchsize();
- inline void clear_has_batchsize();
- inline void set_has_random_skip();
- inline void clear_has_random_skip();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::std::string* source_;
- ::std::string* path_;
- ::google::protobuf::uint32 batchsize_;
- ::google::protobuf::uint32 random_skip_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
- friend void protobuf_AddDesc_model_2eproto();
- friend void protobuf_AssignDesc_model_2eproto();
- friend void protobuf_ShutdownFile_model_2eproto();
-
- void InitAsDefaultInstance();
- static DataProto* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class MnistProto : public ::google::protobuf::Message {
- public:
- MnistProto();
- virtual ~MnistProto();
-
- MnistProto(const MnistProto& from);
-
- inline MnistProto& operator=(const MnistProto& 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 MnistProto& default_instance();
-
- void Swap(MnistProto* other);
-
- // implements Message ----------------------------------------------
-
- MnistProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const MnistProto& from);
- void MergeFrom(const MnistProto& 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 kernel = 1 [default = 0];
- inline bool has_kernel() const;
- inline void clear_kernel();
- static const int kKernelFieldNumber = 1;
- inline ::google::protobuf::int32 kernel() const;
- inline void set_kernel(::google::protobuf::int32 value);
-
- // optional float sigma = 2 [default = 0];
- inline bool has_sigma() const;
- inline void clear_sigma();
- static const int kSigmaFieldNumber = 2;
- inline float sigma() const;
- inline void set_sigma(float value);
-
- // optional float alpha = 3 [default = 0];
- inline bool has_alpha() const;
- inline void clear_alpha();
- static const int kAlphaFieldNumber = 3;
- inline float alpha() const;
- inline void set_alpha(float value);
-
- // optional float beta = 4 [default = 0];
- inline bool has_beta() const;
- inline void clear_beta();
- static const int kBetaFieldNumber = 4;
- inline float beta() const;
- inline void set_beta(float value);
-
- // optional float gamma = 5 [default = 0];
- inline bool has_gamma() const;
- inline void clear_gamma();
- static const int kGammaFieldNumber = 5;
- inline float gamma() const;
- inline void set_gamma(float value);
-
- // optional int32 resize = 6 [default = 0];
- inline bool has_resize() const;
- inline void clear_resize();
- static const int kResizeFieldNumber = 6;
- inline ::google::protobuf::int32 resize() const;
- inline void set_resize(::google::protobuf::int32 value);
-
- // optional int32 elastic_freq = 7 [default = 0];
- inline bool has_elastic_freq() const;
- inline void clear_elastic_freq();
- static const int kElasticFreqFieldNumber = 7;
- inline ::google::protobuf::int32 elastic_freq() const;
- inline void set_elastic_freq(::google::protobuf::int32 value);
-
- // optional float norm_a = 8 [default = 1];
- inline bool has_norm_a() const;
- inline void clear_norm_a();
- static const int kNormAFieldNumber = 8;
- inline float norm_a() const;
- inline void set_norm_a(float value);
-
- // optional float norm_b = 9 [default = 0];
- inline bool has_norm_b() const;
- inline void clear_norm_b();
- static const int kNormBFieldNumber = 9;
- inline float norm_b() const;
- inline void set_norm_b(float value);
-
- // @@protoc_insertion_point(class_scope:singa.MnistProto)
- private:
- inline void set_has_kernel();
- inline void clear_has_kernel();
- inline void set_has_sigma();
- inline void clear_has_sigma();
- inline void set_has_alpha();
- inline void clear_has_alpha();
- inline void set_has_beta();
- inline void clear_has_beta();
- inline void set_has_gamma();
- inline void clear_has_gamma();
- inline void set_has_resize();
- inline void clear_has_resize();
- inline v
<TRUNCATED>
[09/10] incubator-singa git commit: SINGA-7 Implement shared memory
Hogwild algorithm
Posted by wa...@apache.org.
SINGA-7 Implement shared memory Hogwild algorithm
add .conf files
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/bd87c7a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/bd87c7a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/bd87c7a5
Branch: refs/heads/master
Commit: bd87c7a50d8cc1888a09df90376660b8a4acf745
Parents: bfc09c1
Author: wang sheng <wa...@gmail.com>
Authored: Mon Jun 15 14:40:43 2015 +0800
Committer: wang sheng <wa...@gmail.com>
Committed: Mon Jun 15 14:40:43 2015 +0800
----------------------------------------------------------------------
examples/cifar10/cluster.conf | 6 +
examples/cifar10/model-lmdb.conf | 218 +++++++++++++++++++++++++++
examples/cifar10/model-prefetch.conf | 241 ++++++++++++++++++++++++++++++
examples/cifar10/model.conf | 218 +++++++++++++++++++++++++++
examples/mnist/cluster.conf | 5 +
examples/mnist/conv.conf | 175 ++++++++++++++++++++++
examples/mnist/mlp-lmdb.conf | 223 +++++++++++++++++++++++++++
examples/mnist/mlp.conf | 221 +++++++++++++++++++++++++++
8 files changed, 1307 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/cifar10/cluster.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/cluster.conf b/examples/cifar10/cluster.conf
new file mode 100644
index 0000000..6f6d963
--- /dev/null
+++ b/examples/cifar10/cluster.conf
@@ -0,0 +1,6 @@
+nworker_groups: 2
+nserver_groups: 1
+nservers_per_group: 1
+nworkers_per_group: 1
+nworkers_per_procs: 2
+workspace: "examples/cifar10/"
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/cifar10/model-lmdb.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/model-lmdb.conf b/examples/cifar10/model-lmdb.conf
new file mode 100644
index 0000000..ea22ccd
--- /dev/null
+++ b/examples/cifar10/model-lmdb.conf
@@ -0,0 +1,218 @@
+name: "cifar10-convnet"
+train_steps: 70000
+test_steps:100
+test_frequency:1000
+display_frequency:50
+updater{
+ momentum:0.9
+ weight_decay:0.004
+ learning_rate_change_method:kFixedStep
+ step:0
+ step:60000
+ step:65000
+ step_lr:0.001
+ step_lr:0.0001
+ step_lr:0.00001
+}
+neuralnet {
+layer {
+ name: "data"
+ type: "kLMDBData"
+ data_param {
+ path: "examples/cifar10/cifar10_train_lmdb"
+ batchsize: 100
+ }
+ exclude: kTest
+}
+
+layer {
+ name: "data"
+ type: "kLMDBData"
+ data_param {
+ path: "examples/cifar10/cifar10_test_lmdb"
+ batchsize: 100
+ }
+ exclude: kTrain
+}
+
+layer{
+ name:"rgb"
+ type: "kRGBImage"
+ srclayers: "data"
+ rgbimage_param {
+ meanfile: "examples/cifar10/mean.binaryproto"
+ }
+}
+
+layer{
+ name: "label"
+ type: "kLabel"
+ srclayers: "data"
+}
+layer {
+ name: "conv1"
+ type: "kConvolution"
+ srclayers: "rgb"
+ convolution_param {
+ num_filters: 32
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.0001
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+layer {
+ name: "pool1"
+ type: "kPooling"
+ srclayers: "conv1"
+ pooling_param {
+ pool: MAX
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "relu1"
+ type: "kReLU"
+ srclayers:"pool1"
+}
+layer {
+ name: "norm1"
+ type: "kLRN"
+ lrn_param {
+ norm_region: WITHIN_CHANNEL
+ local_size: 3
+ alpha: 5e-05
+ beta: 0.75
+ }
+ srclayers:"relu1"
+}
+layer {
+ name: "conv2"
+ type: "kConvolution"
+ srclayers: "norm1"
+ convolution_param {
+ num_filters: 32
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+layer {
+ name: "relu2"
+ type: "kReLU"
+ srclayers:"conv2"
+}
+layer {
+ name: "pool2"
+ type: "kPooling"
+ srclayers: "relu2"
+ pooling_param {
+ pool: MAX
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "norm2"
+ type: "kLRN"
+ lrn_param {
+ norm_region: WITHIN_CHANNEL
+ local_size: 3
+ alpha: 5e-05
+ beta: 0.75
+ }
+ srclayers:"pool2"
+}
+layer {
+ name: "conv3"
+ type: "kConvolution"
+ srclayers: "norm2"
+ convolution_param {
+ num_filters: 64
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ value:0
+ }
+}
+layer {
+ name: "relu3"
+ type: "kReLU"
+ srclayers:"conv3"
+}
+layer {
+ name: "pool3"
+ type: "kPooling"
+ srclayers: "relu3"
+ pooling_param {
+ pool: AVE
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "ip1"
+ type: "kInnerProduct"
+ srclayers:"pool3"
+ inner_product_param {
+ num_output: 10
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ learning_rate_multiplier:1.0
+ weight_decay_multiplier:250
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ weight_decay_multiplier:0
+ value:0
+ }
+}
+
+layer{
+ name: "loss"
+ type:"kSoftmaxLoss"
+ softmaxloss_param{
+ topk:1
+ }
+ srclayers:"ip1"
+ srclayers:"label"
+}
+}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/cifar10/model-prefetch.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/model-prefetch.conf b/examples/cifar10/model-prefetch.conf
new file mode 100644
index 0000000..220a4b9
--- /dev/null
+++ b/examples/cifar10/model-prefetch.conf
@@ -0,0 +1,241 @@
+name: "cifar10-convnet"
+train_steps: 70000
+test_steps:100
+test_frequency:1000
+display_frequency:50
+updater{
+ momentum:0.9
+ weight_decay:0.004
+ learning_rate_change_method:kFixedStep
+ step:0
+ step:60000
+ step:65000
+ step_lr:0.001
+ step_lr:0.0001
+ step_lr:0.00001
+}
+neuralnet {
+layer{
+ name: "prefetch"
+ type: "kPrefetch"
+ sublayers {
+ name: "data"
+ type: "kShardData"
+ data_param {
+ path: "examples/cifar10/cifar10_train_shard"
+ batchsize: 100
+ }
+ }
+ sublayers{
+ name:"rgb"
+ type: "kRGBImage"
+ srclayers: "data"
+ rgbimage_param {
+ meanfile: "examples/cifar10/image_mean.bin"
+ }
+ }
+ sublayers{
+ name: "label"
+ type: "kLabel"
+ srclayers: "data"
+ }
+ exclude: kTest
+}
+
+layer{
+ name: "prefetch"
+ type: "kPrefetch"
+ sublayers {
+ name: "data"
+ type: "kShardData"
+ data_param {
+ path: "examples/cifar10/cifar10_test_shard"
+ batchsize: 100
+ }
+ }
+ sublayers{
+ name:"rgb"
+ type: "kRGBImage"
+ srclayers: "data"
+ rgbimage_param {
+ meanfile: "examples/cifar10/image_mean.bin"
+ }
+ }
+ sublayers{
+ name: "label"
+ type: "kLabel"
+ srclayers: "data"
+ }
+ exclude: kTrain
+}
+
+layer {
+ name: "conv1"
+ type: "kConvolution"
+ srclayers: "prefetch"
+ datablob: "rgb"
+ convolution_param {
+ num_filters: 32
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.0001
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+
+layer {
+ name: "pool1"
+ type: "kPooling"
+ srclayers: "conv1"
+ pooling_param {
+ pool: MAX
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "relu1"
+ type: "kReLU"
+ srclayers:"pool1"
+}
+layer {
+ name: "norm1"
+ type: "kLRN"
+ lrn_param {
+ norm_region: WITHIN_CHANNEL
+ local_size: 3
+ alpha: 5e-05
+ beta: 0.75
+ }
+ srclayers:"relu1"
+}
+layer {
+ name: "conv2"
+ type: "kConvolution"
+ srclayers: "norm1"
+ convolution_param {
+ num_filters: 32
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+layer {
+ name: "relu2"
+ type: "kReLU"
+ srclayers:"conv2"
+}
+layer {
+ name: "pool2"
+ type: "kPooling"
+ srclayers: "relu2"
+ pooling_param {
+ pool: MAX
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "norm2"
+ type: "kLRN"
+ lrn_param {
+ norm_region: WITHIN_CHANNEL
+ local_size: 3
+ alpha: 5e-05
+ beta: 0.75
+ }
+ srclayers:"pool2"
+}
+layer {
+ name: "conv3"
+ type: "kConvolution"
+ srclayers: "norm2"
+ convolution_param {
+ num_filters: 64
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ value:0
+ }
+}
+layer {
+ name: "relu3"
+ type: "kReLU"
+ srclayers:"conv3"
+}
+layer {
+ name: "pool3"
+ type: "kPooling"
+ srclayers: "relu3"
+ pooling_param {
+ pool: AVE
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "ip1"
+ type: "kInnerProduct"
+ srclayers:"pool3"
+ inner_product_param {
+ num_output: 10
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ learning_rate_multiplier:1.0
+ weight_decay_multiplier:250
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ weight_decay_multiplier:0
+ value:0
+ }
+}
+
+layer{
+ name: "loss"
+ type:"kSoftmaxLoss"
+ softmaxloss_param{
+ topk:1
+ }
+ srclayers:"ip1"
+ srclayers:"prefetch"
+ datablob: "label"
+}
+}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/cifar10/model.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/model.conf b/examples/cifar10/model.conf
new file mode 100644
index 0000000..0cdf8b0
--- /dev/null
+++ b/examples/cifar10/model.conf
@@ -0,0 +1,218 @@
+name: "cifar10-convnet"
+train_steps: 1000
+test_steps:100
+test_frequency:300
+display_frequency:30
+updater{
+ momentum:0.0
+ weight_decay:0.004
+ learning_rate_change_method:kFixedStep
+ step:0
+ step:60000
+ step:65000
+ step_lr:0.001
+ step_lr:0.0001
+ step_lr:0.00001
+}
+neuralnet {
+partition_type: kDataPartition
+layer{
+ name: "data"
+ type: "kShardData"
+ data_param {
+ path: "examples/cifar10/cifar10_train_shard"
+ batchsize: 16
+ }
+ exclude: kTest
+}
+layer{
+ name: "data"
+ type: "kShardData"
+ data_param {
+ path: "examples/cifar10/cifar10_test_shard"
+ batchsize: 100
+ }
+ exclude: kTrain
+}
+layer{
+ name:"rgb"
+ type: "kRGBImage"
+ srclayers: "data"
+ rgbimage_param {
+ meanfile: "examples/cifar10/image_mean.bin"
+ }
+}
+layer{
+ name: "label"
+ type: "kLabel"
+ srclayers: "data"
+}
+
+layer {
+ name: "conv1"
+ type: "kConvolution"
+ srclayers: "rgb"
+ convolution_param {
+ num_filters: 32
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.0001
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+
+layer {
+ name: "pool1"
+ type: "kPooling"
+ srclayers: "conv1"
+ pooling_param {
+ pool: MAX
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "relu1"
+ type: "kReLU"
+ srclayers:"pool1"
+}
+layer {
+ name: "norm1"
+ type: "kLRN"
+ lrn_param {
+ norm_region: WITHIN_CHANNEL
+ local_size: 3
+ alpha: 5e-05
+ beta: 0.75
+ }
+ srclayers:"relu1"
+}
+layer {
+ name: "conv2"
+ type: "kConvolution"
+ srclayers: "norm1"
+ convolution_param {
+ num_filters: 32
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+layer {
+ name: "relu2"
+ type: "kReLU"
+ srclayers:"conv2"
+}
+layer {
+ name: "pool2"
+ type: "kPooling"
+ srclayers: "relu2"
+ pooling_param {
+ pool: MAX
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "norm2"
+ type: "kLRN"
+ lrn_param {
+ norm_region: WITHIN_CHANNEL
+ local_size: 3
+ alpha: 5e-05
+ beta: 0.75
+ }
+ srclayers:"pool2"
+}
+layer {
+ name: "conv3"
+ type: "kConvolution"
+ srclayers: "norm2"
+ convolution_param {
+ num_filters: 64
+ kernel: 5
+ stride: 1
+ pad:2
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ value:0
+ }
+}
+layer {
+ name: "relu3"
+ type: "kReLU"
+ srclayers:"conv3"
+}
+layer {
+ name: "pool3"
+ type: "kPooling"
+ srclayers: "relu3"
+ pooling_param {
+ pool: AVE
+ kernel: 3
+ stride: 2
+ }
+}
+layer {
+ name: "ip1"
+ type: "kInnerProduct"
+ srclayers:"pool3"
+ inner_product_param {
+ num_output: 10
+ }
+ param{
+ name: "weight"
+ init_method:kGaussian
+ std:0.01
+ learning_rate_multiplier:1.0
+ weight_decay_multiplier:250
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ weight_decay_multiplier:0
+ value:0
+ }
+}
+
+layer{
+ name: "loss"
+ type:"kSoftmaxLoss"
+ softmaxloss_param{
+ topk:1
+ }
+ srclayers:"ip1"
+ srclayers: "label"
+}
+}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/mnist/cluster.conf
----------------------------------------------------------------------
diff --git a/examples/mnist/cluster.conf b/examples/mnist/cluster.conf
new file mode 100644
index 0000000..6b8a8e6
--- /dev/null
+++ b/examples/mnist/cluster.conf
@@ -0,0 +1,5 @@
+nworker_groups: 1
+nserver_groups: 1
+nservers_per_group: 1
+nworkers_per_group: 1
+workspace: "examples/cifar10/"
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/mnist/conv.conf
----------------------------------------------------------------------
diff --git a/examples/mnist/conv.conf b/examples/mnist/conv.conf
new file mode 100644
index 0000000..5f3bf58
--- /dev/null
+++ b/examples/mnist/conv.conf
@@ -0,0 +1,175 @@
+name: "mnist-conv"
+train_steps: 10000
+test_steps:100
+test_frequency:500
+display_frequency:50
+debug: false
+updater{
+ base_learning_rate:0.01
+ momentum:0.9
+ weight_decay:0.0005
+ gamma:0.0001
+ pow:0.75
+ learning_rate_change_method:kInverse
+}
+neuralnet {
+layer {
+ name: "data"
+ type: "kLMDBData"
+ data_param {
+ path: "/home/wangwei/program/singa/examples/mnist/mnist_train_lmdb"
+ batchsize: 64
+ }
+ exclude: kTest
+}
+
+layer {
+ name: "data"
+ type: "kLMDBData"
+ data_param {
+ path: "/home/wangwei/program/singa/examples/mnist/mnist_test_lmdb"
+ batchsize: 100
+ }
+ exclude: kTrain
+}
+
+layer{
+ name:"mnist"
+ type: "kMnistImage"
+ srclayers: "data"
+ mnist_param {
+# sigma: 6
+# alpha: 38
+# gamma: 15
+# kernel: 21
+# elastic_freq:100
+# beta:15
+# resize: 29
+ norm_a:255
+ }
+}
+
+
+layer{
+ name: "label"
+ type: "kLabel"
+ srclayers: "data"
+}
+layer {
+ name: "conv1"
+ type: "kConvolution"
+ srclayers: "mnist"
+ convolution_param {
+ num_filters: 20
+ kernel: 5
+ stride: 1
+ }
+ param{
+ name: "weight"
+ init_method:kUniformSqrtFanIn
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+layer {
+ name: "pool1"
+ type: "kPooling"
+ srclayers: "conv1"
+ pooling_param {
+ pool: MAX
+ kernel: 2
+ stride: 2
+ }
+}
+layer {
+ name: "conv2"
+ type: "kConvolution"
+ srclayers: "pool1"
+ convolution_param {
+ num_filters: 50
+ kernel: 5
+ stride: 1
+ }
+ param{
+ name: "weight"
+ init_method:kUniformSqrtFanIn
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+}
+layer {
+ name: "pool2"
+ type: "kPooling"
+ srclayers: "conv2"
+ pooling_param {
+ pool: MAX
+ kernel: 2
+ stride: 2
+ }
+}
+layer {
+ name: "ip1"
+ type: "kInnerProduct"
+ srclayers:"pool2"
+ inner_product_param {
+ num_output: 500
+ }
+ param{
+ name: "weight"
+ init_method:kUniformSqrtFanIn
+ learning_rate_multiplier:1.0
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2.0
+ value:0
+ }
+
+}
+
+layer {
+ name: "relu1"
+ type: "kReLU"
+ srclayers:"ip1"
+}
+
+layer {
+ name: "ip2"
+ type: "kInnerProduct"
+ srclayers:"relu1"
+ inner_product_param {
+ num_output: 10
+ }
+ param{
+ name: "weight"
+ init_method:kUniformSqrtFanIn
+ learning_rate_multiplier:1
+ }
+ param{
+ name: "bias"
+ init_method: kConstant
+ learning_rate_multiplier:2
+ value:0
+ }
+}
+layer{
+ name: "loss"
+ type:"kSoftmaxLoss"
+ softmaxloss_param{
+ topk:1
+ }
+ srclayers:"ip2"
+ srclayers:"label"
+}
+}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/mnist/mlp-lmdb.conf
----------------------------------------------------------------------
diff --git a/examples/mnist/mlp-lmdb.conf b/examples/mnist/mlp-lmdb.conf
new file mode 100644
index 0000000..d0ed08f
--- /dev/null
+++ b/examples/mnist/mlp-lmdb.conf
@@ -0,0 +1,223 @@
+name: "deep-big-simple-mlp"
+train_steps: 10000
+test_steps:10
+test_frequency:60
+display_frequency:30
+checkpoint_frequency:120
+updater{
+ base_learning_rate: 0.001
+ learning_rate_change_method: kStep
+ learning_rate_change_frequency: 60
+ gamma: 0.997
+ param_type: "Param"
+}
+
+neuralnet {
+layer {
+ name: "data"
+ type: "kLMDBData"
+ data_param {
+ path: "/home/wangwei/program/singa/examples/mnist/mnist_train_lmdb"
+ batchsize: 1000
+ random_skip: 10000
+ }
+ exclude: kTest
+}
+
+layer {
+ name: "data"
+ type: "kLMDBData"
+ data_param {
+ path: "/home/wangwei/program/singa/examples/mnist/mnist_test_lmdb"
+ batchsize: 1000
+ }
+ exclude: kTrain
+}
+
+layer{
+ name:"mnist"
+ type: "kMnistImage"
+ srclayers: "data"
+ mnist_param {
+# sigma: 6
+# alpha: 38
+# gamma: 15
+# kernel: 21
+# elastic_freq:100
+# beta:15
+# resize: 29
+ norm_a: 127.5
+ norm_b: 1
+ }
+}
+
+
+layer{
+ name: "label"
+ type: "kLabel"
+ srclayers: "data"
+}
+
+layer{
+ name: "fc1"
+ type: "kInnerProduct"
+ srclayers:"mnist"
+ inner_product_param{
+ num_output: 2500
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+}
+
+layer{
+ name: "tanh1"
+ type:"kTanh"
+ srclayers:"fc1"
+}
+layer{
+ name: "fc2"
+ type: "kInnerProduct"
+ srclayers:"tanh1"
+ inner_product_param{
+ num_output: 2000
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+}
+
+layer{
+ name: "tanh2"
+ type:"kTanh"
+ srclayers:"fc2"
+}
+layer{
+ name: "fc3"
+ type: "kInnerProduct"
+ srclayers:"tanh2"
+ inner_product_param{
+ num_output: 1500
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+
+}
+
+layer{
+ name: "tanh3"
+ type:"kTanh"
+ srclayers:"fc3"
+}
+layer{
+ name: "fc4"
+ type: "kInnerProduct"
+ srclayers:"tanh3"
+ inner_product_param{
+ num_output: 1000
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+
+}
+
+layer{
+ name: "tanh4"
+ type:"kTanh"
+ srclayers:"fc4"
+}
+layer{
+ name: "fc5"
+ type: "kInnerProduct"
+ srclayers:"tanh4"
+ inner_product_param{
+ num_output: 500
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+
+}
+
+layer{
+ name: "tanh5"
+ type:"kTanh"
+ srclayers:"fc5"
+}
+layer{
+ name: "fc6"
+ type: "kInnerProduct"
+ srclayers:"tanh5"
+ inner_product_param{
+ num_output: 10
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+}
+layer{
+ name: "loss"
+ type:"kSoftmaxLoss"
+ softmaxloss_param{
+ topk:1
+ }
+ srclayers:"fc6"
+ srclayers:"label"
+}
+}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/bd87c7a5/examples/mnist/mlp.conf
----------------------------------------------------------------------
diff --git a/examples/mnist/mlp.conf b/examples/mnist/mlp.conf
new file mode 100644
index 0000000..9eeb1c6
--- /dev/null
+++ b/examples/mnist/mlp.conf
@@ -0,0 +1,221 @@
+name: "deep-big-simple-mlp"
+train_steps: 10000
+test_steps:10
+test_frequency:60
+display_frequency:30
+updater{
+ base_learning_rate: 0.001
+ learning_rate_change_method: kStep
+ learning_rate_change_frequency: 60
+ gamma: 0.997
+ param_type: "Param"
+}
+
+neuralnet {
+layer {
+ name: "data"
+ type: "kShardData"
+ data_param {
+ path: "examples/mnist/mnist_train_shard"
+ batchsize: 1000
+ }
+ exclude: kTest
+}
+
+layer {
+ name: "data"
+ type: "kShardData"
+ data_param {
+ path: "examples/mnist/mnist_test_shard"
+ batchsize: 1000
+ }
+ exclude: kTrain
+}
+
+layer{
+ name:"mnist"
+ type: "kMnistImage"
+ srclayers: "data"
+ mnist_param {
+# sigma: 6
+# alpha: 38
+# gamma: 15
+# kernel: 21
+# elastic_freq:100
+# beta:15
+# resize: 29
+ norm_a: 127.5
+ norm_b: 1
+ }
+}
+
+
+layer{
+ name: "label"
+ type: "kLabel"
+ srclayers: "data"
+}
+
+layer{
+ name: "fc1"
+ type: "kInnerProduct"
+ srclayers:"mnist"
+ inner_product_param{
+ num_output: 2500
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+}
+
+layer{
+ name: "tanh1"
+ type:"kTanh"
+ srclayers:"fc1"
+}
+layer{
+ name: "fc2"
+ type: "kInnerProduct"
+ srclayers:"tanh1"
+ inner_product_param{
+ num_output: 2000
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+}
+
+layer{
+ name: "tanh2"
+ type:"kTanh"
+ srclayers:"fc2"
+}
+layer{
+ name: "fc3"
+ type: "kInnerProduct"
+ srclayers:"tanh2"
+ inner_product_param{
+ num_output: 1500
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+
+}
+
+layer{
+ name: "tanh3"
+ type:"kTanh"
+ srclayers:"fc3"
+}
+layer{
+ name: "fc4"
+ type: "kInnerProduct"
+ srclayers:"tanh3"
+ inner_product_param{
+ num_output: 1000
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+
+}
+
+layer{
+ name: "tanh4"
+ type:"kTanh"
+ srclayers:"fc4"
+}
+layer{
+ name: "fc5"
+ type: "kInnerProduct"
+ srclayers:"tanh4"
+ inner_product_param{
+ num_output: 500
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+
+}
+
+layer{
+ name: "tanh5"
+ type:"kTanh"
+ srclayers:"fc5"
+}
+layer{
+ name: "fc6"
+ type: "kInnerProduct"
+ srclayers:"tanh5"
+ inner_product_param{
+ num_output: 10
+ }
+ param{
+ name: "weight"
+ init_method: kUniform
+ low:-0.05
+ high:0.05
+ }
+ param{
+ name: "bias"
+ init_method: kUniform
+ low: -0.05
+ high:0.05
+ }
+}
+layer{
+ name: "loss"
+ type:"kSoftmaxLoss"
+ softmaxloss_param{
+ topk:1
+ }
+ srclayers:"fc6"
+ srclayers:"label"
+}
+}
[07/10] incubator-singa git commit: SINGA-7 Implement shared memory
Hogwild algorithm
Posted by wa...@apache.org.
SINGA-7 Implement shared memory Hogwild algorithm
fix bugs in param.cc
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/d5f9b9cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/d5f9b9cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/d5f9b9cd
Branch: refs/heads/master
Commit: d5f9b9cd0d1f028ead5155b2fdbd6e95c3026f33
Parents: 40a86ab
Author: wang sheng <wa...@gmail.com>
Authored: Mon Jun 15 14:19:53 2015 +0800
Committer: wang sheng <wa...@gmail.com>
Committed: Mon Jun 15 14:19:53 2015 +0800
----------------------------------------------------------------------
src/proto/cluster.pb.h | 1139 ------
src/proto/model.pb.h | 8292 -------------------------------------------
src/utils/param.cc | 12 +-
3 files changed, 5 insertions(+), 9438 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d5f9b9cd/src/proto/cluster.pb.h
----------------------------------------------------------------------
diff --git a/src/proto/cluster.pb.h b/src/proto/cluster.pb.h
deleted file mode 100644
index 82ee8b2..0000000
--- a/src/proto/cluster.pb.h
+++ /dev/null
@@ -1,1139 +0,0 @@
-// 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);
-
- // 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();
- 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);
-
- // optional bool server_update = 40 [default = true];
- inline bool has_server_update() const;
- inline void clear_server_update();
- static const int kServerUpdateFieldNumber = 40;
- inline bool server_update() const;
- inline void set_server_update(bool value);
-
- // optional bool share_memory = 41 [default = true];
- inline bool has_share_memory() const;
- inline void clear_share_memory();
- static const int kShareMemoryFieldNumber = 41;
- inline bool share_memory() const;
- inline void set_share_memory(bool 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_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();
- inline void clear_has_worker_timeout();
- inline void set_has_server_timeout();
- inline void clear_has_server_timeout();
- inline void set_has_server_update();
- inline void clear_has_server_update();
- inline void set_has_share_memory();
- inline void clear_has_share_memory();
-
- ::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_;
- ::google::protobuf::int32 nprocs_;
- ::google::protobuf::int32 start_port_;
- ::std::string* workspace_;
- ::std::string* log_dir_;
- ::std::string* zookeeper_host_;
- static ::std::string* _default_zookeeper_host_;
- ::google::protobuf::RepeatedPtrField< ::singa::ServerTopology > server_group_;
- ::google::protobuf::int32 stub_timeout_;
- bool server_worker_separate_;
- bool server_update_;
- bool share_memory_;
- ::google::protobuf::int32 worker_timeout_;
- ::google::protobuf::int32 server_timeout_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(19 + 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);
- }
-}
-
-// 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_);
- }
-}
-
-// 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] & 0x00004000u) != 0;
-}
-inline void ClusterProto::set_has_stub_timeout() {
- _has_bits_[0] |= 0x00004000u;
-}
-inline void ClusterProto::clear_has_stub_timeout() {
- _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 {
- 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] & 0x00008000u) != 0;
-}
-inline void ClusterProto::set_has_worker_timeout() {
- _has_bits_[0] |= 0x00008000u;
-}
-inline void ClusterProto::clear_has_worker_timeout() {
- _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 {
- 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] & 0x00010000u) != 0;
-}
-inline void ClusterProto::set_has_server_timeout() {
- _has_bits_[0] |= 0x00010000u;
-}
-inline void ClusterProto::clear_has_server_timeout() {
- _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 {
- return server_timeout_;
-}
-inline void ClusterProto::set_server_timeout(::google::protobuf::int32 value) {
- set_has_server_timeout();
- server_timeout_ = value;
-}
-
-// optional bool server_update = 40 [default = true];
-inline bool ClusterProto::has_server_update() const {
- return (_has_bits_[0] & 0x00020000u) != 0;
-}
-inline void ClusterProto::set_has_server_update() {
- _has_bits_[0] |= 0x00020000u;
-}
-inline void ClusterProto::clear_has_server_update() {
- _has_bits_[0] &= ~0x00020000u;
-}
-inline void ClusterProto::clear_server_update() {
- server_update_ = true;
- clear_has_server_update();
-}
-inline bool ClusterProto::server_update() const {
- return server_update_;
-}
-inline void ClusterProto::set_server_update(bool value) {
- set_has_server_update();
- server_update_ = value;
-}
-
-// optional bool share_memory = 41 [default = true];
-inline bool ClusterProto::has_share_memory() const {
- return (_has_bits_[0] & 0x00040000u) != 0;
-}
-inline void ClusterProto::set_has_share_memory() {
- _has_bits_[0] |= 0x00040000u;
-}
-inline void ClusterProto::clear_has_share_memory() {
- _has_bits_[0] &= ~0x00040000u;
-}
-inline void ClusterProto::clear_share_memory() {
- share_memory_ = true;
- clear_has_share_memory();
-}
-inline bool ClusterProto::share_memory() const {
- return share_memory_;
-}
-inline void ClusterProto::set_share_memory(bool value) {
- set_has_share_memory();
- share_memory_ = 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
[10/10] incubator-singa git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-singa
Posted by wa...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-singa
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/4df2bb5a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/4df2bb5a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/4df2bb5a
Branch: refs/heads/master
Commit: 4df2bb5a86217ca5ed9ef97e6ff2a7d410b115a4
Parents: bd87c7a 856fc1f
Author: wang sheng <wa...@gmail.com>
Authored: Mon Jun 15 14:41:52 2015 +0800
Committer: wang sheng <wa...@gmail.com>
Committed: Mon Jun 15 14:41:52 2015 +0800
----------------------------------------------------------------------
----------------------------------------------------------------------