Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renamed tensorflow specs; add tfcompile #3928

Merged
merged 1 commit into from Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmssw-tool-conf.spec
Expand Up @@ -191,8 +191,7 @@ Requires: cms_oracleocci_abi_hack-fake-toolfile
%endif

%if %isamd64
Requires: tensorflow-c-toolfile
Requires: tensorflow-cc-toolfile
Requires: tensorflow-toolfile
%endif

Requires: xtensor-toolfile
Expand Down
66 changes: 66 additions & 0 deletions tensorflow-1.6.0-rename-runtime.patch
@@ -0,0 +1,66 @@
diff --git a/tensorflow/compiler/aot/BUILD b/tensorflow/compiler/aot/BUILD
index 0540260..5bea30c 100644
--- a/tensorflow/compiler/aot/BUILD
+++ b/tensorflow/compiler/aot/BUILD
@@ -10,7 +10,7 @@ load("//tensorflow:tensorflow.bzl", "tf_cc_binary")

# Optional runtime utilities for use by code generated by tfcompile.
cc_library(
- name = "runtime",
+ name = "tf_aot_runtime",
srcs = ["runtime.cc"],
hdrs = ["runtime.h"],
visibility = ["//visibility:public"],
@@ -23,7 +23,7 @@ tf_cc_test(
name = "runtime_test",
srcs = ["runtime_test.cc"],
deps = [
- ":runtime",
+ ":tf_aot_runtime",
"//tensorflow/core:framework",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
@@ -53,7 +53,7 @@ cc_library(
],
deps = [
":embedded_protocol_buffers",
- ":runtime", # needed by codegen to print aligned_buffer_bytes
+ ":tf_aot_runtime", # needed by codegen to print aligned_buffer_bytes
"//tensorflow/compiler/tf2xla",
"//tensorflow/compiler/tf2xla:common",
"//tensorflow/compiler/tf2xla:tf2xla_proto",
diff --git a/tensorflow/compiler/aot/tfcompile.bzl b/tensorflow/compiler/aot/tfcompile.bzl
index 58572fe..4518115 100644
--- a/tensorflow/compiler/aot/tfcompile.bzl
+++ b/tensorflow/compiler/aot/tfcompile.bzl
@@ -275,7 +275,7 @@ def tf_library(name, graph, config,
srcs=[test_file],
deps=[
":" + name,
- "//tensorflow/compiler/aot:runtime",
+ "//tensorflow/compiler/aot:tf_aot_runtime",
"//tensorflow/compiler/aot:tf_library_test_main",
"//tensorflow/compiler/xla:executable_run_options",
"//third_party/eigen3",
@@ -323,7 +323,7 @@ def tf_library(name, graph, config,
deps=[
":" + name,
"//tensorflow/compiler/aot:benchmark",
- "//tensorflow/compiler/aot:runtime",
+ "//tensorflow/compiler/aot:tf_aot_runtime",
"//tensorflow/compiler/xla:executable_run_options",
"//third_party/eigen3",
] + if_android([
diff --git a/tensorflow/compiler/tf2xla/BUILD b/tensorflow/compiler/tf2xla/BUILD
index 3c7dfef..4c07a96 100644
--- a/tensorflow/compiler/tf2xla/BUILD
+++ b/tensorflow/compiler/tf2xla/BUILD
@@ -90,7 +90,7 @@ cc_library(
deps = [
# Keep dependencies to a minimum here; this library is used in every AOT
# binary produced by tfcompile.
- "//tensorflow/compiler/aot:runtime",
+ "//tensorflow/compiler/aot:tf_aot_runtime",
"//tensorflow/compiler/xla:executable_run_options",
"//tensorflow/core:framework_lite",
],
22 changes: 0 additions & 22 deletions tensorflow-c-toolfile.spec

This file was deleted.

15 changes: 0 additions & 15 deletions tensorflow-c.spec

This file was deleted.

24 changes: 0 additions & 24 deletions tensorflow-cc-toolfile.spec

This file was deleted.

23 changes: 14 additions & 9 deletions tensorflow-sources.spec
Expand Up @@ -6,14 +6,15 @@
%define branch cms/v%{realversion}
%define github_user cms-externals
Source: git+https://github.com/%{github_user}/tensorflow.git?obj=%{branch}/%{tag}&export=tensorflow-%{realversion}&output=/tensorflow-%{realversion}-%{tag}.tgz

Patch0: tensorflow-1.6.0-rename-runtime
BuildRequires: bazel eigen protobuf gcc
BuildRequires: py2-setuptools java-env
Requires: py2-numpy python py2-wheel

%prep

%setup -q -n tensorflow-%{realversion}
%patch0 -p1

%build
export PYTHON_BIN_PATH=`which python`
Expand Down Expand Up @@ -53,27 +54,31 @@ sed -i -e 's|"-z defs",|"-z defs","-lrt",|' ../build/*/external/org_tensorflow/t
sed -i -e 's|executable=ctx.executable._swig,|env=ctx.configuration.default_shell_env, executable=ctx.executable._swig,|' ../build/*/external/org_tensorflow/tensorflow/tensorflow.bzl
sed -i -e 's|mnemonic="ProtoCompile",|env=ctx.configuration.default_shell_env, mnemonic="ProtoCompile",|' ../build/*/external/protobuf_archive/protobuf.bzl

bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS tensorflow:libtensorflow_cc.so
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow:libtensorflow_cc.so
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow/tools/pip_package:build_pip_package
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow/tools/lib_package:libtensorflow
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow/python/tools:tools_pip
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow/tools/graph_transforms:transform_graph
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow/compiler/aot:tf_aot_runtime
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow/compiler/tf2xla:xla_compiled_cpu_function
bazel --output_user_root ../build build -s --verbose_failures -c opt --cxxopt=$CXX_OPT_FLAGS //tensorflow/compiler/aot:tfcompile

bazel shutdown

#Copying out what was built by bazel
incdir="$PWD/tensorflow_cc/include"
libdir="$PWD/tensorflow_cc/lib"
bindir="$PWD/tensorflow_cc/bin"

# Make directory and clean it
mkdir -p $incdir
mkdir -p $libdir

rm -rf $incdir/*
rm -rf $libdir/*
rm -rf $incdir $libdir $bindir
mkdir -p $incdir $libdir $bindir

cp -v $PWD/bazel-bin/tensorflow/libtensorflow_cc.so $libdir
cp -v $PWD/bazel-bin/tensorflow/libtensorflow_framework.so $libdir
cp -v $PWD/bazel-bin/tensorflow/compiler/aot/libtf_aot_runtime.so $libdir
cp -v $PWD/bazel-bin/tensorflow/compiler/tf2xla/libxla_compiled_cpu_function.so $libdir
cp -v $PWD/bazel-bin/tensorflow/compiler/aot/tfcompile $bindir

#Download depencies used by tensorflow and copy to include dir
tensorflow/contrib/makefile/download_dependencies.sh
Expand Down Expand Up @@ -147,5 +152,5 @@ cp -p eigen/signature_of_eigen3_matrix_library ${incdir}/eigen/ || exit 1
bazel-bin/tensorflow/tools/pip_package/build_pip_package %{i}

cp $PWD/bazel-bin/tensorflow/tools/lib_package/libtensorflow.tar.gz %{i}

tar cfz %{i}/libtensorflow_cc.tar.gz tensorflow_cc/.
cd tensorflow_cc
tar cfz %{i}/libtensorflow_cc.tar.gz .
58 changes: 58 additions & 0 deletions tensorflow-toolfile.spec
@@ -0,0 +1,58 @@
### RPM external tensorflow-toolfile 1.0
Requires: tensorflow
%prep

%build

%install

mkdir -p %i/etc/scram.d
cat << \EOF_TOOLFILE >%i/etc/scram.d/tensorflow.xml
<tool name="tensorflow" version="@TOOL_VERSION@">
<client>
<environment name="TENSORFLOW_BASE" default="@TOOL_ROOT@"/>
<environment name="LIBDIR" default="$TENSORFLOW_BASE/lib"/>
<environment name="INCLUDE" default="$TENSORFLOW_BASE/include"/>
</client>
<runtime name="PATH" value="$TENSORFLOW_BASE/bin" type="path"/>
</tool>
EOF_TOOLFILE

cat << \EOF_TOOLFILE >%i/etc/scram.d/tensorflow-framework.xml
<tool name="tensorflow-framework" version="@TOOL_VERSION@">
<lib name="tensorflow_framework"/>
<use name="tensorflow"/>
</tool>
EOF_TOOLFILE

cat << \EOF_TOOLFILE >%i/etc/scram.d/tensorflow-cc.xml
<tool name="tensorflow-cc" version="@TOOL_VERSION@">
<lib name="tensorflow_cc"/>
<use name="tensorflow-framework"/>
<use name="eigen"/>
<use name="protobuf"/>
</tool>
EOF_TOOLFILE

cat << \EOF_TOOLFILE >%i/etc/scram.d/tensorflow-c.xml
<tool name="tensorflow-c" version="@TOOL_VERSION@">
<lib name="tensorflow"/>
<use name="tensorflow-framework"/>
</tool>
EOF_TOOLFILE

cat << \EOF_TOOLFILE >%i/etc/scram.d/tensorflow-runtime.xml
<tool name="tensorflow-runtime" version="@TOOL_VERSION@">
<lib name="tf_aot_runtime"/>
<use name="tensorflow"/>
</tool>
EOF_TOOLFILE

cat << \EOF_TOOLFILE >%i/etc/scram.d/tensorflow-xla_compiled_cpu_function.xml
<tool name="tensorflow-xla_compiled_cpu_function" version="@TOOL_VERSION@">
<lib name="xla_compiled_cpu_function"/>
<use name="tensorflow"/>
</tool>
EOF_TOOLFILE

## IMPORT scram-tools-post
5 changes: 2 additions & 3 deletions tensorflow-cc.spec → tensorflow.spec
@@ -1,4 +1,4 @@
### RPM external tensorflow-cc 1.6.0
### RPM external tensorflow 1.6.0
Provides: libtensorflow_cc.so(tensorflow)(64bit)
Source: none

Expand All @@ -8,8 +8,7 @@ BuildRequires: tensorflow-sources

%build


%install

tar xfz ${TENSORFLOW_SOURCES_ROOT}/libtensorflow.tar.gz -C %{i}
tar xfz ${TENSORFLOW_SOURCES_ROOT}/libtensorflow_cc.tar.gz -C %{i}