I have a data processing model which is made of many chains of algorithms processing data chunks. Each chain is a graph of algorithms, which I implemented with the TBB graph class.
Now I would like to have something like a "pool of graphs", i.e. a pool of tasks, each of them containing a tbb::graph. In this way I could run the chains of algorithms in parallel over the data chunks.
Could you point any TBB example of something similar to a "pool of graphs", or might you suggest and hints to implement it?
My suggestion would be that you use tbb::concurrent_queue or tbb::concurrent_vector , the advantage of it is that you can resize it during multiple accesses. My personal hint to this, create a lock / graph object so that you never modify an object in parallel.
http://threadingbuildingblocks.org/wiki/index.php?title=Concurrent_Vector
An example for the queue can be found here: https://sites.google.com/site/samplecodesproject/tbb/containers-3/concurrent_queue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With