mailing list of musl libc
 help / color / mirror / code / Atom feed
* openmp/pthreads and fork...
@ 2014-08-05  5:56 Isaac Dunham
  2014-08-05 12:08 ` Szabolcs Nagy
  2014-08-05 16:51 ` Rich Felker
  0 siblings, 2 replies; 4+ messages in thread
From: Isaac Dunham @ 2014-08-05  5:56 UTC (permalink / raw)
  To: musl

Hello,
I've been packaging OpenBLAS for Alpine Linux, and an issue came to my
attention:
OpenBLAS (optionally) uses pthreads or OpenMP, and OpenMP uses pthreads.
OpenBLAS implements the BLAS (Basic Linear Algebra Subprograms) API/ABI,
like ATLAS, MKL, and so on.
Some programs that use BLAS will fork(); python is one of these.
With OpenBLAS, this had caused "random" segfaults due to use of threads
by the library both before and after the fork.
The OpenBLAS issue is here:
https://github.com/xianyi/OpenBLAS/issues/294

They worked around this using pthread_atfork() to cleanup before the fork().
I see some claims that calling any pthread functions in the child would be
UB, so I'm wondering about a few things:
-Is the last-mentioned claim correct?
-What is musl's behavior?
-How correct, and how likely to work with musl, is the fix for libgomp
mentioned here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60035
(and for that matter, the equivalent workaround referred to in OpenBLAS
issue 294)?
-Is there a safe (non-crashing) way to use/write libraries that might or
might not be built with threading--whether POSIX-specified or just
"working with musl" ?

Thanks,
Isaac Dunham

PS: OpenBLAS almost built out of the box; the only issue was use of
get_nprocs(), a GNU extension equivalent to sysconf(_SC_NPROCESSORS_ONLN).
When I submitted a patch, it was merged in about 2 hours.
I've been building with NO_AFFINITY=1 ... TARGET=ATOM.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-05 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05  5:56 openmp/pthreads and fork Isaac Dunham
2014-08-05 12:08 ` Szabolcs Nagy
2014-08-05 16:51 ` Rich Felker
2014-08-05 17:47   ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).