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

 

publicaciones de 4 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

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.

Cita:

Raf Schietekat escribió:

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

Cita:

Raf Schietekat escribió:

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

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya