tensor_graph_executor.hpp 1021 Bytes
Newer Older
Mccaskey, Alex's avatar
Mccaskey, Alex committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/** ExaTN:: Tensor Runtime: Tensor graph executor
REVISION: 2019/07/24

Copyright (C) 2018-2019 Dmitry Lyakh, Tiffany Mintz, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)

Rationale:

**/

#ifndef EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_
#define EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_

#include "tensor_graph.hpp"
#include "tensor_node_executor.hpp"
#include "tensor_operation.hpp"

#include <memory>

namespace exatn {
namespace runtime {

class TensorGraphExecutor {

public:

  /** Set the DAG node executor (tensor operation executor). **/
  bool setNodeExecutor(std::shared_ptr<TensorNodeExecutor> node_executor)
  {
    if(node_executor_) return false;
    node_executor_ = node_executor;
    return true;
  }

  /** Traverses the DAG and executes all its nodes. **/
  virtual void execute(TensorGraph & dag) = 0;

protected:
  std::shared_ptr<TensorNodeExecutor> node_executor_;
};

} //namespace runtime
} //namespace exatn

#endif //EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_