From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG474-0002lt-OH for guix-patches@gnu.org; Tue, 08 May 2018 11:01:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG46w-0003Cm-HQ for guix-patches@gnu.org; Tue, 08 May 2018 11:01:10 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:46508) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fG46w-0003Cc-Bi for guix-patches@gnu.org; Tue, 08 May 2018 11:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fG46w-0007L9-3b for guix-patches@gnu.org; Tue, 08 May 2018 11:01:02 -0400 Subject: [bug#31386] [PATCH 3/3] gnu: Add tensorflow-core. Resent-Message-ID: From: Ricardo Wurmus Date: Tue, 8 May 2018 16:59:09 +0200 Message-ID: <20180508145909.25354-3-ricardo.wurmus@mdc-berlin.de> In-Reply-To: <20180508145909.25354-1-ricardo.wurmus@mdc-berlin.de> References: <20180508145909.25354-1-ricardo.wurmus@mdc-berlin.de> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31386@debbugs.gnu.org Cc: Ricardo Wurmus * gnu/packages/machine-learning.scm (tensorflow-core): New variable. --- gnu/packages/machine-learning.scm | 113 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 87fbec6b6..e02e89ef4 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -36,6 +36,7 @@ #:use-module (guix build-system r) #:use-module (guix git-download) #:use-module (gnu packages) + #:use-module (gnu packages algebra) #:use-module (gnu packages autotools) #:use-module (gnu packages boost) #:use-module (gnu packages check) @@ -48,6 +49,7 @@ #:use-module (gnu packages ocaml) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages statistics) #:use-module (gnu packages swig) @@ -609,6 +611,117 @@ 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 tensorflow-core + (package + (name "tensorflow-core") + (version "1.7.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tensorflow/tensorflow.git") + (commit (string-append "v" version)))) + (file-name (string-append "tensorflow-" version "-checkout")) + (sha256 + (base32 + "0jljzbwhmxi8crbivwachcmlfrrv279qrsvwc62cnnbyw0n1g0kp")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; no "check" target + #:make-flags + (list "-f" "tensorflow/contrib/makefile/Makefile" + "CC=gcc") + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'unpack 'fix-version + (lambda _ + (substitute* "tensorflow/tools/git/gen_git_source.sh" + (("^GIT_VERSION=.*") + (string-append "GIT_VERSION=" ,version "\n"))) + #t)) + (add-after 'unpack 'unpack-third-party + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "tensorflow/contrib/makefile/" + (let ((fft2d "downloads/fft2d") + (nsync "downloads/nsync")) + (mkdir-p fft2d) + (invoke "tar" "xf" (assoc-ref inputs "fft2d") + "-C" fft2d "--strip-components=1") + (mkdir-p nsync) + (invoke "tar" "xf" (assoc-ref inputs "nsync") + "-C" nsync "--strip-components=1"))))) + ;; FIXME: it would be nice to build a separate package for nsync and + ;; use it here. Unfortunately, I could not build Tensorflow with a + ;; separately built nsync. + (add-before 'build 'build-nsync + (lambda _ + (with-directory-excursion "tensorflow/contrib/makefile/" + (invoke "bash" "compile_nsync.sh") + (setenv "TARGET_NSYNC_LIB" + "tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11/nsync.a") + (setenv "HOST_NSYNC_LIB" + "tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11/nsync.a") + #t))) + (add-after 'unpack 'find-eigen-headers + (lambda* (#:key inputs #:allow-other-keys) + ;; Ensure that Eigen headers can be found + (setenv "CPLUS_INCLUDE_PATH" + (string-append (getenv "CPLUS_INCLUDE_PATH") + ":" + (assoc-ref inputs "eigen") + "/include/eigen3")) + #t)) + (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 "tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a" lib) + (for-each (lambda (file) + (let ((target (string-append inc "/" + (dirname file)))) + (mkdir-p target) + (install-file file target))) + (find-files "tensorflow/core" ".*\\.h$")) + #t)))))) + (native-inputs + `(("protobuf" ,protobuf) ; protoc + ;; "You may use, copy, modify this code for any purpose and without + ;; fee. You may distribute this ORIGINAL package." + ("fft2d" + ,(origin + (method url-fetch) + (uri "https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz") + (sha256 + (base32 + "15jjkfvhqvl2c0753d2di8hz0pyzn598g74wqy79awdrf1y67fsj")))) + ("nsync" + ,(origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/" + "github.com/google/nsync/archive/" + "0559ce013feac8db639ee1bf776aca0325d28777.tar.gz")) + (sha256 + (base32 + "0qdkyqym34x739mmzv97ah5r7ph462v5xkxqxvidmcfqbi64b132")))) + ("googletest" ,googletest))) + (inputs + `(("eigen" ,eigen-for-tensorflow) + ("gemmlowp" ,gemmlowp-for-tensorflow) + ("protobuf" ,protobuf) + ("zlib" ,zlib))) + (home-page "https://tensorflow.org") + (synopsis "Machine learning framework") + (description + "TensorFlow is a software library for high performance numerical +computation. Its flexible architecture allows easy deployment of computation +across a variety of platforms, and from desktops to clusters of servers to +mobile and edge devices. + +This package provides only the core library.") + (license license:asl2.0))) + (define-public dlib (package (name "dlib") -- 2.15.1