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

Advice: concurrent_vector static?

Sensei_S_
Beginner
203 Views

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.

 

Thanks!

0 Kudos
0 Replies
Reply