|
1 | | -From 67fcb9333c5bccf13cabb3462cd56dd4c7ef7e18 Mon Sep 17 00:00:00 2001 |
| 1 | +From 89eedf14f72f2baa2fa8b1766a3b3682f454538d Mon Sep 17 00:00:00 2001 |
2 | 2 | From: "H. Vetinari" < [email protected]> |
3 | 3 | Date: Thu, 23 Jan 2025 22:58:14 +1100 |
4 | 4 | Subject: [PATCH 08/15] point include paths to Conda prefix include dir |
5 | 5 |
|
6 | 6 | Updated to use `sys.prefix` per |
7 | 7 | https://github.com/conda-forge/pytorch-cpu-feedstock/issues/424. |
8 | 8 | --- |
9 | | - torch/utils/cpp_extension.py | 4 ++++ |
10 | | - 1 file changed, 4 insertions(+) |
| 9 | + torch/utils/cpp_extension.py | 5 +++++ |
| 10 | + 1 file changed, 5 insertions(+) |
11 | 11 |
|
12 | 12 | diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py |
13 | | -index 7fa5237994e..7d271c101f8 100644 |
| 13 | +index 7fa5237994e..99fbd38e81a 100644 |
14 | 14 | --- a/torch/utils/cpp_extension.py |
15 | 15 | +++ b/torch/utils/cpp_extension.py |
16 | | -@@ -1495,7 +1495,11 @@ def include_paths(device_type: str = "cpu") -> list[str]: |
| 16 | +@@ -1495,9 +1495,14 @@ def include_paths(device_type: str = "cpu") -> list[str]: |
17 | 17 | A list of include path strings. |
18 | 18 | """ |
19 | 19 | lib_include = os.path.join(_TORCH_PATH, 'include') |
20 | 20 | + # Account for conda prefix. |
21 | 21 | + conda_pieces = [sys.prefix] + IS_WINDOWS * ["Library"] + ["include"] |
22 | | -+ conda_include = os.path.join(*conda_pieces) |
| 22 | ++ conda_include = os.path.join(*pieces) |
23 | 23 | paths = [ |
24 | 24 | + conda_include, |
25 | 25 | lib_include, |
26 | 26 | # Remove this once torch/torch.h is officially no longer supported for C++ extensions. |
| 27 | ++ os.path.join(conda_include, 'torch', 'csrc', 'api', 'include'), |
27 | 28 | os.path.join(lib_include, 'torch', 'csrc', 'api', 'include'), |
| 29 | + ] |
| 30 | + if device_type == "cuda" and IS_HIP_EXTENSION: |
0 commit comments