From patchwork Wed Jan 2 16:17:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 622 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id EB17C169F6; Wed, 2 Jan 2019 16:19:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mira.cbaines.net (Postfix) with ESMTP id 54C0D169EF for ; Wed, 2 Jan 2019 16:19:10 +0000 (GMT) Received: from localhost ([127.0.0.1]:45901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gejEb-0004Kw-SR for patchwork@mira.cbaines.net; Wed, 02 Jan 2019 11:19:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gejEZ-0004KD-4g for guix-patches@gnu.org; Wed, 02 Jan 2019 11:19:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gejEV-0006iP-AV for guix-patches@gnu.org; Wed, 02 Jan 2019 11:19:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:46940) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gejEV-0006i7-6Q for guix-patches@gnu.org; Wed, 02 Jan 2019 11:19:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gejEV-0002A9-20 for guix-patches@gnu.org; Wed, 02 Jan 2019 11:19:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33952] [PATCH 02/14] gnu: Add tensorflow-core. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 02 Jan 2019 16:19:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33952 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: <33952@debbugs.gnu.org> Received: via spool by 33952-submit@debbugs.gnu.org id=B33952.15464459058159 (code B ref 33952); Wed, 02 Jan 2019 16:19:03 +0000 Received: (at 33952) by debbugs.gnu.org; 2 Jan 2019 16:18:25 +0000 Received: from localhost ([127.0.0.1]:44892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gejDp-00027T-5M for submit@debbugs.gnu.org; Wed, 02 Jan 2019 11:18:24 -0500 Received: from venus.bbbm.mdc-berlin.de ([141.80.25.30]:34414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gejDn-00027B-15 for 33952@debbugs.gnu.org; Wed, 02 Jan 2019 11:18:19 -0500 Received: from localhost (localhost [127.0.0.1]) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTP id 271EC3807F9 for <33952@debbugs.gnu.org>; Wed, 2 Jan 2019 17:18:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mdc-berlin.de; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mdc; t= 1546445896; x=1548260297; bh=ZwOhOjusRPsH3MEAouKQ2qRTem9utUdqXCF u4PdqPcg=; b=GKRLe9p3PiicVu9aW4YuuuKtvkSvpcKATY4JMbc3LFmTrQMcG9f tYjWnmZGLluoZbxp7c99/R+uPD+pM6gCyuXkUioEbj4l4MXMcFJcCiogCsWfCdYV g3bYNaLb8Ox1wdzpSfBWBztwmuUZ7966Fau4FMrZWV1SgGPMAc8JmeEM= X-Virus-Scanned: amavisd-new at mdc-berlin.de Received: from venus.bbbm.mdc-berlin.de ([127.0.0.1]) by localhost (venus.bbbm.mdc-berlin.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uK7HYDqDqebR for <33952@debbugs.gnu.org>; Wed, 2 Jan 2019 17:18:16 +0100 (CET) Received: from SW-IT-P-CAS4.mdc-berlin.net (puck.citx.mdc-berlin.de [141.80.36.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTPS for <33952@debbugs.gnu.org>; Wed, 2 Jan 2019 17:18:16 +0100 (CET) Received: from localhost (141.80.113.103) by SW-IT-P-CAS4.mdc-berlin.net (141.80.113.59) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 2 Jan 2019 17:18:16 +0100 From: Ricardo Wurmus Date: Wed, 2 Jan 2019 17:17:55 +0100 Message-ID: <20190102161807.28297-2-ricardo.wurmus@mdc-berlin.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190102161807.28297-1-ricardo.wurmus@mdc-berlin.de> References: <20190102161807.28297-1-ricardo.wurmus@mdc-berlin.de> MIME-Version: 1.0 X-Originating-IP: [141.80.113.103] X-TM-AS-Product-Ver: SMEX-12.5.0.1684-8.5.1010-24332.001 X-TM-AS-Result: No-7.370300-8.000000-10 X-TMASE-MatchedRID: 7Pf7V6wkGECSkBDp1A0HiriMC5wdwKqdTJDl9FKHbrn4JyR+b5tvoACp QUIkMZXSFRUy+zA3fVId5+xfgNMUHmuS3ZpfRN2uEPf7TDUOGooPo0vi0aZfNXoUz5ARuHjRSvb gLcfUMI/mW4ZetWKlulT8csekrjnB+6PZybtGIjxxfk94zHLa/hNtTUpgahCnXCmcAC8DBrPQjc tQJI1P42dVfQoAAZHlcnzlXgcs2Wz9kbyhKg6JlGQNT9IU7RXuSiV8TkZKsPk/dS8ROsItevM+9 Fw01I7G/PQsPwZF9JCZplG8XJtO6FlP3wf1xZicr51gSC67hpX4uJ1REX4MHTUsHjosUACS9Tva dhXG9g2kP/ncvQmH7BRAoy63JAD4g65RAqtBhOIwo+sXt0rns1ObpRiWjuVrY8r/ndGdDsV2net tBoMDd+qBCyoe19uFWBWV0v8HvoIfE8yM4pjsD8C4UUZr4lSFSnQ4MjwaO9cqtq5d3cxkNZd/mw Lf2BVUj23JX2ku95TWz1AJ/yLK3ogmvDUsLiUUHNmFvm5Xe8dLhb8xGEnVfg== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.370300-8.000000 X-TMASE-Version: SMEX-12.5.0.1684-8.5.1010-24332.001 X-TM-SNTS-SMTP: 43D1A4789705ED50F8D2E3CAE9BB68AD8D9662D69330869EA4B9418D10DF94292000:9 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ricardo Wurmus Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/machine-learning.scm (tensorflow-core): New variable. --- gnu/packages/machine-learning.scm | 112 ++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index f4e66b9a3..dd725a609 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -54,6 +54,7 @@ #:use-module (gnu packages onc-rpc) #: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) @@ -679,6 +680,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) + ("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")