From 8d0b9d8339c88660fc23ed3816c92a17f31efdad Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Wed, 8 Aug 2018 12:21:13 +0800 Subject: [PATCH 01/13] fix memory share from system in graph stream analysis. --- CMakeLists.txt | 2 +- framework/core/net/net.cpp | 3 +-- framework/graph/graph.cpp | 8 +++++-- framework/graph/graph_global_mem.h | 20 ++++++++-------- .../graph/llvm/optimizer/memory_scheduler.cpp | 5 ++-- .../graph/llvm/optimizer/memory_scheduler.h | 23 ++++++++++++++++++- saber/core/context.h | 8 +++++-- test/framework/net/net_exec_test.cpp | 1 - 8 files changed, 48 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1f9ba682..414aa7504 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ anakin_option(COMPILE_PTX "Returns a list of PTX files generated from src." NO i # common build options -anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." NO) +anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." YES) anakin_option(ENABLE_VERBOSE_MSG "Enable verbose=1 : compile msg during make." NO) anakin_option(DISABLE_ALL_WARNINGS "Disable all the warning msg during compile." YES) anakin_option(ENABLE_NOISY_WARNINGS "Enable noisy warning msg during compile." NO if DISABLE_ALL_WARNINGS) diff --git a/framework/core/net/net.cpp b/framework/core/net/net.cpp index c972c0c26..85bb0a3ad 100755 --- a/framework/core/net/net.cpp +++ b/framework/core/net/net.cpp @@ -660,8 +660,7 @@ template Status Net::init_env(graph::Graph& graph) { LOG(WARNING) << "Detect and initial " << graph.get_ins().size() << " lanes."; // fixme, multi_stream error - //Env::env_init(graph.get_ins().size()); - Env::env_init(1); + Env::env_init(graph.get_ins().size()); LOG(WARNING) << "Current used device id : " << TargetWrapper::get_device_id(); return Status::OK(); } diff --git a/framework/graph/graph.cpp b/framework/graph/graph.cpp index 54eb66cbd..b5cff9208 100644 --- a/framework/graph/graph.cpp +++ b/framework/graph/graph.cpp @@ -145,12 +145,16 @@ Status Graph::Optimize() EXCLUSIVE_LOCKS_REQUIRED(_mut) { //_nodes_exec_order = conv_eltwise_fusion_scheduler.get_exec_node_in_order(); #endif // optimization again + ParallScheduler para_scheduler; + para_scheduler.RegIOResource(_vgraph); + para_scheduler.Run(); + MemoryScheduler mem_scheduler; mem_scheduler.RegIOResource(_vgraph); mem_scheduler.Run(); - ParallScheduler para_scheduler; + /*ParallScheduler para_scheduler; para_scheduler.RegIOResource(_vgraph); - para_scheduler.Run(); + para_scheduler.Run();*/ // set info for graph statistics.set_info(true); diff --git a/framework/graph/graph_global_mem.h b/framework/graph/graph_global_mem.h index 5ecfe9914..8e919d3e5 100644 --- a/framework/graph/graph_global_mem.h +++ b/framework/graph/graph_global_mem.h @@ -47,7 +47,7 @@ class GraphGlobalMemBase { } /// get sum size in m-btyes - size_t get_sum_mbyte() EXCLUSIVE_LOCKS_REQUIRED(_mut) { + float get_sum_mbyte() EXCLUSIVE_LOCKS_REQUIRED(_mut) { std::unique_lock lock(this->_mut); size_t sum = 0; for (auto block_p : _int8_mem_pool) { @@ -139,7 +139,7 @@ enum INFO{ template struct Decide{ - typedef int type; + typedef float type; }; template<> @@ -164,16 +164,16 @@ struct Statistics { template struct Info_to_type {}; - inline void _set_info(int mem_in_mbytes, Info_to_type) { + inline void _set_info(float mem_in_mbytes, Info_to_type) { temp_mem_used = mem_in_mbytes; } - inline void _set_info(int mem_in_mbytes, Info_to_type) { + inline void _set_info(float mem_in_mbytes, Info_to_type) { original_temp_mem_used = mem_in_mbytes; } - inline void _set_info(int mem_in_mbytes, Info_to_type) { + inline void _set_info(float mem_in_mbytes, Info_to_type) { model_mem_used = mem_in_mbytes; } - inline void _set_info(int mem_in_mbytes, Info_to_type) { + inline void _set_info(float mem_in_mbytes, Info_to_type) { system_mem_used = mem_in_mbytes; } inline void _set_info(bool whether_optimized, Info_to_type) { @@ -198,13 +198,13 @@ struct Statistics { private: ///< temp_mem_used : temp memory used by anakin edge [MB].default 0 - int temp_mem_used{0}; + float temp_mem_used{0.f}; ///< original_temp_mem_used : temp memory used by old version [MB].default 0 - int original_temp_mem_used{0}; + float original_temp_mem_used{0.f}; ///< system_mem_used : system mem used by nvidia / amd GPU system resource [MB].default 0 - int system_mem_used{0}; + float system_mem_used{0.f}; ///< model_mem_used : mem used by model.default 0 - int model_mem_used{0}; + float model_mem_used{0.f}; ///< is_optimized stand for whether optimized flag.default false bool is_optimized{false}; diff --git a/framework/graph/llvm/optimizer/memory_scheduler.cpp b/framework/graph/llvm/optimizer/memory_scheduler.cpp index c836b44c7..2135f5c49 100644 --- a/framework/graph/llvm/optimizer/memory_scheduler.cpp +++ b/framework/graph/llvm/optimizer/memory_scheduler.cpp @@ -123,8 +123,8 @@ void IOBlockResource::free(std::vector& io_vec, VGraph* vgraph_p) { void IOBlockResource::lock(std::vector& io_vec) { for (auto& io_res : io_vec) { - if (has_free()) { - auto& tmp_io = _free.front(); // get active resouce + if (has_free(io_res)) { + auto tmp_io = get_free(io_res);//_free.front(); // get active resouce io_res.shared = true; if (tmp_io.shared) { @@ -134,7 +134,6 @@ void IOBlockResource::lock(std::vector& io_vec) { } _lock.push_back(io_res); - _free.pop_front(); } else { // alloc new io block io_res.shared = false; _lock.push_back(io_res); diff --git a/framework/graph/llvm/optimizer/memory_scheduler.h b/framework/graph/llvm/optimizer/memory_scheduler.h index e4a0e7592..6c71351dd 100644 --- a/framework/graph/llvm/optimizer/memory_scheduler.h +++ b/framework/graph/llvm/optimizer/memory_scheduler.h @@ -83,7 +83,28 @@ class IOBlockResource { ~IOBlockResource() {} void free(std::vector&, VGraph*); - inline bool has_free() { return !(_free.empty()); } + inline bool has_free(io& target) { + for (auto it = _free.begin(); it != _free.end();) { + auto& io_tmp = *it; + if(target.lane == io_tmp.lane) { + return true; + } + ++it; + } + return false; + } + inline io get_free(io& target) { + for (auto it = _free.begin(); it != _free.end();) { + auto& io_tmp = *it; + if(target.lane == io_tmp.lane) { + it = _free.erase(it); + return io_tmp; + } else { + ++it; + } + } + return io(); + } bool is_same_target(io&, io&, VGraph*); void push_free(io&, VGraph*); void lock(std::vector&); diff --git a/saber/core/context.h b/saber/core/context.h index b8a916578..0a16c3bcc 100644 --- a/saber/core/context.h +++ b/saber/core/context.h @@ -43,14 +43,18 @@ class Context final{ _device_id = device_id; } if (data_stream_id >= devs[_device_id]._max_stream) { - LOG(WARNING) << "data stream index exceeds the maximum stream number, set to default stream(0)!"; + LOG(WARNING) << "data stream index("<< data_stream_id + << ") exceeds the maximum stream number("<< devs[_device_id]._max_stream + << "), set to default stream(0)!"; data_stream_id = 0; } _stream_data = devs[_device_id]._data_stream[data_stream_id]; _data_stream_id = data_stream_id; if (compute_stream_id >= devs[_device_id]._max_stream) { - LOG(WARNING) << "compute stream index exceeds the maximum stream number, set to default stream(0)!"; + LOG(WARNING) << "compute stream index(" << compute_stream_id + << ") exceeds the maximum stream number("<< devs[_device_id]._max_stream + << "), set to default stream(0)!"; compute_stream_id = 0; } _stream_compute = devs[_device_id]._compute_stream[compute_stream_id]; diff --git a/test/framework/net/net_exec_test.cpp b/test/framework/net/net_exec_test.cpp index 81d1616fb..d43709486 100644 --- a/test/framework/net/net_exec_test.cpp +++ b/test/framework/net/net_exec_test.cpp @@ -265,7 +265,6 @@ TEST(NetTest, net_execute_reconstruction_test) { int main(int argc, const char** argv){ - Env::env_init(); // initial logger logger::init(argv[0]); InitTest(); From 62cc605d085da78a5683c7c7ec92c713087c0e66 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Wed, 8 Aug 2018 12:24:49 +0800 Subject: [PATCH 02/13] change build model. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 414aa7504..e1f9ba682 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ anakin_option(COMPILE_PTX "Returns a list of PTX files generated from src." NO i # common build options -anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." YES) +anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." NO) anakin_option(ENABLE_VERBOSE_MSG "Enable verbose=1 : compile msg during make." NO) anakin_option(DISABLE_ALL_WARNINGS "Disable all the warning msg during compile." YES) anakin_option(ENABLE_NOISY_WARNINGS "Enable noisy warning msg during compile." NO if DISABLE_ALL_WARNINGS) From 08b1719907448ea0c283481be88a52d2b84e5e50 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Wed, 8 Aug 2018 12:47:21 +0800 Subject: [PATCH 03/13] update graph.cpp --- framework/graph/graph.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/framework/graph/graph.cpp b/framework/graph/graph.cpp index b5cff9208..87b7bc564 100644 --- a/framework/graph/graph.cpp +++ b/framework/graph/graph.cpp @@ -138,14 +138,14 @@ Status Graph::Optimize() EXCLUSIVE_LOCKS_REQUIRED(_mut) { _nodes_exec_order = scheduler.get_exec_node_in_order(); #else // enable conv+eltwise fusion // optimization - ConvElsFusionScheduler conv_eltwise_fusion_scheduler; - conv_eltwise_fusion_scheduler.RegIOResource(_vgraph); - conv_eltwise_fusion_scheduler.Run(); - // get node exec in order - //_nodes_exec_order = conv_eltwise_fusion_scheduler.get_exec_node_in_order(); + ConvElsFusionScheduler conv_eltwise_fusion_scheduler; + conv_eltwise_fusion_scheduler.RegIOResource(_vgraph); + conv_eltwise_fusion_scheduler.Run(); + // get node exec in order + //_nodes_exec_order = conv_eltwise_fusion_scheduler.get_exec_node_in_order(); #endif - // optimization again - ParallScheduler para_scheduler; + // optimization again + ParallScheduler para_scheduler; para_scheduler.RegIOResource(_vgraph); para_scheduler.Run(); From 3a06d2312d89602c1ecf0700007281f47bd6adff Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Wed, 8 Aug 2018 12:48:19 +0800 Subject: [PATCH 04/13] Update graph.cpp --- framework/graph/graph.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/graph/graph.cpp b/framework/graph/graph.cpp index 87b7bc564..2b28be0f9 100644 --- a/framework/graph/graph.cpp +++ b/framework/graph/graph.cpp @@ -144,8 +144,8 @@ Status Graph::Optimize() EXCLUSIVE_LOCKS_REQUIRED(_mut) { // get node exec in order //_nodes_exec_order = conv_eltwise_fusion_scheduler.get_exec_node_in_order(); #endif - // optimization again - ParallScheduler para_scheduler; + // optimization again + ParallScheduler para_scheduler; para_scheduler.RegIOResource(_vgraph); para_scheduler.Run(); From ee248e6dd8dcd28a2a7850d3c92906f84eb797d4 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Wed, 8 Aug 2018 12:51:12 +0800 Subject: [PATCH 05/13] Update memory_scheduler.h --- .../graph/llvm/optimizer/memory_scheduler.h | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/framework/graph/llvm/optimizer/memory_scheduler.h b/framework/graph/llvm/optimizer/memory_scheduler.h index 6c71351dd..3325ed066 100644 --- a/framework/graph/llvm/optimizer/memory_scheduler.h +++ b/framework/graph/llvm/optimizer/memory_scheduler.h @@ -84,27 +84,27 @@ class IOBlockResource { void free(std::vector&, VGraph*); inline bool has_free(io& target) { - for (auto it = _free.begin(); it != _free.end();) { - auto& io_tmp = *it; - if(target.lane == io_tmp.lane) { - return true; - } - ++it; - } - return false; - } - inline io get_free(io& target) { - for (auto it = _free.begin(); it != _free.end();) { - auto& io_tmp = *it; - if(target.lane == io_tmp.lane) { - it = _free.erase(it); - return io_tmp; - } else { - ++it; - } - } - return io(); - } + for (auto it = _free.begin(); it != _free.end();) { + auto& io_tmp = *it; + if(target.lane == io_tmp.lane) { + return true; + } + ++it; + } + return false; + } + inline io get_free(io& target) { + for (auto it = _free.begin(); it != _free.end();) { + auto& io_tmp = *it; + if(target.lane == io_tmp.lane) { + it = _free.erase(it); + return io_tmp; + } else { + ++it; + } + } + return io(); + } bool is_same_target(io&, io&, VGraph*); void push_free(io&, VGraph*); void lock(std::vector&); From 398e0cbbf39f0bd074c5a0ecc494a974eeb48032 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Thu, 9 Aug 2018 13:10:15 +0800 Subject: [PATCH 06/13] Resolve synchornization bugs in prediction and mutl-stream --- cmake/compiler_options.cmake | 1 + framework/core/net/net.cpp | 118 +++++++++++++-------------- saber/core/impl/cuda/cuda_impl.cpp | 4 + test/framework/net/net_exec_test.cpp | 40 +++++++-- 4 files changed, 95 insertions(+), 68 deletions(-) diff --git a/cmake/compiler_options.cmake b/cmake/compiler_options.cmake index ef5e953c4..7655167fb 100644 --- a/cmake/compiler_options.cmake +++ b/cmake/compiler_options.cmake @@ -109,6 +109,7 @@ if(USE_CUDA) anakin_add_compile_option(-G NVCC) anakin_add_compile_option(-g NVCC) anakin_add_compile_option(-std=c++11 NVCC) + anakin_add_compile_option(--default-stream per-thread NVCC) anakin_add_compile_option(-Wno-deprecated-gpu-targets NVCC) # suppress warning by architectures are deprecated (2.0,2.1) else() anakin_add_compile_option("-Xcompiler -fPIC" NVCC) diff --git a/framework/core/net/net.cpp b/framework/core/net/net.cpp index 85bb0a3ad..25bdfd009 100755 --- a/framework/core/net/net.cpp +++ b/framework/core/net/net.cpp @@ -73,9 +73,9 @@ void Net::init(graph::Graph& for (auto& node_name : node_names_in_exec_order) { auto node_ptr = (*_graph_p)[node_name]; //LOG(ERROR) << "get node " << node_name << ", op type " << node_ptr->get_op_name(); - if (node_ptr->get_op_name() == "Output") { + /*if (node_ptr->get_op_name() == "Output") { continue; - } + }*/ // create operations auto* op_pointer = OpFactory::Global()[node_ptr->get_op_name()]; @@ -146,9 +146,9 @@ void Net::init(graph::Graph& for (auto& node_name : node_names_in_exec_order) { auto node_ptr = (*_graph_p)[node_name]; //LOG(ERROR) << "get node " << node_name << ", op type " << node_ptr->get_op_name(); - if (node_ptr->get_op_name() == "Output") { + /*if (node_ptr->get_op_name() == "Output") { continue; - } + }*/ #ifdef ENABLE_OP_TIMER if (std::string::npos != (node_ptr->get_op_name()).find("Conv") || std::string::npos != (node_ptr->get_op_name()).find("Deconv")) { @@ -203,10 +203,10 @@ void Net::init(graph::Graph& int dil_h = dilation_rate_val.vector()[0]; int dil_w = dilation_rate_val.vector()[1]; - if ((group_val == 1) && (k_w == 3 && k_h == 3 && dil_h == 1 && dil_w == 1)) { - node_ptr->set_op(OpFactory::Global()["Sass"+node_ptr->get_op_name()]); - node_ptr->get_op_name() = "Sass" + node_ptr->get_op_name(); - } else { + if ((group_val == 1) && (k_w == 3 && k_h == 3 && dil_h == 1 && dil_w == 1)) { + node_ptr->set_op(OpFactory::Global()["Sass"+node_ptr->get_op_name()]); + node_ptr->get_op_name() = "Sass" + node_ptr->get_op_name(); + } else { LOG(ERROR) << "node_ptr->get_op_name() sass not support yet."; auto *op_pointer = OpFactory::Global()[node_ptr->get_op_name()]; node_ptr->set_op(op_pointer); @@ -215,8 +215,7 @@ void Net::init(graph::Graph& auto *op_pointer = OpFactory::Global()[node_ptr->get_op_name()]; node_ptr->set_op(op_pointer); } - } - else { + } else { auto *op_pointer = OpFactory::Global()[node_ptr->get_op_name()]; if (op_pointer == nullptr) { CHECK(false)<< node_name << ", type " << node_ptr->get_op_name() << " is null"; @@ -337,72 +336,68 @@ void Net::prediction() { int i = 0; for(auto& executer : _exec_funcs) { - if (RunType == OpRunType::SYNC || executer.need_sync) { + if (RunType == OpRunType::SYNC || executer.need_sync || executer.op_name == "Output") { for(int i = 0; i < executer.ins.size(); i++) { - // sync event record in multi_stream + // sync event record in multi_stream or syn when encountering output op executer.ins[i]->sync(); } } #ifdef ENABLE_DEBUG LOG(ERROR) << " executer : " << executer.name << " (" << executer.op_name << ") "; - for(auto in : executer.ins) { - LOG(ERROR) << " \\in shape " << in->valid_shape()[0] - << " " << in->valid_shape()[1] - << " " << in->valid_shape()[2] - << " " << in->valid_shape()[3] - << " valid_size: " << in->valid_size() - << " realsize: " << in->size() - << " offset_size "<get_seq_offset().size(); + for(auto in : executer.ins) { + LOG(ERROR) << " \\in shape " << in->valid_shape()[0] + << " " << in->valid_shape()[1] + << " " << in->valid_shape()[2] + << " " << in->valid_shape()[3] + << " valid_size: " << in->valid_size() + << " realsize: " << in->size() + << " offset_size "<get_seq_offset().size(); } #endif #ifdef ENABLE_OP_TIMER - Context ctx(0, 0, 0); - saber::SaberTimer my_time; - my_time.start(ctx); + Context ctx(0, 0, 0); + saber::SaberTimer my_time; + my_time.start(ctx); #endif - if (executer.op_name != "Input") { - executer.infer_shape(); - executer.launch(); - } - - for(int i = 0; i < executer.outs.size(); i++) { - executer.outs[i]->record_event(executer.ctx_p->get_compute_stream()); - } -#ifdef ENABLE_OP_TIMER - for (int i = 0; i < executer.outs.size(); i++) { - // record - executer.outs[i]->record_event(executer.ctx_p->get_compute_stream()); - executer.outs[i]->sync(); - } - my_time.end(ctx); - _op_time[op_id++] += my_time.get_average_ms(); + if (executer.op_name != "Input" || executer.op_name != "Output") { + executer.infer_shape(); + executer.launch(); + } + + for(int i = 0; i < executer.outs.size(); i++) { + executer.outs[i]->record_event(executer.ctx_p->get_compute_stream()); + } + +#ifdef ENABLE_OP_TIMER + for (int i = 0; i < executer.outs.size(); i++) { + // record + executer.outs[i]->record_event(executer.ctx_p->get_compute_stream()); + executer.outs[i]->sync(); + } + my_time.end(ctx); + _op_time[op_id++] += my_time.get_average_ms(); #endif - //LOG(INFO)<< "op: " << executer.name<<"(" << executer.op_name <<") === infer+launch time "< offset=out->get_seq_offset(); - LOG(INFO)<<"print offset of "< offset=out->get_seq_offset(); + LOG(INFO)<<"print offset of "<data(); + LOG(ERROR) << " |---out avg " << tensor_average(out); } - LOG(INFO)<<" end print offset of "<data(); -#ifdef USE_X86_PLACE -// for (int i = 0; i < 10; ++i) { -// std::cout << out->data()[i]<<" "; -// } -#endif - LOG(ERROR) << " |---out avg " << tensor_average(out); - } #ifdef USE_ARM_PLACE int idx = 0; @@ -421,7 +416,6 @@ void Net::prediction() { sum += *ptr_data; ptr_data++; } - //LOG(INFO) << "channel: " << j << ", mean value :" << sum_c / (w * h); } LOG(INFO) << executer.name << ", tensor idx: " << idx << ", mean value :" << sum / size << ", num: " << out->num() << \ diff --git a/saber/core/impl/cuda/cuda_impl.cpp b/saber/core/impl/cuda/cuda_impl.cpp index 063cda12c..f01a0e308 100644 --- a/saber/core/impl/cuda/cuda_impl.cpp +++ b/saber/core/impl/cuda/cuda_impl.cpp @@ -123,6 +123,7 @@ void NVH_API::sync_stream(event_t& event, stream_t& stream) {} void NVH_API::sync_memcpy(void* dst, int dst_id, const void* src, int src_id, \ size_t count, __HtoH) { CUDA_CHECK(cudaMemcpy(dst, src, count, cudaMemcpyHostToHost)); + CUDA_CHECK(cudaStreamSynchronize(0)); //LOG(INFO) << "NVH, sync, H2H, size: " << count; } @@ -223,6 +224,7 @@ void NV_API::sync_memcpy(void* dst, int dst_id, const void* src, int src_id, \ size_t count, __DtoD) { if(dst_id == src_id){ CUDA_CHECK(cudaMemcpy(dst, src, count, cudaMemcpyDeviceToDevice)); + CUDA_CHECK(cudaStreamSynchronize(0)); //LOG(INFO) << "cuda, sync, D2D, size: " << count; } else{ CUDA_CHECK(cudaMemcpyPeer(dst, dst_id, src, src_id, count)); @@ -247,6 +249,7 @@ void NV_API::async_memcpy(void* dst, int dst_id, const void* src, int src_id, \ void NV_API::sync_memcpy(void* dst, int dst_id, const void* src, int src_id, \ size_t count, __HtoD) { CUDA_CHECK(cudaMemcpy(dst, src, count, cudaMemcpyHostToDevice)); + CUDA_CHECK(cudaStreamSynchronize(0)); //LOG(INFO) << "cuda, sync, H2D, size: " << count; } @@ -260,6 +263,7 @@ void NV_API::async_memcpy(void* dst, int dst_id, const void* src, int src_id, \ void NV_API::sync_memcpy(void* dst, int dst_id, const void* src, int src_id, \ size_t count, __DtoH) { CUDA_CHECK(cudaMemcpy(dst, src, count, cudaMemcpyDeviceToHost)); + CUDA_CHECK(cudaStreamSynchronize(0)); //LOG(INFO) << "cuda, sync, D2H, size: " << count; } diff --git a/test/framework/net/net_exec_test.cpp b/test/framework/net/net_exec_test.cpp index d43709486..6e628c9cc 100644 --- a/test/framework/net/net_exec_test.cpp +++ b/test/framework/net/net_exec_test.cpp @@ -17,8 +17,9 @@ using Target_H = ARM; //#define USE_DIEPSE // vgg16 -//std::string model_path = "../benchmark/CNN/models/vgg16.anakin.bin"; -std::string model_path = "/home/public/model_from_fluid/beta/demoprogram.anakin2.bin"; +// std::string model_path = "../benchmark/CNN/models/vgg16.anakin.bin"; +// std::string model_path = "/home/public/model_from_fluid/beta/demoprogram.anakin2.bin"; +std::string model_path = "/home/cuichaowen/anakin2/public_model/public-caffe-model/mobilenetv12/mobilenet_v2.anakin.bin"; #ifdef USE_CUDA #if 1 @@ -54,7 +55,7 @@ TEST(NetTest, net_execute_base_test) { #endif // get in - auto d_tensor_in_p = net_executer.get_in("input_0"); + /*auto d_tensor_in_p = net_executer.get_in("input_0"); Tensor4d h_tensor_in; auto valid_shape_in = d_tensor_in_p->valid_shape(); @@ -69,7 +70,7 @@ TEST(NetTest, net_execute_base_test) { h_data[i] = 1.0f; } - d_tensor_in_p->copy_from(h_tensor_in); + d_tensor_in_p->copy_from(h_tensor_in);*/ #ifdef USE_DIEPSE // for diepse model @@ -106,7 +107,7 @@ TEST(NetTest, net_execute_base_test) { d_tensor_in_2_p->copy_from(h_tensor_in_2); #endif - int epoch = 1; + int epoch = 10; // do inference Context ctx(0, 0, 0); saber::SaberTimer my_time; @@ -122,7 +123,31 @@ TEST(NetTest, net_execute_base_test) { //auto start = std::chrono::system_clock::now(); for(int i=0; i h_tensor_in; + + auto valid_shape_in = d_tensor_in_p->valid_shape(); + for (int i=0; icopy_from(h_tensor_in); + + //cudaStreamSynchronize(0); + //cudaDeviceSynchronize(); net_executer.prediction(); + //cudaDeviceSynchronize(); + + auto tensor_out_0_p = net_executer.get_out("prob_out"); + test_print(tensor_out_0_p); } /* // running part of model net_executer.execute_stop_at_node("relu2_2/expand"); @@ -182,11 +207,14 @@ TEST(NetTest, net_execute_base_test) { //auto tensor_out_0_p = net_executer.get_out("detection_output_0.tmp_0_out"); + // mobilenet-v2 + //auto tensor_out_0_p = net_executer.get_out("prob_out"); + + // get out result //LOG(WARNING)<< "result avg: " << tensor_average(tensor_out_0_p); //test_print(tensor_out_0_p); - // save the optimized model to disk. std::string save_model_path = model_path + std::string(".saved"); status = graph->save(save_model_path); From 6ab4ea2aaadbefe76110b38c099349f65c1c5907 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Mon, 13 Aug 2018 11:18:12 +0800 Subject: [PATCH 07/13] add preliminary structure for RPC service --- CMakeLists.txt | 11 ++-- cmake/find_modules.cmake | 13 ++++ cmake/utils.cmake | 70 ++++++++++++---------- framework/service/CMakeLists.txt | 13 ++++ framework/service/anakin_service.cpp | 46 +++++++++++++++ framework/service/anakin_service.h | 73 +++++++++++++++++++++++ framework/service/api/service.proto | 51 ++++++++++++++++ framework/service/monitor.cpp | 10 ++++ framework/service/monitor.h | 76 ++++++++++++++++++++++++ framework/service/service_daemon.cpp | 88 ++++++++++++++++++++++++++++ framework/service/service_daemon.h | 61 +++++++++++++++++++ 11 files changed, 476 insertions(+), 36 deletions(-) create mode 100644 framework/service/CMakeLists.txt create mode 100644 framework/service/anakin_service.cpp create mode 100644 framework/service/anakin_service.h create mode 100644 framework/service/api/service.proto create mode 100644 framework/service/monitor.cpp create mode 100644 framework/service/monitor.h create mode 100644 framework/service/service_daemon.cpp create mode 100644 framework/service/service_daemon.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e1f9ba682..ba4be3280 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,9 @@ set(ANAKIN_FRAMEWORK ${ANAKIN_ROOT}/framework) set(ANAKIN_LITE_FRAMEWORK ${ANAKIN_FRAMEWORK}/lite) set(ANAKIN_UTILS ${ANAKIN_ROOT}/utils) set(ANAKIN_THIRD_PARTY_PATH ${ANAKIN_ROOT}/third-party) +set(ANAKIN_TEMP_THIRD_PARTY_PATH ${CMAKE_BINARY_DIR}/third-party) set(ANAKIN_MODEL_PARSER ${ANAKIN_FRAMEWORK}/model_parser) +set(ANAKIN_SERVICE ${ANAKIN_FRAMEWORK}/service) set(ANAKIN_SABER ${ANAKIN_ROOT}/saber) set(ANAKIN_LITE_SABER ${ANAKIN_SABER}/lite) set(ANAKIN_UNIT_TEST ${ANAKIN_ROOT}/test) @@ -116,6 +118,8 @@ anakin_option(BUILD_WITH_UNIT_TEST "Build anakin unit test components." YES) anakin_option(BUILD_LITE "Build anakin lite components." NO) +anakin_option(BUILD_RPC "Build anakin rpc service components." YES) + # build examples anakin_option(BUILD_EXAMPLES "build detection and classification examples" NO) @@ -164,7 +168,6 @@ if(USE_CUDA) endif() if(USE_X86_PLACE) - set(ANAKIN_TEMP_THIRD_PARTY_PATH ${CMAKE_BINARY_DIR}/third-party) if(USE_MKLML) include(cmake/external/mklml.cmake) endif() @@ -185,6 +188,9 @@ include(cmake/gather.cmake) # fetch files of model_parser add_subdirectory(${ANAKIN_MODEL_PARSER}) add_subdirectory(${ANAKIN_SABER}) +if(BUILD_RPC) + add_subdirectory(${ANAKIN_SERVICE}) +endif() add_subdirectory(${ANAKIN_FRAMEWORK}) if(BUILD_WITH_UNIT_TEST) @@ -201,6 +207,3 @@ endif() anakin_print_statistic() - -#set(executable_output_path ${PROJECT_BINARY_DIR}/unit_test) - diff --git a/cmake/find_modules.cmake b/cmake/find_modules.cmake index 5fc394da4..24fe08914 100644 --- a/cmake/find_modules.cmake +++ b/cmake/find_modules.cmake @@ -310,6 +310,19 @@ macro(anakin_find_protobuf) endif() endmacro() +macro(anakin_find_baidu_rpc) + set(BAIDU_RPC_ROOT "/usr" CATCH "baidu rpc root dir") + find_path(RPC_INCLUDE_DIR server.h PATHS ${BAIDU_RPC_ROOT}/include/brpc/ $ENV{BAIDU_RPC_ROOT}/include/brpc/) + find_library(RPC_LIBRARY NAMES libbrpc.so + PATHS ${BAIDU_RPC_ROOT}/lib $ENV{BAIDU_RPC_ROOT}/include/brpc/ + DOC "library path for baidu rpc.") + if(RPC_INCLUDE_DIR AND RPC_LIBRARY) + include_directories(${BAIDU_RPC_ROOT}/include) + list(APPEND ANAKIN_LINKER_LIBS ${RPC_LIBRARY}) + else() + message(SEND_ERROR "Could not found baidu-rpc !") + endif() +endmacro() macro(anakin_find_openmp) find_package(OpenMP REQUIRED) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 1c281840f..74fe3704c 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -239,31 +239,26 @@ endfunction() # ---------------------------------------------------------------------------- # section: generate the protobuf .h and .cpp files. # ---------------------------------------------------------------------------- -function(anakin_protos_processing) - set(PROTO_SRC_PATH ${ANAKIN_MODEL_PARSER}/proto) - set(__working_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PROTO_TEMP/) - - anakin_fetch_files_with_suffix(${PROTO_SRC_PATH} "proto" PROTO_SRC_FILES) - foreach(__file ${PROTO_SRC_FILES}) - exec_program(protoc ${__working_dir} ARGS " -I=${PROTO_SRC_PATH} --cpp_out=. ${__file}" - OUTPUT_VARIABLE OUTPUT - RETURN_VALUE VALUE) - if(NOT VALUE) - anakin_fetch_files_with_suffix(${__working_dir} "h" PROTO_GENERATE_H) - # get *.cpp or *.cc - anakin_fetch_files_with_suffix(${__working_dir} "c*" PROTO_GENERATE_C) - foreach(__include_file ${PROTO_GENERATE_H}) - exec_program(mv ARGS ${__include_file} ${PROTO_SRC_PATH} - OUTPUT_VARIABLE __out - RETURN_VALUE __value) - endforeach() - foreach(__src_file ${PROTO_GENERATE_C}) - if(POLICY CMP0007) - cmake_policy(PUSH) - cmake_policy(SET CMP0007 NEW) - endif() - string(REPLACE "." ";" SRC_LIST ${__src_file}) - list(GET SRC_LIST -1 __src_file_name_suffix) +function(anakin_gen_pb proto_src_path) + set(__working_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PROTO_TEMP/) + foreach(__proto_file ${ARGN}) + exec_program(protoc ${__working_dir} ARGS " -I=${proto_src_path} --cpp_out=. ${__proto_file}" + OUTPUT_VARIABLE OUTPUT RETURN_VALUE VALUE) + if(NOT VALUE) + anakin_fetch_files_with_suffix(${__working_dir} "h" PROTO_GENERATE_H) + # get *.cpp or *.cc + anakin_fetch_files_with_suffix(${__working_dir} "c*" PROTO_GENERATE_C) + foreach(__include_file ${PROTO_GENERATE_H}) + exec_program(mv ARGS ${__include_file} ${proto_src_path} + OUTPUT_VARIABLE __out RETURN_VALUE __value) + endforeach() + foreach(__src_file ${PROTO_GENERATE_C}) + if(POLICY CMP0007) + cmake_policy(PUSH) + cmake_policy(SET CMP0007 NEW) + endif() + string(REPLACE "." ";" SRC_LIST ${__src_file}) + list(GET SRC_LIST -1 __src_file_name_suffix) list(GET SRC_LIST -3 __src_file_name) string(REPLACE "/" ";" SRC_LIST_PATH ${__src_file_name}) @@ -274,18 +269,29 @@ function(anakin_protos_processing) else() set(__full_src_filename "${__pure_src_file_name}.pb.cc") endif() - #message(STATUS " first ---> ${__working_dir}${__full_src_filename} ${ANAKIN_ROOT}/src/${__pure_src_file_name}.pb.cpp") - exec_program(mv ARGS " ${__working_dir}${__full_src_filename} ${PROTO_SRC_PATH}/${__pure_src_file_name}.pb.cpp" + exec_program(mv ARGS " ${__working_dir}${__full_src_filename} ${proto_src_path}/${__pure_src_file_name}.pb.cpp" OUTPUT_VARIABLE __out RETURN_VALUE __value) if(POLICY CMP0007) cmake_policy(POP) endif() - endforeach() - else() - message(FATAL_ERROR "anakin_protos_processing : ${__file} \n error msg: ${OUTPUT}") - endif() - endforeach() + endforeach() + else() + message(FATAL_ERROR "anakin_protos_processing : ${__file} \n error msg: ${OUTPUT}") + endif() + endforeach() +endfunction() + +function(anakin_protos_processing) + set(PROTO_SRC_PATH ${ANAKIN_MODEL_PARSER}/proto) + set(SERVICE_API_SRC_PATH ${ANAKIN_SERVICE}/api) + + set(__working_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PROTO_TEMP/) + + anakin_fetch_files_with_suffix(${PROTO_SRC_PATH} "proto" PROTO_SRC_FILES) + anakin_fetch_files_with_suffix(${SERVICE_API_SRC_PATH} "proto" SERVICE_API_PROTO_SRC_FILES) + anakin_gen_pb(${PROTO_SRC_PATH} ${PROTO_SRC_FILES}) + anakin_gen_pb(${SERVICE_API_SRC_PATH} ${SERVICE_API_PROTO_SRC_FILES}) endfunction() # ---------------------------------------------------------------------------- diff --git a/framework/service/CMakeLists.txt b/framework/service/CMakeLists.txt new file mode 100644 index 000000000..510b1367c --- /dev/null +++ b/framework/service/CMakeLists.txt @@ -0,0 +1,13 @@ +# ---------------------------------------------------------------------------- +# Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved +# ---------------------------------------------------------------------------- + +# used for temporary +anakin_fetch_include_recursively(${ANAKIN_SERVICE}) + +anakin_fetch_files_with_suffix(${ANAKIN_SERVICE}/api "cpp" ANAKIN_BASE_SRC) +anakin_fetch_files_with_suffix(${ANAKIN_SERVICE} "cpp" ANAKIN_BASE_SRC) + +list(APPEND ANAKIN_SRC ${ANAKIN_BASE_SRC}) +set(ANAKIN_SRC ${ANAKIN_SRC} PARENT_SCOPE) +unset(ANAKIN_BASE_SRC) diff --git a/framework/service/anakin_service.cpp b/framework/service/anakin_service.cpp new file mode 100644 index 000000000..93073a5e3 --- /dev/null +++ b/framework/service/anakin_service.cpp @@ -0,0 +1,46 @@ +#include "framework/service/anakin_service.h" + +namespace anakin { + +namespace rpc { + +template +void AnakinService::set_device_id(int dev_id) { } + +template +void AnakinService::initial(std::string model_name, + std::string model_path, + int thread_num) { + _worker_map[model_name] = std::make_shared(model_path, thread_num); +} + +template +void AnakinService::register_inputs(std::string model_name, + std::vector& in_names) { + _worker_map[model_name].register_inputs(in_names); +} + +template +void AnakinService::register_outputs(std::string model_name, + std::vector& out_names) { + _worker_map[model_name].register_outputs(out_names); +} + +template +void AnakinService::Reshape(std::string model_name, + std::string in_name, + std::vector in_shape) { + _worker_map[model_name].Reshape(in_name, in_shape); +} + +template +void AnakinService::register_interior_edges(std::string model_name, + std::string edge_start, + std::string edge_end) { + _worker_map[model_name].register_interior_edges(edge_start, edge_end); +} + +} /* namespace rpc */ + +} /* namespace anakin */ + diff --git a/framework/service/anakin_service.h b/framework/service/anakin_service.h new file mode 100644 index 000000000..9001ddf3a --- /dev/null +++ b/framework/service/anakin_service.h @@ -0,0 +1,73 @@ +/* Copyright (c) 2018 Anakin Authors, Inc. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef ANAKIN_SERVICE_H +#define ANAKIN_SERVICE_H + +#include "framework/core/net/worker.h" +#include "framework/core/net/worker.h" +#include "framework/service/api/service.pb.h" + +namespace anakin { + +namespace rpc { + +template +class AnakinService public: RPCService { +public: + void evaluate(::google::protobuf::RpcController* controller_base, + const RPCRequest* request, + RPCResponse* response, + ::google::protobuf::Closure* done) { + _evaluate(controller_base, request, response, done, EnumToType()); + } + +public: + inline void set_device_id(int dev_id); + + inline void initial(std::string model_name, std::string model_path, int thread_num); + + inline void Reshape(std::string model_name, std::string in_name, std::vector in_shape); + + inline void register_inputs(std::string model_name, std::vector in_names); + + inline void register_outputs(std::string model_name, std::vector); + + inline void register_interior_edges(std::string model_name, std::string edge_start, std::string edge_end); + + template + void register_aux_function(std::string model_name, functor function, ParamTypes ...args) { + _worker_map[model_name].register_aux_function(function, std::forward(args)...); + } + +private: + inline void _evaluate(::google::protobuf::RpcController* controller_base, + const RPCRequest* request, + RPCResponse* response, + ::google::protobuf::Closure* done) { + // make sure that done will be invoked + brpc::ClosureGuard done_guard(done); + brpc::Controller* cntl = static_cast(controller_base); + } + +private: + std::unordered_map > > _worker_map; +}; + +} /* namespace rpc */ + +} /* namespace anakin */ + +#endif diff --git a/framework/service/api/service.proto b/framework/service/api/service.proto new file mode 100644 index 000000000..2a15156b1 --- /dev/null +++ b/framework/service/api/service.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; + +message Date { + optional bytes name = 1; + repeated int32 shape; + repeated float data; +}; + +message IO { + required bytes input_name = 1; // input name + required Date input_tensor = 2; // input tensor +}; + +// RPC request +message RPCRequest { + required bytes model = 1; + repeated IO inputs = 2; + optional int64 request_id = 3; // you need to set request ID,then to get async retults by request_id +}; + +message DeviceStatus { + required int32 id = 1; // device id (represent as device num id) + required bytes name = 2; // device name + required int32 temp = 3; // device temperature Celsius degree + required int32 mem_free = 4; // device memory free bytes + required int32 mem_used = 5; // device memory used bytes + // the number of device current compute running processes + optional int32 compute_run_process_num = 6; +}; + +// RPC service execution information +message ExecutionInfo { + // additional exception message of the execution + required bytes message = 1; + // duration of this execution in nano seconds + required int32 duration_in_nano_seconds = 2; + // device status + DeviceStatus device_status = 3; +}; + +// RPC response +message RPCResponse { + required bytes model = 1; // model name + repeated IO outputs = 2; // evaluation output of a batch + optional ExecutionInfo info = 3; // the additional information of this execution + optional int64 request_id = 4; +}; + +service RPCService { + rpc evaluate (RPCRequest) returns (RPCResponse); +}; diff --git a/framework/service/monitor.cpp b/framework/service/monitor.cpp new file mode 100644 index 000000000..c059c85e6 --- /dev/null +++ b/framework/service/monitor.cpp @@ -0,0 +1,10 @@ +#include "framework/service/monitor.h" + +namespace anakin { + +namespace rpc { + +} /* namespace rpc */ + +} /* namespace anakin */ + diff --git a/framework/service/monitor.h b/framework/service/monitor.h new file mode 100644 index 000000000..1c05bc8dc --- /dev/null +++ b/framework/service/monitor.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2018 Anakin Authors, Inc. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef ANAKIN_MONITOR_H +#define ANAKIN_MONITOR_H + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include // cuda driver types + +namespace anakin { + +namespace rpc { + +/*struct DevInfo{ + DevInfo() {} + // all of those funcs must be thread safety + void fill_id(int id) { + std::unique_lock lock(this->mut); + dev_id = id; + } + void set_temp(int); + void set_g_mem_free(size_t); + void set_g_mem_used(size_t); + void set_name(const char*); + void set_compute_run_proc_num(int); + + // + int get_id() { return dev_id; } + int get_temp() { return temp; } + size_t get_g_mem_free() { return g_mem_free; } + size_t get_g_mem_used() { return g_mem_used; } + std::string get_name() { return dev_name; } + int get_compute_run_proc() { return compute_run_proc_num; } + +private: + // resource infomation + int dev_id{-1}; // device id current reside + int temp{-1}; // device temperature + size_t g_mem_free{-1}; // global memory free (bytes) + size_t g_mem_used{-1}; // global memory used (bytes) + int compute_run_proc_num{0}; // compute running process num on device + std::string dev_name; // device name + std::mutex mut; +}; + + +class Monitor { +}; */ + +} /* namespace rpc */ + +} /* namespace anakin */ + +#endif diff --git a/framework/service/service_daemon.cpp b/framework/service/service_daemon.cpp new file mode 100644 index 000000000..5003f4400 --- /dev/null +++ b/framework/service/service_daemon.cpp @@ -0,0 +1,88 @@ +#include "framework/service/service_daemon.h" + +namespace anakin { + +namespace rpc { + +void ServiceDaemon::operator()(std::function server_start, vector device_list, int server_port) { + // Our process ID and Session ID + pid_t pid, sid; + + // Fork off the parent process + pid = fork(); + if (pid < 0) { + exit(EXIT_FAILURE); + } + // exit the parent process. + if (pid > 0) { + exit(EXIT_SUCCESS); + } + + // Change the file mode mask, so we can use the files created by daemon. + umask(0); + + // Create a new SID for the child process + sid = setsid(); + if (sid < 0) { + // Log the failure + exit(EXIT_FAILURE); + } + + // Change the current working directory + if ((chdir("/")) < 0) { + exit(EXIT_FAILURE); + } + + // Close out the standard file descriptors + //close(STDIN_FILENO); // 0 + //close(STDOUT_FILENO); // 1 + //close(STDERR_FILENO); // 2 + + // Daemon-specific initialization goes here */ + pid_t *pid_news = new pid_t[device_list.size()]; + for(;;) { + for(auto dev_id : device_list) { + if(!check_port_occupied(server_port)) { + // reaped zombie process + if(pid_news[dev_id]) waitpid(pid_news[dev_id], NULL, 0); + + pid_news[dev_id] = fork(); + // fork new process + if(pid_news[dev_id] == 0) { + prctl(PR_SET_NAME, "anakin_child_rpc_service"); + int ret = server_start(server_port, dev_id); + if(ret == 0) exit(EXIT_SUCCESS); + else exit(EXIT_FAILURE); + } + } + } + + sleep(30); // wait 30 seconds + } + exit(EXIT_SUCCESS); +} + +bool ServiceDaemon::check_port_occupied() { + struct sockaddr_in client; + int sk; + + client.sin_family = AF_INET; + client.sin_port = htons(port); + client.sin_addr.s_addr = inet_addr("0.0.0.0"); + + sk = (int) socket(AF_INET, SOCK_STREAM, 0); + + int result = connect(sk, (struct sockaddr *) &client, sizeof(client)); + + if (result == 0) { + return true; // port is ocuupied. + } else { + return false; + } +} + + +} /* namespace rpc */ + +} /* namespace anakin */ + diff --git a/framework/service/service_daemon.h b/framework/service/service_daemon.h new file mode 100644 index 000000000..dabe5d5c4 --- /dev/null +++ b/framework/service/service_daemon.h @@ -0,0 +1,61 @@ +/* Copyright (c) 2018 Anakin Authors, Inc. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef ANAKIN_SERVICE_DAEMON_H +#define ANAKIN_SERVICE_DAEMON_H + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "framework/service/anakin_service.h" + +namespace anakin { + +namespace rpc { + +class ServiceDaemon { +public: + ServiceDaemon() {} + ~ServiceDaemon() {} + + void operator()(std::function server_start, + vector device_list, + int server_port); + +private: + bool check_port_occupied(); + +private: +}; + +} /* namespace rpc */ + +} /* namespace anakin */ + +#endif From 25b55b54b2d1314344bcd2868983d1b880d2d287 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Mon, 13 Aug 2018 18:07:07 +0800 Subject: [PATCH 08/13] fix some bugs. --- cmake/gather.cmake | 4 ++++ cmake/utils.cmake | 4 +++- framework/core/.thread_pool.h.swp | Bin 12288 -> 0 bytes framework/core/.type_traits_extend.h.swp | Bin 16384 -> 0 bytes framework/core/.types.h.swp | Bin 12288 -> 0 bytes framework/core/net/.worker.cpp.swp | Bin 24576 -> 0 bytes framework/core/net/.worker.h.swp | Bin 20480 -> 0 bytes 7 files changed, 7 insertions(+), 1 deletion(-) delete mode 100644 framework/core/.thread_pool.h.swp delete mode 100644 framework/core/.type_traits_extend.h.swp delete mode 100644 framework/core/.types.h.swp delete mode 100644 framework/core/net/.worker.cpp.swp delete mode 100644 framework/core/net/.worker.h.swp diff --git a/cmake/gather.cmake b/cmake/gather.cmake index 03a2cac83..7485a84a6 100644 --- a/cmake/gather.cmake +++ b/cmake/gather.cmake @@ -49,6 +49,10 @@ if(USE_PROTOBUF) anakin_protos_processing() endif() +if(BUILD_RPC) + anakin_find_baidu_rpc() +endif() + if (USE_GFLAGS) anakin_find_gflags() endif() diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 27b9860d1..cef19143b 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -291,7 +291,9 @@ function(anakin_protos_processing) anakin_fetch_files_with_suffix(${PROTO_SRC_PATH} "proto" PROTO_SRC_FILES) anakin_fetch_files_with_suffix(${SERVICE_API_SRC_PATH} "proto" SERVICE_API_PROTO_SRC_FILES) anakin_gen_pb(${PROTO_SRC_PATH} ${PROTO_SRC_FILES}) - anakin_gen_pb(${SERVICE_API_SRC_PATH} ${SERVICE_API_PROTO_SRC_FILES}) + if(BUILD_RPC) + anakin_gen_pb(${SERVICE_API_SRC_PATH} ${SERVICE_API_PROTO_SRC_FILES}) + endif() endfunction() # ---------------------------------------------------------------------------- diff --git a/framework/core/.thread_pool.h.swp b/framework/core/.thread_pool.h.swp deleted file mode 100644 index aca658f223cb232c5bdb1ee007cf3bdeba1b027c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&u<$=6vw9=_}Kyi4%~RS7bgmKn^vN7BdgAjHik5*Y^S9HX*FJty`!#Y-I>`q zQE7WXa6$Z%df))us00_d^$4PsdI1g~ap2Gk;&0#vd}nPZ+w_M}PatNcPd1);Gw;oJ zX5Ki;v=5xFpQM*dhZ&xy8T;wv`PWbXcI?>fI%8of!-ywCp&r;JU9Se0FQw`_A>T6xCuT65-fug z;4nA@2s{sNJ;B&@@HO}fTm=erK^gq;IAh;~8{l2=7FYp4KgQUP;2O9JJ_nzGc`yZv z;JZf|`wV;vu7JznHSiqx3tHR)H^B{X9efGC0PlnMfYa-3;2*DmSHLUa74Ql?xB~ly z>c}o`wQxWL#&Do>Nb1vxX|p`g*tIhrn`<|rdPZQPTiz}RGPq03_< z#>K{VDwQyS11l31Y;Y}kI~Ej#8>4oaK|i%(lLEYQh38X|in*-5o2t;YpW8@er|5o6 zRjEpW<>s8B6YI6c;?iO;f41nln9B9BAwrwzQ75B8p_RMiC$t%vNo6TeX+IcMA7ukA zH@FoQd=tR4A+=3;OwK3qbW_HX>#e{AWQt=?<#L&7lPa3TN+wFuxI=A0$%fEcc0`AU zkx;aiq%`F4YZK}ul-NjUvXN9hLsH>4K^=i8U?0ZZn9^NBkxJUU{}vj#GKpC48$o-E zQUia(2+lJvnZs6g+wqi}#Ies^I=Jz>+08p`;&awIyCj+EmHn_=1L4*R8esOjsZF(* z+b*1h7g)`uHFMeLL{}>nEnukvXIZ62s%mCSg~f6G_ONE?6vtJ~7OV`FN+qs)W;_#C z^an8}Z^hR4t(WMox(lE*frxM-ItLhe=n7ab8LWUvKA(rB2=eNZYXtD=b@zw9^M&z<2Q7NeE>-nJcw2Hsv_!^@JY3N>L$au=|!TR?&DN24d49 z6W-r^bSc>It_b=()QP#xeD2OnSKaYFm!-KXw{6xJ>~30je% zP)3xx&XB;hZ3H7W2U-|Ia4E6hrRZe4up^Dt zvW=spb7#~f4do3I>|aHNT9fL{0?pT&_2!HVXkEpwYc0;FQllfJOFn>)FgvwkK6GAr zPYcu`eIpGFHL|Yi&5%jDcF47G-8kG6Sv#nd%fsQY#Bp#&qLk=f8QnQ0O?johu(aA- zdTF+VYq2mti<69jS5J)4BrVB5TTa6$Wk$! mqS*rnkI?8oJ&r^hCECnT9chwkaZC+oXQ&}?0O52ivA+Q~L?h<_ diff --git a/framework/core/.type_traits_extend.h.swp b/framework/core/.type_traits_extend.h.swp deleted file mode 100644 index 50691b4509567da68a226ee8050cf3c735df8c7a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI3TWlOx8OKlCK-19BDisd}A->uY*k-evxWQO!XVtCaB-=V`cXtverP6A4_U!H< zvoo8SGg-T(F^Zmc?%$zwht{*y6Iz=DP9${GSWb8uq!Y3a7?S1#no@UI6gwwYD z9{1G2otGu<$<^x4$I~NE3=HO4LbjuN&Gzi`!pjxoRWq3w#MY z0RFw7u~)%m@D=c7;DQt2I5-0C0sFuoZfER=;0NFp@NFP~1?~kO0=I%a;1=-r_b~P| z@G`gpo&lG^7r-N+06qxb5AFtgz#DMpb?_Q^5_}$90xmcU)&YTi;5P8{+Zg*A_$ugt zWsn6Q1vB7%;9q+g`zQDbcph8=8{izMfQP^wm;}GRm9bxdx4@g=GO)lb_z2hwZUPMa z?%j<26nqgp2|fot3mkAKxC8v=U5q^qo&pbp6Ceu?f&<`hdl>r`_$K%a=zt1%2+V=I z!H+R{^CR$ma0OfjPk;tk0VQw}90do!KadN51%Cm51h0W_fak!o;1Uo(<;*ECSO|;X z<$*2zfYt);h*0?6)HFTDLK#Gkq;9%1`LF{=B=2-xTk^&J3A9#V?C}Mr%&Ct+8oWu7 z7mAk08x*$vKw(=x^#e=!{PDHJa|L>g2Gxw)7M`51U4zY1*_wyVtC?)N zzP*dZVFP^+l!#<8A%jeVXk4`_mQv(L&2YoT=?kb0sRn_JD4PLYHVc44O zoVRdfQFsl$k)cEnWIj)80&zrtKcvTxIy$r>bTswApSlWtg@ zewrTADLTm0ZCeK;Lm?gOh9ilOPB^k1cZ7q7hpT|_+h+PuCD&5r4O_e4_uW~Q>*|)$ zZ&@9CNgd+02Vv6y<6fhV=$p}^zRE#&cs+7YvofR#?R05Tfl9(LZ0+_qjDUmfe4oM`X>13sHN0%MT# z7$SI7wN@|&P&cixYdf6c4~S7In-reoMh#9ApsmA0XlxwJ()=SpO)zcQO7b}%w*(xnpX|+O2tL0-QtF&6i z)^RlW9Ko$)8RGbC8;#)`7{`YpA%X&fcflK3WvhWW1)?5FL~X3qghAYJ0pCLtXrfr9 zQgwpvFIG#{j52cCbCv0UUx$da72t6>uDrzRHPSASArYQ0O-$ zdKXt_6l!Tp+0Ey2yj$kI%qbrzFP3vp8nd2mrhO+Ej=fM@eLJj<)+|MdO-pYg2!Hh3Al1YQJ}z$d|JpymWV z29AJfuowIZHr@um2fqT}0bd8tf-B%ra2BkC0yqj(y&*7*QNSo*6fg=H1&jhl0i%FX zz$jo8FbcdA6_~{TVv8o;(Gi|M$0lPig^^AYRq>dKN9{`Ft=Upy7Q*t!W&_8{Z1?(4 z&*tRw z9>3tj|Gi^krRzgpOxGxvD0WXbGduQHR9Vn(aQZJ0`>#MpUW};u3VK}sRlnl*6|}a% F{sR!K#Wnx{ diff --git a/framework/core/.types.h.swp b/framework/core/.types.h.swp deleted file mode 100644 index c68b9110cc7e33699f4ff1940e80fba15c7ef535..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2!EYNy6vn3?IC9{TAV?y|PSU7EZISAvPUALNTei~@ffUB;S$kD`b~`g$ z$Fv15+>ijlr3Wtj2b?%?0B)S12gHE`2X27G4T%%toAo+z(iTB)6*JOL>)D-o^WHaa zUKMqk^Owt;^m2ZQp`BoCxqj`nqiW^c;ud3m68aq;^@X$_@84F1G?n`OzmLAWwQsP{ z4oxR%?r_PkhO$r`J_5yiq93WN1wT@vU)G?jp=Z{052t`r zz$xGqa0)mDoB~b(r+`zyDc}@v3OEHGLIrq>vG*Qh?3<%-9{>M8`uqQ@rx^PZ+yu*D z0vrcFKFQb*;C*lr{58SY=ip=TA@~3c00(b?O|Svh!3*H$95@S}1K%EFtPc#(Kmre31TTVT!3i({j)P<1QSki}jNJiWfZO0ra0#q~3t$EO z`8Z>LfKR|}@D7*+zeAJXz^~vJa0h$`Qmr1sy>>1;1)Ks-0jGdd;6ErZC1fiM7`sJ< zS(3P+r(^C58eZL_*#b=6I>QLft9T{*Oxpua!`wolkWQW&YX^L|hv|E~`ZrDvS366c zsM{hLNkJ`cI0ccSP{xVTd1iyDtgY2cjhy|NHh6fJl(?1%ZH9BBAke~KQV@;LrhW%^ zC@IvGXwkxF(sq`Fes-Ze6Ef+M-{o3U2|sJ%S_8Kp=?1gH(kxcDCLLxmfau$!8Gy{SSG5Y|lN zu-7g3eWxhcUlD#IGNG*F`Dw4x7=|+tW`-4JXK613%A1>|ozko2kyfct)=vt1J<$re z5r{tdG`>__sOzCGYKg3JV}z2YA&nW^uxw>L97igV z6c0zzL9K?%AnL58!4F@Wj==632qk>tdLaFdievvg@S?KaR0*MIZ$4B8~dpvSzN78|#&=23;xEYDKS6 zF4d`0qt%LczT7BRJoMJ!<2J$h^C&jBwhd>*E+R+CvSqRtcSF%i>triLB8JVx;Jn}E zwJn0<1F%h8(qyqt<@zM86zk=By1QGlYfangifYv&oK+rU4WBo=0zvids=TdiQ8AG% zseKh1M3=+P1*XrHuyI*z>lhQCE)@FxexBpst&Ye?s$GCNtE4V$lvhh$y)?I&$F*1t z-;NTS78ErNhiOiJ6r&d$kea8}Ymg08W4<3*dAP0jeMmQMB~>ij z(Q&zosh6X@&e3I|(wv5eG;KF{GMh9xbA}=BXcZo+u-!2yxOrNV@)b3| zpy>O#Mi(1@2DxUBO*X#nUAe&*n4VYdh02_)Xv(6hrE}s?G?g;nubYeMyl(Qe#_cry z;$|vu7@m~)7;7NbK-(Iq*u~zhXG&W(Z`w%DUfi{wop&xKdHjhr5NjaTK&*jS1F;5T z4a6FVH4tmyL!$xPSR>tt)}G+D_-gm~k;rk4`+Kc>+#9)mlKXp?dz2&BPjr9pbdUE( zuDd_uL#%;V1F;5T4a6FVH4tkc)U zJ4=#&3LXacfV+VP)`L^PUp^{HuY$c`J$U_0NqQ383PwOLc=ZfPdImfW?gaym1=J1xuh0bc2h)1>k(}yHh3UHlPCz)`5SWB1!)Qe*;Is*FgfD z2hIj(fyYnAGe86D!R-iS+y;ih1>k(}B!U=+!ByaNum-%0z{iW=DEKBwfm6ZBU@bTa z`~<;`X|M^TK?)p2K;?R{2TXxUa1tOr-{}Qcn)m0Dt`^wU&ifAoQ}#iFC)sv!7#D|$ ziZ+GQ*-Xad^QvWYQ&u(nRdrM5g?VlzEW41&ShlHZ^K4GHZM~di!E?55^sqyc&C5nf zvH1YW)$k4m^U70fg^H*aZ1TKnsk+A8DvTL!C74$kCP~W@!$;ODwo$Py)JfLO0yo(< zCQivzgw-#trh%?d(Xu6;w{>$M(4uUph)%by+B8**w#+$mEDaMP8@DS^K7<=$vVlvfGV4EW>2~a>D=GlVnp)Pmk+* zDG_|4E%=XpS-G1-Yyk1B?7%lA*>c)RMVD~6D}pt!AUkx%E@FL9n~u~n`N?d4^^;VGE8*|OIya7A zQOWdap>(yF2x~4?R5chA6uEv|q~0lxD?ONtOd{#3R#G*-a^G|_w1+w+fi^Lcd`NNx z_?7j)k>KzzIuouU=`W>fs-5t=VaA_qvpxNyg7hSP)FNxx$Zab$Qb=HodTDrc$C&7( z!Rd*Kq0uQOI*1K#$IS1d?o$hqvPF|I{hSdNviYPH*zI6#ml-cv9QyH!rDLr+YR}Mp z?J7y4hk~CbW1+E{q@V=)-nyo09&JTgp@$Bo)2ys4a%NRb?)8SH6uEscbYJ~(k{UCx zrec*uAB1j)RJUhIR_Ic#>NjjqUF*dHp9Up*dluF1%@$SDvayEXt61VAwIFFtYC@X@ zrDE$4K*NhRRb-D+bJ(eCG^%hOQ`o=Y%-(*QeSvxgELm_0rAoR|2rghX3UUk}quZEj z)m0Y_r>dDut&k!8-AT1)QiX~+_&N-4At z^sRxr6>MVeopJ+P#ca2)v>rCJcW`8Sa(K^>JTf-8Yf_#Vx@vlOVrYA?GM+&r=cd4m z-dq=3JGfXF*ZmTlq)Oh7+HO4B(T!C)y`Eh&XR4@$BDN}+AO@S`_I}Pax1V5kn1ZE* z7D`7`@LI`XGL$^W1$tqgnsl+Mou21?5eEd6r3TD9P!4=?g@GkuQcfh~F1K>(woCcnN-+w*045UCWSO=bl@BdY>4Ge&{ z;O9RG3Sbso19pNPAO&85-~SzO8~7Gj27TZ)wEY$EGI$Ey1o}ZA*aDJZ1Nb-~J$($s zpI8I224W3-U^TGJ(w8!S-MKW46$g71wOBoRDGdU4;xN@p{!|=#$EU0D%czUfrl^P4GY1!%pMVjUb3Unx{(Nc$w?&(N>HWX9S z=%(G-L`>fAe;ciJqF%?Li6UU;#tThuA$*)de9G%HS+S7Rkgu)ql%X5mStt4+ zZuSCPWqpY!0(TdY$AFYz;I$PGzgnD#+ETm%{xk9c}~eMCJM6cD2DbaF$$n-vk1*9|Ndre025DuhIaB|RE>1hbqXq}4)~l#*HyCb(*zf+dD$1Jyq; z84zE^Yz>Wcv?Njqnj4fKRPo?OL}S?iS^dyMDN4~ok4)XLfu>5Z0_k)S$zKHQxabO` zTj<%)JygkVCyKYNCga!g`b6qS&x-JA-2{c(Fh?b1uF#;FZseC67-TZFFEO|k< z-0U6RBN2AkdCLUGx*M&sdRQ;=)(wOO%{W zwkz&BA#$JIO9^$>8es;4t4v^pVg3XUPwqCBmheP^feFnd{EjRum^Mu0HE^xbn&M5A zM%@t_H4$@%lnRD?t*P^5)>t`Kopa0nSGqf5V(M6>@cm&`v}jX&5sqfsvnc+<4a|vu z!~14SM3Jo;lTc5t&R{r$q*y^Bo{OAP3!BJRw~@}a*tZXIfiJ0fygJjGHFIpYzwi4$ zF$LA({$aHQZWNNHIDNvV4_S8cP6oYc66kqKi&-*;7Wz{zTQklOsJoob26pA;gEBqn zY_XLkZYuLg;#xI35=U6m_0DyaB&Wvs<8LOsA}IZvw-1nW;ri=Cqq!?ahUBqvd1`p~ z(1cWdxQ+>o=)@Ch;cXRLh^;>DBnuIHrJUguB?|{e_hgy-gjjE=mV@vN`2pLxh%}Qa^f%KF!VW>UNnc+j7Y%+x-){y`A0Vs#bw&;qC7#1B-ZrMW8BtwQE4Y!nSDn zTJ+K*=Cz?+UCs6@Q0e2nEOfNqB1UkW)(Y`fH<>W!9lU_0Qp~*T2RQF^WHLE3AAB#` zc^NXxa9hHA51iip?sxqECHSe2!j~oge-{q)sleYq0lWyG|0uW{bHkuKz~x5BT~& za((^>;qM;?!{9{lbNKu>gDXJ>d=^{?J^|i_&K$i7mBoMGcMSxMeoMA3;%(6LjXaL3 z-KCpq)?9x%rpw_?2%U*6L91K#>Ikai#z=Hq@DnM!o#l_j9NQ8|653w|C3?*Jth5l) zeXCsz>3_>qga2`GrSX3$`rrgt8bv4x1O zFCvbv#L<;@{uiQ`7mfy6SF{C^Hx=UWild3}&L$48kW%9CikqyaAbD@Lo&Dvp?Je8i YS2BN}zS6GpecMrrRn5`F|2|*$Ux!1EoB#j- diff --git a/framework/core/net/.worker.h.swp b/framework/core/net/.worker.h.swp deleted file mode 100644 index 494ca8f06abe90e53adf042e1f811592c183725f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeI2d2Ae48Ndh9E6~!4`w~1H1e?^|O;V1?b}ih*ZQa8Tw$mt(G9B-}^$uCjZ0E2O z+JZoUprD4MNQgo~qLiZ&H&nDjw6rP+0TMz22~_?-fJC{WqDUa%_r3RacQ)Rb^q@#| zR{D9oGw=M~_rCXi-_FwZ%V#cAudKez<8zkh{bt`)uYJ+CH(j}NpXb%{u-*#dH66*r z<9~MRD4Sb2{`2mWH})H>Er(evU-E+}I21;;DSK%q!HQmslS8$7oakDlvzmOv#b9SBKox5|#cB#E(36v5jB~VJ>e;|RN;d#60_iqyL^ZS1{{=f4~&-(^k1H0f1I30fS z6wmt+9EFSFpJ#a9ZEyp;7v2Mh;Y#q~G8l(#@N{@0{ONSh`yt#6*TCgafs(8bn1z$!Tc>*7*Wj!0 zL1@Br;dFTL6wiAA{s`}d2%4}Hw!jEHAAWkW=e+}74dZYwJV*lMukd^LCENjDg15k% z;V@hPldu_1gMX1!`7Yc8N8x&S8!W)n;WH#m~vs%N%o#-r2A|*{$O&b^%GOq6 z%HCFsrs&={ZmX-kOs{m>L8d3NBOPsKwJ86Msy#s#Eb^b)W54fBbUjSPQth=j<~s9v zWJ=hpI#2a(jg3t$9GKlb=^1U^#zpl$2X)k_Gx~v>Y~w-^DI4TjY?hODtu6GMn6cI6 zWuF(-s)3k8pGEN#onki;Rj-GEwy0DI&)Yt(!U@%2PSti8>9m@LZ_rXFJp1geh@sef zt!9h`CM;3NrY<8LD6oF8#~onbz*iVGYMsiG9y8S@rm_2Y)C|&2hJnZGqc;V-6?dc7}vl&i<^Lk(2kLsY=c@B*Luof-fyff zh0)01Bo7WK-Z|=EN4?f)>JPjHi%Id&D4idF5 z4VLwo?bDg`0b7bv4ti_$#aeb~QztsA>#ApsxjAk+*buxTdG!`k<829}dOOEC7#Z>c zuGqHL$i`*jj!ps`6Tg{9^$km>oH1>k#nFbP+}Y9LL^zRhY0%XEN>ESYbfEZz_+z0s zv;Jz3guzl1v!T*Jw^8nbt0y**!hGFn!L> zDzC*-?Ev1_N^nHQOIbkE0nUDhZ`NPxiaN-os5oj;G>S8ciV!|C z5l_Gdw5McY!HlcuS}cld%8atRtfT63oft2N5vq#RA90mNIJw!?YBwWH!sS+`D)p^u z=k^`DlzpFGP32iDPSQ~|!?sjYoZRzLE>*bN60@;t693;v9KZQY8~+oQn$KJLeg*6U zd3G;lz6hU&DY%3}bLBX@(R$}&B;3IGd&W0`U7vlCm!>{4< zuoF%L5AGy({|4L!pM{IyRj?WECXW9m+zwxWRX7NX@Je_EybzuR_Y>Fu94>`v*aPD* z20P$1@Ze{}_4mQ&;d5{cyc4d39dIiAm^lB-ki*IFbA)v>EWsu4D`NH^z<1zVa4#Hz z3*bIt_76Y|E6|2RFbhwBJBa0Phfl#L;bZRqEjXuP)AOz+u(q*+G2U1SFBfB~E^Nn3 zLE9dC_#O*g13TeP!mju1oMwA*j`HN>_@n4=V-jn%+Jss*BT_w6?;I)QjGxNK5Awqy zn<6=4&Wp6#$%XcPaPFI|#Mx|?zU9JF|$9`{2?3GwcT>o^k zLS&R~tyZhFV}iUBk;B+nH&~XznPG|TwcTNE`rY<>QuJZ^8XB~i8gVkJMBpZjp?JUY z|VTp}bQU(w<4cV|f^LwWE_~##}_yb)!{WgjL+r~}0LNrTKV#?R1OX;>d%j4~7^W0e1PJruEk>rI>&WCiXQ}2Nu ziC{>D$x~HX!8n`h5xlGJ_m?42Q!FToQdkBoy(e9^*>)i|bBK5LQ!6s?oBsTso| zj&nU|w{^oz)hOS<1ridA`W$=QN zctsuCoy^0`Oj4DB{l8b!rhxo55rmtpar}+$_Ya+Z?@n{9fJB#V*D{D9zgkqSjqm3( zmn7LprZGD*u&eBlG2d19Y<$=TaDa zTOsNbvm2X|Qr$MT)y=dxnaUfI>K&A6PZ74Ls*QL5`# zWzQr3AyJk~B59XmtFUHX_UpTz$U z5SqP}7*u}$@4mnP31a@6;YK(YzCz4@J-i*xg$Ic9{{r{JQFsoV1pgr3KML2un_&*l zgj3mfZr19{{p@Vcfk$tez*=+K=K36fZq`B-vJ+l1Mq9&{d+-v z_rCyY@Ev0QufS*FR`?8D0o&j%7yHX^`LBk(Fb6x~m&p2~a1*>6-UUYfEWzXPQ|36z z9LIn7EtlLdpVXOhlRE=%qo#wHb)<>^om&j>BYf${dF{+8d>+ v*XvK2<0x|+ Date: Mon, 13 Aug 2018 18:55:49 +0800 Subject: [PATCH 09/13] update utils. --- cmake/find_modules.cmake | 46 ++++++++++++++++++++++------------------ cmake/utils.cmake | 2 +- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/cmake/find_modules.cmake b/cmake/find_modules.cmake index 24fe08914..aef2b3a77 100644 --- a/cmake/find_modules.cmake +++ b/cmake/find_modules.cmake @@ -266,7 +266,7 @@ macro(anakin_find_xbyak) endmacro() macro(anakin_find_mklml) - set(MKLML_ROOT ${ANAKIN_ROOT}/third-party/mklml) + set(MKLML_ROOT "${ANAKIN_ROOT}/third-party/mklml" CACHE PATH "MKLML ROOT") find_path(MKLML_ROOT_INCLUDE mkl_vsl.h ${MKLML_ROOT}/include) if (MKLML_ROOT_INCLUDE) set(MKLML_FOUND TRUE) @@ -301,29 +301,33 @@ macro(anakin_find_protobuf) log ) list(APPEND ANAKIN_LINKER_LIBS ${log-lib}) else() - find_package(Protobuf REQUIRED) - if(PROTOBUF_FOUND) - message(STATUS "Found protobuf in ${PROTOBUF_INCLUDE_DIR}") - include_directories(${PROTOBUF_INCLUDE_DIR}) - list(APPEND ANAKIN_LINKER_LIBS ${PROTOBUF_LIBRARIES}) - endif() + find_program(PROTOBUF_PROTOC_EXECUTABLE protoc) + if(PROTOBUF_PROTOC_EXECUTABLE) + find_package(Protobuf REQUIRED) + message(STATUS "Found protobuf in ${PROTOBUF_INCLUDE_DIR}") + include_directories(${PROTOBUF_INCLUDE_DIR}) + list(APPEND ANAKIN_LINKER_LIBS ${PROTOBUF_LIBRARIES}) + else() + set(PROTOBUF_ROOT "" CACHE PATH "Folder contains protobuf") + if (NOT "${PROTOBUF_ROOT}" STREQUAL "") + find_path(PROTOBUF_INCLUDE_DIR google/protobuf/message.h PATHS ${PROTOBUF_ROOT}/include NO_DEFAULT_PATH) + find_library(PROTOBUF_LIBRARY protobuf PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH) + find_library(PROTOBUF_LITE_LIBRARY protobuf-lite PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH) + find_library(PROTOBUF_PROTOC_LIBRARY protoc PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH) + find_program(PROTOBUF_PROTOC_EXECUTABLE protoc PATHS ${PROTOBUF_ROOT}/bin NO_DEFAULT_PATH) + if (PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARY AND PROTOBUF_LITE_LIBRARY AND PROTOBUF_PROTOC_LIBRARY AND PROTOBUF_PROTOC_EXECUTABLE) + message(STATUS "Using custom protobuf library in ${PROTOBUF_ROOT}.") + set(PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARY} ${PROTOBUF_LITE_LIBRARY} ${PROTOBUF_PROTOC_LIBRARY}) + list(APPEND ANAKIN_LINKER_LIBS ${PROTOBUF_LIBRARIES}) + include_directories(${PROTOBUF_INCLUDE_DIR}) + else() + message(WARNING "Cannot find protobuf library in ${PROTOBUF_ROOT}.") + endif() + endif() + endif() endif() endmacro() -macro(anakin_find_baidu_rpc) - set(BAIDU_RPC_ROOT "/usr" CATCH "baidu rpc root dir") - find_path(RPC_INCLUDE_DIR server.h PATHS ${BAIDU_RPC_ROOT}/include/brpc/ $ENV{BAIDU_RPC_ROOT}/include/brpc/) - find_library(RPC_LIBRARY NAMES libbrpc.so - PATHS ${BAIDU_RPC_ROOT}/lib $ENV{BAIDU_RPC_ROOT}/include/brpc/ - DOC "library path for baidu rpc.") - if(RPC_INCLUDE_DIR AND RPC_LIBRARY) - include_directories(${BAIDU_RPC_ROOT}/include) - list(APPEND ANAKIN_LINKER_LIBS ${RPC_LIBRARY}) - else() - message(SEND_ERROR "Could not found baidu-rpc !") - endif() -endmacro() - macro(anakin_find_openmp) find_package(OpenMP REQUIRED) if(OPENMP_FOUND OR OpenMP_CXX_FOUND) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index cef19143b..ae78035ac 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -242,7 +242,7 @@ endfunction() function(anakin_gen_pb proto_src_path) set(__working_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PROTO_TEMP/) foreach(__proto_file ${ARGN}) - exec_program(protoc ${__working_dir} ARGS " -I=${proto_src_path} --cpp_out=. ${__proto_file}" + exec_program(${PROTOBUF_PROTOC_EXECUTABLE} ${__working_dir} ARGS " -I=${proto_src_path} --cpp_out=. ${__proto_file}" OUTPUT_VARIABLE OUTPUT RETURN_VALUE VALUE) if(NOT VALUE) anakin_fetch_files_with_suffix(${__working_dir} "h" PROTO_GENERATE_H) From 302cc8e905203638d4964b687ba6bca7eaa4afd1 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Wed, 15 Aug 2018 17:52:52 +0800 Subject: [PATCH 10/13] milestone: add support rpc service. --- cmake/cuda.cmake | 3 + cmake/find_modules.cmake | 33 +- cmake/gather.cmake | 3 +- framework/core/singleton.cpp | 2 +- framework/core/thread_pool.inl | 14 +- framework/service/anakin_service.cpp | 122 +- framework/service/anakin_service.h | 28 +- framework/service/api/service.pb.cpp | 2896 +++++++++++++++++ framework/service/api/service.pb.h | 1472 +++++++++ framework/service/api/service.proto | 16 +- framework/service/device_info.cpp | 99 + framework/service/device_info.h | 190 ++ framework/service/monitor.h | 86 +- framework/service/service_daemon.cpp | 24 +- framework/service/service_daemon.h | 7 +- test/CMakeLists.txt | 1 + test/framework/service/service_rpc_client.cpp | 100 + test/framework/service/service_rpc_server.cpp | 75 + test/framework/service/service_test.h | 50 + 19 files changed, 5116 insertions(+), 105 deletions(-) create mode 100644 framework/service/api/service.pb.cpp create mode 100644 framework/service/api/service.pb.h create mode 100644 framework/service/device_info.cpp create mode 100644 framework/service/device_info.h create mode 100644 test/framework/service/service_rpc_client.cpp create mode 100644 test/framework/service/service_rpc_server.cpp create mode 100644 test/framework/service/service_test.h diff --git a/cmake/cuda.cmake b/cmake/cuda.cmake index 4b06a58a2..f73f87ca4 100644 --- a/cmake/cuda.cmake +++ b/cmake/cuda.cmake @@ -143,6 +143,9 @@ macro(anakin_find_cuda) if(USE_CURAND) list(APPEND ANAKIN_LINKER_LIBS ${CUDA_curand_LIBRARY}) endif() + if(BUILD_RPC) + list(APPEND ANAKIN_LINKER_LIBS ${CUDA_INCLUDE_DIRS}/../lib64/stubs/libnvidia-ml.so) + endif() list(APPEND ANAKIN_LINKER_LIBS ${CUDA_CUDART_LIBRARY}) else() message(FATAL_ERROR "Cuda SHARED lib Could not found !") diff --git a/cmake/find_modules.cmake b/cmake/find_modules.cmake index aef2b3a77..f35740a08 100644 --- a/cmake/find_modules.cmake +++ b/cmake/find_modules.cmake @@ -235,19 +235,18 @@ macro(anakin_find_gtest) endif() endmacro() +macro(anakin_find_google_flags) + set(GFLAGS_ROOT_DIR "/usr/include" CACHE PATH "gflags path") + find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h PATHS ${GFLAGS_ROOT_DIR}) -macro(anakin_find_gflags) - set(GFLAGS_INCLUDE_DIR ${ANAKIN_ROOT}/third-party/gflags/include) find_library(GFLAGS_LIBRARY NAMES libgflags.so - PATHS ${GFLAGS_INCLUDE_DIR}/../lib - DOC "library path for gflags.") + PATHS ${GFLAGS_ROOT_DIR}/../lib64 + DOC "library path for gflags.") if(GFLAGS_INCLUDE_DIR AND GFLAGS_LIBRARY) - set(GFLAGS_FOUND TRUE) - endif() - if(GFLAGS_FOUND) - message(STATUS "Found gflags in ${GFLAGS_INCLUDE_DIR}") - include_directories(${GFLAGS_INCLUDE_DIR}) - list(APPEND ANAKIN_LINKER_LIBS ${GFLAGS_LIBRARY}) + include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) + list(APPEND ANAKIN_DEMO_LIBRARIES ${GFLAGS_LIBRARY}) + else() + message(SEND_ERROR "Could not found gflags !") endif() endmacro() @@ -328,6 +327,20 @@ macro(anakin_find_protobuf) endif() endmacro() +macro(anakin_find_baidu_rpc) + set(BAIDU_RPC_ROOT "/usr/local/" CACHE "baidu rpc root dir") + find_path(RPC_INCLUDE_DIR server.h PATHS ${BAIDU_RPC_ROOT}/include/brpc/ $ENV{BAIDU_RPC_ROOT}/include/brpc/) + find_library(RPC_LIBRARY NAMES libbrpc.so + PATHS ${BAIDU_RPC_ROOT}/lib $ENV{BAIDU_RPC_ROOT}/include/brpc/ + DOC "library path for baidu rpc.") + if(RPC_INCLUDE_DIR AND RPC_LIBRARY) + include_directories(${BAIDU_RPC_ROOT}/include) + list(APPEND ANAKIN_LINKER_LIBS ${RPC_LIBRARY}) + else() + message(SEND_ERROR "Could not found baidu-rpc !") + endif() +endmacro() + macro(anakin_find_openmp) find_package(OpenMP REQUIRED) if(OPENMP_FOUND OR OpenMP_CXX_FOUND) diff --git a/cmake/gather.cmake b/cmake/gather.cmake index 7485a84a6..3e1678b16 100644 --- a/cmake/gather.cmake +++ b/cmake/gather.cmake @@ -51,10 +51,11 @@ endif() if(BUILD_RPC) anakin_find_baidu_rpc() + anakin_find_google_flags() endif() if (USE_GFLAGS) - anakin_find_gflags() + anakin_find_google_flags() endif() if(USE_MKL) diff --git a/framework/core/singleton.cpp b/framework/core/singleton.cpp index d8a2b9c0a..83562a3da 100644 --- a/framework/core/singleton.cpp +++ b/framework/core/singleton.cpp @@ -1,4 +1,4 @@ -#include "framework/core/thread_safe_macros.h" +#include "framework/core/singleton.h" namespace anakin { diff --git a/framework/core/thread_pool.inl b/framework/core/thread_pool.inl index 3aa8bab05..896cda884 100644 --- a/framework/core/thread_pool.inl +++ b/framework/core/thread_pool.inl @@ -1,7 +1,7 @@ namespace anakin { -void ThreadPool::launch() { +inline void ThreadPool::launch() { for(size_t i = 0; i<_num_thread; ++i) { _workers.emplace_back( [i ,this]() { @@ -29,16 +29,16 @@ void ThreadPool::launch() { } } -void ThreadPool::stop() { +inline void ThreadPool::stop() { std::unique_lock lock(this->_mut); _stop = true; } -void ThreadPool::init() {} +inline void ThreadPool::init() {} -void ThreadPool::auxiliary_funcs() {} +inline void ThreadPool::auxiliary_funcs() {} -ThreadPool::~ThreadPool() { +inline ThreadPool::~ThreadPool() { stop(); this->_cv.notify_all(); for(auto & worker: _workers){ @@ -47,7 +47,7 @@ ThreadPool::~ThreadPool() { } template -typename function_traits::return_type ThreadPool::RunSync(functor function, ParamTypes ...args) +inline typename function_traits::return_type ThreadPool::RunSync(functor function, ParamTypes ...args) EXCLUSIVE_LOCKS_REQUIRED(_mut) { auto task = std::make_shared::return_type(void)> >( \ std::bind(function, std::forward(args)...) @@ -62,7 +62,7 @@ typename function_traits::return_type ThreadPool::RunSync(functor funct } template -std::future::return_type> ThreadPool::RunAsync(functor function, ParamTypes ...args) +inline std::future::return_type> ThreadPool::RunAsync(functor function, ParamTypes ...args) EXCLUSIVE_LOCKS_REQUIRED(_mut) { auto task = std::make_shared::return_type(void)> >( \ std::bind(function, std::forward(args)...) diff --git a/framework/service/anakin_service.cpp b/framework/service/anakin_service.cpp index 7777556f1..bff8e3dc1 100644 --- a/framework/service/anakin_service.cpp +++ b/framework/service/anakin_service.cpp @@ -5,53 +5,143 @@ namespace anakin { namespace rpc { template -void AnakinService::set_device_id(int dev_id) { } +void AnakinService::set_device_id(int dev_id) { + _dev_id = dev_id; +} template void AnakinService::initial(std::string model_name, - std::string model_path, - int thread_num) { - _worker_map[model_name] = std::make_shared(model_path, thread_num); + std::string model_path, + int thread_num) { + _worker_map[model_name] = std::make_shared >(model_path, + thread_num); } template void AnakinService::register_inputs(std::string model_name, - std::vector& in_names) { - _worker_map[model_name].register_inputs(in_names); + std::vector in_names) { + _worker_map[model_name]->register_inputs(in_names); } template void AnakinService::register_outputs(std::string model_name, - std::vector& out_names) { - _worker_map[model_name].register_outputs(out_names); + std::vector out_names) { + _worker_map[model_name]->register_outputs(out_names); } template void AnakinService::Reshape(std::string model_name, - std::string in_name, - std::vector in_shape) { - _worker_map[model_name].Reshape(in_name, in_shape); + std::string in_name, + std::vector in_shape) { + _worker_map[model_name]->Reshape(in_name, in_shape); } template void AnakinService::register_interior_edges(std::string model_name, - std::string edge_start, - std::string edge_end) { - _worker_map[model_name].register_interior_edges(edge_start, edge_end); + std::string edge_start, + std::string edge_end) { + _worker_map[model_name]->register_interior_edges(edge_start, edge_end); } template inline void AnakinService::extract_request( const RPCRequest* request, - std::vector::type, Dtype> >) { + std::vector::type, Dtype> >& inputs) { + for(int i = 0; i < request->inputs_size(); i++) { + auto& io = request->inputs(i); + auto& data = io.tensor(); + auto& shape = data.shape(); + saber::Shape tensor_shape{shape[0],shape[1],shape[2],shape[3]}; + Tensor4dPtr::type, Dtype> h_tensor_p = + new Tensor4d::type, Dtype>(); + h_tensor_p->re_alloc(tensor_shape); + auto* h_data = h_tensor_p->mutable_data(); + memcpy(h_data, data.data().data(), shape[0]*shape[1]*shape[2]*shape[3]*sizeof(Dtype)); + inputs.push_back(h_tensor_p); + } } template -inline void AnakinService::fill_response( +inline void AnakinService::fill_response_data( + int request_id, + std::string model_name, RPCResponse* response, std::vector >& outputs) { + response->set_model(model_name); + response->set_request_id(request_id); + for(auto& d_out_p : outputs) { + // copy to host + auto shape = d_out_p->valid_shape(); + Tensor4dPtr::type, Dtype> h_tensor_p = + new Tensor4d::type, Dtype>(); + h_tensor_p->re_alloc(shape); + h_tensor_p->copy_from(*d_out_p); + // fill response + IO* output = response->add_outputs(); + Data* data = output->mutable_tensor(); + data->add_shape(shape[0]); + data->add_shape(shape[1]); + data->add_shape(shape[2]); + data->add_shape(shape[3]); + data->mutable_data()->Reserve(shape[0]*shape[1]*shape[2]*shape[3]); + memcpy(data->mutable_data()->mutable_data(), + h_tensor_p->mutable_data(), + shape[0]*shape[1]*shape[2]*shape[3]*sizeof(float)); + } +} + +template +inline void AnakinService::fill_response_exec_info(RPCResponse* response) { + auto* info = response->mutable_info(); + info->set_msg("SUC"); + DeviceStatus* status_p = info->mutable_device_status(); + status_p->set_id(_monitor.get_id()); + status_p->set_name(_monitor.get_name()); + status_p->set_temp(_monitor.get_temp()); + status_p->set_mem_free(_monitor.get_mem_free()); + status_p->set_mem_used(_monitor.get_mem_used()); + info->set_duration_in_nano_seconds(-1); } +#ifdef USE_CUDA +template class AnakinService; +template class AnakinService; +template class AnakinService; + +template class AnakinService; +template class AnakinService; +template class AnakinService; +#endif + +#ifdef USE_X86_PLACE +template class AnakinService; +template class AnakinServNet; +template class AnakinServNet; + +template class AnakinServNet; +template class AnakinServNet; +template class AnakinServNet; +#endif + +#ifdef USE_ARM_PLACE +#ifdef ANAKIN_TYPE_FP32 +template class AnakinService; +template class AnakinService; +#endif + +#ifdef ANAKIN_TYPE_FP16 +template class AnakinService; +template class AnakinService; +#endif + +#ifdef ANAKIN_TYPE_INT8 +template class AnakinService; +template class AnakinService; +#endif //int8 + +#endif //arm + + } /* namespace rpc */ } /* namespace anakin */ diff --git a/framework/service/anakin_service.h b/framework/service/anakin_service.h index 7b9160b26..875569ab6 100644 --- a/framework/service/anakin_service.h +++ b/framework/service/anakin_service.h @@ -18,7 +18,7 @@ #include -#include "framework/core/net/worker.h" +#include "framework/service/monitor.h" #include "framework/core/net/worker.h" #include "framework/service/api/service.pb.h" @@ -26,8 +26,8 @@ namespace anakin { namespace rpc { -template -class AnakinService public: RPCService { +template +class AnakinService : public RPCService { public: void evaluate(::google::protobuf::RpcController* controller_base, const RPCRequest* request, @@ -54,10 +54,17 @@ class AnakinService public: RPCService { _worker_map[model_name].register_aux_function(function, std::forward(args)...); } -public: + template + void create_monitor(int interval_time_in_sec) { + _monitor.create_instance(_dev_id, interval_time_in_sec); + } + +private: inline void extract_request(const RPCRequest* request, - std::vector::type, Dtype> >); - inline void fill_response(RPCResponse* response, std::vector >& outputs); + std::vector::type, Dtype> >& inputs); + inline void fill_response_data(int request_id, std::string model_name, + RPCResponse* response, std::vector >& outputs); + inline void fill_response_exec_info(RPCResponse* response); private: inline void _evaluate(::google::protobuf::RpcController* controller_base, @@ -74,10 +81,13 @@ class AnakinService public: RPCService { LOG(INFO) << " -- (attached=" << cntl->request_attachment() << ")"; } std::string model_name = request->model(); + int request_id = request->request_id(); std::vector::type, Dtype> > inputs; extract_request(request, inputs); - auto ret = _worker_map[model_name].sync_prediction(inputs); - fill_response(response, ret.get()); + auto ret = _worker_map[model_name]->sync_prediction(inputs); + auto results = ret.get(); + fill_response_data(request_id, model_name, response, results); + fill_response_exec_info(response); } inline void _evaluate(::google::protobuf::RpcController* controller_base, @@ -94,6 +104,8 @@ class AnakinService public: RPCService { private: std::unordered_map > > _worker_map; + Monitor _monitor; + int _dev_id; }; } /* namespace rpc */ diff --git a/framework/service/api/service.pb.cpp b/framework/service/api/service.pb.cpp new file mode 100644 index 000000000..de39b576c --- /dev/null +++ b/framework/service/api/service.pb.cpp @@ -0,0 +1,2896 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: service.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "service.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace anakin { +namespace rpc { +class DataDefaultTypeInternal { +public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; +} _Data_default_instance_; +class IODefaultTypeInternal { +public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; +} _IO_default_instance_; +class RPCRequestDefaultTypeInternal { +public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; +} _RPCRequest_default_instance_; +class DeviceStatusDefaultTypeInternal { +public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; +} _DeviceStatus_default_instance_; +class ExecutionInfoDefaultTypeInternal { +public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; +} _ExecutionInfo_default_instance_; +class RPCResponseDefaultTypeInternal { +public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; +} _RPCResponse_default_instance_; + +namespace protobuf_service_2eproto { + + +namespace { + +::google::protobuf::Metadata file_level_metadata[6]; +const ::google::protobuf::ServiceDescriptor* file_level_service_descriptors[1]; + +} // namespace + +PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField + const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, +}; + +PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField + const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + ::google::protobuf::internal::AuxillaryParseTableField(), +}; +PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const + TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, +}; + +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Data, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Data, shape_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Data, data_), + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IO, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IO, tensor_), + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, model_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, inputs_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, request_id_), + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, temp_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, mem_free_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, mem_used_), + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, msg_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, duration_in_nano_seconds_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, device_status_), + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, model_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, outputs_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, info_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, request_id_), +}; +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(Data)}, + { 7, -1, sizeof(IO)}, + { 13, -1, sizeof(RPCRequest)}, + { 21, -1, sizeof(DeviceStatus)}, + { 31, -1, sizeof(ExecutionInfo)}, + { 39, -1, sizeof(RPCResponse)}, +}; + +static ::google::protobuf::Message const * const file_default_instances[] = { + reinterpret_cast(&_Data_default_instance_), + reinterpret_cast(&_IO_default_instance_), + reinterpret_cast(&_RPCRequest_default_instance_), + reinterpret_cast(&_DeviceStatus_default_instance_), + reinterpret_cast(&_ExecutionInfo_default_instance_), + reinterpret_cast(&_RPCResponse_default_instance_), +}; + +namespace { + +void protobuf_AssignDescriptors() { + AddDescriptors(); + ::google::protobuf::MessageFactory* factory = NULL; + AssignDescriptors( + "service.proto", schemas, file_default_instances, TableStruct::offsets, factory, + file_level_metadata, NULL, file_level_service_descriptors); +} + +void protobuf_AssignDescriptorsOnce() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); +} + +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 6); +} + +} // namespace +void TableStruct::InitDefaultsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::internal::InitProtobufDefaults(); + _Data_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Data_default_instance_);_IO_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_IO_default_instance_);_RPCRequest_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_RPCRequest_default_instance_);_DeviceStatus_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_DeviceStatus_default_instance_);_ExecutionInfo_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_ExecutionInfo_default_instance_);_RPCResponse_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_RPCResponse_default_instance_);_IO_default_instance_._instance.get_mutable()->tensor_ = const_cast< ::anakin::rpc::Data*>( + ::anakin::rpc::Data::internal_default_instance()); + _ExecutionInfo_default_instance_._instance.get_mutable()->device_status_ = const_cast< ::anakin::rpc::DeviceStatus*>( + ::anakin::rpc::DeviceStatus::internal_default_instance()); + _RPCResponse_default_instance_._instance.get_mutable()->info_ = const_cast< ::anakin::rpc::ExecutionInfo*>( + ::anakin::rpc::ExecutionInfo::internal_default_instance()); +} + +void InitDefaults() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); +} +namespace { +void AddDescriptorsImpl() { + InitDefaults(); + static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + "\n\rservice.proto\022\nanakin.rpc\"#\n\004Data\022\r\n\005s" + "hape\030\001 \003(\005\022\014\n\004data\030\002 \003(\002\"&\n\002IO\022 \n\006tensor" + "\030\001 \001(\0132\020.anakin.rpc.Data\"O\n\nRPCRequest\022\r" + "\n\005model\030\001 \001(\014\022\036\n\006inputs\030\002 \003(\0132\016.anakin.r" + "pc.IO\022\022\n\nrequest_id\030\003 \001(\003\"Z\n\014DeviceStatu" + "s\022\n\n\002id\030\001 \001(\005\022\014\n\004name\030\002 \001(\014\022\014\n\004temp\030\003 \001(" + "\005\022\020\n\010mem_free\030\004 \001(\005\022\020\n\010mem_used\030\005 \001(\005\"o\n" + "\rExecutionInfo\022\013\n\003msg\030\001 \001(\014\022 \n\030duration_" + "in_nano_seconds\030\002 \001(\005\022/\n\rdevice_status\030\003" + " \001(\0132\030.anakin.rpc.DeviceStatus\"z\n\013RPCRes" + "ponse\022\r\n\005model\030\001 \001(\014\022\037\n\007outputs\030\002 \003(\0132\016." + "anakin.rpc.IO\022\'\n\004info\030\003 \001(\0132\031.anakin.rpc" + ".ExecutionInfo\022\022\n\nrequest_id\030\004 \001(\0032I\n\nRP" + "CService\022;\n\010evaluate\022\026.anakin.rpc.RPCReq" + "uest\032\027.anakin.rpc.RPCResponseB\003\200\001\001b\006prot" + "o3" + }; + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + descriptor, 602); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "service.proto", &protobuf_RegisterTypes); +} +} // anonymous namespace + +void AddDescriptors() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl); +} +// Force AddDescriptors() to be called at dynamic initialization time. +struct StaticDescriptorInitializer { + StaticDescriptorInitializer() { + AddDescriptors(); + } +} static_descriptor_initializer; + +} // namespace protobuf_service_2eproto + + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int Data::kShapeFieldNumber; +const int Data::kDataFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +Data::Data() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_service_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:anakin.rpc.Data) +} +Data::Data(const Data& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL), + shape_(from.shape_), + data_(from.data_), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:anakin.rpc.Data) +} + +void Data::SharedCtor() { + _cached_size_ = 0; +} + +Data::~Data() { + // @@protoc_insertion_point(destructor:anakin.rpc.Data) + SharedDtor(); +} + +void Data::SharedDtor() { +} + +void Data::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Data::descriptor() { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; +} + +const Data& Data::default_instance() { + protobuf_service_2eproto::InitDefaults(); + return *internal_default_instance(); +} + +Data* Data::New(::google::protobuf::Arena* arena) const { + Data* n = new Data; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Data::Clear() { +// @@protoc_insertion_point(message_clear_start:anakin.rpc.Data) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + shape_.Clear(); + data_.Clear(); + _internal_metadata_.Clear(); +} + +bool Data::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:anakin.rpc.Data) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated int32 shape = 1; + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_shape()))); + } else if ( + static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 10u, input, this->mutable_shape()))); + } else { + goto handle_unusual; + } + break; + } + + // repeated float data = 2; + case 2: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + input, this->mutable_data()))); + } else if ( + static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(21u /* 21 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + 1, 18u, input, this->mutable_data()))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:anakin.rpc.Data) + return true; +failure: + // @@protoc_insertion_point(parse_failure:anakin.rpc.Data) + return false; +#undef DO_ +} + +void Data::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:anakin.rpc.Data) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated int32 shape = 1; + if (this->shape_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( + _shape_cached_byte_size_)); + } + for (int i = 0, n = this->shape_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( + this->shape(i), output); + } + + // repeated float data = 2; + if (this->data_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( + _data_cached_byte_size_)); + ::google::protobuf::internal::WireFormatLite::WriteFloatArray( + this->data().data(), this->data_size(), output); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); + } + // @@protoc_insertion_point(serialize_end:anakin.rpc.Data) +} + +::google::protobuf::uint8* Data::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused + // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.Data) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated int32 shape = 1; + if (this->shape_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 1, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + static_cast< ::google::protobuf::uint32>( + _shape_cached_byte_size_), target); + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32NoTagToArray(this->shape_, target); + } + + // repeated float data = 2; + if (this->data_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 2, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + static_cast< ::google::protobuf::uint32>( + _data_cached_byte_size_), target); + target = ::google::protobuf::internal::WireFormatLite:: + WriteFloatNoTagToArray(this->data_, target); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.Data) + return target; +} + +size_t Data::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.Data) + size_t total_size = 0; + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); + } + // repeated int32 shape = 1; + { + size_t data_size = ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->shape_); + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + static_cast< ::google::protobuf::int32>(data_size)); + } + int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _shape_cached_byte_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } + + // repeated float data = 2; + { + unsigned int count = static_cast(this->data_size()); + size_t data_size = 4UL * count; + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + static_cast< ::google::protobuf::int32>(data_size)); + } + int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _data_cached_byte_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } + + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Data::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.Data) + GOOGLE_DCHECK_NE(&from, this); + const Data* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.Data) + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.Data) + MergeFrom(*source); + } +} + +void Data::MergeFrom(const Data& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.Data) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + shape_.MergeFrom(from.shape_); + data_.MergeFrom(from.data_); +} + +void Data::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.Data) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Data::CopyFrom(const Data& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.Data) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Data::IsInitialized() const { + return true; +} + +void Data::Swap(Data* other) { + if (other == this) return; + InternalSwap(other); +} +void Data::InternalSwap(Data* other) { + using std::swap; + shape_.InternalSwap(&other->shape_); + data_.InternalSwap(&other->data_); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Data::GetMetadata() const { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Data + +// repeated int32 shape = 1; +int Data::shape_size() const { + return shape_.size(); +} +void Data::clear_shape() { + shape_.Clear(); +} +::google::protobuf::int32 Data::shape(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.Data.shape) + return shape_.Get(index); +} +void Data::set_shape(int index, ::google::protobuf::int32 value) { + shape_.Set(index, value); + // @@protoc_insertion_point(field_set:anakin.rpc.Data.shape) +} +void Data::add_shape(::google::protobuf::int32 value) { + shape_.Add(value); + // @@protoc_insertion_point(field_add:anakin.rpc.Data.shape) +} +const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +Data::shape() const { + // @@protoc_insertion_point(field_list:anakin.rpc.Data.shape) + return shape_; +} +::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +Data::mutable_shape() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.shape) + return &shape_; +} + +// repeated float data = 2; +int Data::data_size() const { + return data_.size(); +} +void Data::clear_data() { + data_.Clear(); +} +float Data::data(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.Data.data) + return data_.Get(index); +} +void Data::set_data(int index, float value) { + data_.Set(index, value); + // @@protoc_insertion_point(field_set:anakin.rpc.Data.data) +} +void Data::add_data(float value) { + data_.Add(value); + // @@protoc_insertion_point(field_add:anakin.rpc.Data.data) +} +const ::google::protobuf::RepeatedField< float >& +Data::data() const { + // @@protoc_insertion_point(field_list:anakin.rpc.Data.data) + return data_; +} +::google::protobuf::RepeatedField< float >* +Data::mutable_data() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.data) + return &data_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int IO::kTensorFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +IO::IO() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_service_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:anakin.rpc.IO) +} +IO::IO(const IO& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from.has_tensor()) { + tensor_ = new ::anakin::rpc::Data(*from.tensor_); + } else { + tensor_ = NULL; + } + // @@protoc_insertion_point(copy_constructor:anakin.rpc.IO) +} + +void IO::SharedCtor() { + tensor_ = NULL; + _cached_size_ = 0; +} + +IO::~IO() { + // @@protoc_insertion_point(destructor:anakin.rpc.IO) + SharedDtor(); +} + +void IO::SharedDtor() { + if (this != internal_default_instance()) delete tensor_; +} + +void IO::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* IO::descriptor() { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; +} + +const IO& IO::default_instance() { + protobuf_service_2eproto::InitDefaults(); + return *internal_default_instance(); +} + +IO* IO::New(::google::protobuf::Arena* arena) const { + IO* n = new IO; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void IO::Clear() { +// @@protoc_insertion_point(message_clear_start:anakin.rpc.IO) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (GetArenaNoVirtual() == NULL && tensor_ != NULL) { + delete tensor_; + } + tensor_ = NULL; + _internal_metadata_.Clear(); +} + +bool IO::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:anakin.rpc.IO) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // .anakin.rpc.Data tensor = 1; + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_tensor())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:anakin.rpc.IO) + return true; +failure: + // @@protoc_insertion_point(parse_failure:anakin.rpc.IO) + return false; +#undef DO_ +} + +void IO::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:anakin.rpc.IO) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // .anakin.rpc.Data tensor = 1; + if (this->has_tensor()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, *this->tensor_, output); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); + } + // @@protoc_insertion_point(serialize_end:anakin.rpc.IO) +} + +::google::protobuf::uint8* IO::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused + // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.IO) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // .anakin.rpc.Data tensor = 1; + if (this->has_tensor()) { + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessageNoVirtualToArray( + 1, *this->tensor_, deterministic, target); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.IO) + return target; +} + +size_t IO::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.IO) + size_t total_size = 0; + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); + } + // .anakin.rpc.Data tensor = 1; + if (this->has_tensor()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->tensor_); + } + + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void IO::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.IO) + GOOGLE_DCHECK_NE(&from, this); + const IO* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.IO) + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.IO) + MergeFrom(*source); + } +} + +void IO::MergeFrom(const IO& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.IO) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.has_tensor()) { + mutable_tensor()->::anakin::rpc::Data::MergeFrom(from.tensor()); + } +} + +void IO::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.IO) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void IO::CopyFrom(const IO& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.IO) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool IO::IsInitialized() const { + return true; +} + +void IO::Swap(IO* other) { + if (other == this) return; + InternalSwap(other); +} +void IO::InternalSwap(IO* other) { + using std::swap; + swap(tensor_, other->tensor_); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata IO::GetMetadata() const { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// IO + +// .anakin.rpc.Data tensor = 1; +bool IO::has_tensor() const { + return this != internal_default_instance() && tensor_ != NULL; +} +void IO::clear_tensor() { + if (GetArenaNoVirtual() == NULL && tensor_ != NULL) delete tensor_; + tensor_ = NULL; +} +const ::anakin::rpc::Data& IO::tensor() const { + const ::anakin::rpc::Data* p = tensor_; + // @@protoc_insertion_point(field_get:anakin.rpc.IO.tensor) + return p != NULL ? *p : *reinterpret_cast( + &::anakin::rpc::_Data_default_instance_); +} +::anakin::rpc::Data* IO::mutable_tensor() { + + if (tensor_ == NULL) { + tensor_ = new ::anakin::rpc::Data; + } + // @@protoc_insertion_point(field_mutable:anakin.rpc.IO.tensor) + return tensor_; +} +::anakin::rpc::Data* IO::release_tensor() { + // @@protoc_insertion_point(field_release:anakin.rpc.IO.tensor) + + ::anakin::rpc::Data* temp = tensor_; + tensor_ = NULL; + return temp; +} +void IO::set_allocated_tensor(::anakin::rpc::Data* tensor) { + delete tensor_; + tensor_ = tensor; + if (tensor) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.IO.tensor) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int RPCRequest::kModelFieldNumber; +const int RPCRequest::kInputsFieldNumber; +const int RPCRequest::kRequestIdFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +RPCRequest::RPCRequest() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_service_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:anakin.rpc.RPCRequest) +} +RPCRequest::RPCRequest(const RPCRequest& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL), + inputs_(from.inputs_), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (from.model().size() > 0) { + model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); + } + request_id_ = from.request_id_; + // @@protoc_insertion_point(copy_constructor:anakin.rpc.RPCRequest) +} + +void RPCRequest::SharedCtor() { + model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + request_id_ = GOOGLE_LONGLONG(0); + _cached_size_ = 0; +} + +RPCRequest::~RPCRequest() { + // @@protoc_insertion_point(destructor:anakin.rpc.RPCRequest) + SharedDtor(); +} + +void RPCRequest::SharedDtor() { + model_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +void RPCRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* RPCRequest::descriptor() { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; +} + +const RPCRequest& RPCRequest::default_instance() { + protobuf_service_2eproto::InitDefaults(); + return *internal_default_instance(); +} + +RPCRequest* RPCRequest::New(::google::protobuf::Arena* arena) const { + RPCRequest* n = new RPCRequest; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void RPCRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:anakin.rpc.RPCRequest) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + inputs_.Clear(); + model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + request_id_ = GOOGLE_LONGLONG(0); + _internal_metadata_.Clear(); +} + +bool RPCRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:anakin.rpc.RPCRequest) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // bytes model = 1; + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_model())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .anakin.rpc.IO inputs = 2; + case 2: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_inputs())); + } else { + goto handle_unusual; + } + break; + } + + // int64 request_id = 3; + case 3: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &request_id_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:anakin.rpc.RPCRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:anakin.rpc.RPCRequest) + return false; +#undef DO_ +} + +void RPCRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:anakin.rpc.RPCRequest) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes model = 1; + if (this->model().size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 1, this->model(), output); + } + + // repeated .anakin.rpc.IO inputs = 2; + for (unsigned int i = 0, + n = static_cast(this->inputs_size()); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->inputs(static_cast(i)), output); + } + + // int64 request_id = 3; + if (this->request_id() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->request_id(), output); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); + } + // @@protoc_insertion_point(serialize_end:anakin.rpc.RPCRequest) +} + +::google::protobuf::uint8* RPCRequest::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused + // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.RPCRequest) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes model = 1; + if (this->model().size() > 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 1, this->model(), target); + } + + // repeated .anakin.rpc.IO inputs = 2; + for (unsigned int i = 0, + n = static_cast(this->inputs_size()); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessageNoVirtualToArray( + 2, this->inputs(static_cast(i)), deterministic, target); + } + + // int64 request_id = 3; + if (this->request_id() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->request_id(), target); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.RPCRequest) + return target; +} + +size_t RPCRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.RPCRequest) + size_t total_size = 0; + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); + } + // repeated .anakin.rpc.IO inputs = 2; + { + unsigned int count = static_cast(this->inputs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->inputs(static_cast(i))); + } + } + + // bytes model = 1; + if (this->model().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->model()); + } + + // int64 request_id = 3; + if (this->request_id() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->request_id()); + } + + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void RPCRequest::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.RPCRequest) + GOOGLE_DCHECK_NE(&from, this); + const RPCRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.RPCRequest) + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.RPCRequest) + MergeFrom(*source); + } +} + +void RPCRequest::MergeFrom(const RPCRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.RPCRequest) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + inputs_.MergeFrom(from.inputs_); + if (from.model().size() > 0) { + + model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); + } + if (from.request_id() != 0) { + set_request_id(from.request_id()); + } +} + +void RPCRequest::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.RPCRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void RPCRequest::CopyFrom(const RPCRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.RPCRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool RPCRequest::IsInitialized() const { + return true; +} + +void RPCRequest::Swap(RPCRequest* other) { + if (other == this) return; + InternalSwap(other); +} +void RPCRequest::InternalSwap(RPCRequest* other) { + using std::swap; + inputs_.InternalSwap(&other->inputs_); + model_.Swap(&other->model_); + swap(request_id_, other->request_id_); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata RPCRequest::GetMetadata() const { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// RPCRequest + +// bytes model = 1; +void RPCRequest::clear_model() { + model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& RPCRequest::model() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.model) + return model_.GetNoArena(); +} +void RPCRequest::set_model(const ::std::string& value) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.model) +} +#if LANG_CXX11 +void RPCRequest::set_model(::std::string&& value) { + + model_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCRequest.model) +} +#endif +void RPCRequest::set_model(const char* value) { + GOOGLE_DCHECK(value != NULL); + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCRequest.model) +} +void RPCRequest::set_model(const void* value, size_t size) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCRequest.model) +} +::std::string* RPCRequest::mutable_model() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.model) + return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* RPCRequest::release_model() { + // @@protoc_insertion_point(field_release:anakin.rpc.RPCRequest.model) + + return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void RPCRequest::set_allocated_model(::std::string* model) { + if (model != NULL) { + + } else { + + } + model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCRequest.model) +} + +// repeated .anakin.rpc.IO inputs = 2; +int RPCRequest::inputs_size() const { + return inputs_.size(); +} +void RPCRequest::clear_inputs() { + inputs_.Clear(); +} +const ::anakin::rpc::IO& RPCRequest::inputs(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.inputs) + return inputs_.Get(index); +} +::anakin::rpc::IO* RPCRequest::mutable_inputs(int index) { + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.inputs) + return inputs_.Mutable(index); +} +::anakin::rpc::IO* RPCRequest::add_inputs() { + // @@protoc_insertion_point(field_add:anakin.rpc.RPCRequest.inputs) + return inputs_.Add(); +} +::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* +RPCRequest::mutable_inputs() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCRequest.inputs) + return &inputs_; +} +const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& +RPCRequest::inputs() const { + // @@protoc_insertion_point(field_list:anakin.rpc.RPCRequest.inputs) + return inputs_; +} + +// int64 request_id = 3; +void RPCRequest::clear_request_id() { + request_id_ = GOOGLE_LONGLONG(0); +} +::google::protobuf::int64 RPCRequest::request_id() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.request_id) + return request_id_; +} +void RPCRequest::set_request_id(::google::protobuf::int64 value) { + + request_id_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.request_id) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int DeviceStatus::kIdFieldNumber; +const int DeviceStatus::kNameFieldNumber; +const int DeviceStatus::kTempFieldNumber; +const int DeviceStatus::kMemFreeFieldNumber; +const int DeviceStatus::kMemUsedFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +DeviceStatus::DeviceStatus() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_service_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:anakin.rpc.DeviceStatus) +} +DeviceStatus::DeviceStatus(const DeviceStatus& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (from.name().size() > 0) { + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + ::memcpy(&id_, &from.id_, + static_cast(reinterpret_cast(&mem_used_) - + reinterpret_cast(&id_)) + sizeof(mem_used_)); + // @@protoc_insertion_point(copy_constructor:anakin.rpc.DeviceStatus) +} + +void DeviceStatus::SharedCtor() { + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(&id_, 0, static_cast( + reinterpret_cast(&mem_used_) - + reinterpret_cast(&id_)) + sizeof(mem_used_)); + _cached_size_ = 0; +} + +DeviceStatus::~DeviceStatus() { + // @@protoc_insertion_point(destructor:anakin.rpc.DeviceStatus) + SharedDtor(); +} + +void DeviceStatus::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +void DeviceStatus::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* DeviceStatus::descriptor() { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; +} + +const DeviceStatus& DeviceStatus::default_instance() { + protobuf_service_2eproto::InitDefaults(); + return *internal_default_instance(); +} + +DeviceStatus* DeviceStatus::New(::google::protobuf::Arena* arena) const { + DeviceStatus* n = new DeviceStatus; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void DeviceStatus::Clear() { +// @@protoc_insertion_point(message_clear_start:anakin.rpc.DeviceStatus) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(&id_, 0, static_cast( + reinterpret_cast(&mem_used_) - + reinterpret_cast(&id_)) + sizeof(mem_used_)); + _internal_metadata_.Clear(); +} + +bool DeviceStatus::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:anakin.rpc.DeviceStatus) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // int32 id = 1; + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &id_))); + } else { + goto handle_unusual; + } + break; + } + + // bytes name = 2; + case 2: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_name())); + } else { + goto handle_unusual; + } + break; + } + + // int32 temp = 3; + case 3: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &temp_))); + } else { + goto handle_unusual; + } + break; + } + + // int32 mem_free = 4; + case 4: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &mem_free_))); + } else { + goto handle_unusual; + } + break; + } + + // int32 mem_used = 5; + case 5: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &mem_used_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:anakin.rpc.DeviceStatus) + return true; +failure: + // @@protoc_insertion_point(parse_failure:anakin.rpc.DeviceStatus) + return false; +#undef DO_ +} + +void DeviceStatus::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:anakin.rpc.DeviceStatus) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 id = 1; + if (this->id() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->id(), output); + } + + // bytes name = 2; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 2, this->name(), output); + } + + // int32 temp = 3; + if (this->temp() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->temp(), output); + } + + // int32 mem_free = 4; + if (this->mem_free() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->mem_free(), output); + } + + // int32 mem_used = 5; + if (this->mem_used() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->mem_used(), output); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); + } + // @@protoc_insertion_point(serialize_end:anakin.rpc.DeviceStatus) +} + +::google::protobuf::uint8* DeviceStatus::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused + // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.DeviceStatus) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 id = 1; + if (this->id() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->id(), target); + } + + // bytes name = 2; + if (this->name().size() > 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 2, this->name(), target); + } + + // int32 temp = 3; + if (this->temp() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->temp(), target); + } + + // int32 mem_free = 4; + if (this->mem_free() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->mem_free(), target); + } + + // int32 mem_used = 5; + if (this->mem_used() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(5, this->mem_used(), target); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.DeviceStatus) + return target; +} + +size_t DeviceStatus::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.DeviceStatus) + size_t total_size = 0; + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); + } + // bytes name = 2; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->name()); + } + + // int32 id = 1; + if (this->id() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->id()); + } + + // int32 temp = 3; + if (this->temp() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->temp()); + } + + // int32 mem_free = 4; + if (this->mem_free() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->mem_free()); + } + + // int32 mem_used = 5; + if (this->mem_used() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->mem_used()); + } + + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void DeviceStatus::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.DeviceStatus) + GOOGLE_DCHECK_NE(&from, this); + const DeviceStatus* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.DeviceStatus) + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.DeviceStatus) + MergeFrom(*source); + } +} + +void DeviceStatus::MergeFrom(const DeviceStatus& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.DeviceStatus) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.id() != 0) { + set_id(from.id()); + } + if (from.temp() != 0) { + set_temp(from.temp()); + } + if (from.mem_free() != 0) { + set_mem_free(from.mem_free()); + } + if (from.mem_used() != 0) { + set_mem_used(from.mem_used()); + } +} + +void DeviceStatus::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.DeviceStatus) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void DeviceStatus::CopyFrom(const DeviceStatus& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.DeviceStatus) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DeviceStatus::IsInitialized() const { + return true; +} + +void DeviceStatus::Swap(DeviceStatus* other) { + if (other == this) return; + InternalSwap(other); +} +void DeviceStatus::InternalSwap(DeviceStatus* other) { + using std::swap; + name_.Swap(&other->name_); + swap(id_, other->id_); + swap(temp_, other->temp_); + swap(mem_free_, other->mem_free_); + swap(mem_used_, other->mem_used_); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata DeviceStatus::GetMetadata() const { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// DeviceStatus + +// int32 id = 1; +void DeviceStatus::clear_id() { + id_ = 0; +} +::google::protobuf::int32 DeviceStatus::id() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.id) + return id_; +} +void DeviceStatus::set_id(::google::protobuf::int32 value) { + + id_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.id) +} + +// bytes name = 2; +void DeviceStatus::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& DeviceStatus::name() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.name) + return name_.GetNoArena(); +} +void DeviceStatus::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.name) +} +#if LANG_CXX11 +void DeviceStatus::set_name(::std::string&& value) { + + name_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.DeviceStatus.name) +} +#endif +void DeviceStatus::set_name(const char* value) { + GOOGLE_DCHECK(value != NULL); + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.DeviceStatus.name) +} +void DeviceStatus::set_name(const void* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.DeviceStatus.name) +} +::std::string* DeviceStatus::mutable_name() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.DeviceStatus.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* DeviceStatus::release_name() { + // @@protoc_insertion_point(field_release:anakin.rpc.DeviceStatus.name) + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void DeviceStatus::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.DeviceStatus.name) +} + +// int32 temp = 3; +void DeviceStatus::clear_temp() { + temp_ = 0; +} +::google::protobuf::int32 DeviceStatus::temp() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.temp) + return temp_; +} +void DeviceStatus::set_temp(::google::protobuf::int32 value) { + + temp_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.temp) +} + +// int32 mem_free = 4; +void DeviceStatus::clear_mem_free() { + mem_free_ = 0; +} +::google::protobuf::int32 DeviceStatus::mem_free() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_free) + return mem_free_; +} +void DeviceStatus::set_mem_free(::google::protobuf::int32 value) { + + mem_free_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_free) +} + +// int32 mem_used = 5; +void DeviceStatus::clear_mem_used() { + mem_used_ = 0; +} +::google::protobuf::int32 DeviceStatus::mem_used() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_used) + return mem_used_; +} +void DeviceStatus::set_mem_used(::google::protobuf::int32 value) { + + mem_used_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_used) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int ExecutionInfo::kMsgFieldNumber; +const int ExecutionInfo::kDurationInNanoSecondsFieldNumber; +const int ExecutionInfo::kDeviceStatusFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +ExecutionInfo::ExecutionInfo() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_service_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:anakin.rpc.ExecutionInfo) +} +ExecutionInfo::ExecutionInfo(const ExecutionInfo& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + msg_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (from.msg().size() > 0) { + msg_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.msg_); + } + if (from.has_device_status()) { + device_status_ = new ::anakin::rpc::DeviceStatus(*from.device_status_); + } else { + device_status_ = NULL; + } + duration_in_nano_seconds_ = from.duration_in_nano_seconds_; + // @@protoc_insertion_point(copy_constructor:anakin.rpc.ExecutionInfo) +} + +void ExecutionInfo::SharedCtor() { + msg_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(&device_status_, 0, static_cast( + reinterpret_cast(&duration_in_nano_seconds_) - + reinterpret_cast(&device_status_)) + sizeof(duration_in_nano_seconds_)); + _cached_size_ = 0; +} + +ExecutionInfo::~ExecutionInfo() { + // @@protoc_insertion_point(destructor:anakin.rpc.ExecutionInfo) + SharedDtor(); +} + +void ExecutionInfo::SharedDtor() { + msg_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete device_status_; +} + +void ExecutionInfo::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ExecutionInfo::descriptor() { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; +} + +const ExecutionInfo& ExecutionInfo::default_instance() { + protobuf_service_2eproto::InitDefaults(); + return *internal_default_instance(); +} + +ExecutionInfo* ExecutionInfo::New(::google::protobuf::Arena* arena) const { + ExecutionInfo* n = new ExecutionInfo; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void ExecutionInfo::Clear() { +// @@protoc_insertion_point(message_clear_start:anakin.rpc.ExecutionInfo) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (GetArenaNoVirtual() == NULL && device_status_ != NULL) { + delete device_status_; + } + device_status_ = NULL; + duration_in_nano_seconds_ = 0; + _internal_metadata_.Clear(); +} + +bool ExecutionInfo::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:anakin.rpc.ExecutionInfo) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // bytes msg = 1; + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_msg())); + } else { + goto handle_unusual; + } + break; + } + + // int32 duration_in_nano_seconds = 2; + case 2: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &duration_in_nano_seconds_))); + } else { + goto handle_unusual; + } + break; + } + + // .anakin.rpc.DeviceStatus device_status = 3; + case 3: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_device_status())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:anakin.rpc.ExecutionInfo) + return true; +failure: + // @@protoc_insertion_point(parse_failure:anakin.rpc.ExecutionInfo) + return false; +#undef DO_ +} + +void ExecutionInfo::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:anakin.rpc.ExecutionInfo) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes msg = 1; + if (this->msg().size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 1, this->msg(), output); + } + + // int32 duration_in_nano_seconds = 2; + if (this->duration_in_nano_seconds() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->duration_in_nano_seconds(), output); + } + + // .anakin.rpc.DeviceStatus device_status = 3; + if (this->has_device_status()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, *this->device_status_, output); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); + } + // @@protoc_insertion_point(serialize_end:anakin.rpc.ExecutionInfo) +} + +::google::protobuf::uint8* ExecutionInfo::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused + // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.ExecutionInfo) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes msg = 1; + if (this->msg().size() > 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 1, this->msg(), target); + } + + // int32 duration_in_nano_seconds = 2; + if (this->duration_in_nano_seconds() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->duration_in_nano_seconds(), target); + } + + // .anakin.rpc.DeviceStatus device_status = 3; + if (this->has_device_status()) { + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessageNoVirtualToArray( + 3, *this->device_status_, deterministic, target); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.ExecutionInfo) + return target; +} + +size_t ExecutionInfo::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.ExecutionInfo) + size_t total_size = 0; + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); + } + // bytes msg = 1; + if (this->msg().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->msg()); + } + + // .anakin.rpc.DeviceStatus device_status = 3; + if (this->has_device_status()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->device_status_); + } + + // int32 duration_in_nano_seconds = 2; + if (this->duration_in_nano_seconds() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->duration_in_nano_seconds()); + } + + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ExecutionInfo::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.ExecutionInfo) + GOOGLE_DCHECK_NE(&from, this); + const ExecutionInfo* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.ExecutionInfo) + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.ExecutionInfo) + MergeFrom(*source); + } +} + +void ExecutionInfo::MergeFrom(const ExecutionInfo& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.ExecutionInfo) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.msg().size() > 0) { + + msg_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.msg_); + } + if (from.has_device_status()) { + mutable_device_status()->::anakin::rpc::DeviceStatus::MergeFrom(from.device_status()); + } + if (from.duration_in_nano_seconds() != 0) { + set_duration_in_nano_seconds(from.duration_in_nano_seconds()); + } +} + +void ExecutionInfo::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.ExecutionInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ExecutionInfo::CopyFrom(const ExecutionInfo& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.ExecutionInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ExecutionInfo::IsInitialized() const { + return true; +} + +void ExecutionInfo::Swap(ExecutionInfo* other) { + if (other == this) return; + InternalSwap(other); +} +void ExecutionInfo::InternalSwap(ExecutionInfo* other) { + using std::swap; + msg_.Swap(&other->msg_); + swap(device_status_, other->device_status_); + swap(duration_in_nano_seconds_, other->duration_in_nano_seconds_); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata ExecutionInfo::GetMetadata() const { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// ExecutionInfo + +// bytes msg = 1; +void ExecutionInfo::clear_msg() { + msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& ExecutionInfo::msg() const { + // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.msg) + return msg_.GetNoArena(); +} +void ExecutionInfo::set_msg(const ::std::string& value) { + + msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.msg) +} +#if LANG_CXX11 +void ExecutionInfo::set_msg(::std::string&& value) { + + msg_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.ExecutionInfo.msg) +} +#endif +void ExecutionInfo::set_msg(const char* value) { + GOOGLE_DCHECK(value != NULL); + + msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.ExecutionInfo.msg) +} +void ExecutionInfo::set_msg(const void* value, size_t size) { + + msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.ExecutionInfo.msg) +} +::std::string* ExecutionInfo::mutable_msg() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.msg) + return msg_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* ExecutionInfo::release_msg() { + // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.msg) + + return msg_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void ExecutionInfo::set_allocated_msg(::std::string* msg) { + if (msg != NULL) { + + } else { + + } + msg_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), msg); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.msg) +} + +// int32 duration_in_nano_seconds = 2; +void ExecutionInfo::clear_duration_in_nano_seconds() { + duration_in_nano_seconds_ = 0; +} +::google::protobuf::int32 ExecutionInfo::duration_in_nano_seconds() const { + // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) + return duration_in_nano_seconds_; +} +void ExecutionInfo::set_duration_in_nano_seconds(::google::protobuf::int32 value) { + + duration_in_nano_seconds_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) +} + +// .anakin.rpc.DeviceStatus device_status = 3; +bool ExecutionInfo::has_device_status() const { + return this != internal_default_instance() && device_status_ != NULL; +} +void ExecutionInfo::clear_device_status() { + if (GetArenaNoVirtual() == NULL && device_status_ != NULL) delete device_status_; + device_status_ = NULL; +} +const ::anakin::rpc::DeviceStatus& ExecutionInfo::device_status() const { + const ::anakin::rpc::DeviceStatus* p = device_status_; + // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.device_status) + return p != NULL ? *p : *reinterpret_cast( + &::anakin::rpc::_DeviceStatus_default_instance_); +} +::anakin::rpc::DeviceStatus* ExecutionInfo::mutable_device_status() { + + if (device_status_ == NULL) { + device_status_ = new ::anakin::rpc::DeviceStatus; + } + // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.device_status) + return device_status_; +} +::anakin::rpc::DeviceStatus* ExecutionInfo::release_device_status() { + // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.device_status) + + ::anakin::rpc::DeviceStatus* temp = device_status_; + device_status_ = NULL; + return temp; +} +void ExecutionInfo::set_allocated_device_status(::anakin::rpc::DeviceStatus* device_status) { + delete device_status_; + device_status_ = device_status; + if (device_status) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.device_status) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int RPCResponse::kModelFieldNumber; +const int RPCResponse::kOutputsFieldNumber; +const int RPCResponse::kInfoFieldNumber; +const int RPCResponse::kRequestIdFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +RPCResponse::RPCResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_service_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:anakin.rpc.RPCResponse) +} +RPCResponse::RPCResponse(const RPCResponse& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL), + outputs_(from.outputs_), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (from.model().size() > 0) { + model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); + } + if (from.has_info()) { + info_ = new ::anakin::rpc::ExecutionInfo(*from.info_); + } else { + info_ = NULL; + } + request_id_ = from.request_id_; + // @@protoc_insertion_point(copy_constructor:anakin.rpc.RPCResponse) +} + +void RPCResponse::SharedCtor() { + model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(&info_, 0, static_cast( + reinterpret_cast(&request_id_) - + reinterpret_cast(&info_)) + sizeof(request_id_)); + _cached_size_ = 0; +} + +RPCResponse::~RPCResponse() { + // @@protoc_insertion_point(destructor:anakin.rpc.RPCResponse) + SharedDtor(); +} + +void RPCResponse::SharedDtor() { + model_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete info_; +} + +void RPCResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* RPCResponse::descriptor() { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; +} + +const RPCResponse& RPCResponse::default_instance() { + protobuf_service_2eproto::InitDefaults(); + return *internal_default_instance(); +} + +RPCResponse* RPCResponse::New(::google::protobuf::Arena* arena) const { + RPCResponse* n = new RPCResponse; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void RPCResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:anakin.rpc.RPCResponse) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + outputs_.Clear(); + model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (GetArenaNoVirtual() == NULL && info_ != NULL) { + delete info_; + } + info_ = NULL; + request_id_ = GOOGLE_LONGLONG(0); + _internal_metadata_.Clear(); +} + +bool RPCResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:anakin.rpc.RPCResponse) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // bytes model = 1; + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_model())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .anakin.rpc.IO outputs = 2; + case 2: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_outputs())); + } else { + goto handle_unusual; + } + break; + } + + // .anakin.rpc.ExecutionInfo info = 3; + case 3: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_info())); + } else { + goto handle_unusual; + } + break; + } + + // int64 request_id = 4; + case 4: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &request_id_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:anakin.rpc.RPCResponse) + return true; +failure: + // @@protoc_insertion_point(parse_failure:anakin.rpc.RPCResponse) + return false; +#undef DO_ +} + +void RPCResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:anakin.rpc.RPCResponse) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes model = 1; + if (this->model().size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 1, this->model(), output); + } + + // repeated .anakin.rpc.IO outputs = 2; + for (unsigned int i = 0, + n = static_cast(this->outputs_size()); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->outputs(static_cast(i)), output); + } + + // .anakin.rpc.ExecutionInfo info = 3; + if (this->has_info()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, *this->info_, output); + } + + // int64 request_id = 4; + if (this->request_id() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(4, this->request_id(), output); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); + } + // @@protoc_insertion_point(serialize_end:anakin.rpc.RPCResponse) +} + +::google::protobuf::uint8* RPCResponse::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused + // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.RPCResponse) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes model = 1; + if (this->model().size() > 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 1, this->model(), target); + } + + // repeated .anakin.rpc.IO outputs = 2; + for (unsigned int i = 0, + n = static_cast(this->outputs_size()); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessageNoVirtualToArray( + 2, this->outputs(static_cast(i)), deterministic, target); + } + + // .anakin.rpc.ExecutionInfo info = 3; + if (this->has_info()) { + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessageNoVirtualToArray( + 3, *this->info_, deterministic, target); + } + + // int64 request_id = 4; + if (this->request_id() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(4, this->request_id(), target); + } + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.RPCResponse) + return target; +} + +size_t RPCResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.RPCResponse) + size_t total_size = 0; + + if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); + } + // repeated .anakin.rpc.IO outputs = 2; + { + unsigned int count = static_cast(this->outputs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->outputs(static_cast(i))); + } + } + + // bytes model = 1; + if (this->model().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->model()); + } + + // .anakin.rpc.ExecutionInfo info = 3; + if (this->has_info()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->info_); + } + + // int64 request_id = 4; + if (this->request_id() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->request_id()); + } + + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void RPCResponse::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.RPCResponse) + GOOGLE_DCHECK_NE(&from, this); + const RPCResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.RPCResponse) + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.RPCResponse) + MergeFrom(*source); + } +} + +void RPCResponse::MergeFrom(const RPCResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.RPCResponse) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + outputs_.MergeFrom(from.outputs_); + if (from.model().size() > 0) { + + model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); + } + if (from.has_info()) { + mutable_info()->::anakin::rpc::ExecutionInfo::MergeFrom(from.info()); + } + if (from.request_id() != 0) { + set_request_id(from.request_id()); + } +} + +void RPCResponse::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.RPCResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void RPCResponse::CopyFrom(const RPCResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.RPCResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool RPCResponse::IsInitialized() const { + return true; +} + +void RPCResponse::Swap(RPCResponse* other) { + if (other == this) return; + InternalSwap(other); +} +void RPCResponse::InternalSwap(RPCResponse* other) { + using std::swap; + outputs_.InternalSwap(&other->outputs_); + model_.Swap(&other->model_); + swap(info_, other->info_); + swap(request_id_, other->request_id_); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata RPCResponse::GetMetadata() const { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// RPCResponse + +// bytes model = 1; +void RPCResponse::clear_model() { + model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& RPCResponse::model() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.model) + return model_.GetNoArena(); +} +void RPCResponse::set_model(const ::std::string& value) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.model) +} +#if LANG_CXX11 +void RPCResponse::set_model(::std::string&& value) { + + model_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCResponse.model) +} +#endif +void RPCResponse::set_model(const char* value) { + GOOGLE_DCHECK(value != NULL); + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCResponse.model) +} +void RPCResponse::set_model(const void* value, size_t size) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCResponse.model) +} +::std::string* RPCResponse::mutable_model() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.model) + return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* RPCResponse::release_model() { + // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.model) + + return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void RPCResponse::set_allocated_model(::std::string* model) { + if (model != NULL) { + + } else { + + } + model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.model) +} + +// repeated .anakin.rpc.IO outputs = 2; +int RPCResponse::outputs_size() const { + return outputs_.size(); +} +void RPCResponse::clear_outputs() { + outputs_.Clear(); +} +const ::anakin::rpc::IO& RPCResponse::outputs(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.outputs) + return outputs_.Get(index); +} +::anakin::rpc::IO* RPCResponse::mutable_outputs(int index) { + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.outputs) + return outputs_.Mutable(index); +} +::anakin::rpc::IO* RPCResponse::add_outputs() { + // @@protoc_insertion_point(field_add:anakin.rpc.RPCResponse.outputs) + return outputs_.Add(); +} +::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* +RPCResponse::mutable_outputs() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCResponse.outputs) + return &outputs_; +} +const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& +RPCResponse::outputs() const { + // @@protoc_insertion_point(field_list:anakin.rpc.RPCResponse.outputs) + return outputs_; +} + +// .anakin.rpc.ExecutionInfo info = 3; +bool RPCResponse::has_info() const { + return this != internal_default_instance() && info_ != NULL; +} +void RPCResponse::clear_info() { + if (GetArenaNoVirtual() == NULL && info_ != NULL) delete info_; + info_ = NULL; +} +const ::anakin::rpc::ExecutionInfo& RPCResponse::info() const { + const ::anakin::rpc::ExecutionInfo* p = info_; + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.info) + return p != NULL ? *p : *reinterpret_cast( + &::anakin::rpc::_ExecutionInfo_default_instance_); +} +::anakin::rpc::ExecutionInfo* RPCResponse::mutable_info() { + + if (info_ == NULL) { + info_ = new ::anakin::rpc::ExecutionInfo; + } + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.info) + return info_; +} +::anakin::rpc::ExecutionInfo* RPCResponse::release_info() { + // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.info) + + ::anakin::rpc::ExecutionInfo* temp = info_; + info_ = NULL; + return temp; +} +void RPCResponse::set_allocated_info(::anakin::rpc::ExecutionInfo* info) { + delete info_; + info_ = info; + if (info) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.info) +} + +// int64 request_id = 4; +void RPCResponse::clear_request_id() { + request_id_ = GOOGLE_LONGLONG(0); +} +::google::protobuf::int64 RPCResponse::request_id() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.request_id) + return request_id_; +} +void RPCResponse::set_request_id(::google::protobuf::int64 value) { + + request_id_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.request_id) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +RPCService::~RPCService() {} + +const ::google::protobuf::ServiceDescriptor* RPCService::descriptor() { + protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_service_2eproto::file_level_service_descriptors[0]; +} + +const ::google::protobuf::ServiceDescriptor* RPCService::GetDescriptor() { + return descriptor(); +} + +void RPCService::evaluate(::google::protobuf::RpcController* controller, + const ::anakin::rpc::RPCRequest*, + ::anakin::rpc::RPCResponse*, + ::google::protobuf::Closure* done) { + controller->SetFailed("Method evaluate() not implemented."); + done->Run(); +} + +void RPCService::CallMethod(const ::google::protobuf::MethodDescriptor* method, + ::google::protobuf::RpcController* controller, + const ::google::protobuf::Message* request, + ::google::protobuf::Message* response, + ::google::protobuf::Closure* done) { + GOOGLE_DCHECK_EQ(method->service(), protobuf_service_2eproto::file_level_service_descriptors[0]); + switch(method->index()) { + case 0: + evaluate(controller, + ::google::protobuf::down_cast(request), + ::google::protobuf::down_cast< ::anakin::rpc::RPCResponse*>(response), + done); + break; + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + break; + } +} + +const ::google::protobuf::Message& RPCService::GetRequestPrototype( + const ::google::protobuf::MethodDescriptor* method) const { + GOOGLE_DCHECK_EQ(method->service(), descriptor()); + switch(method->index()) { + case 0: + return ::anakin::rpc::RPCRequest::default_instance(); + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + return *::google::protobuf::MessageFactory::generated_factory() + ->GetPrototype(method->input_type()); + } +} + +const ::google::protobuf::Message& RPCService::GetResponsePrototype( + const ::google::protobuf::MethodDescriptor* method) const { + GOOGLE_DCHECK_EQ(method->service(), descriptor()); + switch(method->index()) { + case 0: + return ::anakin::rpc::RPCResponse::default_instance(); + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + return *::google::protobuf::MessageFactory::generated_factory() + ->GetPrototype(method->output_type()); + } +} + +RPCService_Stub::RPCService_Stub(::google::protobuf::RpcChannel* channel) + : channel_(channel), owns_channel_(false) {} +RPCService_Stub::RPCService_Stub( + ::google::protobuf::RpcChannel* channel, + ::google::protobuf::Service::ChannelOwnership ownership) + : channel_(channel), + owns_channel_(ownership == ::google::protobuf::Service::STUB_OWNS_CHANNEL) {} +RPCService_Stub::~RPCService_Stub() { + if (owns_channel_) delete channel_; +} + +void RPCService_Stub::evaluate(::google::protobuf::RpcController* controller, + const ::anakin::rpc::RPCRequest* request, + ::anakin::rpc::RPCResponse* response, + ::google::protobuf::Closure* done) { + channel_->CallMethod(descriptor()->method(0), + controller, request, response, done); +} + +// @@protoc_insertion_point(namespace_scope) + +} // namespace rpc +} // namespace anakin + +// @@protoc_insertion_point(global_scope) diff --git a/framework/service/api/service.pb.h b/framework/service/api/service.pb.h new file mode 100644 index 000000000..98375c746 --- /dev/null +++ b/framework/service/api/service.pb.h @@ -0,0 +1,1472 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: service.proto + +#ifndef PROTOBUF_service_2eproto__INCLUDED +#define PROTOBUF_service_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 3004000 +#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 3004000 < 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 +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +// @@protoc_insertion_point(includes) +namespace anakin { +namespace rpc { +class Data; +class DataDefaultTypeInternal; +extern DataDefaultTypeInternal _Data_default_instance_; +class DeviceStatus; +class DeviceStatusDefaultTypeInternal; +extern DeviceStatusDefaultTypeInternal _DeviceStatus_default_instance_; +class ExecutionInfo; +class ExecutionInfoDefaultTypeInternal; +extern ExecutionInfoDefaultTypeInternal _ExecutionInfo_default_instance_; +class IO; +class IODefaultTypeInternal; +extern IODefaultTypeInternal _IO_default_instance_; +class RPCRequest; +class RPCRequestDefaultTypeInternal; +extern RPCRequestDefaultTypeInternal _RPCRequest_default_instance_; +class RPCResponse; +class RPCResponseDefaultTypeInternal; +extern RPCResponseDefaultTypeInternal _RPCResponse_default_instance_; +} // namespace rpc +} // namespace anakin + +namespace anakin { +namespace rpc { + +namespace protobuf_service_2eproto { +// Internal implementation detail -- do not call these. +struct TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[]; + static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static void InitDefaultsImpl(); +}; +void AddDescriptors(); +void InitDefaults(); +} // namespace protobuf_service_2eproto + +// =================================================================== + +class Data : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.Data) */ { + public: + Data(); + virtual ~Data(); + + Data(const Data& from); + + inline Data& operator=(const Data& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + Data(Data&& from) noexcept + : Data() { + *this = ::std::move(from); + } + + inline Data& operator=(Data&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + static const ::google::protobuf::Descriptor* descriptor(); + static const Data& default_instance(); + + static inline const Data* internal_default_instance() { + return reinterpret_cast( + &_Data_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = + 0; + + void Swap(Data* other); + friend void swap(Data& a, Data& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline Data* New() const PROTOBUF_FINAL { return New(NULL); } + + Data* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void CopyFrom(const Data& from); + void MergeFrom(const Data& from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const PROTOBUF_FINAL; + void InternalSwap(Data* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return NULL; + } + inline void* MaybeArenaPtr() const { + return NULL; + } + public: + + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated int32 shape = 1; + int shape_size() const; + void clear_shape(); + static const int kShapeFieldNumber = 1; + ::google::protobuf::int32 shape(int index) const; + void set_shape(int index, ::google::protobuf::int32 value); + void add_shape(::google::protobuf::int32 value); + const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + shape() const; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_shape(); + + // repeated float data = 2; + int data_size() const; + void clear_data(); + static const int kDataFieldNumber = 2; + float data(int index) const; + void set_data(int index, float value); + void add_data(float value); + const ::google::protobuf::RepeatedField< float >& + data() const; + ::google::protobuf::RepeatedField< float >* + mutable_data(); + + // @@protoc_insertion_point(class_scope:anakin.rpc.Data) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > shape_; + mutable int _shape_cached_byte_size_; + ::google::protobuf::RepeatedField< float > data_; + mutable int _data_cached_byte_size_; + mutable int _cached_size_; + friend struct protobuf_service_2eproto::TableStruct; +}; +// ------------------------------------------------------------------- + +class IO : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.IO) */ { + public: + IO(); + virtual ~IO(); + + IO(const IO& from); + + inline IO& operator=(const IO& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + IO(IO&& from) noexcept + : IO() { + *this = ::std::move(from); + } + + inline IO& operator=(IO&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + static const ::google::protobuf::Descriptor* descriptor(); + static const IO& default_instance(); + + static inline const IO* internal_default_instance() { + return reinterpret_cast( + &_IO_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = + 1; + + void Swap(IO* other); + friend void swap(IO& a, IO& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline IO* New() const PROTOBUF_FINAL { return New(NULL); } + + IO* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void CopyFrom(const IO& from); + void MergeFrom(const IO& from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const PROTOBUF_FINAL; + void InternalSwap(IO* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return NULL; + } + inline void* MaybeArenaPtr() const { + return NULL; + } + public: + + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // .anakin.rpc.Data tensor = 1; + bool has_tensor() const; + void clear_tensor(); + static const int kTensorFieldNumber = 1; + const ::anakin::rpc::Data& tensor() const; + ::anakin::rpc::Data* mutable_tensor(); + ::anakin::rpc::Data* release_tensor(); + void set_allocated_tensor(::anakin::rpc::Data* tensor); + + // @@protoc_insertion_point(class_scope:anakin.rpc.IO) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::anakin::rpc::Data* tensor_; + mutable int _cached_size_; + friend struct protobuf_service_2eproto::TableStruct; +}; +// ------------------------------------------------------------------- + +class RPCRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.RPCRequest) */ { + public: + RPCRequest(); + virtual ~RPCRequest(); + + RPCRequest(const RPCRequest& from); + + inline RPCRequest& operator=(const RPCRequest& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + RPCRequest(RPCRequest&& from) noexcept + : RPCRequest() { + *this = ::std::move(from); + } + + inline RPCRequest& operator=(RPCRequest&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + static const ::google::protobuf::Descriptor* descriptor(); + static const RPCRequest& default_instance(); + + static inline const RPCRequest* internal_default_instance() { + return reinterpret_cast( + &_RPCRequest_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = + 2; + + void Swap(RPCRequest* other); + friend void swap(RPCRequest& a, RPCRequest& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline RPCRequest* New() const PROTOBUF_FINAL { return New(NULL); } + + RPCRequest* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void CopyFrom(const RPCRequest& from); + void MergeFrom(const RPCRequest& from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const PROTOBUF_FINAL; + void InternalSwap(RPCRequest* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return NULL; + } + inline void* MaybeArenaPtr() const { + return NULL; + } + public: + + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .anakin.rpc.IO inputs = 2; + int inputs_size() const; + void clear_inputs(); + static const int kInputsFieldNumber = 2; + const ::anakin::rpc::IO& inputs(int index) const; + ::anakin::rpc::IO* mutable_inputs(int index); + ::anakin::rpc::IO* add_inputs(); + ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* + mutable_inputs(); + const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& + inputs() const; + + // bytes model = 1; + void clear_model(); + static const int kModelFieldNumber = 1; + const ::std::string& model() const; + void set_model(const ::std::string& value); + #if LANG_CXX11 + void set_model(::std::string&& value); + #endif + void set_model(const char* value); + void set_model(const void* value, size_t size); + ::std::string* mutable_model(); + ::std::string* release_model(); + void set_allocated_model(::std::string* model); + + // int64 request_id = 3; + void clear_request_id(); + static const int kRequestIdFieldNumber = 3; + ::google::protobuf::int64 request_id() const; + void set_request_id(::google::protobuf::int64 value); + + // @@protoc_insertion_point(class_scope:anakin.rpc.RPCRequest) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO > inputs_; + ::google::protobuf::internal::ArenaStringPtr model_; + ::google::protobuf::int64 request_id_; + mutable int _cached_size_; + friend struct protobuf_service_2eproto::TableStruct; +}; +// ------------------------------------------------------------------- + +class DeviceStatus : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.DeviceStatus) */ { + public: + DeviceStatus(); + virtual ~DeviceStatus(); + + DeviceStatus(const DeviceStatus& from); + + inline DeviceStatus& operator=(const DeviceStatus& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + DeviceStatus(DeviceStatus&& from) noexcept + : DeviceStatus() { + *this = ::std::move(from); + } + + inline DeviceStatus& operator=(DeviceStatus&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + static const ::google::protobuf::Descriptor* descriptor(); + static const DeviceStatus& default_instance(); + + static inline const DeviceStatus* internal_default_instance() { + return reinterpret_cast( + &_DeviceStatus_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = + 3; + + void Swap(DeviceStatus* other); + friend void swap(DeviceStatus& a, DeviceStatus& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline DeviceStatus* New() const PROTOBUF_FINAL { return New(NULL); } + + DeviceStatus* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void CopyFrom(const DeviceStatus& from); + void MergeFrom(const DeviceStatus& from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const PROTOBUF_FINAL; + void InternalSwap(DeviceStatus* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return NULL; + } + inline void* MaybeArenaPtr() const { + return NULL; + } + public: + + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // bytes name = 2; + void clear_name(); + static const int kNameFieldNumber = 2; + const ::std::string& name() const; + void set_name(const ::std::string& value); + #if LANG_CXX11 + void set_name(::std::string&& value); + #endif + void set_name(const char* value); + void set_name(const void* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // int32 id = 1; + void clear_id(); + static const int kIdFieldNumber = 1; + ::google::protobuf::int32 id() const; + void set_id(::google::protobuf::int32 value); + + // int32 temp = 3; + void clear_temp(); + static const int kTempFieldNumber = 3; + ::google::protobuf::int32 temp() const; + void set_temp(::google::protobuf::int32 value); + + // int32 mem_free = 4; + void clear_mem_free(); + static const int kMemFreeFieldNumber = 4; + ::google::protobuf::int32 mem_free() const; + void set_mem_free(::google::protobuf::int32 value); + + // int32 mem_used = 5; + void clear_mem_used(); + static const int kMemUsedFieldNumber = 5; + ::google::protobuf::int32 mem_used() const; + void set_mem_used(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:anakin.rpc.DeviceStatus) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::int32 id_; + ::google::protobuf::int32 temp_; + ::google::protobuf::int32 mem_free_; + ::google::protobuf::int32 mem_used_; + mutable int _cached_size_; + friend struct protobuf_service_2eproto::TableStruct; +}; +// ------------------------------------------------------------------- + +class ExecutionInfo : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.ExecutionInfo) */ { + public: + ExecutionInfo(); + virtual ~ExecutionInfo(); + + ExecutionInfo(const ExecutionInfo& from); + + inline ExecutionInfo& operator=(const ExecutionInfo& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + ExecutionInfo(ExecutionInfo&& from) noexcept + : ExecutionInfo() { + *this = ::std::move(from); + } + + inline ExecutionInfo& operator=(ExecutionInfo&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + static const ::google::protobuf::Descriptor* descriptor(); + static const ExecutionInfo& default_instance(); + + static inline const ExecutionInfo* internal_default_instance() { + return reinterpret_cast( + &_ExecutionInfo_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = + 4; + + void Swap(ExecutionInfo* other); + friend void swap(ExecutionInfo& a, ExecutionInfo& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline ExecutionInfo* New() const PROTOBUF_FINAL { return New(NULL); } + + ExecutionInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void CopyFrom(const ExecutionInfo& from); + void MergeFrom(const ExecutionInfo& from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const PROTOBUF_FINAL; + void InternalSwap(ExecutionInfo* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return NULL; + } + inline void* MaybeArenaPtr() const { + return NULL; + } + public: + + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // bytes msg = 1; + void clear_msg(); + static const int kMsgFieldNumber = 1; + const ::std::string& msg() const; + void set_msg(const ::std::string& value); + #if LANG_CXX11 + void set_msg(::std::string&& value); + #endif + void set_msg(const char* value); + void set_msg(const void* value, size_t size); + ::std::string* mutable_msg(); + ::std::string* release_msg(); + void set_allocated_msg(::std::string* msg); + + // .anakin.rpc.DeviceStatus device_status = 3; + bool has_device_status() const; + void clear_device_status(); + static const int kDeviceStatusFieldNumber = 3; + const ::anakin::rpc::DeviceStatus& device_status() const; + ::anakin::rpc::DeviceStatus* mutable_device_status(); + ::anakin::rpc::DeviceStatus* release_device_status(); + void set_allocated_device_status(::anakin::rpc::DeviceStatus* device_status); + + // int32 duration_in_nano_seconds = 2; + void clear_duration_in_nano_seconds(); + static const int kDurationInNanoSecondsFieldNumber = 2; + ::google::protobuf::int32 duration_in_nano_seconds() const; + void set_duration_in_nano_seconds(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:anakin.rpc.ExecutionInfo) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::google::protobuf::internal::ArenaStringPtr msg_; + ::anakin::rpc::DeviceStatus* device_status_; + ::google::protobuf::int32 duration_in_nano_seconds_; + mutable int _cached_size_; + friend struct protobuf_service_2eproto::TableStruct; +}; +// ------------------------------------------------------------------- + +class RPCResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.RPCResponse) */ { + public: + RPCResponse(); + virtual ~RPCResponse(); + + RPCResponse(const RPCResponse& from); + + inline RPCResponse& operator=(const RPCResponse& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + RPCResponse(RPCResponse&& from) noexcept + : RPCResponse() { + *this = ::std::move(from); + } + + inline RPCResponse& operator=(RPCResponse&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + static const ::google::protobuf::Descriptor* descriptor(); + static const RPCResponse& default_instance(); + + static inline const RPCResponse* internal_default_instance() { + return reinterpret_cast( + &_RPCResponse_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = + 5; + + void Swap(RPCResponse* other); + friend void swap(RPCResponse& a, RPCResponse& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline RPCResponse* New() const PROTOBUF_FINAL { return New(NULL); } + + RPCResponse* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void CopyFrom(const RPCResponse& from); + void MergeFrom(const RPCResponse& from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const PROTOBUF_FINAL; + void InternalSwap(RPCResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return NULL; + } + inline void* MaybeArenaPtr() const { + return NULL; + } + public: + + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .anakin.rpc.IO outputs = 2; + int outputs_size() const; + void clear_outputs(); + static const int kOutputsFieldNumber = 2; + const ::anakin::rpc::IO& outputs(int index) const; + ::anakin::rpc::IO* mutable_outputs(int index); + ::anakin::rpc::IO* add_outputs(); + ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* + mutable_outputs(); + const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& + outputs() const; + + // bytes model = 1; + void clear_model(); + static const int kModelFieldNumber = 1; + const ::std::string& model() const; + void set_model(const ::std::string& value); + #if LANG_CXX11 + void set_model(::std::string&& value); + #endif + void set_model(const char* value); + void set_model(const void* value, size_t size); + ::std::string* mutable_model(); + ::std::string* release_model(); + void set_allocated_model(::std::string* model); + + // .anakin.rpc.ExecutionInfo info = 3; + bool has_info() const; + void clear_info(); + static const int kInfoFieldNumber = 3; + const ::anakin::rpc::ExecutionInfo& info() const; + ::anakin::rpc::ExecutionInfo* mutable_info(); + ::anakin::rpc::ExecutionInfo* release_info(); + void set_allocated_info(::anakin::rpc::ExecutionInfo* info); + + // int64 request_id = 4; + void clear_request_id(); + static const int kRequestIdFieldNumber = 4; + ::google::protobuf::int64 request_id() const; + void set_request_id(::google::protobuf::int64 value); + + // @@protoc_insertion_point(class_scope:anakin.rpc.RPCResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO > outputs_; + ::google::protobuf::internal::ArenaStringPtr model_; + ::anakin::rpc::ExecutionInfo* info_; + ::google::protobuf::int64 request_id_; + mutable int _cached_size_; + friend struct protobuf_service_2eproto::TableStruct; +}; +// =================================================================== + +class RPCService_Stub; + +class RPCService : public ::google::protobuf::Service { + protected: + // This class should be treated as an abstract interface. + inline RPCService() {}; + public: + virtual ~RPCService(); + + typedef RPCService_Stub Stub; + + static const ::google::protobuf::ServiceDescriptor* descriptor(); + + virtual void evaluate(::google::protobuf::RpcController* controller, + const ::anakin::rpc::RPCRequest* request, + ::anakin::rpc::RPCResponse* response, + ::google::protobuf::Closure* done); + + // implements Service ---------------------------------------------- + + const ::google::protobuf::ServiceDescriptor* GetDescriptor(); + void CallMethod(const ::google::protobuf::MethodDescriptor* method, + ::google::protobuf::RpcController* controller, + const ::google::protobuf::Message* request, + ::google::protobuf::Message* response, + ::google::protobuf::Closure* done); + const ::google::protobuf::Message& GetRequestPrototype( + const ::google::protobuf::MethodDescriptor* method) const; + const ::google::protobuf::Message& GetResponsePrototype( + const ::google::protobuf::MethodDescriptor* method) const; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RPCService); +}; + +class RPCService_Stub : public RPCService { + public: + RPCService_Stub(::google::protobuf::RpcChannel* channel); + RPCService_Stub(::google::protobuf::RpcChannel* channel, + ::google::protobuf::Service::ChannelOwnership ownership); + ~RPCService_Stub(); + + inline ::google::protobuf::RpcChannel* channel() { return channel_; } + + // implements RPCService ------------------------------------------ + + void evaluate(::google::protobuf::RpcController* controller, + const ::anakin::rpc::RPCRequest* request, + ::anakin::rpc::RPCResponse* response, + ::google::protobuf::Closure* done); + private: + ::google::protobuf::RpcChannel* channel_; + bool owns_channel_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RPCService_Stub); +}; + + +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// Data + +// repeated int32 shape = 1; +inline int Data::shape_size() const { + return shape_.size(); +} +inline void Data::clear_shape() { + shape_.Clear(); +} +inline ::google::protobuf::int32 Data::shape(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.Data.shape) + return shape_.Get(index); +} +inline void Data::set_shape(int index, ::google::protobuf::int32 value) { + shape_.Set(index, value); + // @@protoc_insertion_point(field_set:anakin.rpc.Data.shape) +} +inline void Data::add_shape(::google::protobuf::int32 value) { + shape_.Add(value); + // @@protoc_insertion_point(field_add:anakin.rpc.Data.shape) +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +Data::shape() const { + // @@protoc_insertion_point(field_list:anakin.rpc.Data.shape) + return shape_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +Data::mutable_shape() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.shape) + return &shape_; +} + +// repeated float data = 2; +inline int Data::data_size() const { + return data_.size(); +} +inline void Data::clear_data() { + data_.Clear(); +} +inline float Data::data(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.Data.data) + return data_.Get(index); +} +inline void Data::set_data(int index, float value) { + data_.Set(index, value); + // @@protoc_insertion_point(field_set:anakin.rpc.Data.data) +} +inline void Data::add_data(float value) { + data_.Add(value); + // @@protoc_insertion_point(field_add:anakin.rpc.Data.data) +} +inline const ::google::protobuf::RepeatedField< float >& +Data::data() const { + // @@protoc_insertion_point(field_list:anakin.rpc.Data.data) + return data_; +} +inline ::google::protobuf::RepeatedField< float >* +Data::mutable_data() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.data) + return &data_; +} + +// ------------------------------------------------------------------- + +// IO + +// .anakin.rpc.Data tensor = 1; +inline bool IO::has_tensor() const { + return this != internal_default_instance() && tensor_ != NULL; +} +inline void IO::clear_tensor() { + if (GetArenaNoVirtual() == NULL && tensor_ != NULL) delete tensor_; + tensor_ = NULL; +} +inline const ::anakin::rpc::Data& IO::tensor() const { + const ::anakin::rpc::Data* p = tensor_; + // @@protoc_insertion_point(field_get:anakin.rpc.IO.tensor) + return p != NULL ? *p : *reinterpret_cast( + &::anakin::rpc::_Data_default_instance_); +} +inline ::anakin::rpc::Data* IO::mutable_tensor() { + + if (tensor_ == NULL) { + tensor_ = new ::anakin::rpc::Data; + } + // @@protoc_insertion_point(field_mutable:anakin.rpc.IO.tensor) + return tensor_; +} +inline ::anakin::rpc::Data* IO::release_tensor() { + // @@protoc_insertion_point(field_release:anakin.rpc.IO.tensor) + + ::anakin::rpc::Data* temp = tensor_; + tensor_ = NULL; + return temp; +} +inline void IO::set_allocated_tensor(::anakin::rpc::Data* tensor) { + delete tensor_; + tensor_ = tensor; + if (tensor) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.IO.tensor) +} + +// ------------------------------------------------------------------- + +// RPCRequest + +// bytes model = 1; +inline void RPCRequest::clear_model() { + model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& RPCRequest::model() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.model) + return model_.GetNoArena(); +} +inline void RPCRequest::set_model(const ::std::string& value) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.model) +} +#if LANG_CXX11 +inline void RPCRequest::set_model(::std::string&& value) { + + model_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCRequest.model) +} +#endif +inline void RPCRequest::set_model(const char* value) { + GOOGLE_DCHECK(value != NULL); + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCRequest.model) +} +inline void RPCRequest::set_model(const void* value, size_t size) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCRequest.model) +} +inline ::std::string* RPCRequest::mutable_model() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.model) + return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* RPCRequest::release_model() { + // @@protoc_insertion_point(field_release:anakin.rpc.RPCRequest.model) + + return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void RPCRequest::set_allocated_model(::std::string* model) { + if (model != NULL) { + + } else { + + } + model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCRequest.model) +} + +// repeated .anakin.rpc.IO inputs = 2; +inline int RPCRequest::inputs_size() const { + return inputs_.size(); +} +inline void RPCRequest::clear_inputs() { + inputs_.Clear(); +} +inline const ::anakin::rpc::IO& RPCRequest::inputs(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.inputs) + return inputs_.Get(index); +} +inline ::anakin::rpc::IO* RPCRequest::mutable_inputs(int index) { + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.inputs) + return inputs_.Mutable(index); +} +inline ::anakin::rpc::IO* RPCRequest::add_inputs() { + // @@protoc_insertion_point(field_add:anakin.rpc.RPCRequest.inputs) + return inputs_.Add(); +} +inline ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* +RPCRequest::mutable_inputs() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCRequest.inputs) + return &inputs_; +} +inline const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& +RPCRequest::inputs() const { + // @@protoc_insertion_point(field_list:anakin.rpc.RPCRequest.inputs) + return inputs_; +} + +// int64 request_id = 3; +inline void RPCRequest::clear_request_id() { + request_id_ = GOOGLE_LONGLONG(0); +} +inline ::google::protobuf::int64 RPCRequest::request_id() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.request_id) + return request_id_; +} +inline void RPCRequest::set_request_id(::google::protobuf::int64 value) { + + request_id_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.request_id) +} + +// ------------------------------------------------------------------- + +// DeviceStatus + +// int32 id = 1; +inline void DeviceStatus::clear_id() { + id_ = 0; +} +inline ::google::protobuf::int32 DeviceStatus::id() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.id) + return id_; +} +inline void DeviceStatus::set_id(::google::protobuf::int32 value) { + + id_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.id) +} + +// bytes name = 2; +inline void DeviceStatus::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& DeviceStatus::name() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.name) + return name_.GetNoArena(); +} +inline void DeviceStatus::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.name) +} +#if LANG_CXX11 +inline void DeviceStatus::set_name(::std::string&& value) { + + name_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.DeviceStatus.name) +} +#endif +inline void DeviceStatus::set_name(const char* value) { + GOOGLE_DCHECK(value != NULL); + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.DeviceStatus.name) +} +inline void DeviceStatus::set_name(const void* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.DeviceStatus.name) +} +inline ::std::string* DeviceStatus::mutable_name() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.DeviceStatus.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* DeviceStatus::release_name() { + // @@protoc_insertion_point(field_release:anakin.rpc.DeviceStatus.name) + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void DeviceStatus::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.DeviceStatus.name) +} + +// int32 temp = 3; +inline void DeviceStatus::clear_temp() { + temp_ = 0; +} +inline ::google::protobuf::int32 DeviceStatus::temp() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.temp) + return temp_; +} +inline void DeviceStatus::set_temp(::google::protobuf::int32 value) { + + temp_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.temp) +} + +// int32 mem_free = 4; +inline void DeviceStatus::clear_mem_free() { + mem_free_ = 0; +} +inline ::google::protobuf::int32 DeviceStatus::mem_free() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_free) + return mem_free_; +} +inline void DeviceStatus::set_mem_free(::google::protobuf::int32 value) { + + mem_free_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_free) +} + +// int32 mem_used = 5; +inline void DeviceStatus::clear_mem_used() { + mem_used_ = 0; +} +inline ::google::protobuf::int32 DeviceStatus::mem_used() const { + // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_used) + return mem_used_; +} +inline void DeviceStatus::set_mem_used(::google::protobuf::int32 value) { + + mem_used_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_used) +} + +// ------------------------------------------------------------------- + +// ExecutionInfo + +// bytes msg = 1; +inline void ExecutionInfo::clear_msg() { + msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ExecutionInfo::msg() const { + // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.msg) + return msg_.GetNoArena(); +} +inline void ExecutionInfo::set_msg(const ::std::string& value) { + + msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.msg) +} +#if LANG_CXX11 +inline void ExecutionInfo::set_msg(::std::string&& value) { + + msg_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.ExecutionInfo.msg) +} +#endif +inline void ExecutionInfo::set_msg(const char* value) { + GOOGLE_DCHECK(value != NULL); + + msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.ExecutionInfo.msg) +} +inline void ExecutionInfo::set_msg(const void* value, size_t size) { + + msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.ExecutionInfo.msg) +} +inline ::std::string* ExecutionInfo::mutable_msg() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.msg) + return msg_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ExecutionInfo::release_msg() { + // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.msg) + + return msg_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExecutionInfo::set_allocated_msg(::std::string* msg) { + if (msg != NULL) { + + } else { + + } + msg_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), msg); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.msg) +} + +// int32 duration_in_nano_seconds = 2; +inline void ExecutionInfo::clear_duration_in_nano_seconds() { + duration_in_nano_seconds_ = 0; +} +inline ::google::protobuf::int32 ExecutionInfo::duration_in_nano_seconds() const { + // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) + return duration_in_nano_seconds_; +} +inline void ExecutionInfo::set_duration_in_nano_seconds(::google::protobuf::int32 value) { + + duration_in_nano_seconds_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) +} + +// .anakin.rpc.DeviceStatus device_status = 3; +inline bool ExecutionInfo::has_device_status() const { + return this != internal_default_instance() && device_status_ != NULL; +} +inline void ExecutionInfo::clear_device_status() { + if (GetArenaNoVirtual() == NULL && device_status_ != NULL) delete device_status_; + device_status_ = NULL; +} +inline const ::anakin::rpc::DeviceStatus& ExecutionInfo::device_status() const { + const ::anakin::rpc::DeviceStatus* p = device_status_; + // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.device_status) + return p != NULL ? *p : *reinterpret_cast( + &::anakin::rpc::_DeviceStatus_default_instance_); +} +inline ::anakin::rpc::DeviceStatus* ExecutionInfo::mutable_device_status() { + + if (device_status_ == NULL) { + device_status_ = new ::anakin::rpc::DeviceStatus; + } + // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.device_status) + return device_status_; +} +inline ::anakin::rpc::DeviceStatus* ExecutionInfo::release_device_status() { + // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.device_status) + + ::anakin::rpc::DeviceStatus* temp = device_status_; + device_status_ = NULL; + return temp; +} +inline void ExecutionInfo::set_allocated_device_status(::anakin::rpc::DeviceStatus* device_status) { + delete device_status_; + device_status_ = device_status; + if (device_status) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.device_status) +} + +// ------------------------------------------------------------------- + +// RPCResponse + +// bytes model = 1; +inline void RPCResponse::clear_model() { + model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& RPCResponse::model() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.model) + return model_.GetNoArena(); +} +inline void RPCResponse::set_model(const ::std::string& value) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.model) +} +#if LANG_CXX11 +inline void RPCResponse::set_model(::std::string&& value) { + + model_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCResponse.model) +} +#endif +inline void RPCResponse::set_model(const char* value) { + GOOGLE_DCHECK(value != NULL); + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCResponse.model) +} +inline void RPCResponse::set_model(const void* value, size_t size) { + + model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCResponse.model) +} +inline ::std::string* RPCResponse::mutable_model() { + + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.model) + return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* RPCResponse::release_model() { + // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.model) + + return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void RPCResponse::set_allocated_model(::std::string* model) { + if (model != NULL) { + + } else { + + } + model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.model) +} + +// repeated .anakin.rpc.IO outputs = 2; +inline int RPCResponse::outputs_size() const { + return outputs_.size(); +} +inline void RPCResponse::clear_outputs() { + outputs_.Clear(); +} +inline const ::anakin::rpc::IO& RPCResponse::outputs(int index) const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.outputs) + return outputs_.Get(index); +} +inline ::anakin::rpc::IO* RPCResponse::mutable_outputs(int index) { + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.outputs) + return outputs_.Mutable(index); +} +inline ::anakin::rpc::IO* RPCResponse::add_outputs() { + // @@protoc_insertion_point(field_add:anakin.rpc.RPCResponse.outputs) + return outputs_.Add(); +} +inline ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* +RPCResponse::mutable_outputs() { + // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCResponse.outputs) + return &outputs_; +} +inline const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& +RPCResponse::outputs() const { + // @@protoc_insertion_point(field_list:anakin.rpc.RPCResponse.outputs) + return outputs_; +} + +// .anakin.rpc.ExecutionInfo info = 3; +inline bool RPCResponse::has_info() const { + return this != internal_default_instance() && info_ != NULL; +} +inline void RPCResponse::clear_info() { + if (GetArenaNoVirtual() == NULL && info_ != NULL) delete info_; + info_ = NULL; +} +inline const ::anakin::rpc::ExecutionInfo& RPCResponse::info() const { + const ::anakin::rpc::ExecutionInfo* p = info_; + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.info) + return p != NULL ? *p : *reinterpret_cast( + &::anakin::rpc::_ExecutionInfo_default_instance_); +} +inline ::anakin::rpc::ExecutionInfo* RPCResponse::mutable_info() { + + if (info_ == NULL) { + info_ = new ::anakin::rpc::ExecutionInfo; + } + // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.info) + return info_; +} +inline ::anakin::rpc::ExecutionInfo* RPCResponse::release_info() { + // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.info) + + ::anakin::rpc::ExecutionInfo* temp = info_; + info_ = NULL; + return temp; +} +inline void RPCResponse::set_allocated_info(::anakin::rpc::ExecutionInfo* info) { + delete info_; + info_ = info; + if (info) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.info) +} + +// int64 request_id = 4; +inline void RPCResponse::clear_request_id() { + request_id_ = GOOGLE_LONGLONG(0); +} +inline ::google::protobuf::int64 RPCResponse::request_id() const { + // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.request_id) + return request_id_; +} +inline void RPCResponse::set_request_id(::google::protobuf::int64 value) { + + request_id_ = value; + // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.request_id) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + + +} // namespace rpc +} // namespace anakin + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_service_2eproto__INCLUDED diff --git a/framework/service/api/service.proto b/framework/service/api/service.proto index ce900e143..baa61f03f 100644 --- a/framework/service/api/service.proto +++ b/framework/service/api/service.proto @@ -1,18 +1,16 @@ syntax = "proto3"; -package anakin.rpc +package anakin.rpc; option cc_generic_services = true; -message Date { - bytes name = 1; - repeated int32 shape = 2; - repeated float data = 3; +message Data { + repeated int32 shape = 1; + repeated float data = 2; }; message IO { - bytes input_name = 1; // input name - Date input_tensor = 2; // input tensor + Data tensor = 1; // input tensor }; // RPC request @@ -28,14 +26,12 @@ message DeviceStatus { int32 temp = 3; // device temperature Celsius degree int32 mem_free = 4; // device memory free bytes int32 mem_used = 5; // device memory used bytes - // the number of device current compute running processes - int32 compute_run_process_num = 6; }; // RPC service execution information message ExecutionInfo { // additional exception message of the execution - bytes message = 1; + bytes msg = 1; // duration of this execution in nano seconds int32 duration_in_nano_seconds = 2; // device status diff --git a/framework/service/device_info.cpp b/framework/service/device_info.cpp new file mode 100644 index 000000000..9639c5699 --- /dev/null +++ b/framework/service/device_info.cpp @@ -0,0 +1,99 @@ +#include "framework/service/device_info.h" + +namespace anakin { + +namespace rpc { + +#ifdef USE_CUDA +template<> +struct Inquiry { + ~Inquiry() { + result = nvmlShutdown(); + if (NVML_SUCCESS != result) { + LOG(FATAL) << "Failed to shutdown the nvml of device: " << nvmlErrorString(result); + } + } + + void init(int dev_id = 0) { + _dev_id = dev_id; + memory_has_inspected = false; + result = nvmlInit(); + if (NVML_SUCCESS != result) { + LOG(FATAL) <<" Failed to initialize NVML: " << nvmlErrorString(result); + } + result = nvmlDeviceGetHandleByIndex(dev_id, &device); + if (NVML_SUCCESS != result) { + LOG(FATAL) << " Failed to get handle for device: " << nvmlErrorString(result); + } + } + + template + typename InfoTraits::data_type get() { + LOG(WARNING) << "Target not support! "; + return InfoTraits::data_type(); + } + +private: + int _dev_id; + nvmlReturn_t result; + nvmlDevice_t device; + nvmlMemory_t memory; + bool memory_has_inspected; +}; + +template<> +typename InfoTraits::data_type Inquiry::get() { + return _dev_id; +} + +template<> +typename InfoTraits::data_type Inquiry::get() { + char name[NVML_DEVICE_NAME_BUFFER_SIZE]; + result = nvmlDeviceGetName(device, name, NVML_DEVICE_NAME_BUFFER_SIZE); + if (NVML_SUCCESS != result) { + LOG(FATAL) << "Failed to get name of device: " << nvmlErrorString(result); + } + return std::string(name); +} + +template<> +typename InfoTraits::data_type Inquiry::get() { + nvmlTemperatureSensors_t sensorType = NVML_TEMPERATURE_GPU; + unsigned int temp; + result = nvmlDeviceGetTemperature(device, sensorType, &temp); + if (NVML_SUCCESS != result) { + LOG(FATAL) << "Failed to get temperature of device: " << nvmlErrorString(result); + } + return temp; +} + +template<> +typename InfoTraits::data_type Inquiry::get() { + if(!memory_has_inspected) { + result = nvmlDeviceGetMemoryInfo(device, &memory); + if (NVML_SUCCESS != result) { + LOG(FATAL) << "Failed to get device memory info of device: " << nvmlErrorString(result); + } + memory_has_inspected = true; + } + return memory.free; +} + +template<> +typename InfoTraits::data_type Inquiry::get() { + if(!memory_has_inspected) { + result = nvmlDeviceGetMemoryInfo(device, &memory); + if (NVML_SUCCESS != result) { + LOG(FATAL) << "Failed to get device memory info of device: " << nvmlErrorString(result); + } + memory_has_inspected = true; + } + return memory.used; +} + +#endif + +} /* namespace rpc */ + +} /* namespace anakin */ + diff --git a/framework/service/device_info.h b/framework/service/device_info.h new file mode 100644 index 000000000..0b5dfc097 --- /dev/null +++ b/framework/service/device_info.h @@ -0,0 +1,190 @@ +/* Copyright (c) 2018 Anakin Authors, Inc. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef ANAKIN_DEVICE_INFO_H +#define ANAKIN_DEVICE_INFO_H + +#include "anakin_config.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifdef USE_CUDA +#include +#include +#include +#include // cuda driver types +#endif + +#include "logger/logger.h" +#include "saber/saber_types.h" + +namespace anakin { + +namespace rpc { + +enum Info { + DEV_ID, + DEV_NAME, + DEV_TMP, + DEV_MEM_FREE, + DEV_MEM_USED, +}; + +template +struct check_same { + const static bool value = false; +}; + +template<> +struct check_same { + const static bool value = true; +}; + +template<> +struct check_same { + const static bool value = true; +}; + +template<> +struct check_same { + const static bool value = true; +}; + +template<> +struct check_same { + const static bool value = true; +}; + +template<> +struct check_same { + const static bool value = true; +}; + + +template +struct InfoTraits { + typedef float data_type; + float _val; +}; + +template<> +struct InfoTraits { + typedef std::string data_type; +}; + +template<> +struct InfoTraits { + typedef int data_type; +}; + +template +struct InfoStruct { + void _set(typename InfoTraits::data_type value) { + _val = value; + } + typename InfoTraits::data_type _get() { + return _val; + } +private: + typename InfoTraits::data_type _val; +}; + +template +struct Inquiry { + ~Inquiry(); + + void init(int dev_id = 0); + + template + typename InfoTraits::data_type get() { + LOG(WARNING) << "Target not support! "; + return InfoTraits::data_type(); + } +private: + int _dev_id; +}; + +template +struct HasTarget { + const static bool value = check_same::value || HasTarget::value; +}; + +template +struct HasTarget { + const static bool value = check_same::value; +}; + +template +class DevInfo : public InfoStruct... { +public: + template + void set(typename InfoTraits::data_type value) { + std::unique_lock lock(this->mut); + if(HasTarget::value) { + LOG(FATAL)<<" DevInfo parameter pack doesn't have target info type " << I; + } + InfoStruct::_set(value); + } + + template + typename InfoTraits::data_type get() { + if(HasTarget::value) { + LOG(ERROR)<<" DevInfo parameter pack doesn't have target info type " << I; + return typename InfoTraits::data_type(); + } + return InfoStruct::_get(); + } + + template + void inquiry(int dev_id) { + Inquiry instance; + instance.init(dev_id); + std::vector info_vec = {infos...}; + for(auto& info : info_vec) { + switch(info) { + case DEV_ID: { + set(instance.get()); + } break; + case DEV_NAME: { + set(instance.get()); + } break; + case DEV_TMP: { + set(instance.get()); + } break; + case DEV_MEM_FREE: { + set(instance.get()); + } break; + case DEV_MEM_USED: { + set(instance.get()); + } break; + default: break; + } + } + } +private: + std::mutex _mut; +}; + +} /* namespace rpc */ + +} /* namespace anakin */ + +#endif diff --git a/framework/service/monitor.h b/framework/service/monitor.h index 1c05bc8dc..ef2e40472 100644 --- a/framework/service/monitor.h +++ b/framework/service/monitor.h @@ -16,58 +16,58 @@ #ifndef ANAKIN_MONITOR_H #define ANAKIN_MONITOR_H -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include // cuda driver types +#include "framework/service/device_info.h" namespace anakin { namespace rpc { -/*struct DevInfo{ - DevInfo() {} - // all of those funcs must be thread safety - void fill_id(int id) { - std::unique_lock lock(this->mut); - dev_id = id; +/// monitor thread pool +class Monitor { +public: + Monitor(){} + ~Monitor(){} + + template + void create_instance(int dev_id, int interval_time_in_sec) { + _id = dev_id; + _monitor_thread = new std::thread([this](int dev_id, int time) { + DevInfo dev_info_pack; + std::chrono::time_point start = sys_clock::now(); + for(;;) { + double elapsed_time_ms =\ + std::chrono::duration_cast(sys_clock::now()-start).count(); + if(elapsed_time_ms > time * 1000) { + start = sys_clock::now(); + dev_info_pack.inquiry(dev_id); + _name = dev_info_pack.template get(); + _temp = dev_info_pack.template get(); + _mem_free = dev_info_pack.template get(); + _mem_used = dev_info_pack.template get(); + } + } + }, dev_id, interval_time_in_sec); } - void set_temp(int); - void set_g_mem_free(size_t); - void set_g_mem_used(size_t); - void set_name(const char*); - void set_compute_run_proc_num(int); - - // - int get_id() { return dev_id; } - int get_temp() { return temp; } - size_t get_g_mem_free() { return g_mem_free; } - size_t get_g_mem_used() { return g_mem_used; } - std::string get_name() { return dev_name; } - int get_compute_run_proc() { return compute_run_proc_num; } -private: - // resource infomation - int dev_id{-1}; // device id current reside - int temp{-1}; // device temperature - size_t g_mem_free{-1}; // global memory free (bytes) - size_t g_mem_used{-1}; // global memory used (bytes) - int compute_run_proc_num{0}; // compute running process num on device - std::string dev_name; // device name - std::mutex mut; -}; + int get_id() { return _id; } + std::string get_name() { return _name; } -class Monitor { -}; */ + float get_temp() { return _temp; } + + float get_mem_free() { return _mem_free; } + + float get_mem_used() { return _mem_used; } + +private: + typedef std::chrono::system_clock sys_clock; + int _id{-1}; // device id (represent as device num id) + std::string _name{"unknown"}; // device name + float _temp{-1000}; // device temperature Celsius degree + float _mem_free{-1}; // device memory free bytes + float _mem_used{-1}; + std::thread* _monitor_thread; +}; } /* namespace rpc */ diff --git a/framework/service/service_daemon.cpp b/framework/service/service_daemon.cpp index 5003f4400..4dc6a52ca 100644 --- a/framework/service/service_daemon.cpp +++ b/framework/service/service_daemon.cpp @@ -4,7 +4,9 @@ namespace anakin { namespace rpc { -void ServiceDaemon::operator()(std::function server_start, vector device_list, int server_port) { +void ServiceDaemon::operator()(std::function server_start, + std::vector device_list, + int server_port) { // Our process ID and Session ID pid_t pid, sid; @@ -21,7 +23,7 @@ void ServiceDaemon::operator()(std::function server_start, vector< // Change the file mode mask, so we can use the files created by daemon. umask(0); - // Create a new SID for the child process + // Create a new SID(a new session) for the child process sid = setsid(); if (sid < 0) { // Log the failure @@ -34,15 +36,15 @@ void ServiceDaemon::operator()(std::function server_start, vector< } // Close out the standard file descriptors - //close(STDIN_FILENO); // 0 - //close(STDOUT_FILENO); // 1 - //close(STDERR_FILENO); // 2 + close(STDIN_FILENO); // 0 + close(STDOUT_FILENO); // 1 + close(STDERR_FILENO); // 2 // Daemon-specific initialization goes here */ pid_t *pid_news = new pid_t[device_list.size()]; for(;;) { for(auto dev_id : device_list) { - if(!check_port_occupied(server_port)) { + if(!check_port_occupied(server_port) || !check_process_exist(pid_news[dev_id])) { // reaped zombie process if(pid_news[dev_id]) waitpid(pid_news[dev_id], NULL, 0); @@ -62,7 +64,7 @@ void ServiceDaemon::operator()(std::function server_start, vector< exit(EXIT_SUCCESS); } -bool ServiceDaemon::check_port_occupied() { +bool ServiceDaemon::check_port_occupied(int port) { struct sockaddr_in client; int sk; @@ -81,6 +83,14 @@ bool ServiceDaemon::check_port_occupied() { } } +bool ServiceDaemon::check_process_exist(pid_t pid) { + if(kill(pid, 0) == -1) { + return false; + } else { + // process still exists + return true; + } +} } /* namespace rpc */ diff --git a/framework/service/service_daemon.h b/framework/service/service_daemon.h index dabe5d5c4..6adbccce8 100644 --- a/framework/service/service_daemon.h +++ b/framework/service/service_daemon.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "framework/service/anakin_service.h" @@ -45,11 +46,13 @@ class ServiceDaemon { ~ServiceDaemon() {} void operator()(std::function server_start, - vector device_list, + std::vector device_list, int server_port); private: - bool check_port_occupied(); + bool check_port_occupied(int port); + + bool check_process_exist(pid_t pid); private: }; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c36887ca3..93d7f2d0e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,6 +26,7 @@ anakin_fetch_files_with_suffix(${ANAKIN_UNIT_TEST}/framework/graph "cpp" ANAKIN_ anakin_fetch_files_with_suffix(${ANAKIN_UNIT_TEST}/framework/operators "cpp" ANAKIN_TEST_CASE_SRC) anakin_fetch_files_with_suffix(${ANAKIN_UNIT_TEST}/framework/net "cpp" ANAKIN_TEST_CASE_SRC) anakin_fetch_files_with_suffix(${ANAKIN_UNIT_TEST}/framework/lite "cpp" ANAKIN_TEST_CASE_SRC) +anakin_fetch_files_with_suffix(${ANAKIN_UNIT_TEST}/framework/service "cpp" ANAKIN_TEST_CASE_SRC) if(NVIDIA_GPU) diff --git a/test/framework/service/service_rpc_client.cpp b/test/framework/service/service_rpc_client.cpp new file mode 100644 index 000000000..9ec3b0dd0 --- /dev/null +++ b/test/framework/service/service_rpc_client.cpp @@ -0,0 +1,100 @@ +#include +#include "net_test.h" +#include "saber/funcs/timer.h" +#include + +#if defined(USE_CUDA) +using Target = NV; +using Target_H = X86; +#elif defined(USE_X86_PLACE) +using Target = X86; +using Target_H = X86; +#elif defined(USE_ARM_PLACE) +using Target = ARM; +using Target_H = ARM; +#endif + +void fill_request(int id, RPCRequest& request) { + request.set_model("mobilenet_v2"); + request.set_request_id(id); + int batch_size = 10; + IO* input = request.add_inputs(); + Date* data = input->mutable_tensor(); + data->add_shape(1); + data->add_shape(3); + data->add_shape(224); + data->add_shape(224); + float new_tmp_data[1*3*224*224] = {1.f}; + input->mutable_data()->Reserve(1*3*224*224); + memcpy(input->mutable_data()->mutable_data(), new_tmp_data, 3*224*224*sizeof(float)); +} + +TEST(ServiceTest, Service_client_base_test) { + // A Channel represents a communication line to a Server. Notice that + // Channel is thread-safe and can be shared by all threads in your program. + brpc::Channel channel; + + // Initialize the channel, NULL means using default options. + brpc::ChannelOptions options; + // Protocol type. Defined in src/brpc/options.proto + options.protocol = "baidu_std"; + // Connection type. Available values: single, pooled, short + options.connection_type = "single"; + // RPC timeout in milliseconds + options.timeout_ms = 100 /*milliseconds*/; + // Max retries(not including the first RPC) + options.max_retry = 3; + if (channel.Init("0.0.0.0:8000", "", &options) != 0) { + LOG(ERROR) << "Fail to initialize channel"; + return -1; + } + + // Normally, you should not call a Channel directly, but instead construct + // a stub Service wrapping it. stub can be shared by all threads as well. + RPCService_Stub stub(&channel); + + // Send a request and wait for the response every 1 second + int log_id = 0; + while(!brpc::IsAskedToQuit()) { + RPCRequest request; + fill_request(log_id, request); + RPCResponse response; + brpc::Controller cntl; + + cntl.set_log_id(log_id++); // set by user + if(options.protocol != "http" && options.protocol != "h2c") { + // Set attachment which is wired to network directly instead of + // being serialized into protobuf messages. + cntl.request_attachment().append("Hi, What's you name?"); // Carry this along with requests + } else { + cntl.http_request().set_content_type("application/json"); // Content type of http request + } + + // Because `done'(last parameter) is NULL, this function waits until + // the response comes back or error occurs(including timedout). + stub.evaluate(&cntl, &request, &response, NULL); + if (!cntl.Failed()) { + if (cntl.response_attachment().empty()) { + LOG(INFO) << "I (" << cntl.local_side() << ") Received response from remote (" << cntl.remote_side() + << "): " << response->msg() + << " latency = " << cntl.latency_us() <<" us"; + } else { + LOG(INFO) << "I (" << cntl.local_side() << ") Received response from remote (" << cntl.remote_side() + << "): " << response->msg() + << " (attached=" << cntl.response_attachment() << ") latency=" << cntl.latency_us() <<" us"; + } + } else { + LOG(WARNING) << cntl.ErrorText(); + } + usleep(1000 * 1000L); // 1000 * 1000 us = 1 s + } + LOG(INFO) << "Client is going to quit."; +} + +int main(int argc, const char** argv){ + // initial logger + logger::init(argv[0]); + InitTest(); + RUN_ALL_TESTS(argv[0]); + return 0; +} diff --git a/test/framework/service/service_rpc_server.cpp b/test/framework/service/service_rpc_server.cpp new file mode 100644 index 000000000..89ee042c8 --- /dev/null +++ b/test/framework/service/service_rpc_server.cpp @@ -0,0 +1,75 @@ +#include +#include "net_test.h" +#include "saber/funcs/timer.h" +#include + +#if defined(USE_CUDA) +using Target = NV; +using Target_H = X86; +#elif defined(USE_X86_PLACE) +using Target = X86; +using Target_H = X86; +#elif defined(USE_ARM_PLACE) +using Target = ARM; +using Target_H = ARM; +#endif + +std::string mobilenet_v2_model_path = "/home/cuichaowen/anakin2/public_model/public-caffe-model/mobilenetv12/mobilenet_v2.anakin.bin"; + +int service_start(int port,int dev_id) { + // create one server + brpc::Server server; + + // instance anakin rpc service + AnakinService rpc_service; + // device id must be set + rpc_service.set_device_id(dev_id); + + // initialize config for mobilenet v2 + rpc_service.initial("mobilenet_v2", model_path, 3); + rpc_service.register_inputs("mobilenet_v2", {"input_0"}); + rpc_service.register_outputs("mobilenet_v2", {"prob_out"}); + + // create moniter for this service + rpc_service.create_monitor(30); // span 30 second + + // add service to server + if (server.AddService(&rpc_service, brpc::SERVER_DOESNT_OWN_SERVICE) != 0) { + LOG(ERROR) << "Fail to add service"; + return -1; + } + + // Start the server + brpc::ServerOptions options; + // Connection will be closed if there is no read/write operations during the time(s) + options.idle_timeout_sec = 600; + // Max number thread of server + options.num_threads = 10; + // Max concurrency request of server + options.max_concurrency = 300; + if (server.Start(port, &options) != 0) { + LOG(ERROR) << "Fail to start Server on port "<< port << " device id " << dev_id; + return -1; + } + + // Wait until Ctrl-C is pressed, then Stop() and Join() the server + server.RunUntilAskedToQuit(); + + // server is stopped, you can release the source here + return 0; +} + +TEST(ServiceTest, Service_base_test) { + // create anakin service deamon instance + ServiceDaemon daemon_rpc; + // launch daemon service for rpc [ on device 0 and port 8000] + daemon_rpc(service_start, {0}, 8000); +} + +int main(int argc, const char** argv){ + // initial logger + logger::init(argv[0]); + InitTest(); + RUN_ALL_TESTS(argv[0]); + return 0; +} diff --git a/test/framework/service/service_test.h b/test/framework/service/service_test.h new file mode 100644 index 000000000..b4a037368 --- /dev/null +++ b/test/framework/service/service_test.h @@ -0,0 +1,50 @@ +/* Copyright (c) 2018 Anakin Authors, Inc. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef ANAKIN_SERVICE_TEST_H +#define ANAKIN_SERVICE_TEST_H + +#include +#include "utils/unit_test/aktest.h" +#include "utils/logger/logger.h" +#include "graph_base.h" +#include "graph.h" +#include "scheduler.h" +#include "net.h" +#include "worker.h" +#include "service_daemon.h" + +using namespace anakin; +using ::anakin::test::Test; + +using namespace anakin::rpc; + +/** + * \brief anakin service test is base Test class for anakin rpc service + */ +class ServiceTest: public Test { +public: + ServiceTest(){} + + void SetUp(){} + + void TearDown(){} + +protected: +}; + +#endif + + From 733aae980063e0775f26b2e13d3819f951a8f16c Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Wed, 15 Aug 2018 17:53:28 +0800 Subject: [PATCH 11/13] rm auto gen files. --- framework/service/api/service.pb.cpp | 2896 -------------------------- framework/service/api/service.pb.h | 1472 ------------- 2 files changed, 4368 deletions(-) delete mode 100644 framework/service/api/service.pb.cpp delete mode 100644 framework/service/api/service.pb.h diff --git a/framework/service/api/service.pb.cpp b/framework/service/api/service.pb.cpp deleted file mode 100644 index de39b576c..000000000 --- a/framework/service/api/service.pb.cpp +++ /dev/null @@ -1,2896 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: service.proto - -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "service.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace anakin { -namespace rpc { -class DataDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _Data_default_instance_; -class IODefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _IO_default_instance_; -class RPCRequestDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _RPCRequest_default_instance_; -class DeviceStatusDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _DeviceStatus_default_instance_; -class ExecutionInfoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _ExecutionInfo_default_instance_; -class RPCResponseDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _RPCResponse_default_instance_; - -namespace protobuf_service_2eproto { - - -namespace { - -::google::protobuf::Metadata file_level_metadata[6]; -const ::google::protobuf::ServiceDescriptor* file_level_service_descriptors[1]; - -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Data, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Data, shape_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Data, data_), - ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IO, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IO, tensor_), - ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, model_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, inputs_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCRequest, request_id_), - ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, id_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, temp_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, mem_free_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceStatus, mem_used_), - ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, msg_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, duration_in_nano_seconds_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExecutionInfo, device_status_), - ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, model_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, outputs_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, info_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RPCResponse, request_id_), -}; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Data)}, - { 7, -1, sizeof(IO)}, - { 13, -1, sizeof(RPCRequest)}, - { 21, -1, sizeof(DeviceStatus)}, - { 31, -1, sizeof(ExecutionInfo)}, - { 39, -1, sizeof(RPCResponse)}, -}; - -static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast(&_Data_default_instance_), - reinterpret_cast(&_IO_default_instance_), - reinterpret_cast(&_RPCRequest_default_instance_), - reinterpret_cast(&_DeviceStatus_default_instance_), - reinterpret_cast(&_ExecutionInfo_default_instance_), - reinterpret_cast(&_RPCResponse_default_instance_), -}; - -namespace { - -void protobuf_AssignDescriptors() { - AddDescriptors(); - ::google::protobuf::MessageFactory* factory = NULL; - AssignDescriptors( - "service.proto", schemas, file_default_instances, TableStruct::offsets, factory, - file_level_metadata, NULL, file_level_service_descriptors); -} - -void protobuf_AssignDescriptorsOnce() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); -} - -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; -void protobuf_RegisterTypes(const ::std::string&) { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 6); -} - -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _Data_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Data_default_instance_);_IO_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_IO_default_instance_);_RPCRequest_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_RPCRequest_default_instance_);_DeviceStatus_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_DeviceStatus_default_instance_);_ExecutionInfo_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ExecutionInfo_default_instance_);_RPCResponse_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_RPCResponse_default_instance_);_IO_default_instance_._instance.get_mutable()->tensor_ = const_cast< ::anakin::rpc::Data*>( - ::anakin::rpc::Data::internal_default_instance()); - _ExecutionInfo_default_instance_._instance.get_mutable()->device_status_ = const_cast< ::anakin::rpc::DeviceStatus*>( - ::anakin::rpc::DeviceStatus::internal_default_instance()); - _RPCResponse_default_instance_._instance.get_mutable()->info_ = const_cast< ::anakin::rpc::ExecutionInfo*>( - ::anakin::rpc::ExecutionInfo::internal_default_instance()); -} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { -void AddDescriptorsImpl() { - InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - "\n\rservice.proto\022\nanakin.rpc\"#\n\004Data\022\r\n\005s" - "hape\030\001 \003(\005\022\014\n\004data\030\002 \003(\002\"&\n\002IO\022 \n\006tensor" - "\030\001 \001(\0132\020.anakin.rpc.Data\"O\n\nRPCRequest\022\r" - "\n\005model\030\001 \001(\014\022\036\n\006inputs\030\002 \003(\0132\016.anakin.r" - "pc.IO\022\022\n\nrequest_id\030\003 \001(\003\"Z\n\014DeviceStatu" - "s\022\n\n\002id\030\001 \001(\005\022\014\n\004name\030\002 \001(\014\022\014\n\004temp\030\003 \001(" - "\005\022\020\n\010mem_free\030\004 \001(\005\022\020\n\010mem_used\030\005 \001(\005\"o\n" - "\rExecutionInfo\022\013\n\003msg\030\001 \001(\014\022 \n\030duration_" - "in_nano_seconds\030\002 \001(\005\022/\n\rdevice_status\030\003" - " \001(\0132\030.anakin.rpc.DeviceStatus\"z\n\013RPCRes" - "ponse\022\r\n\005model\030\001 \001(\014\022\037\n\007outputs\030\002 \003(\0132\016." - "anakin.rpc.IO\022\'\n\004info\030\003 \001(\0132\031.anakin.rpc" - ".ExecutionInfo\022\022\n\nrequest_id\030\004 \001(\0032I\n\nRP" - "CService\022;\n\010evaluate\022\026.anakin.rpc.RPCReq" - "uest\032\027.anakin.rpc.RPCResponseB\003\200\001\001b\006prot" - "o3" - }; - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - descriptor, 602); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "service.proto", &protobuf_RegisterTypes); -} -} // anonymous namespace - -void AddDescriptors() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl); -} -// Force AddDescriptors() to be called at dynamic initialization time. -struct StaticDescriptorInitializer { - StaticDescriptorInitializer() { - AddDescriptors(); - } -} static_descriptor_initializer; - -} // namespace protobuf_service_2eproto - - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int Data::kShapeFieldNumber; -const int Data::kDataFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -Data::Data() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_service_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:anakin.rpc.Data) -} -Data::Data(const Data& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL), - shape_(from.shape_), - data_(from.data_), - _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - // @@protoc_insertion_point(copy_constructor:anakin.rpc.Data) -} - -void Data::SharedCtor() { - _cached_size_ = 0; -} - -Data::~Data() { - // @@protoc_insertion_point(destructor:anakin.rpc.Data) - SharedDtor(); -} - -void Data::SharedDtor() { -} - -void Data::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Data::descriptor() { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; -} - -const Data& Data::default_instance() { - protobuf_service_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -Data* Data::New(::google::protobuf::Arena* arena) const { - Data* n = new Data; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void Data::Clear() { -// @@protoc_insertion_point(message_clear_start:anakin.rpc.Data) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - shape_.Clear(); - data_.Clear(); - _internal_metadata_.Clear(); -} - -bool Data::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:anakin.rpc.Data) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated int32 shape = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_shape()))); - } else if ( - static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - 1, 10u, input, this->mutable_shape()))); - } else { - goto handle_unusual; - } - break; - } - - // repeated float data = 2; - case 2: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< - float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - input, this->mutable_data()))); - } else if ( - static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(21u /* 21 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - 1, 18u, input, this->mutable_data()))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:anakin.rpc.Data) - return true; -failure: - // @@protoc_insertion_point(parse_failure:anakin.rpc.Data) - return false; -#undef DO_ -} - -void Data::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:anakin.rpc.Data) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // repeated int32 shape = 1; - if (this->shape_size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast< ::google::protobuf::uint32>( - _shape_cached_byte_size_)); - } - for (int i = 0, n = this->shape_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( - this->shape(i), output); - } - - // repeated float data = 2; - if (this->data_size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast< ::google::protobuf::uint32>( - _data_cached_byte_size_)); - ::google::protobuf::internal::WireFormatLite::WriteFloatArray( - this->data().data(), this->data_size(), output); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); - } - // @@protoc_insertion_point(serialize_end:anakin.rpc.Data) -} - -::google::protobuf::uint8* Data::InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const { - (void)deterministic; // Unused - // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.Data) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // repeated int32 shape = 1; - if (this->shape_size() > 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( - 1, - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, - target); - target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast< ::google::protobuf::uint32>( - _shape_cached_byte_size_), target); - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32NoTagToArray(this->shape_, target); - } - - // repeated float data = 2; - if (this->data_size() > 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( - 2, - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, - target); - target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast< ::google::protobuf::uint32>( - _data_cached_byte_size_), target); - target = ::google::protobuf::internal::WireFormatLite:: - WriteFloatNoTagToArray(this->data_, target); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); - } - // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.Data) - return target; -} - -size_t Data::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.Data) - size_t total_size = 0; - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); - } - // repeated int32 shape = 1; - { - size_t data_size = ::google::protobuf::internal::WireFormatLite:: - Int32Size(this->shape_); - if (data_size > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast< ::google::protobuf::int32>(data_size)); - } - int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _shape_cached_byte_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - total_size += data_size; - } - - // repeated float data = 2; - { - unsigned int count = static_cast(this->data_size()); - size_t data_size = 4UL * count; - if (data_size > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast< ::google::protobuf::int32>(data_size)); - } - int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _data_cached_byte_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - total_size += data_size; - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Data::MergeFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.Data) - GOOGLE_DCHECK_NE(&from, this); - const Data* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.Data) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.Data) - MergeFrom(*source); - } -} - -void Data::MergeFrom(const Data& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.Data) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - shape_.MergeFrom(from.shape_); - data_.MergeFrom(from.data_); -} - -void Data::CopyFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.Data) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Data::CopyFrom(const Data& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.Data) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Data::IsInitialized() const { - return true; -} - -void Data::Swap(Data* other) { - if (other == this) return; - InternalSwap(other); -} -void Data::InternalSwap(Data* other) { - using std::swap; - shape_.InternalSwap(&other->shape_); - data_.InternalSwap(&other->data_); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata Data::GetMetadata() const { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Data - -// repeated int32 shape = 1; -int Data::shape_size() const { - return shape_.size(); -} -void Data::clear_shape() { - shape_.Clear(); -} -::google::protobuf::int32 Data::shape(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.Data.shape) - return shape_.Get(index); -} -void Data::set_shape(int index, ::google::protobuf::int32 value) { - shape_.Set(index, value); - // @@protoc_insertion_point(field_set:anakin.rpc.Data.shape) -} -void Data::add_shape(::google::protobuf::int32 value) { - shape_.Add(value); - // @@protoc_insertion_point(field_add:anakin.rpc.Data.shape) -} -const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -Data::shape() const { - // @@protoc_insertion_point(field_list:anakin.rpc.Data.shape) - return shape_; -} -::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -Data::mutable_shape() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.shape) - return &shape_; -} - -// repeated float data = 2; -int Data::data_size() const { - return data_.size(); -} -void Data::clear_data() { - data_.Clear(); -} -float Data::data(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.Data.data) - return data_.Get(index); -} -void Data::set_data(int index, float value) { - data_.Set(index, value); - // @@protoc_insertion_point(field_set:anakin.rpc.Data.data) -} -void Data::add_data(float value) { - data_.Add(value); - // @@protoc_insertion_point(field_add:anakin.rpc.Data.data) -} -const ::google::protobuf::RepeatedField< float >& -Data::data() const { - // @@protoc_insertion_point(field_list:anakin.rpc.Data.data) - return data_; -} -::google::protobuf::RepeatedField< float >* -Data::mutable_data() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.data) - return &data_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int IO::kTensorFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -IO::IO() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_service_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:anakin.rpc.IO) -} -IO::IO(const IO& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL), - _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - if (from.has_tensor()) { - tensor_ = new ::anakin::rpc::Data(*from.tensor_); - } else { - tensor_ = NULL; - } - // @@protoc_insertion_point(copy_constructor:anakin.rpc.IO) -} - -void IO::SharedCtor() { - tensor_ = NULL; - _cached_size_ = 0; -} - -IO::~IO() { - // @@protoc_insertion_point(destructor:anakin.rpc.IO) - SharedDtor(); -} - -void IO::SharedDtor() { - if (this != internal_default_instance()) delete tensor_; -} - -void IO::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* IO::descriptor() { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; -} - -const IO& IO::default_instance() { - protobuf_service_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -IO* IO::New(::google::protobuf::Arena* arena) const { - IO* n = new IO; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void IO::Clear() { -// @@protoc_insertion_point(message_clear_start:anakin.rpc.IO) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - if (GetArenaNoVirtual() == NULL && tensor_ != NULL) { - delete tensor_; - } - tensor_ = NULL; - _internal_metadata_.Clear(); -} - -bool IO::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:anakin.rpc.IO) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // .anakin.rpc.Data tensor = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_tensor())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:anakin.rpc.IO) - return true; -failure: - // @@protoc_insertion_point(parse_failure:anakin.rpc.IO) - return false; -#undef DO_ -} - -void IO::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:anakin.rpc.IO) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // .anakin.rpc.Data tensor = 1; - if (this->has_tensor()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, *this->tensor_, output); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); - } - // @@protoc_insertion_point(serialize_end:anakin.rpc.IO) -} - -::google::protobuf::uint8* IO::InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const { - (void)deterministic; // Unused - // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.IO) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // .anakin.rpc.Data tensor = 1; - if (this->has_tensor()) { - target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( - 1, *this->tensor_, deterministic, target); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); - } - // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.IO) - return target; -} - -size_t IO::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.IO) - size_t total_size = 0; - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); - } - // .anakin.rpc.Data tensor = 1; - if (this->has_tensor()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->tensor_); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void IO::MergeFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.IO) - GOOGLE_DCHECK_NE(&from, this); - const IO* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.IO) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.IO) - MergeFrom(*source); - } -} - -void IO::MergeFrom(const IO& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.IO) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.has_tensor()) { - mutable_tensor()->::anakin::rpc::Data::MergeFrom(from.tensor()); - } -} - -void IO::CopyFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.IO) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void IO::CopyFrom(const IO& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.IO) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool IO::IsInitialized() const { - return true; -} - -void IO::Swap(IO* other) { - if (other == this) return; - InternalSwap(other); -} -void IO::InternalSwap(IO* other) { - using std::swap; - swap(tensor_, other->tensor_); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata IO::GetMetadata() const { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// IO - -// .anakin.rpc.Data tensor = 1; -bool IO::has_tensor() const { - return this != internal_default_instance() && tensor_ != NULL; -} -void IO::clear_tensor() { - if (GetArenaNoVirtual() == NULL && tensor_ != NULL) delete tensor_; - tensor_ = NULL; -} -const ::anakin::rpc::Data& IO::tensor() const { - const ::anakin::rpc::Data* p = tensor_; - // @@protoc_insertion_point(field_get:anakin.rpc.IO.tensor) - return p != NULL ? *p : *reinterpret_cast( - &::anakin::rpc::_Data_default_instance_); -} -::anakin::rpc::Data* IO::mutable_tensor() { - - if (tensor_ == NULL) { - tensor_ = new ::anakin::rpc::Data; - } - // @@protoc_insertion_point(field_mutable:anakin.rpc.IO.tensor) - return tensor_; -} -::anakin::rpc::Data* IO::release_tensor() { - // @@protoc_insertion_point(field_release:anakin.rpc.IO.tensor) - - ::anakin::rpc::Data* temp = tensor_; - tensor_ = NULL; - return temp; -} -void IO::set_allocated_tensor(::anakin::rpc::Data* tensor) { - delete tensor_; - tensor_ = tensor; - if (tensor) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.IO.tensor) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int RPCRequest::kModelFieldNumber; -const int RPCRequest::kInputsFieldNumber; -const int RPCRequest::kRequestIdFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -RPCRequest::RPCRequest() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_service_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:anakin.rpc.RPCRequest) -} -RPCRequest::RPCRequest(const RPCRequest& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL), - inputs_(from.inputs_), - _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.model().size() > 0) { - model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); - } - request_id_ = from.request_id_; - // @@protoc_insertion_point(copy_constructor:anakin.rpc.RPCRequest) -} - -void RPCRequest::SharedCtor() { - model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - request_id_ = GOOGLE_LONGLONG(0); - _cached_size_ = 0; -} - -RPCRequest::~RPCRequest() { - // @@protoc_insertion_point(destructor:anakin.rpc.RPCRequest) - SharedDtor(); -} - -void RPCRequest::SharedDtor() { - model_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void RPCRequest::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* RPCRequest::descriptor() { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; -} - -const RPCRequest& RPCRequest::default_instance() { - protobuf_service_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -RPCRequest* RPCRequest::New(::google::protobuf::Arena* arena) const { - RPCRequest* n = new RPCRequest; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void RPCRequest::Clear() { -// @@protoc_insertion_point(message_clear_start:anakin.rpc.RPCRequest) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - inputs_.Clear(); - model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - request_id_ = GOOGLE_LONGLONG(0); - _internal_metadata_.Clear(); -} - -bool RPCRequest::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:anakin.rpc.RPCRequest) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // bytes model = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_model())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .anakin.rpc.IO inputs = 2; - case 2: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_inputs())); - } else { - goto handle_unusual; - } - break; - } - - // int64 request_id = 3; - case 3: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &request_id_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:anakin.rpc.RPCRequest) - return true; -failure: - // @@protoc_insertion_point(parse_failure:anakin.rpc.RPCRequest) - return false; -#undef DO_ -} - -void RPCRequest::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:anakin.rpc.RPCRequest) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bytes model = 1; - if (this->model().size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( - 1, this->model(), output); - } - - // repeated .anakin.rpc.IO inputs = 2; - for (unsigned int i = 0, - n = static_cast(this->inputs_size()); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->inputs(static_cast(i)), output); - } - - // int64 request_id = 3; - if (this->request_id() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->request_id(), output); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); - } - // @@protoc_insertion_point(serialize_end:anakin.rpc.RPCRequest) -} - -::google::protobuf::uint8* RPCRequest::InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const { - (void)deterministic; // Unused - // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.RPCRequest) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bytes model = 1; - if (this->model().size() > 0) { - target = - ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( - 1, this->model(), target); - } - - // repeated .anakin.rpc.IO inputs = 2; - for (unsigned int i = 0, - n = static_cast(this->inputs_size()); i < n; i++) { - target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( - 2, this->inputs(static_cast(i)), deterministic, target); - } - - // int64 request_id = 3; - if (this->request_id() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->request_id(), target); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); - } - // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.RPCRequest) - return target; -} - -size_t RPCRequest::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.RPCRequest) - size_t total_size = 0; - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); - } - // repeated .anakin.rpc.IO inputs = 2; - { - unsigned int count = static_cast(this->inputs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->inputs(static_cast(i))); - } - } - - // bytes model = 1; - if (this->model().size() > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->model()); - } - - // int64 request_id = 3; - if (this->request_id() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->request_id()); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void RPCRequest::MergeFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.RPCRequest) - GOOGLE_DCHECK_NE(&from, this); - const RPCRequest* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.RPCRequest) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.RPCRequest) - MergeFrom(*source); - } -} - -void RPCRequest::MergeFrom(const RPCRequest& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.RPCRequest) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - inputs_.MergeFrom(from.inputs_); - if (from.model().size() > 0) { - - model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); - } - if (from.request_id() != 0) { - set_request_id(from.request_id()); - } -} - -void RPCRequest::CopyFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.RPCRequest) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void RPCRequest::CopyFrom(const RPCRequest& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.RPCRequest) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool RPCRequest::IsInitialized() const { - return true; -} - -void RPCRequest::Swap(RPCRequest* other) { - if (other == this) return; - InternalSwap(other); -} -void RPCRequest::InternalSwap(RPCRequest* other) { - using std::swap; - inputs_.InternalSwap(&other->inputs_); - model_.Swap(&other->model_); - swap(request_id_, other->request_id_); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata RPCRequest::GetMetadata() const { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// RPCRequest - -// bytes model = 1; -void RPCRequest::clear_model() { - model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& RPCRequest::model() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.model) - return model_.GetNoArena(); -} -void RPCRequest::set_model(const ::std::string& value) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.model) -} -#if LANG_CXX11 -void RPCRequest::set_model(::std::string&& value) { - - model_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCRequest.model) -} -#endif -void RPCRequest::set_model(const char* value) { - GOOGLE_DCHECK(value != NULL); - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCRequest.model) -} -void RPCRequest::set_model(const void* value, size_t size) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCRequest.model) -} -::std::string* RPCRequest::mutable_model() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.model) - return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* RPCRequest::release_model() { - // @@protoc_insertion_point(field_release:anakin.rpc.RPCRequest.model) - - return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void RPCRequest::set_allocated_model(::std::string* model) { - if (model != NULL) { - - } else { - - } - model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCRequest.model) -} - -// repeated .anakin.rpc.IO inputs = 2; -int RPCRequest::inputs_size() const { - return inputs_.size(); -} -void RPCRequest::clear_inputs() { - inputs_.Clear(); -} -const ::anakin::rpc::IO& RPCRequest::inputs(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.inputs) - return inputs_.Get(index); -} -::anakin::rpc::IO* RPCRequest::mutable_inputs(int index) { - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.inputs) - return inputs_.Mutable(index); -} -::anakin::rpc::IO* RPCRequest::add_inputs() { - // @@protoc_insertion_point(field_add:anakin.rpc.RPCRequest.inputs) - return inputs_.Add(); -} -::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* -RPCRequest::mutable_inputs() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCRequest.inputs) - return &inputs_; -} -const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& -RPCRequest::inputs() const { - // @@protoc_insertion_point(field_list:anakin.rpc.RPCRequest.inputs) - return inputs_; -} - -// int64 request_id = 3; -void RPCRequest::clear_request_id() { - request_id_ = GOOGLE_LONGLONG(0); -} -::google::protobuf::int64 RPCRequest::request_id() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.request_id) - return request_id_; -} -void RPCRequest::set_request_id(::google::protobuf::int64 value) { - - request_id_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.request_id) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int DeviceStatus::kIdFieldNumber; -const int DeviceStatus::kNameFieldNumber; -const int DeviceStatus::kTempFieldNumber; -const int DeviceStatus::kMemFreeFieldNumber; -const int DeviceStatus::kMemUsedFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -DeviceStatus::DeviceStatus() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_service_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:anakin.rpc.DeviceStatus) -} -DeviceStatus::DeviceStatus(const DeviceStatus& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL), - _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.name().size() > 0) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); - } - ::memcpy(&id_, &from.id_, - static_cast(reinterpret_cast(&mem_used_) - - reinterpret_cast(&id_)) + sizeof(mem_used_)); - // @@protoc_insertion_point(copy_constructor:anakin.rpc.DeviceStatus) -} - -void DeviceStatus::SharedCtor() { - name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&id_, 0, static_cast( - reinterpret_cast(&mem_used_) - - reinterpret_cast(&id_)) + sizeof(mem_used_)); - _cached_size_ = 0; -} - -DeviceStatus::~DeviceStatus() { - // @@protoc_insertion_point(destructor:anakin.rpc.DeviceStatus) - SharedDtor(); -} - -void DeviceStatus::SharedDtor() { - name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void DeviceStatus::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* DeviceStatus::descriptor() { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; -} - -const DeviceStatus& DeviceStatus::default_instance() { - protobuf_service_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -DeviceStatus* DeviceStatus::New(::google::protobuf::Arena* arena) const { - DeviceStatus* n = new DeviceStatus; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void DeviceStatus::Clear() { -// @@protoc_insertion_point(message_clear_start:anakin.rpc.DeviceStatus) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&id_, 0, static_cast( - reinterpret_cast(&mem_used_) - - reinterpret_cast(&id_)) + sizeof(mem_used_)); - _internal_metadata_.Clear(); -} - -bool DeviceStatus::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:anakin.rpc.DeviceStatus) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // int32 id = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &id_))); - } else { - goto handle_unusual; - } - break; - } - - // bytes name = 2; - case 2: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_name())); - } else { - goto handle_unusual; - } - break; - } - - // int32 temp = 3; - case 3: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &temp_))); - } else { - goto handle_unusual; - } - break; - } - - // int32 mem_free = 4; - case 4: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &mem_free_))); - } else { - goto handle_unusual; - } - break; - } - - // int32 mem_used = 5; - case 5: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &mem_used_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:anakin.rpc.DeviceStatus) - return true; -failure: - // @@protoc_insertion_point(parse_failure:anakin.rpc.DeviceStatus) - return false; -#undef DO_ -} - -void DeviceStatus::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:anakin.rpc.DeviceStatus) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // int32 id = 1; - if (this->id() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->id(), output); - } - - // bytes name = 2; - if (this->name().size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( - 2, this->name(), output); - } - - // int32 temp = 3; - if (this->temp() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->temp(), output); - } - - // int32 mem_free = 4; - if (this->mem_free() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->mem_free(), output); - } - - // int32 mem_used = 5; - if (this->mem_used() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->mem_used(), output); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); - } - // @@protoc_insertion_point(serialize_end:anakin.rpc.DeviceStatus) -} - -::google::protobuf::uint8* DeviceStatus::InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const { - (void)deterministic; // Unused - // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.DeviceStatus) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // int32 id = 1; - if (this->id() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->id(), target); - } - - // bytes name = 2; - if (this->name().size() > 0) { - target = - ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( - 2, this->name(), target); - } - - // int32 temp = 3; - if (this->temp() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->temp(), target); - } - - // int32 mem_free = 4; - if (this->mem_free() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->mem_free(), target); - } - - // int32 mem_used = 5; - if (this->mem_used() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(5, this->mem_used(), target); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); - } - // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.DeviceStatus) - return target; -} - -size_t DeviceStatus::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.DeviceStatus) - size_t total_size = 0; - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); - } - // bytes name = 2; - if (this->name().size() > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->name()); - } - - // int32 id = 1; - if (this->id() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->id()); - } - - // int32 temp = 3; - if (this->temp() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->temp()); - } - - // int32 mem_free = 4; - if (this->mem_free() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->mem_free()); - } - - // int32 mem_used = 5; - if (this->mem_used() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->mem_used()); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void DeviceStatus::MergeFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.DeviceStatus) - GOOGLE_DCHECK_NE(&from, this); - const DeviceStatus* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.DeviceStatus) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.DeviceStatus) - MergeFrom(*source); - } -} - -void DeviceStatus::MergeFrom(const DeviceStatus& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.DeviceStatus) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.name().size() > 0) { - - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); - } - if (from.id() != 0) { - set_id(from.id()); - } - if (from.temp() != 0) { - set_temp(from.temp()); - } - if (from.mem_free() != 0) { - set_mem_free(from.mem_free()); - } - if (from.mem_used() != 0) { - set_mem_used(from.mem_used()); - } -} - -void DeviceStatus::CopyFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.DeviceStatus) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void DeviceStatus::CopyFrom(const DeviceStatus& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.DeviceStatus) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool DeviceStatus::IsInitialized() const { - return true; -} - -void DeviceStatus::Swap(DeviceStatus* other) { - if (other == this) return; - InternalSwap(other); -} -void DeviceStatus::InternalSwap(DeviceStatus* other) { - using std::swap; - name_.Swap(&other->name_); - swap(id_, other->id_); - swap(temp_, other->temp_); - swap(mem_free_, other->mem_free_); - swap(mem_used_, other->mem_used_); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata DeviceStatus::GetMetadata() const { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// DeviceStatus - -// int32 id = 1; -void DeviceStatus::clear_id() { - id_ = 0; -} -::google::protobuf::int32 DeviceStatus::id() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.id) - return id_; -} -void DeviceStatus::set_id(::google::protobuf::int32 value) { - - id_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.id) -} - -// bytes name = 2; -void DeviceStatus::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& DeviceStatus::name() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.name) - return name_.GetNoArena(); -} -void DeviceStatus::set_name(const ::std::string& value) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.name) -} -#if LANG_CXX11 -void DeviceStatus::set_name(::std::string&& value) { - - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.DeviceStatus.name) -} -#endif -void DeviceStatus::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.DeviceStatus.name) -} -void DeviceStatus::set_name(const void* value, size_t size) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.DeviceStatus.name) -} -::std::string* DeviceStatus::mutable_name() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.DeviceStatus.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* DeviceStatus::release_name() { - // @@protoc_insertion_point(field_release:anakin.rpc.DeviceStatus.name) - - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void DeviceStatus::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.DeviceStatus.name) -} - -// int32 temp = 3; -void DeviceStatus::clear_temp() { - temp_ = 0; -} -::google::protobuf::int32 DeviceStatus::temp() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.temp) - return temp_; -} -void DeviceStatus::set_temp(::google::protobuf::int32 value) { - - temp_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.temp) -} - -// int32 mem_free = 4; -void DeviceStatus::clear_mem_free() { - mem_free_ = 0; -} -::google::protobuf::int32 DeviceStatus::mem_free() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_free) - return mem_free_; -} -void DeviceStatus::set_mem_free(::google::protobuf::int32 value) { - - mem_free_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_free) -} - -// int32 mem_used = 5; -void DeviceStatus::clear_mem_used() { - mem_used_ = 0; -} -::google::protobuf::int32 DeviceStatus::mem_used() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_used) - return mem_used_; -} -void DeviceStatus::set_mem_used(::google::protobuf::int32 value) { - - mem_used_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_used) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int ExecutionInfo::kMsgFieldNumber; -const int ExecutionInfo::kDurationInNanoSecondsFieldNumber; -const int ExecutionInfo::kDeviceStatusFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -ExecutionInfo::ExecutionInfo() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_service_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:anakin.rpc.ExecutionInfo) -} -ExecutionInfo::ExecutionInfo(const ExecutionInfo& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL), - _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - msg_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.msg().size() > 0) { - msg_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.msg_); - } - if (from.has_device_status()) { - device_status_ = new ::anakin::rpc::DeviceStatus(*from.device_status_); - } else { - device_status_ = NULL; - } - duration_in_nano_seconds_ = from.duration_in_nano_seconds_; - // @@protoc_insertion_point(copy_constructor:anakin.rpc.ExecutionInfo) -} - -void ExecutionInfo::SharedCtor() { - msg_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&device_status_, 0, static_cast( - reinterpret_cast(&duration_in_nano_seconds_) - - reinterpret_cast(&device_status_)) + sizeof(duration_in_nano_seconds_)); - _cached_size_ = 0; -} - -ExecutionInfo::~ExecutionInfo() { - // @@protoc_insertion_point(destructor:anakin.rpc.ExecutionInfo) - SharedDtor(); -} - -void ExecutionInfo::SharedDtor() { - msg_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != internal_default_instance()) delete device_status_; -} - -void ExecutionInfo::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* ExecutionInfo::descriptor() { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; -} - -const ExecutionInfo& ExecutionInfo::default_instance() { - protobuf_service_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -ExecutionInfo* ExecutionInfo::New(::google::protobuf::Arena* arena) const { - ExecutionInfo* n = new ExecutionInfo; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void ExecutionInfo::Clear() { -// @@protoc_insertion_point(message_clear_start:anakin.rpc.ExecutionInfo) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (GetArenaNoVirtual() == NULL && device_status_ != NULL) { - delete device_status_; - } - device_status_ = NULL; - duration_in_nano_seconds_ = 0; - _internal_metadata_.Clear(); -} - -bool ExecutionInfo::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:anakin.rpc.ExecutionInfo) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // bytes msg = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_msg())); - } else { - goto handle_unusual; - } - break; - } - - // int32 duration_in_nano_seconds = 2; - case 2: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &duration_in_nano_seconds_))); - } else { - goto handle_unusual; - } - break; - } - - // .anakin.rpc.DeviceStatus device_status = 3; - case 3: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_device_status())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:anakin.rpc.ExecutionInfo) - return true; -failure: - // @@protoc_insertion_point(parse_failure:anakin.rpc.ExecutionInfo) - return false; -#undef DO_ -} - -void ExecutionInfo::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:anakin.rpc.ExecutionInfo) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bytes msg = 1; - if (this->msg().size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( - 1, this->msg(), output); - } - - // int32 duration_in_nano_seconds = 2; - if (this->duration_in_nano_seconds() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->duration_in_nano_seconds(), output); - } - - // .anakin.rpc.DeviceStatus device_status = 3; - if (this->has_device_status()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, *this->device_status_, output); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); - } - // @@protoc_insertion_point(serialize_end:anakin.rpc.ExecutionInfo) -} - -::google::protobuf::uint8* ExecutionInfo::InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const { - (void)deterministic; // Unused - // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.ExecutionInfo) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bytes msg = 1; - if (this->msg().size() > 0) { - target = - ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( - 1, this->msg(), target); - } - - // int32 duration_in_nano_seconds = 2; - if (this->duration_in_nano_seconds() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->duration_in_nano_seconds(), target); - } - - // .anakin.rpc.DeviceStatus device_status = 3; - if (this->has_device_status()) { - target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( - 3, *this->device_status_, deterministic, target); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); - } - // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.ExecutionInfo) - return target; -} - -size_t ExecutionInfo::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.ExecutionInfo) - size_t total_size = 0; - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); - } - // bytes msg = 1; - if (this->msg().size() > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->msg()); - } - - // .anakin.rpc.DeviceStatus device_status = 3; - if (this->has_device_status()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->device_status_); - } - - // int32 duration_in_nano_seconds = 2; - if (this->duration_in_nano_seconds() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->duration_in_nano_seconds()); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ExecutionInfo::MergeFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.ExecutionInfo) - GOOGLE_DCHECK_NE(&from, this); - const ExecutionInfo* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.ExecutionInfo) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.ExecutionInfo) - MergeFrom(*source); - } -} - -void ExecutionInfo::MergeFrom(const ExecutionInfo& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.ExecutionInfo) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.msg().size() > 0) { - - msg_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.msg_); - } - if (from.has_device_status()) { - mutable_device_status()->::anakin::rpc::DeviceStatus::MergeFrom(from.device_status()); - } - if (from.duration_in_nano_seconds() != 0) { - set_duration_in_nano_seconds(from.duration_in_nano_seconds()); - } -} - -void ExecutionInfo::CopyFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.ExecutionInfo) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void ExecutionInfo::CopyFrom(const ExecutionInfo& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.ExecutionInfo) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ExecutionInfo::IsInitialized() const { - return true; -} - -void ExecutionInfo::Swap(ExecutionInfo* other) { - if (other == this) return; - InternalSwap(other); -} -void ExecutionInfo::InternalSwap(ExecutionInfo* other) { - using std::swap; - msg_.Swap(&other->msg_); - swap(device_status_, other->device_status_); - swap(duration_in_nano_seconds_, other->duration_in_nano_seconds_); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata ExecutionInfo::GetMetadata() const { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ExecutionInfo - -// bytes msg = 1; -void ExecutionInfo::clear_msg() { - msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& ExecutionInfo::msg() const { - // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.msg) - return msg_.GetNoArena(); -} -void ExecutionInfo::set_msg(const ::std::string& value) { - - msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.msg) -} -#if LANG_CXX11 -void ExecutionInfo::set_msg(::std::string&& value) { - - msg_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.ExecutionInfo.msg) -} -#endif -void ExecutionInfo::set_msg(const char* value) { - GOOGLE_DCHECK(value != NULL); - - msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.ExecutionInfo.msg) -} -void ExecutionInfo::set_msg(const void* value, size_t size) { - - msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.ExecutionInfo.msg) -} -::std::string* ExecutionInfo::mutable_msg() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.msg) - return msg_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* ExecutionInfo::release_msg() { - // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.msg) - - return msg_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void ExecutionInfo::set_allocated_msg(::std::string* msg) { - if (msg != NULL) { - - } else { - - } - msg_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), msg); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.msg) -} - -// int32 duration_in_nano_seconds = 2; -void ExecutionInfo::clear_duration_in_nano_seconds() { - duration_in_nano_seconds_ = 0; -} -::google::protobuf::int32 ExecutionInfo::duration_in_nano_seconds() const { - // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) - return duration_in_nano_seconds_; -} -void ExecutionInfo::set_duration_in_nano_seconds(::google::protobuf::int32 value) { - - duration_in_nano_seconds_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) -} - -// .anakin.rpc.DeviceStatus device_status = 3; -bool ExecutionInfo::has_device_status() const { - return this != internal_default_instance() && device_status_ != NULL; -} -void ExecutionInfo::clear_device_status() { - if (GetArenaNoVirtual() == NULL && device_status_ != NULL) delete device_status_; - device_status_ = NULL; -} -const ::anakin::rpc::DeviceStatus& ExecutionInfo::device_status() const { - const ::anakin::rpc::DeviceStatus* p = device_status_; - // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.device_status) - return p != NULL ? *p : *reinterpret_cast( - &::anakin::rpc::_DeviceStatus_default_instance_); -} -::anakin::rpc::DeviceStatus* ExecutionInfo::mutable_device_status() { - - if (device_status_ == NULL) { - device_status_ = new ::anakin::rpc::DeviceStatus; - } - // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.device_status) - return device_status_; -} -::anakin::rpc::DeviceStatus* ExecutionInfo::release_device_status() { - // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.device_status) - - ::anakin::rpc::DeviceStatus* temp = device_status_; - device_status_ = NULL; - return temp; -} -void ExecutionInfo::set_allocated_device_status(::anakin::rpc::DeviceStatus* device_status) { - delete device_status_; - device_status_ = device_status; - if (device_status) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.device_status) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int RPCResponse::kModelFieldNumber; -const int RPCResponse::kOutputsFieldNumber; -const int RPCResponse::kInfoFieldNumber; -const int RPCResponse::kRequestIdFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -RPCResponse::RPCResponse() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_service_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:anakin.rpc.RPCResponse) -} -RPCResponse::RPCResponse(const RPCResponse& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL), - outputs_(from.outputs_), - _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.model().size() > 0) { - model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); - } - if (from.has_info()) { - info_ = new ::anakin::rpc::ExecutionInfo(*from.info_); - } else { - info_ = NULL; - } - request_id_ = from.request_id_; - // @@protoc_insertion_point(copy_constructor:anakin.rpc.RPCResponse) -} - -void RPCResponse::SharedCtor() { - model_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&info_, 0, static_cast( - reinterpret_cast(&request_id_) - - reinterpret_cast(&info_)) + sizeof(request_id_)); - _cached_size_ = 0; -} - -RPCResponse::~RPCResponse() { - // @@protoc_insertion_point(destructor:anakin.rpc.RPCResponse) - SharedDtor(); -} - -void RPCResponse::SharedDtor() { - model_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != internal_default_instance()) delete info_; -} - -void RPCResponse::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* RPCResponse::descriptor() { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; -} - -const RPCResponse& RPCResponse::default_instance() { - protobuf_service_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -RPCResponse* RPCResponse::New(::google::protobuf::Arena* arena) const { - RPCResponse* n = new RPCResponse; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void RPCResponse::Clear() { -// @@protoc_insertion_point(message_clear_start:anakin.rpc.RPCResponse) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - outputs_.Clear(); - model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (GetArenaNoVirtual() == NULL && info_ != NULL) { - delete info_; - } - info_ = NULL; - request_id_ = GOOGLE_LONGLONG(0); - _internal_metadata_.Clear(); -} - -bool RPCResponse::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:anakin.rpc.RPCResponse) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // bytes model = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_model())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .anakin.rpc.IO outputs = 2; - case 2: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_outputs())); - } else { - goto handle_unusual; - } - break; - } - - // .anakin.rpc.ExecutionInfo info = 3; - case 3: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_info())); - } else { - goto handle_unusual; - } - break; - } - - // int64 request_id = 4; - case 4: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &request_id_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:anakin.rpc.RPCResponse) - return true; -failure: - // @@protoc_insertion_point(parse_failure:anakin.rpc.RPCResponse) - return false; -#undef DO_ -} - -void RPCResponse::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:anakin.rpc.RPCResponse) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bytes model = 1; - if (this->model().size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( - 1, this->model(), output); - } - - // repeated .anakin.rpc.IO outputs = 2; - for (unsigned int i = 0, - n = static_cast(this->outputs_size()); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->outputs(static_cast(i)), output); - } - - // .anakin.rpc.ExecutionInfo info = 3; - if (this->has_info()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, *this->info_, output); - } - - // int64 request_id = 4; - if (this->request_id() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(4, this->request_id(), output); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); - } - // @@protoc_insertion_point(serialize_end:anakin.rpc.RPCResponse) -} - -::google::protobuf::uint8* RPCResponse::InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const { - (void)deterministic; // Unused - // @@protoc_insertion_point(serialize_to_array_start:anakin.rpc.RPCResponse) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bytes model = 1; - if (this->model().size() > 0) { - target = - ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( - 1, this->model(), target); - } - - // repeated .anakin.rpc.IO outputs = 2; - for (unsigned int i = 0, - n = static_cast(this->outputs_size()); i < n; i++) { - target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( - 2, this->outputs(static_cast(i)), deterministic, target); - } - - // .anakin.rpc.ExecutionInfo info = 3; - if (this->has_info()) { - target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( - 3, *this->info_, deterministic, target); - } - - // int64 request_id = 4; - if (this->request_id() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(4, this->request_id(), target); - } - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); - } - // @@protoc_insertion_point(serialize_to_array_end:anakin.rpc.RPCResponse) - return target; -} - -size_t RPCResponse::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:anakin.rpc.RPCResponse) - size_t total_size = 0; - - if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); - } - // repeated .anakin.rpc.IO outputs = 2; - { - unsigned int count = static_cast(this->outputs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->outputs(static_cast(i))); - } - } - - // bytes model = 1; - if (this->model().size() > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->model()); - } - - // .anakin.rpc.ExecutionInfo info = 3; - if (this->has_info()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->info_); - } - - // int64 request_id = 4; - if (this->request_id() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->request_id()); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void RPCResponse::MergeFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:anakin.rpc.RPCResponse) - GOOGLE_DCHECK_NE(&from, this); - const RPCResponse* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:anakin.rpc.RPCResponse) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:anakin.rpc.RPCResponse) - MergeFrom(*source); - } -} - -void RPCResponse::MergeFrom(const RPCResponse& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:anakin.rpc.RPCResponse) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - outputs_.MergeFrom(from.outputs_); - if (from.model().size() > 0) { - - model_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.model_); - } - if (from.has_info()) { - mutable_info()->::anakin::rpc::ExecutionInfo::MergeFrom(from.info()); - } - if (from.request_id() != 0) { - set_request_id(from.request_id()); - } -} - -void RPCResponse::CopyFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:anakin.rpc.RPCResponse) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void RPCResponse::CopyFrom(const RPCResponse& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:anakin.rpc.RPCResponse) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool RPCResponse::IsInitialized() const { - return true; -} - -void RPCResponse::Swap(RPCResponse* other) { - if (other == this) return; - InternalSwap(other); -} -void RPCResponse::InternalSwap(RPCResponse* other) { - using std::swap; - outputs_.InternalSwap(&other->outputs_); - model_.Swap(&other->model_); - swap(info_, other->info_); - swap(request_id_, other->request_id_); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata RPCResponse::GetMetadata() const { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// RPCResponse - -// bytes model = 1; -void RPCResponse::clear_model() { - model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& RPCResponse::model() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.model) - return model_.GetNoArena(); -} -void RPCResponse::set_model(const ::std::string& value) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.model) -} -#if LANG_CXX11 -void RPCResponse::set_model(::std::string&& value) { - - model_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCResponse.model) -} -#endif -void RPCResponse::set_model(const char* value) { - GOOGLE_DCHECK(value != NULL); - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCResponse.model) -} -void RPCResponse::set_model(const void* value, size_t size) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCResponse.model) -} -::std::string* RPCResponse::mutable_model() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.model) - return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* RPCResponse::release_model() { - // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.model) - - return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void RPCResponse::set_allocated_model(::std::string* model) { - if (model != NULL) { - - } else { - - } - model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.model) -} - -// repeated .anakin.rpc.IO outputs = 2; -int RPCResponse::outputs_size() const { - return outputs_.size(); -} -void RPCResponse::clear_outputs() { - outputs_.Clear(); -} -const ::anakin::rpc::IO& RPCResponse::outputs(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.outputs) - return outputs_.Get(index); -} -::anakin::rpc::IO* RPCResponse::mutable_outputs(int index) { - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.outputs) - return outputs_.Mutable(index); -} -::anakin::rpc::IO* RPCResponse::add_outputs() { - // @@protoc_insertion_point(field_add:anakin.rpc.RPCResponse.outputs) - return outputs_.Add(); -} -::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* -RPCResponse::mutable_outputs() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCResponse.outputs) - return &outputs_; -} -const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& -RPCResponse::outputs() const { - // @@protoc_insertion_point(field_list:anakin.rpc.RPCResponse.outputs) - return outputs_; -} - -// .anakin.rpc.ExecutionInfo info = 3; -bool RPCResponse::has_info() const { - return this != internal_default_instance() && info_ != NULL; -} -void RPCResponse::clear_info() { - if (GetArenaNoVirtual() == NULL && info_ != NULL) delete info_; - info_ = NULL; -} -const ::anakin::rpc::ExecutionInfo& RPCResponse::info() const { - const ::anakin::rpc::ExecutionInfo* p = info_; - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.info) - return p != NULL ? *p : *reinterpret_cast( - &::anakin::rpc::_ExecutionInfo_default_instance_); -} -::anakin::rpc::ExecutionInfo* RPCResponse::mutable_info() { - - if (info_ == NULL) { - info_ = new ::anakin::rpc::ExecutionInfo; - } - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.info) - return info_; -} -::anakin::rpc::ExecutionInfo* RPCResponse::release_info() { - // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.info) - - ::anakin::rpc::ExecutionInfo* temp = info_; - info_ = NULL; - return temp; -} -void RPCResponse::set_allocated_info(::anakin::rpc::ExecutionInfo* info) { - delete info_; - info_ = info; - if (info) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.info) -} - -// int64 request_id = 4; -void RPCResponse::clear_request_id() { - request_id_ = GOOGLE_LONGLONG(0); -} -::google::protobuf::int64 RPCResponse::request_id() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.request_id) - return request_id_; -} -void RPCResponse::set_request_id(::google::protobuf::int64 value) { - - request_id_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.request_id) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -RPCService::~RPCService() {} - -const ::google::protobuf::ServiceDescriptor* RPCService::descriptor() { - protobuf_service_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_service_2eproto::file_level_service_descriptors[0]; -} - -const ::google::protobuf::ServiceDescriptor* RPCService::GetDescriptor() { - return descriptor(); -} - -void RPCService::evaluate(::google::protobuf::RpcController* controller, - const ::anakin::rpc::RPCRequest*, - ::anakin::rpc::RPCResponse*, - ::google::protobuf::Closure* done) { - controller->SetFailed("Method evaluate() not implemented."); - done->Run(); -} - -void RPCService::CallMethod(const ::google::protobuf::MethodDescriptor* method, - ::google::protobuf::RpcController* controller, - const ::google::protobuf::Message* request, - ::google::protobuf::Message* response, - ::google::protobuf::Closure* done) { - GOOGLE_DCHECK_EQ(method->service(), protobuf_service_2eproto::file_level_service_descriptors[0]); - switch(method->index()) { - case 0: - evaluate(controller, - ::google::protobuf::down_cast(request), - ::google::protobuf::down_cast< ::anakin::rpc::RPCResponse*>(response), - done); - break; - default: - GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; - break; - } -} - -const ::google::protobuf::Message& RPCService::GetRequestPrototype( - const ::google::protobuf::MethodDescriptor* method) const { - GOOGLE_DCHECK_EQ(method->service(), descriptor()); - switch(method->index()) { - case 0: - return ::anakin::rpc::RPCRequest::default_instance(); - default: - GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; - return *::google::protobuf::MessageFactory::generated_factory() - ->GetPrototype(method->input_type()); - } -} - -const ::google::protobuf::Message& RPCService::GetResponsePrototype( - const ::google::protobuf::MethodDescriptor* method) const { - GOOGLE_DCHECK_EQ(method->service(), descriptor()); - switch(method->index()) { - case 0: - return ::anakin::rpc::RPCResponse::default_instance(); - default: - GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; - return *::google::protobuf::MessageFactory::generated_factory() - ->GetPrototype(method->output_type()); - } -} - -RPCService_Stub::RPCService_Stub(::google::protobuf::RpcChannel* channel) - : channel_(channel), owns_channel_(false) {} -RPCService_Stub::RPCService_Stub( - ::google::protobuf::RpcChannel* channel, - ::google::protobuf::Service::ChannelOwnership ownership) - : channel_(channel), - owns_channel_(ownership == ::google::protobuf::Service::STUB_OWNS_CHANNEL) {} -RPCService_Stub::~RPCService_Stub() { - if (owns_channel_) delete channel_; -} - -void RPCService_Stub::evaluate(::google::protobuf::RpcController* controller, - const ::anakin::rpc::RPCRequest* request, - ::anakin::rpc::RPCResponse* response, - ::google::protobuf::Closure* done) { - channel_->CallMethod(descriptor()->method(0), - controller, request, response, done); -} - -// @@protoc_insertion_point(namespace_scope) - -} // namespace rpc -} // namespace anakin - -// @@protoc_insertion_point(global_scope) diff --git a/framework/service/api/service.pb.h b/framework/service/api/service.pb.h deleted file mode 100644 index 98375c746..000000000 --- a/framework/service/api/service.pb.h +++ /dev/null @@ -1,1472 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: service.proto - -#ifndef PROTOBUF_service_2eproto__INCLUDED -#define PROTOBUF_service_2eproto__INCLUDED - -#include - -#include - -#if GOOGLE_PROTOBUF_VERSION < 3004000 -#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 3004000 < 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 -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -#include -// @@protoc_insertion_point(includes) -namespace anakin { -namespace rpc { -class Data; -class DataDefaultTypeInternal; -extern DataDefaultTypeInternal _Data_default_instance_; -class DeviceStatus; -class DeviceStatusDefaultTypeInternal; -extern DeviceStatusDefaultTypeInternal _DeviceStatus_default_instance_; -class ExecutionInfo; -class ExecutionInfoDefaultTypeInternal; -extern ExecutionInfoDefaultTypeInternal _ExecutionInfo_default_instance_; -class IO; -class IODefaultTypeInternal; -extern IODefaultTypeInternal _IO_default_instance_; -class RPCRequest; -class RPCRequestDefaultTypeInternal; -extern RPCRequestDefaultTypeInternal _RPCRequest_default_instance_; -class RPCResponse; -class RPCResponseDefaultTypeInternal; -extern RPCResponseDefaultTypeInternal _RPCResponse_default_instance_; -} // namespace rpc -} // namespace anakin - -namespace anakin { -namespace rpc { - -namespace protobuf_service_2eproto { -// Internal implementation detail -- do not call these. -struct TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); -}; -void AddDescriptors(); -void InitDefaults(); -} // namespace protobuf_service_2eproto - -// =================================================================== - -class Data : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.Data) */ { - public: - Data(); - virtual ~Data(); - - Data(const Data& from); - - inline Data& operator=(const Data& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 - Data(Data&& from) noexcept - : Data() { - *this = ::std::move(from); - } - - inline Data& operator=(Data&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - #endif - static const ::google::protobuf::Descriptor* descriptor(); - static const Data& default_instance(); - - static inline const Data* internal_default_instance() { - return reinterpret_cast( - &_Data_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 0; - - void Swap(Data* other); - friend void swap(Data& a, Data& b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline Data* New() const PROTOBUF_FINAL { return New(NULL); } - - Data* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; - void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void CopyFrom(const Data& from); - void MergeFrom(const Data& from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const PROTOBUF_FINAL; - void InternalSwap(Data* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; - } - inline void* MaybeArenaPtr() const { - return NULL; - } - public: - - ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated int32 shape = 1; - int shape_size() const; - void clear_shape(); - static const int kShapeFieldNumber = 1; - ::google::protobuf::int32 shape(int index) const; - void set_shape(int index, ::google::protobuf::int32 value); - void add_shape(::google::protobuf::int32 value); - const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& - shape() const; - ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* - mutable_shape(); - - // repeated float data = 2; - int data_size() const; - void clear_data(); - static const int kDataFieldNumber = 2; - float data(int index) const; - void set_data(int index, float value); - void add_data(float value); - const ::google::protobuf::RepeatedField< float >& - data() const; - ::google::protobuf::RepeatedField< float >* - mutable_data(); - - // @@protoc_insertion_point(class_scope:anakin.rpc.Data) - private: - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::RepeatedField< ::google::protobuf::int32 > shape_; - mutable int _shape_cached_byte_size_; - ::google::protobuf::RepeatedField< float > data_; - mutable int _data_cached_byte_size_; - mutable int _cached_size_; - friend struct protobuf_service_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class IO : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.IO) */ { - public: - IO(); - virtual ~IO(); - - IO(const IO& from); - - inline IO& operator=(const IO& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 - IO(IO&& from) noexcept - : IO() { - *this = ::std::move(from); - } - - inline IO& operator=(IO&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - #endif - static const ::google::protobuf::Descriptor* descriptor(); - static const IO& default_instance(); - - static inline const IO* internal_default_instance() { - return reinterpret_cast( - &_IO_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 1; - - void Swap(IO* other); - friend void swap(IO& a, IO& b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline IO* New() const PROTOBUF_FINAL { return New(NULL); } - - IO* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; - void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void CopyFrom(const IO& from); - void MergeFrom(const IO& from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const PROTOBUF_FINAL; - void InternalSwap(IO* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; - } - inline void* MaybeArenaPtr() const { - return NULL; - } - public: - - ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // .anakin.rpc.Data tensor = 1; - bool has_tensor() const; - void clear_tensor(); - static const int kTensorFieldNumber = 1; - const ::anakin::rpc::Data& tensor() const; - ::anakin::rpc::Data* mutable_tensor(); - ::anakin::rpc::Data* release_tensor(); - void set_allocated_tensor(::anakin::rpc::Data* tensor); - - // @@protoc_insertion_point(class_scope:anakin.rpc.IO) - private: - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::anakin::rpc::Data* tensor_; - mutable int _cached_size_; - friend struct protobuf_service_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class RPCRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.RPCRequest) */ { - public: - RPCRequest(); - virtual ~RPCRequest(); - - RPCRequest(const RPCRequest& from); - - inline RPCRequest& operator=(const RPCRequest& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 - RPCRequest(RPCRequest&& from) noexcept - : RPCRequest() { - *this = ::std::move(from); - } - - inline RPCRequest& operator=(RPCRequest&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - #endif - static const ::google::protobuf::Descriptor* descriptor(); - static const RPCRequest& default_instance(); - - static inline const RPCRequest* internal_default_instance() { - return reinterpret_cast( - &_RPCRequest_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 2; - - void Swap(RPCRequest* other); - friend void swap(RPCRequest& a, RPCRequest& b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline RPCRequest* New() const PROTOBUF_FINAL { return New(NULL); } - - RPCRequest* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; - void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void CopyFrom(const RPCRequest& from); - void MergeFrom(const RPCRequest& from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const PROTOBUF_FINAL; - void InternalSwap(RPCRequest* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; - } - inline void* MaybeArenaPtr() const { - return NULL; - } - public: - - ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated .anakin.rpc.IO inputs = 2; - int inputs_size() const; - void clear_inputs(); - static const int kInputsFieldNumber = 2; - const ::anakin::rpc::IO& inputs(int index) const; - ::anakin::rpc::IO* mutable_inputs(int index); - ::anakin::rpc::IO* add_inputs(); - ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* - mutable_inputs(); - const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& - inputs() const; - - // bytes model = 1; - void clear_model(); - static const int kModelFieldNumber = 1; - const ::std::string& model() const; - void set_model(const ::std::string& value); - #if LANG_CXX11 - void set_model(::std::string&& value); - #endif - void set_model(const char* value); - void set_model(const void* value, size_t size); - ::std::string* mutable_model(); - ::std::string* release_model(); - void set_allocated_model(::std::string* model); - - // int64 request_id = 3; - void clear_request_id(); - static const int kRequestIdFieldNumber = 3; - ::google::protobuf::int64 request_id() const; - void set_request_id(::google::protobuf::int64 value); - - // @@protoc_insertion_point(class_scope:anakin.rpc.RPCRequest) - private: - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO > inputs_; - ::google::protobuf::internal::ArenaStringPtr model_; - ::google::protobuf::int64 request_id_; - mutable int _cached_size_; - friend struct protobuf_service_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class DeviceStatus : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.DeviceStatus) */ { - public: - DeviceStatus(); - virtual ~DeviceStatus(); - - DeviceStatus(const DeviceStatus& from); - - inline DeviceStatus& operator=(const DeviceStatus& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 - DeviceStatus(DeviceStatus&& from) noexcept - : DeviceStatus() { - *this = ::std::move(from); - } - - inline DeviceStatus& operator=(DeviceStatus&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - #endif - static const ::google::protobuf::Descriptor* descriptor(); - static const DeviceStatus& default_instance(); - - static inline const DeviceStatus* internal_default_instance() { - return reinterpret_cast( - &_DeviceStatus_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 3; - - void Swap(DeviceStatus* other); - friend void swap(DeviceStatus& a, DeviceStatus& b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline DeviceStatus* New() const PROTOBUF_FINAL { return New(NULL); } - - DeviceStatus* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; - void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void CopyFrom(const DeviceStatus& from); - void MergeFrom(const DeviceStatus& from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const PROTOBUF_FINAL; - void InternalSwap(DeviceStatus* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; - } - inline void* MaybeArenaPtr() const { - return NULL; - } - public: - - ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // bytes name = 2; - void clear_name(); - static const int kNameFieldNumber = 2; - const ::std::string& name() const; - void set_name(const ::std::string& value); - #if LANG_CXX11 - void set_name(::std::string&& value); - #endif - void set_name(const char* value); - void set_name(const void* value, size_t size); - ::std::string* mutable_name(); - ::std::string* release_name(); - void set_allocated_name(::std::string* name); - - // int32 id = 1; - void clear_id(); - static const int kIdFieldNumber = 1; - ::google::protobuf::int32 id() const; - void set_id(::google::protobuf::int32 value); - - // int32 temp = 3; - void clear_temp(); - static const int kTempFieldNumber = 3; - ::google::protobuf::int32 temp() const; - void set_temp(::google::protobuf::int32 value); - - // int32 mem_free = 4; - void clear_mem_free(); - static const int kMemFreeFieldNumber = 4; - ::google::protobuf::int32 mem_free() const; - void set_mem_free(::google::protobuf::int32 value); - - // int32 mem_used = 5; - void clear_mem_used(); - static const int kMemUsedFieldNumber = 5; - ::google::protobuf::int32 mem_used() const; - void set_mem_used(::google::protobuf::int32 value); - - // @@protoc_insertion_point(class_scope:anakin.rpc.DeviceStatus) - private: - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::int32 id_; - ::google::protobuf::int32 temp_; - ::google::protobuf::int32 mem_free_; - ::google::protobuf::int32 mem_used_; - mutable int _cached_size_; - friend struct protobuf_service_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class ExecutionInfo : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.ExecutionInfo) */ { - public: - ExecutionInfo(); - virtual ~ExecutionInfo(); - - ExecutionInfo(const ExecutionInfo& from); - - inline ExecutionInfo& operator=(const ExecutionInfo& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 - ExecutionInfo(ExecutionInfo&& from) noexcept - : ExecutionInfo() { - *this = ::std::move(from); - } - - inline ExecutionInfo& operator=(ExecutionInfo&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - #endif - static const ::google::protobuf::Descriptor* descriptor(); - static const ExecutionInfo& default_instance(); - - static inline const ExecutionInfo* internal_default_instance() { - return reinterpret_cast( - &_ExecutionInfo_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 4; - - void Swap(ExecutionInfo* other); - friend void swap(ExecutionInfo& a, ExecutionInfo& b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline ExecutionInfo* New() const PROTOBUF_FINAL { return New(NULL); } - - ExecutionInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; - void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void CopyFrom(const ExecutionInfo& from); - void MergeFrom(const ExecutionInfo& from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const PROTOBUF_FINAL; - void InternalSwap(ExecutionInfo* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; - } - inline void* MaybeArenaPtr() const { - return NULL; - } - public: - - ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // bytes msg = 1; - void clear_msg(); - static const int kMsgFieldNumber = 1; - const ::std::string& msg() const; - void set_msg(const ::std::string& value); - #if LANG_CXX11 - void set_msg(::std::string&& value); - #endif - void set_msg(const char* value); - void set_msg(const void* value, size_t size); - ::std::string* mutable_msg(); - ::std::string* release_msg(); - void set_allocated_msg(::std::string* msg); - - // .anakin.rpc.DeviceStatus device_status = 3; - bool has_device_status() const; - void clear_device_status(); - static const int kDeviceStatusFieldNumber = 3; - const ::anakin::rpc::DeviceStatus& device_status() const; - ::anakin::rpc::DeviceStatus* mutable_device_status(); - ::anakin::rpc::DeviceStatus* release_device_status(); - void set_allocated_device_status(::anakin::rpc::DeviceStatus* device_status); - - // int32 duration_in_nano_seconds = 2; - void clear_duration_in_nano_seconds(); - static const int kDurationInNanoSecondsFieldNumber = 2; - ::google::protobuf::int32 duration_in_nano_seconds() const; - void set_duration_in_nano_seconds(::google::protobuf::int32 value); - - // @@protoc_insertion_point(class_scope:anakin.rpc.ExecutionInfo) - private: - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::internal::ArenaStringPtr msg_; - ::anakin::rpc::DeviceStatus* device_status_; - ::google::protobuf::int32 duration_in_nano_seconds_; - mutable int _cached_size_; - friend struct protobuf_service_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class RPCResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:anakin.rpc.RPCResponse) */ { - public: - RPCResponse(); - virtual ~RPCResponse(); - - RPCResponse(const RPCResponse& from); - - inline RPCResponse& operator=(const RPCResponse& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 - RPCResponse(RPCResponse&& from) noexcept - : RPCResponse() { - *this = ::std::move(from); - } - - inline RPCResponse& operator=(RPCResponse&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - #endif - static const ::google::protobuf::Descriptor* descriptor(); - static const RPCResponse& default_instance(); - - static inline const RPCResponse* internal_default_instance() { - return reinterpret_cast( - &_RPCResponse_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 5; - - void Swap(RPCResponse* other); - friend void swap(RPCResponse& a, RPCResponse& b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline RPCResponse* New() const PROTOBUF_FINAL { return New(NULL); } - - RPCResponse* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; - void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; - void CopyFrom(const RPCResponse& from); - void MergeFrom(const RPCResponse& from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const PROTOBUF_FINAL; - void InternalSwap(RPCResponse* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; - } - inline void* MaybeArenaPtr() const { - return NULL; - } - public: - - ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated .anakin.rpc.IO outputs = 2; - int outputs_size() const; - void clear_outputs(); - static const int kOutputsFieldNumber = 2; - const ::anakin::rpc::IO& outputs(int index) const; - ::anakin::rpc::IO* mutable_outputs(int index); - ::anakin::rpc::IO* add_outputs(); - ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* - mutable_outputs(); - const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& - outputs() const; - - // bytes model = 1; - void clear_model(); - static const int kModelFieldNumber = 1; - const ::std::string& model() const; - void set_model(const ::std::string& value); - #if LANG_CXX11 - void set_model(::std::string&& value); - #endif - void set_model(const char* value); - void set_model(const void* value, size_t size); - ::std::string* mutable_model(); - ::std::string* release_model(); - void set_allocated_model(::std::string* model); - - // .anakin.rpc.ExecutionInfo info = 3; - bool has_info() const; - void clear_info(); - static const int kInfoFieldNumber = 3; - const ::anakin::rpc::ExecutionInfo& info() const; - ::anakin::rpc::ExecutionInfo* mutable_info(); - ::anakin::rpc::ExecutionInfo* release_info(); - void set_allocated_info(::anakin::rpc::ExecutionInfo* info); - - // int64 request_id = 4; - void clear_request_id(); - static const int kRequestIdFieldNumber = 4; - ::google::protobuf::int64 request_id() const; - void set_request_id(::google::protobuf::int64 value); - - // @@protoc_insertion_point(class_scope:anakin.rpc.RPCResponse) - private: - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO > outputs_; - ::google::protobuf::internal::ArenaStringPtr model_; - ::anakin::rpc::ExecutionInfo* info_; - ::google::protobuf::int64 request_id_; - mutable int _cached_size_; - friend struct protobuf_service_2eproto::TableStruct; -}; -// =================================================================== - -class RPCService_Stub; - -class RPCService : public ::google::protobuf::Service { - protected: - // This class should be treated as an abstract interface. - inline RPCService() {}; - public: - virtual ~RPCService(); - - typedef RPCService_Stub Stub; - - static const ::google::protobuf::ServiceDescriptor* descriptor(); - - virtual void evaluate(::google::protobuf::RpcController* controller, - const ::anakin::rpc::RPCRequest* request, - ::anakin::rpc::RPCResponse* response, - ::google::protobuf::Closure* done); - - // implements Service ---------------------------------------------- - - const ::google::protobuf::ServiceDescriptor* GetDescriptor(); - void CallMethod(const ::google::protobuf::MethodDescriptor* method, - ::google::protobuf::RpcController* controller, - const ::google::protobuf::Message* request, - ::google::protobuf::Message* response, - ::google::protobuf::Closure* done); - const ::google::protobuf::Message& GetRequestPrototype( - const ::google::protobuf::MethodDescriptor* method) const; - const ::google::protobuf::Message& GetResponsePrototype( - const ::google::protobuf::MethodDescriptor* method) const; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RPCService); -}; - -class RPCService_Stub : public RPCService { - public: - RPCService_Stub(::google::protobuf::RpcChannel* channel); - RPCService_Stub(::google::protobuf::RpcChannel* channel, - ::google::protobuf::Service::ChannelOwnership ownership); - ~RPCService_Stub(); - - inline ::google::protobuf::RpcChannel* channel() { return channel_; } - - // implements RPCService ------------------------------------------ - - void evaluate(::google::protobuf::RpcController* controller, - const ::anakin::rpc::RPCRequest* request, - ::anakin::rpc::RPCResponse* response, - ::google::protobuf::Closure* done); - private: - ::google::protobuf::RpcChannel* channel_; - bool owns_channel_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RPCService_Stub); -}; - - -// =================================================================== - - -// =================================================================== - -#if !PROTOBUF_INLINE_NOT_IN_HEADERS -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// Data - -// repeated int32 shape = 1; -inline int Data::shape_size() const { - return shape_.size(); -} -inline void Data::clear_shape() { - shape_.Clear(); -} -inline ::google::protobuf::int32 Data::shape(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.Data.shape) - return shape_.Get(index); -} -inline void Data::set_shape(int index, ::google::protobuf::int32 value) { - shape_.Set(index, value); - // @@protoc_insertion_point(field_set:anakin.rpc.Data.shape) -} -inline void Data::add_shape(::google::protobuf::int32 value) { - shape_.Add(value); - // @@protoc_insertion_point(field_add:anakin.rpc.Data.shape) -} -inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -Data::shape() const { - // @@protoc_insertion_point(field_list:anakin.rpc.Data.shape) - return shape_; -} -inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -Data::mutable_shape() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.shape) - return &shape_; -} - -// repeated float data = 2; -inline int Data::data_size() const { - return data_.size(); -} -inline void Data::clear_data() { - data_.Clear(); -} -inline float Data::data(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.Data.data) - return data_.Get(index); -} -inline void Data::set_data(int index, float value) { - data_.Set(index, value); - // @@protoc_insertion_point(field_set:anakin.rpc.Data.data) -} -inline void Data::add_data(float value) { - data_.Add(value); - // @@protoc_insertion_point(field_add:anakin.rpc.Data.data) -} -inline const ::google::protobuf::RepeatedField< float >& -Data::data() const { - // @@protoc_insertion_point(field_list:anakin.rpc.Data.data) - return data_; -} -inline ::google::protobuf::RepeatedField< float >* -Data::mutable_data() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.Data.data) - return &data_; -} - -// ------------------------------------------------------------------- - -// IO - -// .anakin.rpc.Data tensor = 1; -inline bool IO::has_tensor() const { - return this != internal_default_instance() && tensor_ != NULL; -} -inline void IO::clear_tensor() { - if (GetArenaNoVirtual() == NULL && tensor_ != NULL) delete tensor_; - tensor_ = NULL; -} -inline const ::anakin::rpc::Data& IO::tensor() const { - const ::anakin::rpc::Data* p = tensor_; - // @@protoc_insertion_point(field_get:anakin.rpc.IO.tensor) - return p != NULL ? *p : *reinterpret_cast( - &::anakin::rpc::_Data_default_instance_); -} -inline ::anakin::rpc::Data* IO::mutable_tensor() { - - if (tensor_ == NULL) { - tensor_ = new ::anakin::rpc::Data; - } - // @@protoc_insertion_point(field_mutable:anakin.rpc.IO.tensor) - return tensor_; -} -inline ::anakin::rpc::Data* IO::release_tensor() { - // @@protoc_insertion_point(field_release:anakin.rpc.IO.tensor) - - ::anakin::rpc::Data* temp = tensor_; - tensor_ = NULL; - return temp; -} -inline void IO::set_allocated_tensor(::anakin::rpc::Data* tensor) { - delete tensor_; - tensor_ = tensor; - if (tensor) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.IO.tensor) -} - -// ------------------------------------------------------------------- - -// RPCRequest - -// bytes model = 1; -inline void RPCRequest::clear_model() { - model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline const ::std::string& RPCRequest::model() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.model) - return model_.GetNoArena(); -} -inline void RPCRequest::set_model(const ::std::string& value) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.model) -} -#if LANG_CXX11 -inline void RPCRequest::set_model(::std::string&& value) { - - model_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCRequest.model) -} -#endif -inline void RPCRequest::set_model(const char* value) { - GOOGLE_DCHECK(value != NULL); - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCRequest.model) -} -inline void RPCRequest::set_model(const void* value, size_t size) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCRequest.model) -} -inline ::std::string* RPCRequest::mutable_model() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.model) - return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string* RPCRequest::release_model() { - // @@protoc_insertion_point(field_release:anakin.rpc.RPCRequest.model) - - return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void RPCRequest::set_allocated_model(::std::string* model) { - if (model != NULL) { - - } else { - - } - model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCRequest.model) -} - -// repeated .anakin.rpc.IO inputs = 2; -inline int RPCRequest::inputs_size() const { - return inputs_.size(); -} -inline void RPCRequest::clear_inputs() { - inputs_.Clear(); -} -inline const ::anakin::rpc::IO& RPCRequest::inputs(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.inputs) - return inputs_.Get(index); -} -inline ::anakin::rpc::IO* RPCRequest::mutable_inputs(int index) { - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCRequest.inputs) - return inputs_.Mutable(index); -} -inline ::anakin::rpc::IO* RPCRequest::add_inputs() { - // @@protoc_insertion_point(field_add:anakin.rpc.RPCRequest.inputs) - return inputs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* -RPCRequest::mutable_inputs() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCRequest.inputs) - return &inputs_; -} -inline const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& -RPCRequest::inputs() const { - // @@protoc_insertion_point(field_list:anakin.rpc.RPCRequest.inputs) - return inputs_; -} - -// int64 request_id = 3; -inline void RPCRequest::clear_request_id() { - request_id_ = GOOGLE_LONGLONG(0); -} -inline ::google::protobuf::int64 RPCRequest::request_id() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCRequest.request_id) - return request_id_; -} -inline void RPCRequest::set_request_id(::google::protobuf::int64 value) { - - request_id_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.RPCRequest.request_id) -} - -// ------------------------------------------------------------------- - -// DeviceStatus - -// int32 id = 1; -inline void DeviceStatus::clear_id() { - id_ = 0; -} -inline ::google::protobuf::int32 DeviceStatus::id() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.id) - return id_; -} -inline void DeviceStatus::set_id(::google::protobuf::int32 value) { - - id_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.id) -} - -// bytes name = 2; -inline void DeviceStatus::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline const ::std::string& DeviceStatus::name() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.name) - return name_.GetNoArena(); -} -inline void DeviceStatus::set_name(const ::std::string& value) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.name) -} -#if LANG_CXX11 -inline void DeviceStatus::set_name(::std::string&& value) { - - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.DeviceStatus.name) -} -#endif -inline void DeviceStatus::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.DeviceStatus.name) -} -inline void DeviceStatus::set_name(const void* value, size_t size) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.DeviceStatus.name) -} -inline ::std::string* DeviceStatus::mutable_name() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.DeviceStatus.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string* DeviceStatus::release_name() { - // @@protoc_insertion_point(field_release:anakin.rpc.DeviceStatus.name) - - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void DeviceStatus::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.DeviceStatus.name) -} - -// int32 temp = 3; -inline void DeviceStatus::clear_temp() { - temp_ = 0; -} -inline ::google::protobuf::int32 DeviceStatus::temp() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.temp) - return temp_; -} -inline void DeviceStatus::set_temp(::google::protobuf::int32 value) { - - temp_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.temp) -} - -// int32 mem_free = 4; -inline void DeviceStatus::clear_mem_free() { - mem_free_ = 0; -} -inline ::google::protobuf::int32 DeviceStatus::mem_free() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_free) - return mem_free_; -} -inline void DeviceStatus::set_mem_free(::google::protobuf::int32 value) { - - mem_free_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_free) -} - -// int32 mem_used = 5; -inline void DeviceStatus::clear_mem_used() { - mem_used_ = 0; -} -inline ::google::protobuf::int32 DeviceStatus::mem_used() const { - // @@protoc_insertion_point(field_get:anakin.rpc.DeviceStatus.mem_used) - return mem_used_; -} -inline void DeviceStatus::set_mem_used(::google::protobuf::int32 value) { - - mem_used_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.DeviceStatus.mem_used) -} - -// ------------------------------------------------------------------- - -// ExecutionInfo - -// bytes msg = 1; -inline void ExecutionInfo::clear_msg() { - msg_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline const ::std::string& ExecutionInfo::msg() const { - // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.msg) - return msg_.GetNoArena(); -} -inline void ExecutionInfo::set_msg(const ::std::string& value) { - - msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.msg) -} -#if LANG_CXX11 -inline void ExecutionInfo::set_msg(::std::string&& value) { - - msg_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.ExecutionInfo.msg) -} -#endif -inline void ExecutionInfo::set_msg(const char* value) { - GOOGLE_DCHECK(value != NULL); - - msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.ExecutionInfo.msg) -} -inline void ExecutionInfo::set_msg(const void* value, size_t size) { - - msg_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.ExecutionInfo.msg) -} -inline ::std::string* ExecutionInfo::mutable_msg() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.msg) - return msg_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string* ExecutionInfo::release_msg() { - // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.msg) - - return msg_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void ExecutionInfo::set_allocated_msg(::std::string* msg) { - if (msg != NULL) { - - } else { - - } - msg_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), msg); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.msg) -} - -// int32 duration_in_nano_seconds = 2; -inline void ExecutionInfo::clear_duration_in_nano_seconds() { - duration_in_nano_seconds_ = 0; -} -inline ::google::protobuf::int32 ExecutionInfo::duration_in_nano_seconds() const { - // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) - return duration_in_nano_seconds_; -} -inline void ExecutionInfo::set_duration_in_nano_seconds(::google::protobuf::int32 value) { - - duration_in_nano_seconds_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.ExecutionInfo.duration_in_nano_seconds) -} - -// .anakin.rpc.DeviceStatus device_status = 3; -inline bool ExecutionInfo::has_device_status() const { - return this != internal_default_instance() && device_status_ != NULL; -} -inline void ExecutionInfo::clear_device_status() { - if (GetArenaNoVirtual() == NULL && device_status_ != NULL) delete device_status_; - device_status_ = NULL; -} -inline const ::anakin::rpc::DeviceStatus& ExecutionInfo::device_status() const { - const ::anakin::rpc::DeviceStatus* p = device_status_; - // @@protoc_insertion_point(field_get:anakin.rpc.ExecutionInfo.device_status) - return p != NULL ? *p : *reinterpret_cast( - &::anakin::rpc::_DeviceStatus_default_instance_); -} -inline ::anakin::rpc::DeviceStatus* ExecutionInfo::mutable_device_status() { - - if (device_status_ == NULL) { - device_status_ = new ::anakin::rpc::DeviceStatus; - } - // @@protoc_insertion_point(field_mutable:anakin.rpc.ExecutionInfo.device_status) - return device_status_; -} -inline ::anakin::rpc::DeviceStatus* ExecutionInfo::release_device_status() { - // @@protoc_insertion_point(field_release:anakin.rpc.ExecutionInfo.device_status) - - ::anakin::rpc::DeviceStatus* temp = device_status_; - device_status_ = NULL; - return temp; -} -inline void ExecutionInfo::set_allocated_device_status(::anakin::rpc::DeviceStatus* device_status) { - delete device_status_; - device_status_ = device_status; - if (device_status) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.ExecutionInfo.device_status) -} - -// ------------------------------------------------------------------- - -// RPCResponse - -// bytes model = 1; -inline void RPCResponse::clear_model() { - model_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline const ::std::string& RPCResponse::model() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.model) - return model_.GetNoArena(); -} -inline void RPCResponse::set_model(const ::std::string& value) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.model) -} -#if LANG_CXX11 -inline void RPCResponse::set_model(::std::string&& value) { - - model_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:anakin.rpc.RPCResponse.model) -} -#endif -inline void RPCResponse::set_model(const char* value) { - GOOGLE_DCHECK(value != NULL); - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:anakin.rpc.RPCResponse.model) -} -inline void RPCResponse::set_model(const void* value, size_t size) { - - model_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:anakin.rpc.RPCResponse.model) -} -inline ::std::string* RPCResponse::mutable_model() { - - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.model) - return model_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string* RPCResponse::release_model() { - // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.model) - - return model_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void RPCResponse::set_allocated_model(::std::string* model) { - if (model != NULL) { - - } else { - - } - model_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), model); - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.model) -} - -// repeated .anakin.rpc.IO outputs = 2; -inline int RPCResponse::outputs_size() const { - return outputs_.size(); -} -inline void RPCResponse::clear_outputs() { - outputs_.Clear(); -} -inline const ::anakin::rpc::IO& RPCResponse::outputs(int index) const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.outputs) - return outputs_.Get(index); -} -inline ::anakin::rpc::IO* RPCResponse::mutable_outputs(int index) { - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.outputs) - return outputs_.Mutable(index); -} -inline ::anakin::rpc::IO* RPCResponse::add_outputs() { - // @@protoc_insertion_point(field_add:anakin.rpc.RPCResponse.outputs) - return outputs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >* -RPCResponse::mutable_outputs() { - // @@protoc_insertion_point(field_mutable_list:anakin.rpc.RPCResponse.outputs) - return &outputs_; -} -inline const ::google::protobuf::RepeatedPtrField< ::anakin::rpc::IO >& -RPCResponse::outputs() const { - // @@protoc_insertion_point(field_list:anakin.rpc.RPCResponse.outputs) - return outputs_; -} - -// .anakin.rpc.ExecutionInfo info = 3; -inline bool RPCResponse::has_info() const { - return this != internal_default_instance() && info_ != NULL; -} -inline void RPCResponse::clear_info() { - if (GetArenaNoVirtual() == NULL && info_ != NULL) delete info_; - info_ = NULL; -} -inline const ::anakin::rpc::ExecutionInfo& RPCResponse::info() const { - const ::anakin::rpc::ExecutionInfo* p = info_; - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.info) - return p != NULL ? *p : *reinterpret_cast( - &::anakin::rpc::_ExecutionInfo_default_instance_); -} -inline ::anakin::rpc::ExecutionInfo* RPCResponse::mutable_info() { - - if (info_ == NULL) { - info_ = new ::anakin::rpc::ExecutionInfo; - } - // @@protoc_insertion_point(field_mutable:anakin.rpc.RPCResponse.info) - return info_; -} -inline ::anakin::rpc::ExecutionInfo* RPCResponse::release_info() { - // @@protoc_insertion_point(field_release:anakin.rpc.RPCResponse.info) - - ::anakin::rpc::ExecutionInfo* temp = info_; - info_ = NULL; - return temp; -} -inline void RPCResponse::set_allocated_info(::anakin::rpc::ExecutionInfo* info) { - delete info_; - info_ = info; - if (info) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:anakin.rpc.RPCResponse.info) -} - -// int64 request_id = 4; -inline void RPCResponse::clear_request_id() { - request_id_ = GOOGLE_LONGLONG(0); -} -inline ::google::protobuf::int64 RPCResponse::request_id() const { - // @@protoc_insertion_point(field_get:anakin.rpc.RPCResponse.request_id) - return request_id_; -} -inline void RPCResponse::set_request_id(::google::protobuf::int64 value) { - - request_id_ = value; - // @@protoc_insertion_point(field_set:anakin.rpc.RPCResponse.request_id) -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - - -// @@protoc_insertion_point(namespace_scope) - - -} // namespace rpc -} // namespace anakin - -// @@protoc_insertion_point(global_scope) - -#endif // PROTOBUF_service_2eproto__INCLUDED From 0bcff1e5ab41637c9e0a9a2e8503e938b463a9dd Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Thu, 16 Aug 2018 17:46:10 +0800 Subject: [PATCH 12/13] add service rpc unit test . --- CMakeLists.txt | 2 +- cmake/compiler_options.cmake | 2 +- cmake/find_modules.cmake | 12 +- cmake/gather.cmake | 1 - framework/core/net/net.cpp | 5 +- framework/core/net/net.h | 6 +- framework/core/net/worker.cpp | 36 +++-- framework/core/net/worker.h | 4 +- framework/core/thread_pool.inl | 4 +- framework/service/anakin_service.cpp | 49 ++++-- framework/service/anakin_service.h | 39 ++--- framework/service/api/.gitignore | 42 ++++++ framework/service/device_info.h | 10 +- framework/service/monitor.h | 3 +- framework/service/service_daemon.cpp | 7 +- .../net/net_exec_multi_thread_test.cpp | 139 +++++++++--------- .../net/net_exec_nv_rnn_oneinput.cpp | 4 +- test/framework/net/net_test.h | 2 +- test/framework/service/:w | 115 +++++++++++++++ test/framework/service/service_rpc_client.cpp | 49 ++++-- test/framework/service/service_rpc_server.cpp | 13 +- 21 files changed, 380 insertions(+), 164 deletions(-) create mode 100644 framework/service/api/.gitignore create mode 100644 test/framework/service/:w diff --git a/CMakeLists.txt b/CMakeLists.txt index ba4be3280..f7e373d55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,7 +93,7 @@ anakin_option(COMPILE_PTX "Returns a list of PTX files generated from src." NO i # common build options -anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." NO) +anakin_option(ENABLE_DEBUG "Enable DEBUG(default) mode." YES) anakin_option(ENABLE_VERBOSE_MSG "Enable verbose=1 : compile msg during make." NO) anakin_option(DISABLE_ALL_WARNINGS "Disable all the warning msg during compile." YES) anakin_option(ENABLE_NOISY_WARNINGS "Enable noisy warning msg during compile." NO if DISABLE_ALL_WARNINGS) diff --git a/cmake/compiler_options.cmake b/cmake/compiler_options.cmake index 7655167fb..00e29a3b6 100644 --- a/cmake/compiler_options.cmake +++ b/cmake/compiler_options.cmake @@ -109,7 +109,7 @@ if(USE_CUDA) anakin_add_compile_option(-G NVCC) anakin_add_compile_option(-g NVCC) anakin_add_compile_option(-std=c++11 NVCC) - anakin_add_compile_option(--default-stream per-thread NVCC) + anakin_add_compile_option("--default-stream per-thread" NVCC) anakin_add_compile_option(-Wno-deprecated-gpu-targets NVCC) # suppress warning by architectures are deprecated (2.0,2.1) else() anakin_add_compile_option("-Xcompiler -fPIC" NVCC) diff --git a/cmake/find_modules.cmake b/cmake/find_modules.cmake index f35740a08..16c495211 100644 --- a/cmake/find_modules.cmake +++ b/cmake/find_modules.cmake @@ -237,14 +237,14 @@ endmacro() macro(anakin_find_google_flags) set(GFLAGS_ROOT_DIR "/usr/include" CACHE PATH "gflags path") - find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h PATHS ${GFLAGS_ROOT_DIR}) + find_path(GFLAGS_INCLUDE_DIRS gflags/gflags.h PATHS ${GFLAGS_ROOT_DIR}) - find_library(GFLAGS_LIBRARY NAMES libgflags.so + find_library(GFLAGS_LIBRARIES NAMES libgflags.so PATHS ${GFLAGS_ROOT_DIR}/../lib64 DOC "library path for gflags.") - if(GFLAGS_INCLUDE_DIR AND GFLAGS_LIBRARY) - include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) - list(APPEND ANAKIN_DEMO_LIBRARIES ${GFLAGS_LIBRARY}) + if(GFLAGS_INCLUDE_DIRS AND GFLAGS_LIBRARIES) + include_directories(SYSTEM ${GFLAGS_INCLUDE_DIRS}) + list(APPEND ANAKIN_DEMO_LIBRARIES ${GFLAGS_LIBRARIES}) else() message(SEND_ERROR "Could not found gflags !") endif() @@ -328,7 +328,7 @@ macro(anakin_find_protobuf) endmacro() macro(anakin_find_baidu_rpc) - set(BAIDU_RPC_ROOT "/usr/local/" CACHE "baidu rpc root dir") + set(BAIDU_RPC_ROOT "/usr/local/" CACHE PATH "baidu rpc root dir") find_path(RPC_INCLUDE_DIR server.h PATHS ${BAIDU_RPC_ROOT}/include/brpc/ $ENV{BAIDU_RPC_ROOT}/include/brpc/) find_library(RPC_LIBRARY NAMES libbrpc.so PATHS ${BAIDU_RPC_ROOT}/lib $ENV{BAIDU_RPC_ROOT}/include/brpc/ diff --git a/cmake/gather.cmake b/cmake/gather.cmake index 3e1678b16..ba2721a71 100644 --- a/cmake/gather.cmake +++ b/cmake/gather.cmake @@ -51,7 +51,6 @@ endif() if(BUILD_RPC) anakin_find_baidu_rpc() - anakin_find_google_flags() endif() if (USE_GFLAGS) diff --git a/framework/core/net/net.cpp b/framework/core/net/net.cpp index 25bdfd009..d7b640121 100755 --- a/framework/core/net/net.cpp +++ b/framework/core/net/net.cpp @@ -145,10 +145,7 @@ void Net::init(graph::Graph& // infer basic shape and parsing parameter from graph for (auto& node_name : node_names_in_exec_order) { auto node_ptr = (*_graph_p)[node_name]; - //LOG(ERROR) << "get node " << node_name << ", op type " << node_ptr->get_op_name(); - /*if (node_ptr->get_op_name() == "Output") { - continue; - }*/ + #ifdef ENABLE_OP_TIMER if (std::string::npos != (node_ptr->get_op_name()).find("Conv") || std::string::npos != (node_ptr->get_op_name()).find("Deconv")) { diff --git a/framework/core/net/net.h b/framework/core/net/net.h index ceae98fd6..8094deaf7 100644 --- a/framework/core/net/net.h +++ b/framework/core/net/net.h @@ -28,19 +28,19 @@ namespace anakin { template class Net { public: - explicit Net(bool need_summary = false); + explicit Net(bool need_summary = true); /** * \brief Construct a net by graph. * This construction should be use in thread call and make sure thread safety. */ - explicit Net(graph::Graph&, bool need_summary = false); + explicit Net(graph::Graph&, bool need_summary = true); /** * \brief Construct a net by graph, init with specified context. * This construction should be use in thread call and make sure thread safety. */ - explicit Net(graph::Graph&, OpContextPtr ctx, bool need_summary = false); + explicit Net(graph::Graph&, OpContextPtr ctx, bool need_summary = true); ~Net(); diff --git a/framework/core/net/worker.cpp b/framework/core/net/worker.cpp index 1ff205b19..c63bab977 100644 --- a/framework/core/net/worker.cpp +++ b/framework/core/net/worker.cpp @@ -90,17 +90,25 @@ void Worker::register_interior_edges(std::string b } template -std::future > > Worker::sync_prediction(std::vector::type, Dtype> >& net_ins_list) { - auto task = [&](std::vector::type, Dtype> >& ins) -> std::vector > { +std::future::type, Dtype> > > +Worker::sync_prediction(std::vector::type, Dtype> >& net_ins_list) { + auto task = [&](std::vector::type, Dtype> >& ins) + -> std::vector::type, Dtype> > { auto& net = MultiThreadModel::Global().get_net(std::this_thread::get_id()); //fill the graph inputs for(int i = 0; i < _inputs_in_order.size(); i++) { + for(int j=0; j<10; j++) { + LOG(INFO) << "------> data " << ins[i].mutable_data()[j];; + } auto d_tensor_in_p = net.get_in(_inputs_in_order[i]); - d_tensor_in_p->reshape(ins[i]->valid_shape()); - d_tensor_in_p->copy_from(*ins[i]); - d_tensor_in_p->set_seq_offset(ins[i]->get_seq_offset()); + d_tensor_in_p->reshape(ins[i].valid_shape()); + d_tensor_in_p->copy_from(ins[i]); + d_tensor_in_p->set_seq_offset(ins[i].get_seq_offset()); } + Context ctx(0, 0, 0); + saber::SaberTimer my_time; + my_time.start(ctx); #ifdef ENABLE_OP_TIMER Context ctx(0, 0, 0); saber::SaberTimer my_time; @@ -108,18 +116,28 @@ std::future > > Worker guard(_mut); _thead_id_to_prediction_times_vec_in_ms[std::this_thread::get_id()].push_back(my_time.get_average_ms()); + LOG(ERROR) << " exec << time: " << my_time.get_average_ms() << " ms "; } #endif // get outputs of graph - std::vector> ret; - for (auto out : _outputs_in_order) { - auto d_tensor_out_p = net.get_out(out); - ret.push_back(d_tensor_out_p); + std::vector::type, Dtype>> ret; + ret.resize(_outputs_in_order.size()); + for (int out_idx = 0; out_idx < _outputs_in_order.size(); out_idx++) { + auto d_tensor_out_p = net.get_out(_outputs_in_order[out_idx]); + ret[out_idx].re_alloc(d_tensor_out_p->valid_shape()); + ret[out_idx].copy_from(*d_tensor_out_p); + LOG(INFO) << "this thread: " << std::this_thread::get_id(); + for(int i=0; i< 10; i++) { + LOG(INFO) << "????? data " << ret[out_idx].mutable_data()[i]; + } } return ret; diff --git a/framework/core/net/worker.h b/framework/core/net/worker.h index 9bd3fe76a..4bd998f40 100644 --- a/framework/core/net/worker.h +++ b/framework/core/net/worker.h @@ -106,8 +106,8 @@ class Worker : public ThreadPool { * \param host net_in_list the inputs of net graph (note: the len of net_in_list should be equal to the net inputs). * \return the net graph outputs. */ - std::future > > sync_prediction(\ - std::vector::type, Dtype> >& net_in_list); + std::future::type, Dtype> > > sync_prediction(\ + std::vector::type, Dtype> >& net_in_list); /** * \brief Do sync prediction in multi-thread worker useful in sync rpc server, this function need diff --git a/framework/core/thread_pool.inl b/framework/core/thread_pool.inl index 896cda884..d581cfbab 100644 --- a/framework/core/thread_pool.inl +++ b/framework/core/thread_pool.inl @@ -20,7 +20,7 @@ inline void ThreadPool::launch() { task = std::move(this->_tasks.front()); this->_tasks.pop(); } - DLOG(INFO) << " Thread (" << i <<") processing"; + LOG(WARNING) << " Thread (" << i <<") processing thread_id: " << std::this_thread::get_id(); auxiliary_funcs(); task(); } @@ -55,7 +55,7 @@ inline typename function_traits::return_type ThreadPool::RunSync(functo std::future::return_type> result = task->get_future(); { std::unique_lock lock(this->_mut); - this->_tasks.emplace( [&]() { (*task)(); } ); + this->_tasks.emplace( [=]() { (*task)(); } ); } this->_cv.notify_one(); return result.get(); diff --git a/framework/service/anakin_service.cpp b/framework/service/anakin_service.cpp index bff8e3dc1..e5701a9e2 100644 --- a/framework/service/anakin_service.cpp +++ b/framework/service/anakin_service.cpp @@ -7,6 +7,7 @@ namespace rpc { template void AnakinService::set_device_id(int dev_id) { _dev_id = dev_id; + saber::TargetWrapper::set_device(_dev_id); } template @@ -17,6 +18,14 @@ void AnakinService::initial(std::string model_name, thread_num); } +template +void AnakinService::launch() { + for(auto it = _worker_map.begin(); it != _worker_map.end();) { + it->second->launch(); + it++; + } +} + template void AnakinService::register_inputs(std::string model_name, std::vector in_names) { @@ -46,18 +55,26 @@ void AnakinService::register_interior_edges(std::stri template inline void AnakinService::extract_request( const RPCRequest* request, - std::vector::type, Dtype> >& inputs) { + std::vector::type, Dtype> >& inputs) { for(int i = 0; i < request->inputs_size(); i++) { + LOG(INFO) << "Get " << i << "input"; auto& io = request->inputs(i); auto& data = io.tensor(); auto& shape = data.shape(); saber::Shape tensor_shape{shape[0],shape[1],shape[2],shape[3]}; - Tensor4dPtr::type, Dtype> h_tensor_p = - new Tensor4d::type, Dtype>(); - h_tensor_p->re_alloc(tensor_shape); - auto* h_data = h_tensor_p->mutable_data(); + Tensor4d::type, Dtype> h_tensor; + h_tensor.re_alloc(tensor_shape); + auto* h_data = h_tensor.mutable_data(); + DLOG(INFO) <<"Check shape: " << shape[0] << " " << shape[1] << " " << shape[2] << " " <::fill_response_data( int request_id, std::string model_name, RPCResponse* response, - std::vector >& outputs) { + std::vector::type, Dtype> >& outputs) { response->set_model(model_name); response->set_request_id(request_id); - for(auto& d_out_p : outputs) { + int count =0; + for(auto& h_out : outputs) { + LOG(INFO) << "Get " << count << " output"; + count++; // copy to host - auto shape = d_out_p->valid_shape(); - Tensor4dPtr::type, Dtype> h_tensor_p = - new Tensor4d::type, Dtype>(); - h_tensor_p->re_alloc(shape); - h_tensor_p->copy_from(*d_out_p); + auto shape = h_out.valid_shape(); // fill response IO* output = response->add_outputs(); Data* data = output->mutable_tensor(); @@ -84,9 +100,10 @@ inline void AnakinService::fill_response_data( data->add_shape(shape[2]); data->add_shape(shape[3]); data->mutable_data()->Reserve(shape[0]*shape[1]*shape[2]*shape[3]); - memcpy(data->mutable_data()->mutable_data(), - h_tensor_p->mutable_data(), - shape[0]*shape[1]*shape[2]*shape[3]*sizeof(float)); + for(int j=0; jadd_data(h_out.mutable_data()[j]); + } + LOG(INFO) << " output size: " <data_size(); } } diff --git a/framework/service/anakin_service.h b/framework/service/anakin_service.h index 875569ab6..6c50ad46b 100644 --- a/framework/service/anakin_service.h +++ b/framework/service/anakin_service.h @@ -37,17 +37,19 @@ class AnakinService : public RPCService { } public: - inline void set_device_id(int dev_id); + void set_device_id(int dev_id); - inline void initial(std::string model_name, std::string model_path, int thread_num); + void initial(std::string model_name, std::string model_path, int thread_num); - inline void Reshape(std::string model_name, std::string in_name, std::vector in_shape); + void launch(); - inline void register_inputs(std::string model_name, std::vector in_names); + void Reshape(std::string model_name, std::string in_name, std::vector in_shape); - inline void register_outputs(std::string model_name, std::vector); + void register_inputs(std::string model_name, std::vector in_names); - inline void register_interior_edges(std::string model_name, std::string edge_start, std::string edge_end); + void register_outputs(std::string model_name, std::vector); + + void register_interior_edges(std::string model_name, std::string edge_start, std::string edge_end); template void register_aux_function(std::string model_name, functor function, ParamTypes ...args) { @@ -56,18 +58,19 @@ class AnakinService : public RPCService { template void create_monitor(int interval_time_in_sec) { - _monitor.create_instance(_dev_id, interval_time_in_sec); + _monitor.template create_instance(_dev_id, interval_time_in_sec); } private: - inline void extract_request(const RPCRequest* request, - std::vector::type, Dtype> >& inputs); - inline void fill_response_data(int request_id, std::string model_name, - RPCResponse* response, std::vector >& outputs); - inline void fill_response_exec_info(RPCResponse* response); + void extract_request(const RPCRequest* request, + std::vector::type, Dtype> >& inputs); + void fill_response_data(int request_id, std::string model_name, + RPCResponse* response, + std::vector::type, Dtype> >& outputs); + void fill_response_exec_info(RPCResponse* response); private: - inline void _evaluate(::google::protobuf::RpcController* controller_base, + void _evaluate(::google::protobuf::RpcController* controller_base, const RPCRequest* request, RPCResponse* response, ::google::protobuf::Closure* done, @@ -78,19 +81,21 @@ class AnakinService : public RPCService { // receive remote call from client. LOG(INFO) << "Received request[log_id=" << cntl->log_id() << "] from " << cntl->remote_side(); if (!cntl->request_attachment().empty()) { - LOG(INFO) << " -- (attached=" << cntl->request_attachment() << ")"; + LOG(INFO) << " |-- (attached=" << cntl->request_attachment() << ")"; } std::string model_name = request->model(); int request_id = request->request_id(); - std::vector::type, Dtype> > inputs; + LOG(INFO) <<" |-- Get model: "<::type, Dtype> > inputs; extract_request(request, inputs); auto ret = _worker_map[model_name]->sync_prediction(inputs); auto results = ret.get(); + LOG(ERROR) << "do infer over! thread id: " << std::this_thread::get_id(); fill_response_data(request_id, model_name, response, results); fill_response_exec_info(response); } - inline void _evaluate(::google::protobuf::RpcController* controller_base, + void _evaluate(::google::protobuf::RpcController* controller_base, const RPCRequest* request, RPCResponse* response, ::google::protobuf::Closure* done, @@ -104,7 +109,7 @@ class AnakinService : public RPCService { private: std::unordered_map > > _worker_map; - Monitor _monitor; + Monitor _monitor; int _dev_id; }; diff --git a/framework/service/api/.gitignore b/framework/service/api/.gitignore new file mode 100644 index 000000000..0d9561969 --- /dev/null +++ b/framework/service/api/.gitignore @@ -0,0 +1,42 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# python +*.pyc + +# c++ +*.h +*.cpp +*.cc +*.pb.h +*.pb.cpp diff --git a/framework/service/device_info.h b/framework/service/device_info.h index 0b5dfc097..409999f26 100644 --- a/framework/service/device_info.h +++ b/framework/service/device_info.h @@ -33,7 +33,7 @@ #include // cuda driver types #endif -#include "logger/logger.h" +#include "utils/logger/logger.h" #include "saber/saber_types.h" namespace anakin { @@ -109,14 +109,14 @@ struct InfoStruct { template struct Inquiry { - ~Inquiry(); + ~Inquiry() {} - void init(int dev_id = 0); + void init(int dev_id = 0) {} template typename InfoTraits::data_type get() { LOG(WARNING) << "Target not support! "; - return InfoTraits::data_type(); + return typename InfoTraits::data_type(); } private: int _dev_id; @@ -137,7 +137,7 @@ class DevInfo : public InfoStruct... { public: template void set(typename InfoTraits::data_type value) { - std::unique_lock lock(this->mut); + std::unique_lock lock(this->_mut); if(HasTarget::value) { LOG(FATAL)<<" DevInfo parameter pack doesn't have target info type " << I; } diff --git a/framework/service/monitor.h b/framework/service/monitor.h index ef2e40472..3ef423c1f 100644 --- a/framework/service/monitor.h +++ b/framework/service/monitor.h @@ -23,6 +23,7 @@ namespace anakin { namespace rpc { /// monitor thread pool +template class Monitor { public: Monitor(){} @@ -39,7 +40,7 @@ class Monitor { std::chrono::duration_cast(sys_clock::now()-start).count(); if(elapsed_time_ms > time * 1000) { start = sys_clock::now(); - dev_info_pack.inquiry(dev_id); + dev_info_pack.template inquiry(dev_id); _name = dev_info_pack.template get(); _temp = dev_info_pack.template get(); _mem_free = dev_info_pack.template get(); diff --git a/framework/service/service_daemon.cpp b/framework/service/service_daemon.cpp index 4dc6a52ca..697c43b14 100644 --- a/framework/service/service_daemon.cpp +++ b/framework/service/service_daemon.cpp @@ -36,15 +36,16 @@ void ServiceDaemon::operator()(std::function server_start, } // Close out the standard file descriptors - close(STDIN_FILENO); // 0 - close(STDOUT_FILENO); // 1 - close(STDERR_FILENO); // 2 + //close(STDIN_FILENO); // 0 + //close(STDOUT_FILENO); // 1 + //close(STDERR_FILENO); // 2 // Daemon-specific initialization goes here */ pid_t *pid_news = new pid_t[device_list.size()]; for(;;) { for(auto dev_id : device_list) { if(!check_port_occupied(server_port) || !check_process_exist(pid_news[dev_id])) { + LOG(WARNING) <<" Create daemon process on device : " << dev_id; // reaped zombie process if(pid_news[dev_id]) waitpid(pid_news[dev_id], NULL, 0); diff --git a/test/framework/net/net_exec_multi_thread_test.cpp b/test/framework/net/net_exec_multi_thread_test.cpp index 6704c4324..33b0f8e66 100644 --- a/test/framework/net/net_exec_multi_thread_test.cpp +++ b/test/framework/net/net_exec_multi_thread_test.cpp @@ -15,102 +15,98 @@ using Target_H = ARM; #endif //std::string model_path = "../benchmark/CNN/models/vgg16.anakin.bin"; // std::string model_path = "/home/public/model_from_fluid/beta/demoprogram.anakin2.bin"; -std::string model_path = "benchmark/CNN/mobilenet_v2.anakin.bin"; +//std::string model_path = "benchmark/CNN/mobilenet_v2.anakin.bin"; +std::string model_path = "/home/cuichaowen/anakin2/public_model/public-caffe-model/mobilenetv12/mobilenet_v2.anakin.bin"; #ifdef USE_CUDA #if 0 -TEST(NetTest, nv_net_execute_muti_thread_sync_test) { -#if 1 // use host input - //Env::env_init(1); - LOG(WARNING) << "Sync Runing multi_threads for model: " << model_path; - Worker workers(model_path, 10); - workers.register_inputs({"input_0"}); - workers.register_outputs({"softmax_out"}); - workers.Reshape("input_0", {1, 384, 960, 3}); +TEST(NetTest, net_execute_single_test) { + Graph* graph = new Graph(); + LOG(WARNING) << "load anakin model file from " << model_path << " ..."; + // load anakin model files. + auto status = graph->load(model_path); + if(!status ) { + LOG(FATAL) << " [ERROR] " << status.info(); + } - workers.launch(); + //anakin graph optimization + graph->Optimize(); - std::vector::type, AK_FLOAT> > host_tensor_p_in_list; - // get in - saber::Shape valid_shape_in({1, 384, 960, 3}); - Tensor4dPtr::type, AK_FLOAT> h_tensor_in = new Tensor4d::type, AK_FLOAT>(valid_shape_in); - float* h_data = h_tensor_in->mutable_data(); - for (int i=0; isize(); i++) { - h_data[i] = 1.0f; - } - host_tensor_p_in_list.push_back(h_tensor_in); + Net net_executer(*graph, true); + + int epoch = 2; + // do inference + Context ctx(0, 0, 0); + saber::SaberTimer my_time; + LOG(WARNING) << "EXECUTER !!!!!!!! "; + + my_time.start(ctx); - int epoch = 1000; - // Running for(int i=0; i h_tensor_in; - // get the output - auto d_tensor_p = d_tensor_p_out_list[0]; - } + auto valid_shape_in = d_tensor_in_p->valid_shape(); + for (int i=0; ifirst << " processing " << it->second.size() << " tasks"; - for (auto time_in_ms : it->second) { - LOG(INFO) << " \\__task avg time: " << time_in_ms; - } - } -#endif + h_tensor_in.re_alloc(valid_shape_in); + float* h_data = h_tensor_in.mutable_data(); -#endif + for (int i=0; icopy_from(h_tensor_in); + + net_executer.prediction(); + + auto tensor_out_0_p = net_executer.get_out("prob_out"); + + test_print(tensor_out_0_p); + } +} +#endif -#if 0 // use device input - Env::env_init(1); +#if 1 +TEST(NetTest, net_execute_muti_thread_sync_test) { LOG(WARNING) << "Sync Runing multi_threads for model: " << model_path; - Worker workers(model_path, 1); + Worker workers(model_path, 3); workers.register_inputs({"input_0"}); - workers.register_outputs({"softmax_out"}); - workers.Reshape("input_0", {1, 384, 960, 3}); + workers.register_outputs({"prob_out"}); + workers.Reshape("input_0", {1, 3, 224, 224}); workers.launch(); - std::vector::type, AK_FLOAT> > host_tensor_p_in_list; + std::vector::type, AK_FLOAT> > host_tensor_in_list; // get in - saber::Shape valid_shape_in({1, 384, 960, 3}); - Tensor4dPtr::type, AK_FLOAT> h_tensor_in = new Tensor4d::type, AK_FLOAT>(valid_shape_in); - float* h_data = h_tensor_in->mutable_data(); - for (int i=0; isize(); i++) { - h_data[i] = 1.0f; - } - host_tensor_p_in_list.push_back(h_tensor_in); + saber::Shape valid_shape_in({1, 3, 224, 224}); + Tensor4d::type, AK_FLOAT> h_tensor_in(valid_shape_in); - std::vector > device_tensor_p_in_list; - for (int i=0; i d_tensor_in = new Tensor4d(host_tensor_p_in_list[i]->valid_shape()); - d_tensor_in->copy_from(*(host_tensor_p_in_list[i])); - device_tensor_p_in_list.push_back(d_tensor_in); + float* h_data = h_tensor_in.mutable_data(); + for (int i=0; i ctx(0, 0, 0); - saber::SaberTimer my_time; - - my_time.start(ctx); - auto d_tensor_p_out_list = workers.sync_prediction_device(device_tensor_p_in_list); - my_time.end(ctx); - LOG(INFO)<<"muti thread single task exec time: "< workers(model_path, 10); @@ -155,6 +151,7 @@ TEST(NetTest, net_execute_muti_thread_async_test) { check.join(); } #endif + #endif int main(int argc, const char** argv){ diff --git a/test/framework/net/net_exec_nv_rnn_oneinput.cpp b/test/framework/net/net_exec_nv_rnn_oneinput.cpp index ed4b8c1f3..7c351ebe2 100644 --- a/test/framework/net/net_exec_nv_rnn_oneinput.cpp +++ b/test/framework/net/net_exec_nv_rnn_oneinput.cpp @@ -370,7 +370,7 @@ void worker_run(){ for(int i=0; i::type, AK_FLOAT> > tensor_in_vec(1); // tensor_in_vec[0]=host_tensor_p_in_list[0][i]; - workers.sync_prediction(tensor_in_vec); + //workers.sync_prediction(tensor_in_vec); // auto d_tensor_p_out_list = workers.sync_prediction(host_tensor_p_in_list); // get the output @@ -458,4 +458,4 @@ int main(int argc, const char** argv) { return 0; } -#endif \ No newline at end of file +#endif diff --git a/test/framework/net/net_test.h b/test/framework/net/net_test.h index 4c1f6a51b..6c2631481 100644 --- a/test/framework/net/net_test.h +++ b/test/framework/net/net_test.h @@ -50,7 +50,7 @@ void test_print(Tensor4dPtr& out_tensor_p) { h_tensor_result.re_alloc(out_tensor_p->valid_shape()); LOG(ERROR) << "result count : " << h_tensor_result.valid_shape().count(); h_tensor_result.copy_from(*out_tensor_p); - for (int i = 0; i < h_tensor_result.valid_size(); i++) { + for (int i = 0; i < /*h_tensor_result.valid_size()*/10; i++) { LOG(INFO) << " GET OUT (" << i << ") " << h_tensor_result.mutable_data()[i]; } } diff --git a/test/framework/service/:w b/test/framework/service/:w new file mode 100644 index 000000000..95319a396 --- /dev/null +++ b/test/framework/service/:w @@ -0,0 +1,115 @@ +#include +#include "net_test.h" +#include "saber/funcs/timer.h" +#include + +#if defined(USE_CUDA) +using Target = NV; +using Target_H = X86; +#elif defined(USE_X86_PLACE) +using Target = X86; +using Target_H = X86; +#elif defined(USE_ARM_PLACE) +using Target = ARM; +using Target_H = ARM; +#endif +//std::string model_path = "../benchmark/CNN/models/vgg16.anakin.bin"; +// std::string model_path = "/home/public/model_from_fluid/beta/demoprogram.anakin2.bin"; +//std::string model_path = "benchmark/CNN/mobilenet_v2.anakin.bin"; +std::string model_path = "/home/cuichaowen/anakin2/public_model/public-caffe-model/mobilenetv12/mobilenet_v2.anakin.bin"; + +#ifdef USE_CUDA +#if 1 +TEST(NetTest, net_execute_muti_thread_sync_test) { + LOG(WARNING) << "Sync Runing multi_threads for model: " << model_path; + Worker workers(model_path, 2); + workers.register_inputs({"input_0"}); + workers.register_outputs({"prob_out"}); + workers.Reshape("input_0", {1, 3, 224, 224}); + + workers.launch(); + + std::vector::type, AK_FLOAT> > host_tensor_in_list; + // get in + saber::Shape valid_shape_in({1, 3, 224, 224}); + Tensor4d::type, AK_FLOAT> h_tensor_in(valid_shape_in); + + float* h_data = h_tensor_in.mutable_data(); + for (int i=0; i workers(model_path, 10); + workers.register_inputs({"input_0"}); + workers.register_outputs({"prob_out"}); + workers.Reshape("input_0", {1, 3, 224, 224}); + + workers.launch(); + + std::vector::type, AK_FLOAT> > host_tensor_p_in_list; + // get in + saber::Shape valid_shape_in({1, 3, 224, 224}); + Tensor4dPtr::type, AK_FLOAT> h_tensor_in = new Tensor4d::type, AK_FLOAT>(valid_shape_in); + float* h_data = h_tensor_in->mutable_data(); + for (int i=0; isize(); i++) { + h_data[i] = 1.0f; + } + host_tensor_p_in_list.push_back(h_tensor_in); + + int epoch = 2000; + + std::thread check([&]() { + int iterator = epoch; + while(iterator) { + LOG(INFO) << "check work queue: " << iterator << "/" << epoch; + if(!workers.empty()) { + auto d_tensor_p = workers.async_get_result();//[0]; + LOG(WARNING) << "worker consume one"; + // get hte data of d_tensor_p + + iterator--; + } + } + }); + + // Running + for(int i=0; i::env_init(); + + // initial logger + logger::init(argv[0]); + InitTest(); + RUN_ALL_TESTS(argv[0]); + return 0; +} diff --git a/test/framework/service/service_rpc_client.cpp b/test/framework/service/service_rpc_client.cpp index 9ec3b0dd0..c6ee146af 100644 --- a/test/framework/service/service_rpc_client.cpp +++ b/test/framework/service/service_rpc_client.cpp @@ -1,7 +1,8 @@ #include -#include "net_test.h" +#include "service_test.h" #include "saber/funcs/timer.h" #include +#include #if defined(USE_CUDA) using Target = NV; @@ -14,19 +15,31 @@ using Target = ARM; using Target_H = ARM; #endif +std::string protocol = "baidu_std"; +std::string server = "0.0.0.0:8000"; + void fill_request(int id, RPCRequest& request) { request.set_model("mobilenet_v2"); request.set_request_id(id); - int batch_size = 10; + int batch_size = 1; IO* input = request.add_inputs(); - Date* data = input->mutable_tensor(); - data->add_shape(1); + Data* data = input->mutable_tensor(); + data->add_shape(batch_size); data->add_shape(3); data->add_shape(224); data->add_shape(224); - float new_tmp_data[1*3*224*224] = {1.f}; - input->mutable_data()->Reserve(1*3*224*224); - memcpy(input->mutable_data()->mutable_data(), new_tmp_data, 3*224*224*sizeof(float)); + float new_tmp_data[batch_size*3*224*224]; + for(int i=0; i < batch_size*3*224*224; i++) { + new_tmp_data[i] = 1.0f; + } + data->mutable_data()->Reserve(batch_size*3*224*224); + LOG(WARNING) << " client data_p: " << data->mutable_data()->mutable_data() << " o: " + << request.inputs(0).tensor().data().data(); + //memcpy(data->mutable_data()->mutable_data(), new_tmp_data, 3*224*224*sizeof(float)); + for(int i=0; imsg() + << "): " << response.info().msg() << " latency = " << cntl.latency_us() <<" us"; + for(int j =0; j<10; j++) { + LOG(WARNING) << " \\__ get response data[" << j << "]: " + << response.outputs(0).tensor().data(j); + } } else { LOG(INFO) << "I (" << cntl.local_side() << ") Received response from remote (" << cntl.remote_side() - << "): " << response->msg() + << "): " << response.info().msg() << " (attached=" << cntl.response_attachment() << ") latency=" << cntl.latency_us() <<" us"; } } else { - LOG(WARNING) << cntl.ErrorText(); + LOG(WARNING) << "Anakin Client Error==> "<< cntl.ErrorText() < -#include "net_test.h" +#include "service_test.h" #include "saber/funcs/timer.h" #include @@ -15,8 +15,9 @@ using Target_H = ARM; #endif std::string mobilenet_v2_model_path = "/home/cuichaowen/anakin2/public_model/public-caffe-model/mobilenetv12/mobilenet_v2.anakin.bin"; +int batchsize = 1; -int service_start(int port,int dev_id) { +int service_start(int port, int dev_id) { // create one server brpc::Server server; @@ -26,13 +27,18 @@ int service_start(int port,int dev_id) { rpc_service.set_device_id(dev_id); // initialize config for mobilenet v2 - rpc_service.initial("mobilenet_v2", model_path, 3); + rpc_service.initial("mobilenet_v2", mobilenet_v2_model_path, 3); rpc_service.register_inputs("mobilenet_v2", {"input_0"}); + rpc_service.Reshape("mobilenet_v2", "input_0", {batchsize, 3, 224, 224}); rpc_service.register_outputs("mobilenet_v2", {"prob_out"}); // create moniter for this service rpc_service.create_monitor(30); // span 30 second + + // launch rpc service + rpc_service.launch(); + // add service to server if (server.AddService(&rpc_service, brpc::SERVER_DOESNT_OWN_SERVICE) != 0) { LOG(ERROR) << "Fail to add service"; @@ -47,6 +53,7 @@ int service_start(int port,int dev_id) { options.num_threads = 10; // Max concurrency request of server options.max_concurrency = 300; + if (server.Start(port, &options) != 0) { LOG(ERROR) << "Fail to start Server on port "<< port << " device id " << dev_id; return -1; From 86520a7c0956cb0b2af08874ba0028b421cd0f09 Mon Sep 17 00:00:00 2001 From: cuichaowen <939136265@qq.com> Date: Thu, 16 Aug 2018 18:19:14 +0800 Subject: [PATCH 13/13] rm useless files. --- test/framework/service/:w | 115 -------------------------------------- 1 file changed, 115 deletions(-) delete mode 100644 test/framework/service/:w diff --git a/test/framework/service/:w b/test/framework/service/:w deleted file mode 100644 index 95319a396..000000000 --- a/test/framework/service/:w +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include "net_test.h" -#include "saber/funcs/timer.h" -#include - -#if defined(USE_CUDA) -using Target = NV; -using Target_H = X86; -#elif defined(USE_X86_PLACE) -using Target = X86; -using Target_H = X86; -#elif defined(USE_ARM_PLACE) -using Target = ARM; -using Target_H = ARM; -#endif -//std::string model_path = "../benchmark/CNN/models/vgg16.anakin.bin"; -// std::string model_path = "/home/public/model_from_fluid/beta/demoprogram.anakin2.bin"; -//std::string model_path = "benchmark/CNN/mobilenet_v2.anakin.bin"; -std::string model_path = "/home/cuichaowen/anakin2/public_model/public-caffe-model/mobilenetv12/mobilenet_v2.anakin.bin"; - -#ifdef USE_CUDA -#if 1 -TEST(NetTest, net_execute_muti_thread_sync_test) { - LOG(WARNING) << "Sync Runing multi_threads for model: " << model_path; - Worker workers(model_path, 2); - workers.register_inputs({"input_0"}); - workers.register_outputs({"prob_out"}); - workers.Reshape("input_0", {1, 3, 224, 224}); - - workers.launch(); - - std::vector::type, AK_FLOAT> > host_tensor_in_list; - // get in - saber::Shape valid_shape_in({1, 3, 224, 224}); - Tensor4d::type, AK_FLOAT> h_tensor_in(valid_shape_in); - - float* h_data = h_tensor_in.mutable_data(); - for (int i=0; i workers(model_path, 10); - workers.register_inputs({"input_0"}); - workers.register_outputs({"prob_out"}); - workers.Reshape("input_0", {1, 3, 224, 224}); - - workers.launch(); - - std::vector::type, AK_FLOAT> > host_tensor_p_in_list; - // get in - saber::Shape valid_shape_in({1, 3, 224, 224}); - Tensor4dPtr::type, AK_FLOAT> h_tensor_in = new Tensor4d::type, AK_FLOAT>(valid_shape_in); - float* h_data = h_tensor_in->mutable_data(); - for (int i=0; isize(); i++) { - h_data[i] = 1.0f; - } - host_tensor_p_in_list.push_back(h_tensor_in); - - int epoch = 2000; - - std::thread check([&]() { - int iterator = epoch; - while(iterator) { - LOG(INFO) << "check work queue: " << iterator << "/" << epoch; - if(!workers.empty()) { - auto d_tensor_p = workers.async_get_result();//[0]; - LOG(WARNING) << "worker consume one"; - // get hte data of d_tensor_p - - iterator--; - } - } - }); - - // Running - for(int i=0; i::env_init(); - - // initial logger - logger::init(argv[0]); - InitTest(); - RUN_ALL_TESTS(argv[0]); - return 0; -}