Mikhail Teterin
2008-Nov-12 10:37 UTC
dlopen-ing a library with OpenMP by a non-OpenMP process
Hello! Currently, when a program built without OpenMP (-fopenmp) is trying to dlopen a library, built with the feature, the result is a crash from "bad system call": #0 0x00000008009a223c in ksem_init () from /lib/libc.so.7 #1 0x0000000800998a8f in sem_init () from /lib/libc.so.7 #2 0x00000008011a6537 in omp_get_nested () from /usr/lib/libgomp.so.1 #3 0x00000008011a3466 in ?? () from /usr/lib/libgomp.so.1 #4 0x0000000000000002 in ?? () #5 0x00000008005072b2 in dlsym () from /libexec/ld-elf.so.1 #6 0x0000000800507cd2 in dlopen () from /libexec/ld-elf.so.1 ... Can anything be done about this -- disable the OpenMP functionality, but keep the library usable (single-threaded)? The problem arises, in particular, when one is trying to use libraries built by either GraphicsMagick or ImageMagick ports. Both have an OpenMP option, which speeds up some internal algorithms. The option is off by default, but enabling it makes sense on an SMP system... Yet, this makes the library unsuitable for other purposes... Thanks! Yours, -mi P.S. I'm seeing the crash on a recent FreeBSD-7.1/amd64, but it, likely, can be seen elsewhere.
Mikhail Teterin
2008-Nov-12 11:46 UTC
dlopen-ing a library with OpenMP by a non-OpenMP process
Sent by Kostik Belousov:> On Wed, Nov 12, 2008 at 01:09:22PM -0500, Mikhail Teterin wrote: > >> Hello! >> >> Currently, when a program built without OpenMP (-fopenmp) is trying to >> dlopen a library, built with the feature, the result is a crash from >> "bad system call": >> >> #0 0x00000008009a223c in ksem_init () from /lib/libc.so.7 >> #1 0x0000000800998a8f in sem_init () from /lib/libc.so.7 >> #2 0x00000008011a6537 in omp_get_nested () from /usr/lib/libgomp.so.1 >> #3 0x00000008011a3466 in ?? () from /usr/lib/libgomp.so.1 >> #4 0x0000000000000002 in ?? () >> #5 0x00000008005072b2 in dlsym () from /libexec/ld-elf.so.1 >> #6 0x0000000800507cd2 in dlopen () from /libexec/ld-elf.so.1 >> ... >> > Try "kldload sem". >Uhm... That worked... I see... Shouldn't sem_init be nicer about it, though? Thanks, -mi
Kostik Belousov
2008-Nov-12 12:28 UTC
dlopen-ing a library with OpenMP by a non-OpenMP process
On Wed, Nov 12, 2008 at 01:09:22PM -0500, Mikhail Teterin wrote:> Hello! > > Currently, when a program built without OpenMP (-fopenmp) is trying to > dlopen a library, built with the feature, the result is a crash from > "bad system call": > > #0 0x00000008009a223c in ksem_init () from /lib/libc.so.7 > #1 0x0000000800998a8f in sem_init () from /lib/libc.so.7 > #2 0x00000008011a6537 in omp_get_nested () from /usr/lib/libgomp.so.1 > #3 0x00000008011a3466 in ?? () from /usr/lib/libgomp.so.1 > #4 0x0000000000000002 in ?? () > #5 0x00000008005072b2 in dlsym () from /libexec/ld-elf.so.1 > #6 0x0000000800507cd2 in dlopen () from /libexec/ld-elf.so.1 > ... > > Can anything be done about this -- disable the OpenMP functionality, but > keep the library usable (single-threaded)? The problem arises, in > particular, when one is trying to use libraries built by either > GraphicsMagick or ImageMagick ports. Both have an OpenMP option, which > speeds up some internal algorithms. The option is off by default, but > enabling it makes sense on an SMP system... Yet, this makes the library > unsuitable for other purposes... Thanks! Yours, > > -mi > > P.S. I'm seeing the crash on a recent FreeBSD-7.1/amd64, but it, likely, > can be seen elsewhere.Try "kldload sem". -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20081112/62fb2f76/attachment.pgp