|
std::vector< std::vector< int > > | rr_partitioner (int begin, int end, int step, int num_threads) |
| A partitioner to split the task to each thread in Round-robin manner. More...
|
|
void | parallel_for (int begin, int end, const std::function< void(int)> &f, int step=1, const PartitionerFuncType partitioner=rr_partitioner) |
| A runtime api provided to run the task function in parallel. e.g. A for loop: for (int i = 0; i < 10; i++) { a[i] = i; } should work the same as: parallel_for(0, 10, [&a](int index) { a[i] = i; });. More...
|
|
void | parallel_for_dynamic (int begin, int end, int num_threads, const std::function< void(int thread_id, int task_id)> &f) |
| An API to launch fix amount of threads to run the specific functor in parallel. Different from parallel_for , the partition is determined dynamically on the fly, i.e. any time when a thread is idle, it fetches the next task to run. The behavior is similar to dynamic scheduling in OpenMP: More...
|
|
void tvm::support::parallel_for_dynamic |
( |
int |
begin, |
|
|
int |
end, |
|
|
int |
num_threads, |
|
|
const std::function< void(int thread_id, int task_id)> & |
f |
|
) |
| |
An API to launch fix amount of threads to run the specific functor in parallel. Different from parallel_for
, the partition is determined dynamically on the fly, i.e. any time when a thread is idle, it fetches the next task to run. The behavior is similar to dynamic scheduling in OpenMP:
#pragma omp parallel for schedule(dynamic) num_threads(num_threads) for (int i = 0; i < 10; i++) { a[i] = i; }
- Parameters
-
begin | The start index of this parallel loop (inclusive). |
end | The end index of this parallel loop (exclusive). |
num_threads | The number of threads to be used. |
f | The task function to be executed. Takes the thread index and the task index as input with no output. |
- Note
step
support is left for future work.