guix-commits
[Top][All Lists]
Advanced

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

01/07: gnu: Add dsfmt.


From: guix-commits
Subject: 01/07: gnu: Add dsfmt.
Date: Tue, 7 Apr 2020 10:32:18 -0400 (EDT)

efraim pushed a commit to branch master
in repository guix.

commit b60e2d480ad5d55b94e1ad5b52fca28a85503771
Author: Nicolò Balzarotti <address@hidden>
AuthorDate: Thu Apr 2 08:49:46 2020 +0200

    gnu: Add dsfmt.
    
    * gnu/packages/maths.scm (dsfmt): New variable.
    
    Signed-off-by: Efraim Flashner <address@hidden>
---
 gnu/packages/maths.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 391b2a2..cd786ac 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -37,6 +37,7 @@
 ;;; Copyright © 2020 Felix Gruber <address@hidden>
 ;;; Copyright © 2020 R Veera Kumar <address@hidden>
 ;;; Copyright © 2020 Vincent Legoll <address@hidden>
+;;; Copyright © 2020 Nicolò Balzarotti <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -381,6 +382,81 @@ semiconductors.")
     (license license:gpl3+)
     (home-page "https://www.gnu.org/software/dionysus/";)))
 
+(define-public dsfmt
+  (package
+    (name "dsfmt")
+    (version "2.2.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+         (string-append
+           "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/";
+           "dSFMT-src-" version ".tar.gz"))
+       (sha256
+        (base32
+         "03kaqbjbi6viz0n33dk5jlf6ayxqlsq4804n7kwkndiga9s4hd42"))
+       (modules '((guix build utils)))
+       ;; Don't distribute html documentation with bundled jquery.
+       (snippet
+        '(begin
+           (delete-file-recursively "html") #t))
+       ;; Add patches borrowed from Julia.
+       (patches
+         (list
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                    "https://raw.githubusercontent.com/JuliaLang/julia/";
+                    "v1.3.0/deps/patches/dSFMT.c.patch"))
+             (sha256 (base32
+                      "09mhv11bms8jsmkmdqvlcgljwhzw3b6n9nncpi2b6dla9798hw2y"))
+             (file-name "dSFMT.c.patch"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                    "https://raw.githubusercontent.com/JuliaLang/julia/";
+                    "v1.3.0/deps/patches/dSFMT.h.patch"))
+             (sha256 (base32
+                      "1py5rd0yxic335lzka23f6x2dhncrpizpyrk57gi2f28c0p98y5n"))
+             (file-name "dSFMT.h.patch"))))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)            ; no configure script
+         (replace 'build
+           ;; Upstream Makefile does not build a shared library. Borrow from 
Julia
+           ;; https://github.com/JuliaLang/julia/blob/v1.3.0/deps/dsfmt.mk
+           (lambda _
+             (invoke
+               "gcc" "-DNDEBUG" "-DDSFMT_MEXP=19937"
+               "-fPIC" "-DDSFMT_DO_NOT_USE_OLD_NAMES"
+               "-O3" "-finline-functions" "-fomit-frame-pointer"
+               "-fno-strict-aliasing" "--param" "max-inline-insns-single=1800"
+               "-Wmissing-prototypes" "-Wall" "-std=c99" "-shared" "dSFMT.c"
+               "-o" "libdSFMT.so")))
+         (replace 'install              ; no "install" target
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib"))
+                    (inc (string-append out "/include"))
+                    (doc (string-append out "/share/doc/" ,name "-" ,version)))
+               (install-file "libdSFMT.so" lib)
+               (install-file "dSFMT.h" inc)
+               (install-file "LICENSE.txt" doc)
+               #t))))))
+    (synopsis "Double precision SIMD-oriented Fast Mersenne Twister")
+    (description
+     "The dSMFT package speeds up Fast Mersenne Twister generation by avoiding
+the expensive conversion of integer to double (floating point).  dSFMT directly
+generates double precision floating point pseudorandom numbers which have the
+IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985)
+format.  dSFMT is only available on the CPUs which use IEEE 754 format double
+precision floating point numbers.")
+    (home-page "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/";)
+    (license license:bsd-3)))
+
 (define-public gsl
   (package
     (name "gsl")



reply via email to

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