Community
cancel
Showing results for 
Search instead for 
Did you mean: 
yoavhacohen
Beginner
142 Views

Static Scheduling in TBB?

Hello,
I use TBB for parallelizing my code.
However, due to the dynamic scheduling, the result is not deterministic.
For testing, I do want the code to be parallel (to gain the speedup), but I would like to use static scheduling.
Is it possible to use static scheduling with TBB?
Thanks in advance,
Yoav
0 Kudos
2 Replies
Alexey_K_Intel3
Employee
142 Views

If you mean something a-la OpenMP schedule(static), it does not exist. First, OpenMP fixes the number of threads in a parallel region, so schedule(static) can divide the work equally between the threads. In TBB, the number of threads handling parallel_for tasks can change dynamically.
Partitioning of the overall iteration space intowork chunksis deterministic with simple_partitioner, and non-deterministic with auto_ and affinity_partitioner. Mapping of work chunks to threads is always dynamic and nondeterministicin TBB, done by its work stealing scheduler.

Under the result not being deterministic, what exactly do you mean? Maybe we could suggest some ideas how to deal with the trouble.
RafSchietekat
Black Belt
142 Views

Just to cover the basics (although you would have read that in the documentation): the ultimate deterministic execution is where task_scheduler_init is used to specify single-threaded execution. TBB is about optional parallelism without required concurrency partly to allow such simple static scheduling. Did you try it yet?
Reply