Bolt
flow.h
Go to the documentation of this file.
1 
22 #ifndef FLOW_INCLUDE_FLOW_H_
23 #define FLOW_INCLUDE_FLOW_H_
24 
25 #include <string>
26 #include <vector>
27 #include <map>
28 #include <queue>
29 #include "flow.pb.h"
30 
31 #include "node.h"
32 #include "task.h"
33 #include "schedule.h"
34 #include "tensor.hpp"
35 
36 class Flow {
37 public:
38  Flow();
39 
40  ~Flow();
41 
52  void init(std::vector<std::string> graphPaths,
53  DataType precision,
54  AffinityPolicy affinityPolicy = AFFINITY_CPU_HIGH_PERFORMANCE,
55  int cpuThreads = 1,
56  bool useGPU = true);
57 
64  void enqueue(Task task);
65 
72  std::vector<Task> dequeue(bool block = false);
73 
79  unsigned int size();
80 
81 private:
82  Schedule<flow::GraphParameter, Node, Tensor> schedule;
83  std::queue<std::shared_ptr<Task>> tasks;
84 };
85 #endif // FLOW_INCLUDE_FLOW_H_
unsigned int size()
get the current number of unfinished tasks
optional string precision
Definition: flow.proto:70
void enqueue(Task task)
std::vector< Task > dequeue(bool block=false)
Definition: flow.h:36
Task API Document.
void init(std::vector< std::string > graphPaths, DataType precision, AffinityPolicy affinityPolicy=AFFINITY_CPU_HIGH_PERFORMANCE, int cpuThreads=1, bool useGPU=true)
initialize flow
Definition: task.h:42