From c9fb979b67f15ff9f4744af21d1e91017037af17 Mon Sep 17 00:00:00 2001 From: nixo Date: Sat, 28 Dec 2019 00:10:48 +0100 Subject: [PATCH v4 1/2] gnu: Add dsfmt. * gnu/packages/maths.scm (dsfmt): New variable. --- gnu/packages/maths.scm | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 8f4478b6bb..1f80cb3f3a 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -33,6 +33,7 @@ ;;; Copyright © 2019 Nicolas Goaziou ;;; Copyright © 2019 Steve Sprang ;;; Copyright © 2019 Robert Smith +;;; Copyright © 2019 Nicolò Balzarotti ;;; ;;; This file is part of GNU Guix. ;;; @@ -372,6 +373,70 @@ 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")) + ;; julia needs those (and is the only program depending on dsfmt now) + (patches + (list + (origin (method url-fetch) + (uri + "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 + "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 + (lambda _ + (invoke + "gcc" + ;; flags copied from julia + ;; https://github.com/JuliaLang/julia/blob/v1.3.0/deps/dsfmt.mk + "-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 ((lib (string-append (assoc-ref outputs "out") + "/lib")) + (inc (string-append (assoc-ref outputs "out") + "/include"))) + (install-file "libdSFMT.so" lib) + (install-file "dSFMT.h" inc) + #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") -- 2.23.0