Skip to content

Commit

Permalink
[ROCM] Extend try-catch mechanism for ROCM detection (pytorch#99980)
Browse files Browse the repository at this point in the history
ROCM path detection currently relies on `hipconfig`. On some systems when calling `hipconfig` through `subprocess` python raises a `NotADirectoryError` that isn't catch at the moment. This commit adds `NotADirectoryError` to exceptions catched when calling `hipconfig`.

Fixes pytorch#98629

Pull Request resolved: pytorch#99980
Approved by: https://github.com/jeffdaily, https://github.com/malfet
  • Loading branch information
fd0r authored and pytorchmergebot committed Apr 25, 2023
1 parent df3455b commit 39ff87c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch/utils/hipify/cuda_to_hip_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
except subprocess.CalledProcessError:
print(f"Warning: hipconfig --rocmpath failed, assuming {rocm_path}")
except (FileNotFoundError, PermissionError):
except (FileNotFoundError, PermissionError, NotADirectoryError):
# Do not print warning. This is okay. This file can also be imported for non-ROCm builds.
pass

Expand Down

0 comments on commit 39ff87c

Please sign in to comment.