Repository navigation
Set RUNPATH so installed tests can find the required shared libraries - #136627
kundaMwiza wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/136627
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b9d88b2 with merge base 60c1433 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Broken executables found using: import subprocess
import argparse
import pathlib
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--torch-install-dir",
type=pathlib.Path,
default=pathlib.Path(__file__).parent / "third_party" / "pytorch" / "torch",
)
args = parser.parse_args()
out = subprocess.check_output(
"find -type f -executable",
cwd=args.torch_install_dir,
shell=True,
)
executables = out.decode(encoding="utf-8").splitlines()
problematic_executables: str = []
for exe in executables:
print(exe)
if ".so" in exe or ".py" in exe:
continue
try:
out = subprocess.check_output(
exe, cwd=args.torch_install_dir, shell=True, stderr=subprocess.STDOUT
)
except subprocess.CalledProcessError as e:
if "error while loading shared libraries" in e.output.decode(
encoding="utf-8"
):
problematic_executables.append(exe)
else:
print(e)
with open("torch_executables_missing_rpath.txt", "w") as f:
f.write("\n".join(problematic_executables)) |
|
@malfet bump |
|
Related: #106476 |
|
@pytorchbot merge -r |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Rebase failed due to Command This is likely because the author did not allow edits from maintainers on the PR or because the repo has additional permissions settings that mergebot does not qualify. |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 1 checks: Lint / Test Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
4064003 to
b9d88b2
Compare
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
#136627 has almost fixed the issue that test binaries' runpath has not been set correctly, with few cases left. This PR fixes the rest. The binaries are found by `auditwheel repair` a wheel built with `BUILD_TEST=1`. @malfet Pull Request resolved: #144305 Approved by: https://github.com/malfet
pytorch#136627 has almost fixed the issue that test binaries' runpath has not been set correctly, with few cases left. This PR fixes the rest. The binaries are found by `auditwheel repair` a wheel built with `BUILD_TEST=1`. @malfet Pull Request resolved: pytorch#144305 Approved by: https://github.com/malfet
…pytorch#136627) This change fixes the RUNPATH of installed c++ tests so that the linker can find the shared libraries they depend on. For example, currently: ```bash venv/lib/python3.10/site-packages/torch $ ./bin/test_lazy ./bin/test_lazy: error while loading shared libraries: libtorch.so: cannot open shared object file: No such file or directory ``` Pull Request resolved: pytorch#136627 Approved by: https://github.com/malfet
…ibraries (pytorch#136627)" This reverts commit 84040be83ee4f8850e2384065415c1f8c8e997a5.
On ROCm, test_api, test_jit and test_cpp_rpc fail `--help` with "libaotriton_v2.so.0.14.1: cannot open shared object file". test.sh symlinks libtorch* into torch/bin, so the test binary loads libtorch_hip.so through that symlink, glibc sets its $ORIGIN to torch/bin, and its own dependencies in torch/lib (AOTriton, and before that libcaffe2_nvrtc.so, which pytorch#106712 patched with one more symlink) are not found. The symlinks were added in pytorch#62797 because the installed test binaries had no RUNPATH; pytorch#136627 gave them $ORIGIN/../lib, so they are no longer needed. This removes them for test_libtorch, the distributed C++ tests and test_rpc. test_aot_compilation and test_vulkan keep theirs: test_mobile_nnc, aot_model_compiler_test and the vulkan tests never got that RUNPATH. Test Plan: With the torch/bin and torch/lib from this PR's mi350 wheel and CI's LD_LIBRARY_PATH: with the symlinks, `test_api --help` exits 127 with the CI error; without them, test_api, test_jit, test_lazy, test_cpp_rpc and the c10d store and process-group tests start, pytest-cpp collects 1024 and 588 tests from test_api and test_jit, and FunctionalTest.Conv1d (the libcaffe2_nvrtc.so case) passes on gfx950: ``` torch/bin/test_api --gtest_filter='FunctionalTest.Conv1d*' python -m pytest torch/bin/test_api --collect-only -q ``` This change was developed with the assistance of an AI assistant (Claude).
ROCm CI reports its C++ gtests as passing while running none of them: every `cpp/*` test in the ROCm shard logs shows `0 items`. pytest-cpp skips a binary whose `--help` fails, pytest exits 5, and run_test.py treats 5 as success. On ROCm the build/bin binaries fail `--help` with exit 127: their RUNPATH is build/lib under the build job's /__w workspace, which does not exist in the ROCm test container. - run_test.py: when a C++ test exits 5, fail it if the binary's `--help` fails, and print the error. Binaries that start but define no tests still pass. - test.sh: put torch/lib on LD_LIBRARY_PATH for the two build/bin runs, test_aten and static_runtime_test. `test_api`, `test_jit` and `test_cpp_rpc` run from the installed torch/bin and failed `--help` with "libaotriton_v2.so.0.14.1: cannot open shared object file": test.sh symlinked libtorch* into torch/bin, so libtorch_hip.so loaded through the symlink had `$ORIGIN` = torch/bin and could not find its dependencies in torch/lib. Those symlinks predate the `$ORIGIN/../lib` RUNPATH from #136627; this removes them for test_libtorch, the distributed C++ tests and test_rpc (test_aot_compilation and test_vulkan keep theirs, since those binaries never got that RUNPATH). Test Plan: ``` # in the ROCm test image: exit 127; with torch/lib on LD_LIBRARY_PATH: 8 tests collected build/bin/basic --help # fails now with "--help failed with exit code 127"; zero-test binaries still pass CPP_TESTS_DIR=/tmp/fakebin python test/run_test.py --cpp -i cpp/broken_test CPP_TESTS_DIR=build/bin python test/run_test.py --cpp -i cpp/c10_ConstexprCrc_test cpp/c10_StreamGuard_test cpp/basic ``` On gfx950 all 19 shard-1 C++ tests pass when they actually run. Authored with the assistance of Claude (AI). Pull Request resolved: #199440 Approved by: https://github.com/jeffdaily Co-authored-by: Jeff Daily <[email protected]>
ROCm CI reports its C++ gtests as passing while running none of them: every `cpp/*` test in the ROCm shard logs shows `0 items`. pytest-cpp skips a binary whose `--help` fails, pytest exits 5, and run_test.py treats 5 as success. On ROCm the build/bin binaries fail `--help` with exit 127: their RUNPATH is build/lib under the build job's /__w workspace, which does not exist in the ROCm test container. - run_test.py: when a C++ test exits 5, fail it if the binary's `--help` fails, and print the error. Binaries that start but define no tests still pass. - test.sh: put torch/lib on LD_LIBRARY_PATH for the two build/bin runs, test_aten and static_runtime_test. `test_api`, `test_jit` and `test_cpp_rpc` run from the installed torch/bin and failed `--help` with "libaotriton_v2.so.0.14.1: cannot open shared object file": test.sh symlinked libtorch* into torch/bin, so libtorch_hip.so loaded through the symlink had `$ORIGIN` = torch/bin and could not find its dependencies in torch/lib. Those symlinks predate the `$ORIGIN/../lib` RUNPATH from #136627; this removes them for test_libtorch, the distributed C++ tests and test_rpc (test_aot_compilation and test_vulkan keep theirs, since those binaries never got that RUNPATH). Test Plan: ``` # in the ROCm test image: exit 127; with torch/lib on LD_LIBRARY_PATH: 8 tests collected build/bin/basic --help # fails now with "--help failed with exit code 127"; zero-test binaries still pass CPP_TESTS_DIR=/tmp/fakebin python test/run_test.py --cpp -i cpp/broken_test CPP_TESTS_DIR=build/bin python test/run_test.py --cpp -i cpp/c10_ConstexprCrc_test cpp/c10_StreamGuard_test cpp/basic ``` On gfx950 all 19 shard-1 C++ tests pass when they actually run. Authored with the assistance of Claude (AI). Pull Request resolved: #199440 Approved by: https://github.com/jeffdaily Co-authored-by: Jeff Daily <[email protected]>
ROCm CI reports its C++ gtests as passing while running none of them: every `cpp/*` test in the ROCm shard logs shows `0 items`. pytest-cpp skips a binary whose `--help` fails, pytest exits 5, and run_test.py treats 5 as success. On ROCm the build/bin binaries fail `--help` with exit 127: their RUNPATH is build/lib under the build job's /__w workspace, which does not exist in the ROCm test container. - run_test.py: when a C++ test exits 5, fail it if the binary's `--help` fails, and print the error. Binaries that start but define no tests still pass. - test.sh: put torch/lib on LD_LIBRARY_PATH for the two build/bin runs, test_aten and static_runtime_test. `test_api`, `test_jit` and `test_cpp_rpc` run from the installed torch/bin and failed `--help` with "libaotriton_v2.so.0.14.1: cannot open shared object file": test.sh symlinked libtorch* into torch/bin, so libtorch_hip.so loaded through the symlink had `$ORIGIN` = torch/bin and could not find its dependencies in torch/lib. Those symlinks predate the `$ORIGIN/../lib` RUNPATH from pytorch#136627; this removes them for test_libtorch, the distributed C++ tests and test_rpc (test_aot_compilation and test_vulkan keep theirs, since those binaries never got that RUNPATH). Test Plan: ``` # in the ROCm test image: exit 127; with torch/lib on LD_LIBRARY_PATH: 8 tests collected build/bin/basic --help # fails now with "--help failed with exit code 127"; zero-test binaries still pass CPP_TESTS_DIR=/tmp/fakebin python test/run_test.py --cpp -i cpp/broken_test CPP_TESTS_DIR=build/bin python test/run_test.py --cpp -i cpp/c10_ConstexprCrc_test cpp/c10_StreamGuard_test cpp/basic ``` On gfx950 all 19 shard-1 C++ tests pass when they actually run. Authored with the assistance of Claude (AI). Pull Request resolved: pytorch#199440 Approved by: https://github.com/jeffdaily Co-authored-by: Jeff Daily <[email protected]>
ROCm CI reports its C++ gtests as passing while running none of them: every `cpp/*` test in the ROCm shard logs shows `0 items`. pytest-cpp skips a binary whose `--help` fails, pytest exits 5, and run_test.py treats 5 as success. On ROCm the build/bin binaries fail `--help` with exit 127: their RUNPATH is build/lib under the build job's /__w workspace, which does not exist in the ROCm test container. - run_test.py: when a C++ test exits 5, fail it if the binary's `--help` fails, and print the error. Binaries that start but define no tests still pass. - test.sh: put torch/lib on LD_LIBRARY_PATH for the two build/bin runs, test_aten and static_runtime_test. `test_api`, `test_jit` and `test_cpp_rpc` run from the installed torch/bin and failed `--help` with "libaotriton_v2.so.0.14.1: cannot open shared object file": test.sh symlinked libtorch* into torch/bin, so libtorch_hip.so loaded through the symlink had `$ORIGIN` = torch/bin and could not find its dependencies in torch/lib. Those symlinks predate the `$ORIGIN/../lib` RUNPATH from pytorch#136627; this removes them for test_libtorch, the distributed C++ tests and test_rpc (test_aot_compilation and test_vulkan keep theirs, since those binaries never got that RUNPATH). Test Plan: ``` # in the ROCm test image: exit 127; with torch/lib on LD_LIBRARY_PATH: 8 tests collected build/bin/basic --help # fails now with "--help failed with exit code 127"; zero-test binaries still pass CPP_TESTS_DIR=/tmp/fakebin python test/run_test.py --cpp -i cpp/broken_test CPP_TESTS_DIR=build/bin python test/run_test.py --cpp -i cpp/c10_ConstexprCrc_test cpp/c10_StreamGuard_test cpp/basic ``` On gfx950 all 19 shard-1 C++ tests pass when they actually run. Authored with the assistance of Claude (AI). Pull Request resolved: pytorch#199440 Approved by: https://github.com/jeffdaily Co-authored-by: Jeff Daily <[email protected]>
This change fixes the RUNPATH of installed c++ tests so that the linker can find the shared libraries they depend on.
For example, currently: