mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Keep default CMAKE_PREFIX_PATH
in test_aot_inductor_package (#161907)
`CMAKE_PREFIX_PATH` is a list of paths used to find dependencies. The test overwrites that with a single path causing dependencies such as protobuf or Abseil not being found. Instead prepend the path to the existing value. This fixes a test failure: > pytorch-v2.7.1/test/inductor/test_aot_inductor_package.py", line 242, in test_compile_after_package > self.assertTrue(so_path.exists()) > AssertionError: False is not true Caused by: ``` /software/binutils/2.42-GCCcore-13.3.0/bin/ld: cannot find -labsl::utility: No such file or directory /software/binutils/2.42-GCCcore-13.3.0/bin/ld: cannot find -labsl::variant: No such file or directory collect2: error: ld returned 1 exit status ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/161907 Approved by: https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
3a20a20e70
commit
cc5bdd1240
@ -147,7 +147,10 @@ class TestAOTInductorPackage(TestCase):
|
||||
|
||||
def cmake_compile_and_run(self, base_dir):
|
||||
custom_env = os.environ.copy()
|
||||
custom_env["CMAKE_PREFIX_PATH"] = str(Path(torch.__file__).parent)
|
||||
custom_env["CMAKE_PREFIX_PATH"] = ":".join(
|
||||
[str(Path(torch.__file__).parent)]
|
||||
+ os.environ.get("CMAKE_PREFIX_PATH", "").split(":")
|
||||
)
|
||||
build_path = Path(base_dir) / "build"
|
||||
build_path.mkdir()
|
||||
subprocess.run(
|
||||
@ -194,7 +197,10 @@ class TestAOTInductorPackage(TestCase):
|
||||
self.assertTrue(not build_path.exists())
|
||||
build_path.mkdir()
|
||||
custom_env = os.environ.copy()
|
||||
custom_env["CMAKE_PREFIX_PATH"] = str(Path(torch.__file__).parent)
|
||||
custom_env["CMAKE_PREFIX_PATH"] = ":".join(
|
||||
[str(Path(torch.__file__).parent)]
|
||||
+ os.environ.get("CMAKE_PREFIX_PATH", "").split(":")
|
||||
)
|
||||
subprocess.run(
|
||||
["cmake", ".."],
|
||||
cwd=build_path,
|
||||
|
Reference in New Issue
Block a user