summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew W Elble <aweits@rit.edu>2024-07-25 02:22:48 -0400
committerGitHub <noreply@github.com>2024-07-25 08:22:48 +0200
commit2b763ff2dba30221d9d7d18b2d3e3a401b760f1c (patch)
treee7e22547142b5595a9ef0c10e12350cbad9bf182
parentc6cc97953b5d4861f3269bcd804311e75af42d50 (diff)
downloadspack-2b763ff2dba30221d9d7d18b2d3e3a401b760f1c.tar.gz
spack-2b763ff2dba30221d9d7d18b2d3e3a401b760f1c.tar.bz2
spack-2b763ff2dba30221d9d7d18b2d3e3a401b760f1c.tar.xz
spack-2b763ff2dba30221d9d7d18b2d3e3a401b760f1c.zip
py-tensorflow: alter gcc conflict, fix build (#45330)
-rw-r--r--var/spack/repos/builtin/packages/py-tensorflow/package.py39
1 files changed, 31 insertions, 8 deletions
diff --git a/var/spack/repos/builtin/packages/py-tensorflow/package.py b/var/spack/repos/builtin/packages/py-tensorflow/package.py
index 1d86e81fd0..4c34b1ffea 100644
--- a/var/spack/repos/builtin/packages/py-tensorflow/package.py
+++ b/var/spack/repos/builtin/packages/py-tensorflow/package.py
@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import glob
import os
import sys
import tempfile
@@ -381,7 +382,8 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension):
# https://www.tensorflow.org/install/source#tested_build_configurations
# https://github.com/tensorflow/tensorflow/issues/70199
- conflicts("%gcc", when="@2.17:")
+ # (-mavx512fp16 exists in gcc@12:)
+ conflicts("%gcc@:11", when="@2.17:")
conflicts("%gcc@:9.3.0", when="@2.9:")
conflicts("%gcc@:7.3.0")
@@ -709,6 +711,14 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension):
def post_configure_fixes(self):
spec = self.spec
+ if spec.satisfies("@2.17:"):
+ filter_file(
+ "patchelf",
+ spec["patchelf"].prefix.bin.patchelf,
+ "tensorflow/tools/pip_package/build_pip_package.py",
+ string=True,
+ )
+
# make sure xla is actually turned off
if spec.satisfies("~xla"):
filter_file(
@@ -849,14 +859,27 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension):
bazel(*args)
- build_pip_package = Executable("bazel-bin/tensorflow/tools/pip_package/build_pip_package")
- buildpath = join_path(self.stage.source_path, "spack-build")
- build_pip_package("--src", buildpath)
+ if self.spec.satisfies("@:2.16"):
+ build_pip_package = Executable(
+ "bazel-bin/tensorflow/tools/pip_package/build_pip_package"
+ )
+ buildpath = join_path(self.stage.source_path, "spack-build")
+ build_pip_package("--src", buildpath)
def install(self, spec, prefix):
tmp_path = env["TEST_TMPDIR"]
- buildpath = join_path(self.stage.source_path, "spack-build")
- with working_dir(buildpath):
- args = std_pip_args + ["--prefix=" + prefix, "."]
- pip(*args)
+ if self.spec.satisfies("@2.17:"):
+ buildpath = join_path(
+ self.stage.source_path, "bazel-bin/tensorflow/tools/pip_package/wheel_house/"
+ )
+ with working_dir(buildpath):
+ wheel = glob.glob("*.whl")[0]
+ args = std_pip_args + ["--prefix=" + prefix, wheel]
+ pip(*args)
+ else:
+ buildpath = join_path(self.stage.source_path, "spack-build")
+ with working_dir(buildpath):
+ args = std_pip_args + ["--prefix=" + prefix, "."]
+ pip(*args)
+
remove_linked_tree(tmp_path)