guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: eigen: Add upstream bugfix patch.


From: guix-commits
Subject: 02/02: gnu: eigen: Add upstream bugfix patch.
Date: Mon, 23 Nov 2020 13:22:47 -0500 (EST)

nckx pushed a commit to branch master
in repository guix.

commit ba902a15987b5ea2cd7adf2487229c2fe444931c
Author: Tobias Geerinckx-Rice <me@tobias.gr>
AuthorDate: Mon Nov 23 19:22:00 2020 +0100

    gnu: eigen: Add upstream bugfix patch.
    
    This fixes the build of nanopolish, imp, and others.
    
    Reported by apteryx in #guix.
    
    * gnu/packages/algebra.scm (eigen)[source]: Add patch.
    * gnu/packages/patches/eigen-remove-openmp-error-counting.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/algebra.scm                           |  3 +-
 .../eigen-remove-openmp-error-counting.patch       | 64 ++++++++++++++++++++++
 3 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 2bde6e6..14b626c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -935,6 +935,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/ecl-16-format-directive-limit.patch     \
   %D%/packages/patches/ecl-16-ignore-stderr-write-error.patch  \
   %D%/packages/patches/ecl-16-libffi.patch                     \
+  %D%/packages/patches/eigen-remove-openmp-error-counting.patch        \
   %D%/packages/patches/eigen-stabilise-sparseqr-test.patch     \
   %D%/packages/patches/einstein-build.patch                    \
   %D%/packages/patches/elfutils-tests-ptrace.patch             \
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 1c485a3..5b39144 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -1017,7 +1017,8 @@ Optional thin wrappers allow usage of the library from 
other languages.")
                (base32
                 "1vxrsncfnkyq6gwxpsannpryp12mk7lc8f42ybvz3saf7icwc582"))
               (file-name (string-append name "-" version ".tar.bz2"))
-              (patches (search-patches "eigen-stabilise-sparseqr-test.patch"))
+              (patches (search-patches 
"eigen-remove-openmp-error-counting.patch"
+                                       "eigen-stabilise-sparseqr-test.patch"))
               (modules '((guix build utils)))
               (snippet
                ;; There are 3 test failures in the "unsupported" directory,
diff --git a/gnu/packages/patches/eigen-remove-openmp-error-counting.patch 
b/gnu/packages/patches/eigen-remove-openmp-error-counting.patch
new file mode 100644
index 0000000..556474e
--- /dev/null
+++ b/gnu/packages/patches/eigen-remove-openmp-error-counting.patch
@@ -0,0 +1,64 @@
+From ef3cc72cb65e2d500459c178c63e349bacfa834f Mon Sep 17 00:00:00 2001
+From: Luke Peterson <hazelnusse@gmail.com>
+Date: Thu, 8 Oct 2020 12:16:53 -0700
+Subject: [PATCH] Remove error counting in OpenMP parallelize_gemm
+
+This resolves a compilation error associated with
+Eigen::eigen_assert_exception. It also eliminates the counting of
+exceptions that may occur in the OpenMP parallel section. If an
+unhandled exception occurs in this section, the behavior is non-conforming
+according to the OpenMP specification.
+---
+ Eigen/src/Core/products/Parallelizer.h | 14 +++++---------
+ test/CMakeLists.txt                    |  2 +-
+ 2 files changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/Eigen/src/Core/products/Parallelizer.h 
b/Eigen/src/Core/products/Parallelizer.h
+index 67b2442b5..a3cc05b77 100644
+--- a/Eigen/src/Core/products/Parallelizer.h
++++ b/Eigen/src/Core/products/Parallelizer.h
+@@ -132,8 +132,7 @@ void parallelize_gemm(const Functor& func, Index rows, 
Index cols, Index depth,
+ 
+   
ei_declare_aligned_stack_constructed_variable(GemmParallelInfo<Index>,info,threads,0);
+ 
+-  int errorCount = 0;
+-  #pragma omp parallel num_threads(threads) reduction(+: errorCount)
++  #pragma omp parallel num_threads(threads)
+   {
+     Index i = omp_get_thread_num();
+     // Note that the actual number of threads might be lower than the number 
of request ones.
+@@ -152,14 +151,11 @@ void parallelize_gemm(const Functor& func, Index rows, 
Index cols, Index depth,
+     info[i].lhs_start = r0;
+     info[i].lhs_length = actualBlockRows;
+ 
+-    EIGEN_TRY {
+-      if(transpose) func(c0, actualBlockCols, 0, rows, info);
+-      else          func(0, rows, c0, actualBlockCols, info);
+-    } EIGEN_CATCH(...) {
+-      ++errorCount;
+-    }
++    if(transpose)
++      func(c0, actualBlockCols, 0, rows, info);
++    else
++      func(0, rows, c0, actualBlockCols, info);
+   }
+-  if (errorCount) EIGEN_THROW_X(Eigen::eigen_assert_exception());
+ #endif
+ }
+ 
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 0747aa6cb..b02577780 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -163,7 +163,7 @@ ei_add_test(constructor)
+ ei_add_test(linearstructure)
+ ei_add_test(integer_types)
+ ei_add_test(unalignedcount)
+-if(NOT EIGEN_TEST_NO_EXCEPTIONS)
++if(NOT EIGEN_TEST_NO_EXCEPTIONS AND NOT EIGEN_TEST_OPENMP)
+   ei_add_test(exceptions)
+ endif()
+ ei_add_test(redux)
+-- 
+GitLab
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]