16 #ifndef EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_
17 #define EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_
19 #include "Identifiable.hpp"
21 #include "tensor_graph.hpp"
22 #include "tensor_node_executor.hpp"
23 #include "tensor_operation.hpp"
39 node_executor_(
nullptr), logging_(0), stopping_(
false), active_(
false) {}
52 node_executor_ = node_executor;
53 if(node_executor_) node_executor_->initialize();
59 if(logging_.load() == 0){
60 if(level != 0) logfile_.open(
"exatn_exec_thread.log", std::ios::out | std::ios::trunc);
62 if(level == 0) logfile_.close();
64 logging_.store(level);
73 virtual std::shared_ptr<TensorGraphExecutor>
clone() = 0;
77 const std::vector<std::pair<DimOffset,DimExtent>> & slice_spec) {
78 assert(node_executor_);
79 return node_executor_->getLocalTensor(tensor,slice_spec);
86 stopping_.store(
true);
87 while(active_.load()){};
92 std::shared_ptr<TensorNodeExecutor> node_executor_;
93 std::ofstream logfile_;
94 std::atomic<int> logging_;
95 std::atomic<bool> stopping_;
96 std::atomic<bool> active_;
102 #endif //EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_