On Mon, 5 Jun 2023, Beauregard,Christophe (ECCC) wrote:

FWIW, I think I may have figured out what's happening. It's probably something to note in the http://www.graphicsmagick.org/OpenMP.html documentation.

In a nutshell, my understanding is that libgomp keeps track of its thread pool in thread local storage. When that thread local storage happens to be in the main process, all is well, everything works fine, etc. When that thread local storage is in a transient pthread (and, apparently, you're running on a certain class memory/CPU configuration) and your transient thread terminates, that thread local storage doesn't (always) get cleaned up.

This is very unfortunate and seems like a serious bug.

I suspect this isn't a particularly desirable situation, as GraphicsMagick appears to have put at least some effort into making the API thread-safe.

Considerable effort has been put into making the API as thread-safe as possible, but invoking OpenMP code from a POSIX thread (or other sort of thread) has not been significantly tested.

It would be good to write a bug report against gomp (it seems to still be a GCC product) so that there is hope to get this fixed, or be informed of a work-around.

Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

Reply via email to