forked from NVIDIA/cuda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_dl_common.py
More file actions
36 lines (23 loc) · 957 Bytes
/
load_dl_common.py
File metadata and controls
36 lines (23 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from cuda.pathfinder._dynamic_libs.lib_descriptor import LibDescriptor
class DynamicLibNotFoundError(RuntimeError):
pass
class DynamicLibNotAvailableError(DynamicLibNotFoundError):
pass
class DynamicLibUnknownError(DynamicLibNotFoundError):
pass
@dataclass
class LoadedDL:
abs_path: str | None
was_already_loaded_from_elsewhere: bool
_handle_uint: int # Platform-agnostic unsigned pointer value
found_via: str # "CUDA_PATH" covers both CUDA_PATH and CUDA_HOME env vars
def load_dependencies(desc: LibDescriptor, load_func: Callable[[str], LoadedDL]) -> None:
for dep in desc.dependencies:
load_func(dep)