tensorflow: compile against spack-provided protobuf (#16258)

This allows horovod to be built with frameworks=pytorch,tensorflow.

I tracked down the crash I observed in #15719, where loading torch
before tensorflow would cause a crash in:

google::protobuf::internal::(anonymous
namespace)::InitSCC_DFS(google::protobuf::internal::SCCInfoBase*)

The solution is to make tensorflow compile against the protobuf
version Spack provides, instead of allowing it to use it's own.
It's likely we'll want to go after some of the others
that are listed in third_party/systemlibs/syslibs_configure.bzl
in the future.
This commit is contained in:
Andrew W Elble 2020-04-23 12:14:09 -04:00 committed by GitHub
parent ca67df6e3d
commit d5d232e207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,6 +152,7 @@ class PyTensorflow(Package, CudaPackage):
depends_on('py-protobuf@3.0.0', type=('build', 'run'), when='@0.11.0')
depends_on('py-protobuf@3.0.0b2', type=('build', 'run'), when='@0.7.1:0.10')
depends_on('py-protobuf@3.0.0a3', type=('build', 'run'), when='@0.6:0.7.0')
depends_on('protobuf')
# tensorboard
# tensorflow-estimator
depends_on('py-termcolor@1.1.0:', type=('build', 'run'), when='@1.6:')
@ -498,6 +499,11 @@ def setup_build_environment(self, env):
mkdirp(tmp_path)
env.set('TEST_TMPDIR', tmp_path)
env.set('TF_SYSTEM_LIBS', 'com_google_protobuf')
# NOTE: INCLUDEDIR is not just relevant to protobuf
# see third_party/systemlibs/jsoncpp.BUILD
env.set('INCLUDEDIR', spec['protobuf'].prefix.include)
def configure(self, spec, prefix):
# NOTE: configure script is interactive. If you set the appropriate
# environment variables, this interactivity is skipped. If you don't,
@ -626,6 +632,7 @@ def build(self, spec, prefix):
# Ask bazel to explain what it's up to
# Needs a filename as argument
'--explain=explainlogfile.txt',
'--incompatible_no_support_tools_in_action_inputs=false',
# Increase verbosity of explanation,
'--verbose_explanations',
]
@ -679,9 +686,6 @@ def build(self, spec, prefix):
if spec.satisfies('@2:'):
args.append('--config=v2')
if spec.satisfies('%gcc@5:'):
args.append('--cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0')
args.append('//tensorflow/tools/pip_package:build_pip_package')
bazel(*args)