0

Heyho,

i've been using omp for some time and i wonder, whether there is a good way to storage data. Something like a reduce function for std::vector or anything like that would be perfect.

Anyway...Which container is save? I used std::vector>, but there were some problems with push_back. I had to resize my vector first an than change to content. I am sure that there has to be a better way. Thanks for any sugestions.

P.S.

I beg for pardon. My english isn't that good.

Mehno
  • 868
  • 2
  • 8
  • 21
  • 1
    AFAIK none of the stl containers is threadsafe (please correct me if I'm wrong). You have to either write something yourself or search for a available solution. The first thing that comes to my mind is TBB. – Rambo Ramon Jan 21 '16 at 15:41
  • Thank you for your recommendation. I think I have to learn more about TBB. omp fits just perfectly, if someone gives you the task to add some parallelization to your serial code. I still hope there is another good way. – Mehno Jan 21 '16 at 16:06
  • It is no problem to use openmp for the parallel logic and a tbb container as storage though tbb is capable of doing both. – Rambo Ramon Jan 21 '16 at 16:08
  • Now i really have to learn more about TBB! Thank you. – Mehno Jan 21 '16 at 16:13
  • http://stackoverflow.com/questions/18669296/c-openmp-parallel-for-loop-alternatives-to-stdvector/18671256#18671256 – Z boson Jan 22 '16 at 08:30

0 Answers0