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

How can I set up a "repeater" in the flow graph?

Gehua_Y_
Beginner
345 Views

I am new to TBB flow graph and also new to this forum.  Forgive me if I made mistakes. 

In my flow graph, I have two parallel paths A and B that are joined at join_node c.    Along path A there are a number of function nodes.  Messages may flow pass and be processed.  B has only one node b that represents a pre- task.  This task can be carried out in parallel to tasks on path A, but must be finished before the join_node n can execute, which is why I choose a join_node for c. 

My problem is that I want node b to repeat its msg multiple times so that join_node c can execute when multiple messages flow through path A.  I don't really care what message node b can generate, as long as it is generated a given number times.

Is there anyway to achieve this in tbb flow graph. 

 

 

0 Kudos
3 Replies
RafSchietekat
Valued Contributor III
345 Views

How about a source_node that generates only one value, followed by a write_once_node?

0 Kudos
Gehua_Y_
Beginner
345 Views

I have tried the same idea.  I connect the write_once_node with join_node c.  But I got only one execution of join_node c.  I don't know what is the reason, but I suspect the write_once_node sent only one message.  

Is there a special way to make join_node to work with a write_once_node?

My current solution is to use a multifunction_node with only one output node.  But in this node I can use a for loop to use get<0>(out).try_put().

 

0 Kudos
RafSchietekat
Valued Contributor III
345 Views

That would have been my second suggestion, but I do find flow graph somewhat mysterious.

0 Kudos
Reply