Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

understanding nested flowgraphs

Ant_C_
Beginner
118 Views

Hi,

I'd like to try implement nested flowgraphs in my application and as a first step attempted to copy/paste the code from the docs example here:

http://www.threadingbuildingblocks.org/docs/help/tbb_userguide/use_nested_flow_graphs.htm

If I populate node 'a' with 3 items (exactly like the example) all is well and the program completes:

for ( int i = 0; i < 3; ++i ) {
    a.try_put(i);
}
g.wait_for_all();

However if I increment the loop by 1 such that node 'a' is populated with 4 or more messages, the program always deadlocks with some subset of node a's nested flowgraph tasks completing but no tasks from b's flowgraph ever being executed.

tbb::task_scheduler_init::default_num_threads() for my system returns 4. Alternatively if I initialize the task scheduler with only 3 threads I can then only put 2 items onto the top-level flow graph. In general it seems that waiting on a child flow graph doesn't cause the graph node to give up the thread while it waits. Is that correct or am I misunderstanding?  

thanks in advance.

Antony

 

0 Kudos
0 Replies
Reply