From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 98F5A1382C5 for ; Tue, 1 May 2018 10:30:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B382BE0837; Tue, 1 May 2018 10:30:01 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7A061E0837 for ; Tue, 1 May 2018 10:30:01 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DFFF3335C81 for ; Tue, 1 May 2018 10:27:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 15051281 for ; Tue, 1 May 2018 10:26:59 +0000 (UTC) From: "Mark Wright" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mark Wright" Message-ID: <1525169984.38fe3e1488bd82e32c16cc8d73de52cdb43149cc.gienah@gentoo> Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/tensorflow/ X-VCS-Repository: proj/sci X-VCS-Files: sci-libs/tensorflow/tensorflow-1.8.0.ebuild X-VCS-Directories: sci-libs/tensorflow/ X-VCS-Committer: gienah X-VCS-Committer-Name: Mark Wright X-VCS-Revision: 38fe3e1488bd82e32c16cc8d73de52cdb43149cc X-VCS-Branch: master Date: Tue, 1 May 2018 10:26:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5211bafd-24ef-4403-9ce7-e0445219897a X-Archives-Hash: 51cba284c5245523e6798c4c1a274bab commit: 38fe3e1488bd82e32c16cc8d73de52cdb43149cc Author: Mark Wright gentoo org> AuthorDate: Tue May 1 10:19:44 2018 +0000 Commit: Mark Wright gentoo org> CommitDate: Tue May 1 10:19:44 2018 +0000 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=38fe3e14 sci-libs/tensorflow: Bump to 1.8.0, build C and C++ APIs Package-Manager: Portage-2.3.31, Repoman-2.3.9 sci-libs/tensorflow/tensorflow-1.8.0.ebuild | 171 ++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/sci-libs/tensorflow/tensorflow-1.8.0.ebuild b/sci-libs/tensorflow/tensorflow-1.8.0.ebuild new file mode 100644 index 000000000..34d309cf4 --- /dev/null +++ b/sci-libs/tensorflow/tensorflow-1.8.0.ebuild @@ -0,0 +1,171 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{3,4,5,6} ) + +inherit python-r1 distutils-r1 eutils versionator + +DESCRIPTION="Library for numerical computation using data flow graphs" +HOMEPAGE="https://www.tensorflow.org + https://github.com/tensorflow/tensorflow" +SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~gienah/snapshots/${P}-bazel-cache-repos.tar.xz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" +IUSE="cuda cxx mpi" + +# To create the cache repo tar file, temporarilly remove the +# ${P}-bazel-cache-repos.tar.xz from SRC_URI and src_upack. Then build +# it so that bazel will download the files: +# FEATURES="noclean -network-sandbox" emerge -av sci-libs/tensorflow +# cd /var/tmp/portage/sci-libs/${P} +# tar --owner=portage --group=portage -cJvf \ +# /usr/portage/distfiles/${P}-bazel-cache-repos.tar.xz \ +# homedir/.cache/bazel/_bazel_portage/cache/repos/v1 + +# TensorFlow 1.7 may be the last time we support Cuda versions below 8.0. +# Starting with TensorFlow 1.8 release, 8.0 will be the minimum supported +# version. +# TensorFlow 1.7 may be the last time we support cuDNN versions below 6.0. +# Starting with TensorFlow 1.8 release, 6.0 will be the minimum supported +# version. +# Possibly missing deps: +# dev-python/gast +DEPEND=" + cxx? ( dev-libs/protobuf ) + dev-python/absl-py + dev-python/astor + dev-python/numpy + dev-python/protobuf-python + dev-python/six + dev-python/termcolor + dev-python/wheel + dev-libs/jemalloc + dev-libs/protobuf-c + dev-util/bazel + media-libs/giflib + virtual/jpeg:0 + cuda? ( >=dev-util/nvidia-cuda-toolkit-8.0[profiler] >=dev-libs/cudnn-6 ) + mpi? ( virtual/mpi )" + #opencl? ( virtual/opencl )" +RDEPEND="${DEPEND}" + +src_unpack() { + unpack ${P}.tar.gz + pushd .. || die + unpack distdir/${P}-bazel-cache-repos.tar.xz + popd || die +} + +# TODO: seems it also supports some MPI implementations +src_configure(){ + # there is no setup.py but there is configure + # https://www.tensorflow.org/install/install_sources + # https://www.tensorflow.org/install/install_linux#InstallingNativePip + # + # usage: configure.py [-h] [--workspace WORKSPACE] + python_configure() { + export PYTHON_BIN_PATH=${PYTHON} + export PYTHON_LIB_PATH=${PYTHON_SITEDIR} + export TF_NEED_JEMALLOC=1 + export TF_NEED_GCP=0 + export TF_NEED_HDFS=0 + export TF_NEED_S3=0 + export TF_NEED_KAFKA=0 + export TF_ENABLE_XLA=0 + export TF_NEED_GDR=0 + export TF_NEED_VERBS=0 + export TF_NEED_OPENCL=0 + if use cuda; then + export TF_NEED_CUDA=1 + else + export TF_NEED_CUDA=0 + fi + if use mpi; then + export TF_NEED_MPI=1 + else + export TF_NEED_MPI=0 + fi + export TF_NEED_OPENCL_SYCL=0 + export CC_OPT_FLAGS=${CFLAGS} + export JAVA_HOME=$(java-config -O) + # TODO: protect by a USE flag test --config=mkl + ./configure || die + } + python_foreach_impl python_configure +} + +src_compile() { + # F: fopen_wr + # S: deny + # P: /proc/self/setgroups + # A: /proc/self/setgroups + # R: /proc/7712/setgroups + # C: unable to read /proc/1/cmdline + addpredict /proc + + local opt=$(usex cuda "--config=cuda" "") + einfo ">>> Compiling ${PN} C"$(usex cxx " and C++" "") + bazel build \ + --config=opt ${opt} \ + //tensorflow:libtensorflow.so \ + //tensorflow:libtensorflow_framework.so \ + $(usex cxx "//tensorflow:libtensorflow_cc.so" "") || die + + python_compile() { + einfo ">>> Compiling ${PN} ${MULTIBUILD_VARIANT}" + bazel build \ + --config=opt ${opt} \ + //tensorflow/tools/pip_package:build_pip_package || die + bazel-bin/tensorflow/tools/pip_package/build_pip_package tensorflow_pkg || die + unzip -o -d ${PN}_pkg_${MULTIBUILD_VARIANT} ${PN}_pkg/${P}-*.whl || die + rm -f ${PN}_pkg_${MULTIBUILD_VARIANT}/lib${PN}_framework.so || die + } + python_foreach_impl python_compile + bazel shutdown || die +} + +src_test() { + python_foreach_impl python_test +} + +src_install() { + local SO1=$(get_major_version) + local SOVER=$(version_format_string '$1.$2') + local tl="${PN} ${PN}_framework" + dodir /usr/include/${PN}/${PN}/c + insinto /usr/include/${PN}/${PN}/c + doins ${PN}/c/c_api.h + if use cxx; then + for i in $(find ${PN}/cc ${PN}/core third_party/eigen3/unsupported \ + third_party/eigen3/Eigen \( -path third_party \ + -prune -o -type f -name \*.h -print \) -o \ + \( -path ${PN} -prune -o -type f -print \) ); do + dodir $(dirname /usr/include/${PN}/${i}) + insinto $(dirname /usr/include/${PN}/${i}) + doins ${i} + done + tl+=" ${PN}_cc" + fi + for i in ${tl}; do + dolib.so bazel-bin/${PN}/lib${i}.so + dosym "lib${i}.so" \ + "/usr/$(get_libdir)/lib${i}.so.${SO1}" \ + || die "Could not create /usr/$(get_libdir)/lib${i}.so.${SO1} symlink" + dosym "lib${i}.so" \ + "/usr/$(get_libdir)/lib${i}.so.${SOVER}" \ + || die "Could not create /usr/$(get_libdir)/lib${i}.so.${SOVER} symlink" + done + python_install() { + python_domodule ${PN}_pkg_${MULTIBUILD_VARIANT}/${P}.data/purelib/${PN} + dosym "../../../lib${PN}_framework.so" \ + "$(python_get_sitedir)/${PN}/lib${PN}_framework.so" \ + || die "Could not create $(python_get_sitedir)/lib${PN}_framework.so symlink for python module" + } + python_foreach_impl python_install + einstalldocs +}