Revert "Use absolute path path.resolve() -> path.absolute() (#129409)"

This reverts commit 135c7db99d646b8bd9603bf969d47d3dec5987b1.

Reverted https://github.com/pytorch/pytorch/pull/129409 on behalf of https://github.com/malfet due to need to revert to as dependency of https://github.com/pytorch/pytorch/pull/129374 ([comment](https://github.com/pytorch/pytorch/pull/129409#issuecomment-2562969825))
This commit is contained in:
PyTorch MergeBot
2024-12-26 17:26:06 +00:00
parent 9255ffc841
commit cc4e70b7c3
84 changed files with 124 additions and 128 deletions

View File

@ -126,11 +126,11 @@ def _find_rocm_home() -> Optional[str]:
# Guess #2
hipcc_path = shutil.which('hipcc')
if hipcc_path is not None:
rocm_home_path = Path(hipcc_path).resolve().parent.parent
rocm_home = os.path.dirname(os.path.dirname(
os.path.realpath(hipcc_path)))
# can be either <ROCM_HOME>/hip/bin/hipcc or <ROCM_HOME>/bin/hipcc
if rocm_home_path.name == 'hip':
rocm_home_path = rocm_home_path.parent
rocm_home = str(rocm_home_path)
if os.path.basename(rocm_home) == 'hip':
rocm_home = os.path.dirname(rocm_home)
else:
# Guess #3
fallback_path = '/opt/rocm'
@ -147,7 +147,8 @@ def _find_sycl_home() -> Optional[str]:
# Guess 1: for source code build developer/user, we'll have icpx in PATH,
# which will tell us the SYCL_HOME location.
if icpx_path is not None:
sycl_home = str(Path(icpx_path).resolve().parent.parent)
sycl_home = os.path.dirname(os.path.dirname(
os.path.realpath(icpx_path)))
# Guess 2: for users install Pytorch with XPU support, the sycl runtime is
# inside intel-sycl-rt, which is automatically installed via pip dependency.
@ -156,7 +157,7 @@ def _find_sycl_home() -> Optional[str]:
files = importlib.metadata.files('intel-sycl-rt') or []
for f in files:
if f.name == "libsycl.so":
sycl_home = str(Path(f.locate()).resolve().parent.parent)
sycl_home = os.path.dirname(Path(f.locate()).parent.resolve())
break
except importlib.metadata.PackageNotFoundError:
print("Trying to find SYCL_HOME from intel-sycl-rt package, but it is not installed.",