cuda.pathfinder._utils.env_vars.get_cuda_home_or_path#
- cuda.pathfinder._utils.env_vars.get_cuda_home_or_path() str | None#
Get CUDA Toolkit path from environment variables.
Returns the value of CUDA_PATH or CUDA_HOME following the canonical search order defined in CUDA_ENV_VARS_ORDERED. If both are set and differ, CUDA_PATH takes precedence and a warning is issued.
The result is cached for the process lifetime. The first call determines the CUDA Toolkit path, and subsequent calls return the cached value.
- Returns:
Path to CUDA Toolkit, or None if neither variable is set. Empty strings are preserved and returned as-is if explicitly set in the environment.
Warning
- UserWarning: If multiple CUDA environment variables are set but point to
different locations (only on the first call).
See also
CUDA_ENV_VARS_ORDERED: The canonical search order for CUDA environment variables.