guix-patches
[Top][All Lists]
Advanced

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

[bug#31386] [PATCH 2/3] gnu: Add gemmlowp-for-tensorflow.


From: Ricardo Wurmus
Subject: [bug#31386] [PATCH 2/3] gnu: Add gemmlowp-for-tensorflow.
Date: Tue, 8 May 2018 16:59:08 +0200

* gnu/packages/machine-learning.scm (gemmlowp-for-tensorflow): New variable.
---
 gnu/packages/machine-learning.scm | 54 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/machine-learning.scm 
b/gnu/packages/machine-learning.scm
index f0d35484e..87fbec6b6 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <address@hidden>
+;;; Copyright © 2015, 2016, 2017, 2018 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2016 Efraim Flashner <address@hidden>
 ;;; Copyright © 2016, 2017 Marius Bakke <address@hidden>
 ;;; Copyright © 2016 Hartmut Goebel <address@hidden>
@@ -557,6 +557,58 @@ Support Vector Machines, Spectral Clustering, Kernel PCA, 
Gaussian Processes
 and a QP solver.")
     (license license:gpl2)))
 
+;; TODO: We may need to pass "-msse4.1" as an additional optimization flag
+;; when building for x86_64.  This is strongly recommended by the authors in
+;; the README.md.
+(define-public gemmlowp-for-tensorflow
+  (let ((commit "7c7c744640ddc3d0af18fb245b4d23228813a71b"))
+    (package
+      (name "gemmlowp")
+      (version (string-append "0-1." (string-take commit 7)))
+      (source (origin
+                (method url-fetch)
+                (uri (string-append "https://mirror.bazel.build/";
+                                    "github.com/google/gemmlowp/archive/"
+                                    commit ".zip"))
+                (sha256
+                 (base32
+                  "1kxj8h017q4r1dcva61vziwmks66rvr0iw93lg45fwws4n8cqlmq"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           ;; This directory contains the CMakeLists.txt.
+           (add-after 'unpack 'chdir
+             (lambda _ (chdir "contrib") #t))
+           ;; There is no install target
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (lib (string-append out "/lib/"))
+                      (inc (string-append out "/include/")))
+                 (install-file "../build/libeight_bit_int_gemm.so" lib)
+                 (for-each (lambda (dir)
+                             (let ((target (string-append inc "/" dir)))
+                               (mkdir-p target)
+                               (for-each (lambda (h)
+                                           (install-file h target))
+                                         (find-files (string-append "../" dir)
+                                                     "\\.h$"))))
+                           '("meta" "profiling" "public" "fixedpoint"
+                             "eight_bit_int_gemm" "internal"))
+                 #t))))))
+      (native-inputs
+       `(("unzip" ,unzip)))
+      (home-page "https://github.com/google/gemmlowp";)
+      (synopsis "Small self-contained low-precision GEMM library")
+      (description
+       "This is a small self-contained low-precision @dfn{general matrix
+multiplication} (GEMM) library.  It is not a full linear algebra library.
+Low-precision means that the input and output matrix entries are integers on
+at most 8 bits.  To avoid overflow, results are internally accumulated on more
+than 8 bits, and at the end only some significant 8 bits are kept.")
+      (license license:asl2.0))))
+
 (define-public dlib
   (package
     (name "dlib")
-- 
2.15.1






reply via email to

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