1 /** 2 * Copyright 2021 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 #ifndef MINDSPORE_CCSRC_RUNTIME_FRAMEWORK_ACTOR_DEBUG_AWARE_ACTOR_H_ 18 #define MINDSPORE_CCSRC_RUNTIME_FRAMEWORK_ACTOR_DEBUG_AWARE_ACTOR_H_ 19 20 #include <string> 21 #include "runtime/graph_scheduler/actor/memory_aware_actor.h" 22 23 namespace mindspore { 24 namespace runtime { 25 // The actor represents a set of common debug related operations of actor. 26 class DebugAwareActor : public MemoryAwareActor { 27 public: DebugAwareActor(const std::string & name,KernelTransformType type,const AID * recorder_aid,const AID & memory_manager_aid,const AID * debug_aid,const AID * profiler_aid)28 explicit DebugAwareActor(const std::string &name, KernelTransformType type, const AID *recorder_aid, 29 const AID &memory_manager_aid, const AID *debug_aid, const AID *profiler_aid) 30 : MemoryAwareActor(name, type, recorder_aid, memory_manager_aid), 31 debug_aid_(debug_aid), 32 profiler_aid_(profiler_aid) {} 33 ~DebugAwareActor() override = default; 34 SendDebugReq(OpContext<DeviceTensor> * const context)35 virtual void SendDebugReq(OpContext<DeviceTensor> *const context) {} OnDebugFinish(OpContext<DeviceTensor> * const context)36 virtual void OnDebugFinish(OpContext<DeviceTensor> *const context) { PostRun(context); } 37 38 protected: 39 // The id of debug actor. Send message to it for debug. 40 const AID *debug_aid_; 41 const AID *profiler_aid_; 42 }; 43 } // namespace runtime 44 } // namespace mindspore 45 46 #endif // MINDSPORE_CCSRC_RUNTIME_FRAMEWORK_ACTOR_DEBUG_AWARE_ACTOR_H_ 47