For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

[Patch][Enhancement] Add OpenMP pragmas to replace TBB parallel loops

Denis Barbier's picture


On Debian and Fedora, TBB is only available on amd64 and ia64. In order to improve portability, here is a patch to add OpenMP pragmas. A new --enable-openmp configure option is added to enable those pragmas when compiling with Autotools. Due to a bug in libtool (it strips down -fopenmp flag when linking), a workaround is included, but works only when compiling with GNU g++.
On Windows, it should work out of the box after enabling OpenMP support in Visual projects.

Roman Lygin's picture

Hi Denis,

Thank you for this effort. TBB is highly portable and should compile in all configurations on Debian and Fedora, even if it does not come in prebuilt binaries.

I have to challenge substitution of TBB with OpenMP. They major factor is poor OpenMP composability (which is inherent from its specification) with other threading libraries. For example, in the case of nested parallelism (e.g. BRepMesh called from multiple threads at higher level) this will lead to workstation oversubscription (number of threads > number of processing units, or cores) and hence performance degradation.
General recommendation should be:
1. Build TBB from sources on those configurations which do not ship it upfront.
2. If #1 is impossible or not desired, disable TBB usage.

Hope this helps to understand the issue better.

Denis Barbier's picture

Hi Roman,

As you know, Linux distributions do not use prebuilt binaries but rebuild everything from sources. I do not know why in this particular case, they explicitly build TBB only on amd64 and ia64; either they are misinformed, or they tried to build on other arches and failed.
On Debian, OpenCascade is built on almost all arches, so it is simpler to go with OpenMP. I understand your concern but am pretty sure that building with OpenMP is the best choice for end users until TBB is built on all arches.

Roman Lygin's picture

Hi Denis,

Well, this may be up to you to drive this change into the Linux distros but I believe correctness and performance should be the primary concerns, not just the simplicity. At the same time your efforts to enable OpenMP, users' to adopt it and then rolling back is also to be considered.
My 2 cents...

Denis Barbier's picture

Hi Roman,

I do not understand your words, sorry.
Anyway, did you look at the current code and my patch? I do not say that TBB should always be replaced by OpenMP, but *in this specific case* differences between TBB and OpenMP should be quite low. This is indeed what I observed on Linux, even with high CPU load.
My patch *adds* support for OpenMP, it does not remove support for TBB, Linux distros (or Windows users) can choose whatever they prefer when compiling.
You can provide a patch which boosts performance by using some nice features of TBB, I may then reconsider my position and everybody will be happy ;)

Richard Shaw's picture

I can't speak for all linux distros, but I just checked and Fedora does offer tbb for i686 platforms on all current releases.

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.