[openblas] 03/03: fork-handler.patch: fixes hangs of OpenBLAS when called from a program using OpenMP (Closes: #739331)

Sébastien Villemot sebastien at debian.org
Mon Feb 17 18:40:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastien pushed a commit to branch master
in repository openblas.

commit 0caf9405a949760d029e58e97cc2806208ebb791
Author: Sébastien Villemot <sebastien at debian.org>
Date:   Mon Feb 17 19:40:11 2014 +0100

    fork-handler.patch: fixes hangs of OpenBLAS when called from a program using OpenMP (Closes: #739331)
---
 debian/changelog                  |  2 ++
 debian/patches/fork-handler.patch | 36 ++++++++++++++++++++++++++++++++++++
 debian/patches/series             |  1 +
 3 files changed, 39 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 3371a98..d535ca5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ openblas (0.2.8-4) UNRELEASED; urgency=low
   * Revert to pthreads parallelism instead of OpenMP (Closes: #725673)
   * remove-openmp-warning.patch: new patch, removes annoying warning when
     OpenBLAS is called from an OpenMP application.
+  * fork-handler.patch: fixes hangs of OpenBLAS when called from a program
+    using OpenMP (Closes: #739331)
 
  -- Sébastien Villemot <sebastien at debian.org>  Mon, 17 Feb 2014 18:48:35 +0100
 
diff --git a/debian/patches/fork-handler.patch b/debian/patches/fork-handler.patch
new file mode 100644
index 0000000..db4bba4
--- /dev/null
+++ b/debian/patches/fork-handler.patch
@@ -0,0 +1,36 @@
+Description: Add fork handler
+ This patches fixes hangs of OpenBLAS when called from a program using OpenMP.
+ Note that this will only work if OpenBLAS is compiled with pthreads
+ (i.e. no OpenMP).
+Origin: upstream, https://github.com/xianyi/OpenBLAS/issues/294#issuecomment-33536895
+Bug: https://github.com/xianyi/OpenBLAS/issues/294
+Bug-Debian: http://bugs.debian.org/739331
+Last-Update: 2014-02-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/driver/others/memory.c
++++ b/driver/others/memory.c
+@@ -1260,6 +1260,14 @@ static void gotoblas_memory_init(void) {
+ }
+ #endif
+ 
++static void openblas_fork_handler()
++{
++  int err;
++  err = pthread_atfork (BLASFUNC(blas_thread_shutdown), blas_thread_init, blas_thread_init);
++  if(err != 0)
++    fprintf(stderr, "OpenBLAS cannot install fork handler. You may meet hang after fork.\n");
++}
++
+ /* Initialization for all function; this function should be called before main */
+ 
+ static int gotoblas_initialized = 0;
+@@ -1268,6 +1276,8 @@ void CONSTRUCTOR gotoblas_init(void) {
+ 
+   if (gotoblas_initialized) return;
+ 
++  openblas_fork_handler();
++
+ 
+ #ifdef PROFILE
+    moncontrol (0);
diff --git a/debian/patches/series b/debian/patches/series
index 716e813..ddba23f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ libblas3-soname.patch
 test-custom-package.patch
 qemu-athlon.patch
 remove-openmp-warning.patch
+fork-handler.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/openblas.git



More information about the debian-science-commits mailing list