• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2022 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "runtime/graph_scheduler/actor/rpc/rpc_actor.h"
18 
19 namespace mindspore {
20 namespace runtime {
SetOpcontext(OpContext<DeviceTensor> * const op_context)21 void RpcActor::SetOpcontext(OpContext<DeviceTensor> *const op_context) { op_context_ = op_context; }
22 
set_actor_route_table_proxy(const ActorRouteTableProxyPtr & proxy)23 void RpcActor::set_actor_route_table_proxy(const ActorRouteTableProxyPtr &proxy) { actor_route_table_proxy_ = proxy; }
24 
set_inter_process_edge_names(const std::vector<std::string> & edge_names)25 void RpcActor::set_inter_process_edge_names(const std::vector<std::string> &edge_names) {
26   inter_process_edge_names_ = edge_names;
27 }
28 
CopyRpcDataWithOffset(RpcDataPtr * rpc_data,const void * src_data,size_t src_data_size) const29 bool RpcActor::CopyRpcDataWithOffset(RpcDataPtr *rpc_data, const void *src_data, size_t src_data_size) const {
30   MS_EXCEPTION_IF_NULL(rpc_data);
31   MS_EXCEPTION_IF_NULL(*rpc_data);
32 
33   int ret = memcpy_s(*rpc_data, src_data_size, src_data, src_data_size);
34   if (EOK != ret) {
35     MS_LOG(ERROR) << "Failed to memcpy_s for rpc data. Error number: " << ret;
36     return false;
37   }
38   *rpc_data += src_data_size;
39   return true;
40 }
41 }  // namespace runtime
42 }  // namespace mindspore
43