TBB, classes, memory

TBB, classes, memory

I fail to understand how should I use TBB for my needs.

My code is (obviously) divided among several classes. Such a class has inputs, outputs, internal memory and (at least) one member function that processes the input using some of the internal memory. 

Would like to create a pipeline using flow graph (to be able to generalize in the future) something like A->B. 

Suppose A 's output is a pointer to float array of length N. B processes this array using an internal array of length N.

I create the classes, connect the nodes. I do not understand what happens when it runs. Are new instances of objects for A and B created, depending on the concurrency? If not - what should I do to enable parallel access to different segments of memory?

Thank you,

 

Sorin

 

4 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Raf Schietekat的头像

If you're talking about a node's Body, there's one operational instance for the node, copied at construction time, and it is accessed concurrently. That means that you are responsible for synchronising access to any shared internal state. You can also use TLS if it does not matter that the number of parallel states may exceed the concurrency level of the node.

引文:

Raf Schietekat 写道:

If you're talking about a node's Body, there's one operational instance for the node, copied at construction time, and it is accessed concurrently. That means that you are responsible for synchronising access to any shared internal state. You can also use TLS if it does not matter that the number of parallel states may exceed the concurrency level of the node.

So does this mean that if I need such a node to be operated n times in parallel I should generate n nodes and operate each one serially?

What TLS stands for?

Thanks

Sorin

引文:

Raf Schietekat 写道:

If you're talking about a node's Body, there's one operational instance for the node, copied at construction time, and it is accessed concurrently. That means that you are responsible for synchronising access to any shared internal state. You can also use TLS if it does not matter that the number of parallel states may exceed the concurrency level of the node.

Does this mean that if a class has internal memory that is used for r/w I need to create a new object for each concurrent usage ?

Thank you 

 

Sorin

登陆并发表评论。