MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Run

Method Run

tensorflow/core/kernels/task_runner.h:82–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 : func_(f), summary_(init_summary), thread_pool_(tp), num_tasks_(n) {}
81
82 void Run() {
83 if (num_tasks_ <= 0) return;
84 BlockingCounter bc(num_tasks_ - 1);
85
86 // Sending (num_tasks - 1) tasks to threadpool for scheduling
87 for (int32 i = 0; i < num_tasks_ - 1; ++i) {
88 thread_pool_->Schedule([this, &bc, i]() {
89 const S& ret = func_(i, num_tasks_);
90 UpdateSummaryUnlocked(ret);
91 bc.DecrementCount();
92 });
93 }
94 // Run the last task in current thread.
95 const S& ret = func_(num_tasks_ - 1, num_tasks_);
96 UpdateSummaryUnlocked(ret);
97 bc.Wait();
98 }
99
100 S summary() {
101 return summary_;

Callers

nothing calls this directly

Calls 3

ScheduleMethod · 0.45
DecrementCountMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected