Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Advice: concurrent_vector static?


Dear all,

my application is quite simple: I need several working threads compute solutions independently, and if valid add them to a container.

I've thought of using a concurrent_vector for the solutions, and either pass the vector as a reference, or make the results a static vector inside the builder class.

Another option I've thought about is having each thread a separate solution vector, and use a parallel_reduce. However, I think this solution will take more time than a concurrent vector.

This is an important information: the probability of finding a valid solution is low, so I don't think I would hit several threads accessing the solution container at the same time.

I am open to any suggestions, since this is the first time I'm using TBB.



0 Kudos
0 Replies