aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Mokrejs <mmokrejs@fold.natur.cuni.cz>2018-04-09 18:55:42 +0200
committerMartin Mokrejs <mmokrejs@fold.natur.cuni.cz>2018-04-09 18:55:42 +0200
commitd4716dbcfa408f14649ecf58d015c167cb57ded0 (patch)
tree824fb6a1a1efcf5c51c2b2bac32489f5319d720f /sci-libs
parentsci-libs/tensorflow: version bump (diff)
downloadsci-d4716dbcfa408f14649ecf58d015c167cb57ded0.tar.gz
sci-d4716dbcfa408f14649ecf58d015c167cb57ded0.tar.bz2
sci-d4716dbcfa408f14649ecf58d015c167cb57ded0.zip
sci-libs/tensorflow: more tweaks to use bazel build system
It does not build for me and later runs in sandbox violation error. Possibly the build system could respect USE=mkl too. The autogenerated? BUILD file speaks of static libs being output instead of shared libs. It also mentions how to call linker when linking 3rd-party apps against these libs. Package-Manager: Portage-2.3.27, Repoman-2.3.9
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/tensorflow/tensorflow-1.7.0.ebuild40
1 files changed, 38 insertions, 2 deletions
diff --git a/sci-libs/tensorflow/tensorflow-1.7.0.ebuild b/sci-libs/tensorflow/tensorflow-1.7.0.ebuild
index 0dae0c1d0..d411ba0ac 100644
--- a/sci-libs/tensorflow/tensorflow-1.7.0.ebuild
+++ b/sci-libs/tensorflow/tensorflow-1.7.0.ebuild
@@ -5,7 +5,7 @@ EAPI=6
PYTHON_COMPAT=( python2_7 python3_{3,4,5,6} )
-inherit distutils-r1 eutils
+inherit python-r1 distutils-r1 eutils
DESCRIPTION="Library for numerical computation using data flow graphs"
HOMEPAGE="https://www.tensorflow.org
@@ -27,6 +27,7 @@ DEPEND="dev-util/bazel
dev-python/wheel
dev-python/numpy
dev-libs/protobuf-c
+ dev-python/absl-py
cuda? ( >=dev-util/nvidia-cuda-toolkit-7.0[profiler] >=dev-libs/cudnn-3 )
mpi? ( virtual/mpi )"
RDEPEND="${DEPEND}"
@@ -39,5 +40,40 @@ src_configure(){
# https://www.tensorflow.org/install/install_linux#InstallingNativePip
#
# usage: configure.py [-h] [--workspace WORKSPACE]
- ./configure || die
+ 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
+ export TF_NEED_CUDA=0
+ export TF_NEED_MPI=0
+ 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() {
+ python_compile() {
+ # huh, by default tensorflow links static libs? See BUILD file
+ # set framework_shared_object=true somehow
+ bazel build --config=opt /tensorflow/tools/pip_package:build_pip_package || die
+ bazel-bin/tensorflow/tools/pip_package/build_pip_package tensorflow_pkg || die
+ unzip -o -d tensorflow_pkg tensorflow_pkg/${P}-cp35-cp35m-linux_x86_64.whl || die
+ python_domodule tensorflow_pkg/${P}.data/purelib/tensorflow
+ bazel test || die
+ bazel shutdown || die
+ }
+ python_foreach_impl python_compile
}