summary refs log tree commit diff
path: root/gnu/packages/algebra.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/algebra.scm')
-rw-r--r--gnu/packages/algebra.scm91
1 files changed, 36 insertions, 55 deletions
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index bf62144325..806dc45a24 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016, 2017, 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
-;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -521,31 +521,40 @@ a C program.")
     (license license:bsd-3)))
 
 (define-public fftw
-  ;; TODO: Make this 3.3.7 (see below) on the next upgrade cycle.
   (package
     (name "fftw")
-    (version "3.3.5")
+    (version "3.3.7")
     (source (origin
              (method url-fetch)
              (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
                                  version".tar.gz"))
              (sha256
               (base32
-               "1kwbx92ps0r7s2mqy7lxbxanslxdzj7dp7r7gmdkzv1j8yqf3kwf"))))
+               "0wsms8narnbhfsa8chdflv2j9hzspvflblnqdn7hw8x5xdzrnq1v"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:configure-flags
-       '("--enable-shared" "--enable-openmp" "--enable-threads")
-       #:phases (alist-cons-before
-                 'build 'no-native
-                 (lambda _
-                   ;; By default '-mtune=native' is used.  However, that may
-                   ;; cause the use of ISA extensions (SSE2, etc.) that are
-                   ;; not necessarily available on the user's machine when
-                   ;; that package is built on a different machine.
-                   (substitute* (find-files "." "Makefile$")
-                     (("-mtune=native") "")))
-                 %standard-phases)))
+     `(#:configure-flags
+       '("--enable-shared" "--enable-openmp" "--enable-threads"
+         ,@(let ((system (or (%current-target-system) (%current-system))))
+             ;; Enable SIMD extensions for codelets.  See details at:
+             ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
+             (cond
+              ((string-prefix? "x86_64" system)
+               '("--enable-sse2" "--enable-avx" "--enable-avx2"
+                 "--enable-avx512" "--enable-avx-128-fma"))
+              ((string-prefix? "i686" system)
+               '("--enable-sse2"))
+              ((string-prefix? "aarch64" system)
+               ;; Note that fftw supports NEON on 32-bit ARM only when
+               ;; compiled for single-precision.
+               '("--enable-neon"))
+              (else
+               '())))
+         ;; By default '-mtune=native' is used.  However, that may cause the
+         ;; use of ISA extensions (e.g. AVX) that are not necessarily
+         ;; available on the user's machine when that package is built on a
+         ;; different machine.
+         "ax_cv_c_flags__mtune_native=no")))
     (native-inputs `(("perl" ,perl)))
     (home-page "http://fftw.org")
     (synopsis "Computing the discrete Fourier transform")
@@ -561,8 +570,15 @@ cosine/ sine transforms or DCT/DST).")
     (name "fftwf")
     (arguments
      (substitute-keyword-arguments (package-arguments fftw)
-       ((#:configure-flags cf)
-        `(cons "--enable-float" ,cf))))
+       ((#:configure-flags fftw-configure-flags)
+        `(cons* "--enable-single"
+                ,@(if (string-prefix? "arm" (or (%current-target-system)
+                                                (%current-system)))
+                      ;; fftw supports NEON on 32-bit ARM only when compiled
+                      ;; for single-precision, so add it here.
+                      '("--enable-neon")
+                      '())
+                ,fftw-configure-flags))))
     (description
      (string-append (package-description fftw)
                     "  Single-precision version."))))
@@ -581,42 +597,6 @@ cosine/ sine transforms or DCT/DST).")
      (string-append (package-description fftw)
                     "  With OpenMPI parallelism support."))))
 
-(define-public fftw-3.3.7
-  ;; TODO: Make this the default 'fftw' on the next upgrade cycle.
-  (package
-    (inherit fftw)
-    (version "3.3.7")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
-                                  version".tar.gz"))
-              (sha256
-               (base32
-                "0wsms8narnbhfsa8chdflv2j9hzspvflblnqdn7hw8x5xdzrnq1v"))))))
-
-(define-public fftw-avx
-  (package
-    (inherit fftw-3.3.7)
-    (name "fftw-avx")
-    (arguments
-     (substitute-keyword-arguments (package-arguments fftw-3.3.7)
-       ((#:configure-flags flags ''())
-        ;; Enable AVX & co.  See details at:
-        ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
-        `(append '("--enable-avx" "--enable-avx2" "--enable-avx512"
-                   "--enable-avx-128-fma")
-                 ,flags))
-       ((#:substitutable? _ #f)
-        ;; To run the tests, we must have a CPU that supports all these
-        ;; extensions.  Since we cannot be sure that machines in the build
-        ;; farm support them, disable substitutes altogether.
-        #f)
-       ((#:phases _)
-        ;; Since we're not providing binaries, let '-mtune=native' through.
-        '%standard-phases)))
-    (synopsis "Computing the discrete Fourier transform (AVX2-optimized)")
-    (supported-systems '("x86_64-linux"))))
-
 (define-public java-la4j
   (package
     (name "java-la4j")
@@ -745,7 +725,8 @@ Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
                     ;; See
                     ;; https://bitbucket.org/eigen/eigen/commits/ea8c22ce6920e982d15245ee41d0531a46a28e5d
                     ((".*svd_preallocate[^\n]*" &)
-                     (string-append "//" & " // Not supported by BDCSVD")))))))
+                     (string-append "//" & " // Not supported by BDCSVD")))
+                  #t))))
     (build-system cmake-build-system)
     (arguments
      '(;; Turn off debugging symbols to save space.