[Openmp-dev] OpenMP problems with clang 3.7.0

Christof Söger via Openmp-dev openmp-dev at lists.llvm.org
Wed Sep 23 03:22:57 PDT 2015


On 23.09.2015 11:39, Cownie, James H wrote:
>> 1) Is it possible to build a static version of libomp?
> Compiling a static OpenMP library is, in general, a very bad idea.
> It can easily lead to both awful performance (due to over-subscription) and incorrect program execution when you use any libraries which also use OpenMP.
>
> Imagine that your static instance of the OpenMP runtime starts one thread/core. Now you call into some other library which has its own statically linked OpenMP runtime. That runtime knows nothing about the threads you have already created, so it creates a whole new set. Now you have double over-subscription. Ouch.
>
> Or, suppose you execute an omp atomic statement in a case where it is implemented using a static lock inside the runtime. If you have two runtimes, you have two different locks, and its possible for atomicity not to be enforced between code that uses the two different OpenMP runtimes.
>
> For correctness and performance you need to ensure that there's only one OpenMP runtime in a process. As soon as you create a static OpenMP runtime you make it very easy for that not to be the case.
>
> So, I'm sure it's possible (heck, "It's only software"), but it's not made easy because doing it is a really bad idea.
>
> -- Jim
My usecase would be to compile a static executable for easy 
distribution. But if it is not supported directly I will not try to do it.

Christof


More information about the Openmp-dev mailing list