C++ Parallelization Libraries: OpenMP vs. Thread Building Blocks [closed] C++ Parallelization Libraries: OpenMP vs. Thread Building Blocks [closed] multithreading multithreading

C++ Parallelization Libraries: OpenMP vs. Thread Building Blocks [closed]


I haven't used TBB extensively, but my impression is that they complement each other more than competing. TBB provides threadsafe containers and some parallel algorithms, whereas OpenMP is more of a way to parallelise existing code.

Personally I've found OpenMP very easy to drop into existing code where you have a parallelisable loop or bunch of sections that can be run in parallel. However it doesn't help you particularly for a case where you need to modify some shared data - where TBB's concurrent containers might be exactly what you want.

If all you want is to parallelise loops where the iterations are independent (or can be fairly easily made so), I'd go for OpenMP. If you're going to need more interaction between the threads, I think TBB may offer a little more in that regard.


From Intel's software blog: Compare Windows* threads, OpenMP*, IntelĀ® Threading Building Blocks for parallel programming

It is also the matter of style - for me TBB is very C++ like, while I don't like OpenMP pragmas that much (reeks of C a bit, would use it if I had to write in C).

I would also consider the existing knowledge and experience of the team. Learning a new library (especially when it comes to threading/concurrency) does take some time. I think that for now, OpenMP is more widely known and deployed than TBB (but this is just mine opinion).

Yet another factor - but considering most common platforms, probably not an issue - portability. But the license might be an issue.

  • TBB incorporates some of nice research originating from academic research, for example recursive data parallel approach.
  • There is some work on cache-friendliness, for example.
  • Lecture of the Intel blog seems really interesting.


In general I have found that using TBB requires much more time consuming changes to the code base with a high payoff while OpenMP gives a quick but moderate payoff. If you are staring a new module from scratch and thinking long term go with TBB. If you want small but immediate gains go with OpenMP.

Also, TBB and OpenMP are not mutually exclusive.