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

flow graph hangs at wait_for_all

cinar_e_
Beginner
956 Views

Hello,

I have been using flow_graph for a while and at the exit of my program, there is a wait_for_all() call on the graph. The program hangs there and cannot exit. What can i check in order to find the reason and fix this problem?

regards.

0 Kudos
11 Replies
Nikita_P_Intel
Employee
956 Views

Hi, cinar

Do you use any decrement/increment_wait_count() graph API or asynchronous features like async_node, async_msg?

Thanks, Nikita

0 Kudos
cinar_e_
Beginner
956 Views

hi,

I only use function_node s. Nothing else.

 

regards.

0 Kudos
Nikita_P_Intel
Employee
956 Views

Then, could you, please, send a minimal reproducer for your problem and explain what you are trying to achieve?

Thanks, Nikita

0 Kudos
cinar_e_
Beginner
956 Views

actually it is hard to share.

I have just one graph object and several classes use this same graph for their async needs. Corresponding function nodes are called with try_put() methods. 

Is there no way to understand the graph's current status, etc. before wait_for_all() call?

0 Kudos
Nikita_P_Intel
Employee
956 Views

There is no such status API for the graph as far as I know.

Ok, then how this async needs is organized? Do you use any native (non TBB thread-pool threads)? What TBB version do you use?

0 Kudos
cinar_e_
Beginner
956 Views

hi,

version i use: 4.4~20151115-0ubuntu3

I have 1 long running task and 2 pthreads in addition to the graph usage. In the log, i see that their infinite loops end before wait_for_all(). (pthreads' join calls are after wait_for_all() )

 

 

0 Kudos
Nikita_P_Intel
Employee
956 Views

Seems like this is a multiple wait issue. By default, the graph is created with default task_group context, which can lead to root task ref_count races in concurrent wait scenario. Pass appropriate task_group_context to the graph constructor:

tbb::task_group_context ctx( tbb::task_group_context::bound, tbb::task_group_context::concurrent_wait );
tbb::flow::graph g( ctx );

Also, use the latest version of TBB. We have fixed other possible hanging scenarios for the graph there.

0 Kudos
cinar_e_
Beginner
956 Views

thanks nikita. I upgraded the tbb and made the code change you recommended. I will check with these updates.

0 Kudos
cinar_e_
Beginner
956 Views

Hello nikita,

 

after the changes above (upgrade and task_group_context), i still faced this problem. Do you have anything else to recommend me to check?

0 Kudos
Nikita_P_Intel
Employee
956 Views

Hi cinar,

it is hard to tell without a detailed scenario, reproducer or maybe pseudocode could help.

0 Kudos
cinar_e_
Beginner
956 Views

hello nikita,

I figured out that the problem i faced has nothing to do with tbb; just my own fault. sorry for taking your time.

Best.

0 Kudos
Reply