Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Excessive time spent in TBB Scheduler

jefffaust
New Contributor I
328 Views
We have an application we are parallelizing using a pipeline. VTune shows that a large amount of time is spent in the TBB scheduler. Does this signify that the pipeline is starved of work? I'm not sure where to begin understanding this. Any help will be appreciated.
Below is the summary from VTune "Locks and Waits" analysis. You can see that of the total wait time of 28 seconds, 24 of those seconds were from the TBB scheduler.
-Jeff
0 Kudos
2 Replies
jefffaust
New Contributor I
328 Views
I think I understand what's happening. The parallel filter is being starved of tasks because we're doing too much work in the final serial filter.
0 Kudos
jimdempseyatthecove
Honored Contributor III
328 Views
If you cannot get the tokens out (of your last serial filter) then they cannot be recirculated to the input filter.

Try to do as little as possible in the input and output filters. i.e. if possible pull the "work" portion of the output filter into the parallel interior filters. If your output filter is reduced down to a single file write, then other than experimenting with buffer size there is not much else you can do.

With TBB you might try changing your output filter to one that packs a larger I/O delivery buffer (you have a pool of these preallocated). i.e. change a larger number of small writes to a smaller number of larger writes. You would have to handle the last partial buffer write (possibly by passing a 0 length buffer through the output filter).

Jim Dempsey
0 Kudos
Reply