[Openmp-dev] Building a static LLVM OpenMP library?

Wilmarth, Terry L via Openmp-dev openmp-dev at lists.llvm.org
Fri Jan 22 11:51:42 PST 2016


I’m going to just share Jim Cownie’s standard disclaimer here ;-)   Just as a reminder to proceed with caution.



“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”


From: Openmp-dev [mailto:openmp-dev-bounces at lists.llvm.org] On Behalf Of John Mellor-Crummey via Openmp-dev
Sent: Friday, January 22, 2016 1:34 PM
To: openmp-dev at lists.llvm.org
Subject: [Openmp-dev] Building a static LLVM OpenMP library?

I’m not a cmake expert, but I didn’t see any support anywhere in the LLVM OpenMP directories for creating a static library to be used by statically-linked executables. I want this for use on Cray platforms, where statically-linked binaries are preferred.

Are there cmake build options that can be used with the current build system to create a statically-linked library? If not, is there a cmake expert on this list willing to add such support so that static libraries are either created by default or can be added by setting a cmake variable?
--
John Mellor-Crummey         Professor
Dept of Computer Science    Rice University
email: johnmc at rice.edu<mailto:johnmc at rice.edu>      phone: 713-348-5179

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20160122/46dbab83/attachment-0001.html>


More information about the Openmp-dev mailing list