| 53 | } |
| 54 | |
| 55 | void Device::Exec(function<void(Context*)>&& fn, |
| 56 | const vector<Block*> read_blocks, |
| 57 | const vector<Block*> write_blocks, string op_name, |
| 58 | bool use_rand_generator) { |
| 59 | if (graph_enabled_ == true) { |
| 60 | graph_->AddOperation(std::move(fn), read_blocks, write_blocks, op_name); |
| 61 | } else { |
| 62 | // printf("immediately ops\n"); |
| 63 | DoExec(std::move(fn), 0); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | void Device::RunGraph(bool serial) { |
| 68 | bool previous_state = graph_enabled_; |