Skip to content

Commit b127a47

Browse files
committed
wip
1 parent 2921b31 commit b127a47

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

cuda_bindings/setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import tempfile
1414
from warnings import warn
1515

16-
from cuda.pathfinder._utils.env_vars import get_cuda_home_or_path
1716
from Cython import Tempita
1817
from Cython.Build import cythonize
1918
from pyclibrary import CParser
@@ -27,7 +26,13 @@
2726
# ----------------------------------------------------------------------
2827
# Fetch configuration options
2928

30-
CUDA_HOME = get_cuda_home_or_path()
29+
try:
30+
from cuda.pathfinder._utils.env_vars import get_cuda_home_or_path
31+
CUDA_HOME = get_cuda_home_or_path()
32+
except ImportError:
33+
# Fallback for build environments where cuda-pathfinder may not be available
34+
CUDA_HOME = os.environ.get("CUDA_HOME", os.environ.get("CUDA_PATH", None))
35+
3136
if not CUDA_HOME:
3237
raise RuntimeError("Environment variable CUDA_PATH or CUDA_HOME is not set")
3338

cuda_core/build_hooks.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ def _get_cuda_paths() -> list[str]:
3131
Supports multiple paths separated by os.pathsep (: on Unix, ; on Windows).
3232
Returns a list of paths for use in include_dirs and library_dirs.
3333
"""
34-
from cuda.pathfinder._utils.env_vars import get_cuda_home_or_path
35-
36-
CUDA_PATH = get_cuda_home_or_path()
34+
try:
35+
from cuda.pathfinder._utils.env_vars import get_cuda_home_or_path
36+
CUDA_PATH = get_cuda_home_or_path()
37+
except ImportError:
38+
# Fallback for build environments where cuda-pathfinder may not be available
39+
CUDA_PATH = os.environ.get("CUDA_PATH", os.environ.get("CUDA_HOME", None))
40+
3741
if not CUDA_PATH:
3842
raise RuntimeError("Environment variable CUDA_PATH or CUDA_HOME is not set")
3943
CUDA_PATH = CUDA_PATH.split(os.pathsep)

0 commit comments

Comments
 (0)