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

TBB vs. OpenMP

Shayan_Y_
Beginner
5,845 Views

I'm just wondering why should we use TBB instead of OpenMP in HPC aplications? Is there any specific featrue(s) that separate this libraray from OpenMP? I have developed a small benchmark for the sake of comparing performance and mostly OpenMP beat TBB. 

 

0 Kudos
5 Replies
Vladimir_P_1234567890
5,846 Views

You don't have to, actually. If you have a well balanced simple parallel loops then OpenMP will fit such scenario the best. if you have Fortran code then openmp is only solution there. BTW have you compared openmp/tbb with cilk plus yet?

There is a comparation article (TBB/OpenMP/Native threads) that might help to decide which parallel runtime is better to take for some particular application.

https://software.intel.com/en-us/intel-threading-building-blocks-openmp-or-native-threads

Moreover, tbb will be useful for not-well-balanced workloads, nested parallelism (the nature of tbb), complex flow graph structures and core C++ feature like exception safety or C++11 friendly constructions.

Some more info summary to read:

http://www.itworld.com/article/2845683/why-threading-building-blocks-are-the-best-multicore-programming-solution.html

--Vladimir

0 Kudos
Shayan_Y_
Beginner
5,846 Views

No, I have not tried Cilk yet. Actually the reason which I am curious in such comparison is that I am working on my thesis and I need to know in which cases it's better to use TBB and why is it better.

My assumption was that, We always get better performance if we re-implement the code via TBB.

0 Kudos
jimdempseyatthecove
Honored Contributor III
5,846 Views

>>My assumption was that, We always get better performance if we re-implement the code via TBB

This is not necessarily true for HPC applications, nor necessarily true for workstation/desktop applications.

When an application has many different types of concurrent procedures to run, then TBB may be a better choice (though the newer OpenMP Task capabilities may even-out the advantage).

When an application has a large collection of similar things (or sections of large array) then OpenMP may be a better choice. OpenMP can be structured to work well with affinity placement of threads (TBB and Cilk Plus are not structured that way).

Some good reference material for your Thesis

http://store.elsevier.com/High-Performance-Parallelism-Pearls-Volume-One/James-Reinders/isbn-9780128021187/

http://www.amazon.com/High-Performance-Parallelism-Pearls-Volume/dp/0128038195/ref=pd_bxgy_14_img_2?ie=UTF8&refRID=0X0JBW7HX4WP6CMX07YV

The second link is Volume 2

The second link (amazon) has additional good reference material listed in the "Also Bought" section.

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
5,846 Views

>>  I have developed a small benchmark for the sake of comparing performance and mostly OpenMP beat TBB.

Please, never base a programming performance premise based on a small benchmark. And never bet your Thesis on such a premise. There are many different types of applications. If you want to produce a well founded Thesis, I suggest you perform a comprehensive study of actual cases and not simple or complex benchmarks. An example of a broad range of benchmarks is the PARSEC benchmark suite.

*** However, none of those examples are strictly HPC applications.

Jim Dempsey

0 Kudos
Shayan_Y_
Beginner
5,846 Views

Shayan Y. wrote:

No, I have not tried Cilk yet. Actually the reason which I am curious in such comparison is that I am working on my thesis and I need to know in which cases it's better to use TBB and why is it better.

My assumption was that, We always get better performance if we re-implement the code via TBB.

Nice suggestion , Thanks.

0 Kudos
Reply