Advice: concurrent_vector static?

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.



1 contribution / 0 nouveau(x)
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.