TBB concurrent_vector with openmp

我们两清 提交于 2019-12-10 19:37:23

问题


Can we use TBB concurrent_vector with openmp?

Will concurrent updates be allowed?


回答1:


Yes, TBB's concurrent data structures are meant to be thread-safe, which means whatever threading paradigms, such as OpenMP, TBB, Cilk, PPL, and etc, are okay to use TBB's concurrent data structures. This is because concurrent_vector is simply a data structure class rather than threading-related control code.

Furthermore, TBB's mutex can be also used within OpenMP, Cilk, and PPL.




回答2:


Per Section 1.11 of the concurrent_vector page on the Intel site, incremental growth, limited growth, and pushing of new objects onto the vector are all thread-safe operations.

The introduction also says that adding new elements does not invalidate existing iterators.

All these combined mean that you should be able to safely multithread access to the concurrent_vector with openmp.



来源:https://stackoverflow.com/questions/7683204/tbb-concurrent-vector-with-openmp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!