From e9d737ea6b3e7b0aab07adb0225e9aa4b4adc3ec Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Tue, 6 Mar 2018 15:27:06 +0100 Subject: [PATCH] tensorflow:use eigen and protobuf souces from cmsdist --- eigen.spec | 11 +++++++++-- protobuf.spec | 19 ++++++++++++++----- tensorflow-sources.spec | 6 ++++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/eigen.spec b/eigen.spec index 33dd8599198..1fcdd67a008 100644 --- a/eigen.spec +++ b/eigen.spec @@ -1,12 +1,19 @@ ### RPM external eigen 034b6c3e1017 ## INITENV +PATH PKG_CONFIG_PATH %{i}/share/pkgconfig +## INITENV SETV EIGEN_SOURCE %{source0} +## INITENV SETV EIGEN_STRIP_PREFIX %{source_prefix} ## NOCOMPILER %define tag %{realversion} -Source: https://bitbucket.org/%{n}/%{n}/get/%{tag}.tar.gz + +#These are needed by Tensorflow sources +#NOTE: Never apply any patch in the spec file, this way tensorflow gets the exact same sources +%define source0 https://bitbucket.org/%{n}/%{n}/get/%{tag}.tar.gz +%define source_prefix %{n}-%{n}-%{realversion} +Source: %{source0} BuildRequires: cmake %prep -%setup -n %n-%n-%{realversion} +%setup -n %{source_prefix} %build mkdir build diff --git a/protobuf.spec b/protobuf.spec index 490bbcbd36e..0be9bb405bf 100644 --- a/protobuf.spec +++ b/protobuf.spec @@ -1,17 +1,26 @@ ### RPM external protobuf 3.4.0 -Source: https://github.com/google/protobuf/archive/v%{realversion}.tar.gz -Requires: zlib -BuildRequires: autotools -# +## INITENV SETV PROTOBUF_SOURCE %{source0} +## INITENV SETV PROTOBUF_STRIP_PREFIX %{source_prefix} +#============= IMPORTANT NOTE ========================# # When changing the version of protobuf, remember to regenerate protobuf objects in CMSSW # current recipe for this is: # cmsenv # git cms-addpkg DQMServices/Core # cd $CMSSW_BASE/src # protoc --cpp_out=. DQMServices/Core/src/ROOTFilePB.proto +####################################################### + +#These are needed by Tensorflow sources +#NOTE: Never apply any patch in the spec file, this way tensorflow gets the exact same sources +%define source0 https://github.com/google/protobuf/archive/v%{realversion}.tar.gz +%define source_prefix %{n}-%{realversion} + +Source: %{source0} +Requires: zlib +BuildRequires: autotools %prep -%setup -n %{n}-%{realversion} +%setup -n %{source_prefix} %build ./autogen.sh diff --git a/tensorflow-sources.spec b/tensorflow-sources.spec index 1d4be6c74c5..32bf0465636 100644 --- a/tensorflow-sources.spec +++ b/tensorflow-sources.spec @@ -1,10 +1,10 @@ ### RPM external tensorflow-sources 1.5.0 #Source: https://github.com/tensorflow/tensorflow/archive/v%{realversion}.tar.gz %define isslc6amd64 %(case %{cmsplatf} in (slc6_amd64_*) echo 1 ;; (*) echo 0 ;; esac) -%define tag f92e98b51479146935bbb362403dd8a18ba37547 +%define tag 67d4face442a78bd39861235fd2d408f7b9fae39 %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}.tgz +Source: git+https://github.com/%{github_user}/tensorflow.git?obj=%{branch}/%{tag}&export=tensorflow-%{realversion}&output=/tensorflow-%{realversion}-%{tag}.tgz BuildRequires: bazel eigen protobuf gcc Requires: py2-numpy python py2-wheel @@ -37,6 +37,8 @@ rm -rf ../build ./configure +sed -i -e "s|@EIGEN_SOURCE@|${EIGEN_SOURCE}|;s|@EIGEN_STRIP_PREFIX@|${EIGEN_STRIP_PREFIX}|" tensorflow/workspace.bzl tensorflow/contrib/makefile/download_dependencies.sh +sed -i -e "s|@PROTOBUF_SOURCE@|${PROTOBUF_SOURCE}|;s|@PROTOBUF_STRIP_PREFIX@|${PROTOBUF_STRIP_PREFIX}|" tensorflow/workspace.bzl tensorflow/contrib/makefile/download_dependencies.sh bazel --output_user_root ../build fetch "tensorflow:libtensorflow_cc.so" #This is needed on SLC6 because the version of glibc is old