Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def load_with_system_search(desc: LibDescriptor) -> LoadedDL | None:
return None


def _preload_nvrtc_builtins(found_path: str, found_via: str | None) -> None:
def _preload_nvrtc_builtins(found_path: str, found_via: str) -> None:
# Let Conda packaging provide sibling lookup through RPATH.
if found_via == FOUND_VIA_CONDA:
return
Expand Down Expand Up @@ -224,7 +224,7 @@ def _preload_nvrtc_builtins(found_path: str, found_via: str | None) -> None:
)


def load_with_abs_path(desc: LibDescriptor, found_path: str, found_via: str | None = None) -> LoadedDL:
def load_with_abs_path(desc: LibDescriptor, found_path: str, found_via: str) -> LoadedDL:
"""Load a dynamic library from the given path.

Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def load_with_system_search(desc: LibDescriptor) -> LoadedDL | None:
return None


def load_with_abs_path(desc: LibDescriptor, found_path: str, found_via: str | None = None) -> LoadedDL:
def load_with_abs_path(desc: LibDescriptor, found_path: str, found_via: str) -> LoadedDL:
"""Load a dynamic library from the given path.

Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def check_if_already_loaded_from_elsewhere(self, desc: LibDescriptor) -> LoadedD

def load_with_system_search(self, desc: LibDescriptor) -> LoadedDL | None: ...

def load_with_abs_path(self, desc: LibDescriptor, found_path: str, found_via: str | None = None) -> LoadedDL: ...
def load_with_abs_path(self, desc: LibDescriptor, found_path: str, found_via: str) -> LoadedDL: ...


if sys.platform == "win32":
Expand Down
6 changes: 3 additions & 3 deletions cuda_pathfinder/cuda/pathfinder/_headers/header_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import glob
import os
import sysconfig
from typing import TypeAlias, cast
from typing import TypeAlias

from cuda.pathfinder._headers.header_descriptor_catalog import (
HEADER_DESCRIPTOR_CATALOG,
Expand All @@ -34,8 +34,8 @@ def platform_include_subdirs(desc: HeaderDescriptor) -> tuple[str, ...]:
common subdirs. On Linux, only the common subdirs are returned.
"""
if IS_WINDOWS:
return cast(tuple[str, ...], desc.include_subdirs_windows + desc.include_subdirs)
return cast(tuple[str, ...], desc.include_subdirs)
return desc.include_subdirs_windows + desc.include_subdirs
return desc.include_subdirs


def system_install_dir_patterns(desc: HeaderDescriptor) -> tuple[str, ...]:
Expand Down
3 changes: 2 additions & 1 deletion cuda_pathfinder/cuda/pathfinder/_utils/driver_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def query_driver_cuda_version() -> DriverCudaVersion:
def _query_driver_cuda_version_int() -> int:
"""Return the encoded CUDA driver version from ``cuDriverGetVersion()``."""
loaded_cuda = _load_nvidia_dynamic_lib("cuda")
driver_lib = _DRIVER_LIB_LOADER(loaded_cuda.abs_path)
# `LoadedDL.abs_path` is typed `str | None`, but the Windows loader is declared to take `str`.
driver_lib = _DRIVER_LIB_LOADER(loaded_cuda.abs_path) # type: ignore[arg-type, unused-ignore]
cu_driver_get_version = driver_lib.cuDriverGetVersion
cu_driver_get_version.argtypes = [ctypes.POINTER(ctypes.c_int)]
cu_driver_get_version.restype = ctypes.c_int
Expand Down
3 changes: 3 additions & 0 deletions cuda_pathfinder/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ markers = [
# Basic settings
python_version = "3.11"
explicit_package_bases = true
# Resolve `cuda.pathfinder` imports from this directory whatever the working
# directory is. Without it the package's own imports are typed as `Any`.
mypy_path = "$MYPY_CONFIG_FILE_DIR"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
Expand Down
Loading