|
49 | 49 | from .drvapi import cu_occupancy_b2d_size, cu_stream_callback_pyobj, cu_uuid |
50 | 50 | from .mappings import FILE_EXTENSION_MAP |
51 | 51 | from .linkable_code import LinkableCode, LTOIR, Fatbin, Object |
52 | | -from numba.cuda.utils import _readenv, cached_file_read |
| 52 | +from numba.cuda.utils import cached_file_read |
53 | 53 | from numba.cuda.cudadrv import enums, drvapi, nvrtc |
54 | 54 |
|
55 | 55 | try: |
56 | 56 | from pynvjitlink.api import NvJitLinker, NvJitLinkError |
57 | 57 | except ImportError: |
58 | 58 | NvJitLinker, NvJitLinkError = None, None |
59 | 59 |
|
60 | | -USE_NV_BINDING = config.CUDA_USE_NVIDIA_BINDING |
61 | | - |
62 | | -if USE_NV_BINDING: |
63 | | - from cuda import cuda as binding |
64 | | - |
65 | | - # There is no definition of the default stream in the Nvidia bindings (nor |
66 | | - # is there at the C/C++ level), so we define it here so we don't need to |
67 | | - # use a magic number 0 in places where we want the default stream. |
68 | | - CU_STREAM_DEFAULT = 0 |
69 | 60 |
|
70 | 61 | MIN_REQUIRED_CC = (3, 5) |
71 | 62 | SUPPORTS_IPC = sys.platform.startswith("linux") |
|
82 | 73 | "to be available" |
83 | 74 | ) |
84 | 75 |
|
85 | | -# Enable pynvjitlink if the environment variables NUMBA_CUDA_ENABLE_PYNVJITLINK |
86 | | -# or CUDA_ENABLE_PYNVJITLINK are set, or if the pynvjitlink module is found. If |
87 | | -# explicitly disabled, do not use pynvjitlink, even if present in the env. |
88 | | -_pynvjitlink_enabled_in_env = _readenv( |
89 | | - "NUMBA_CUDA_ENABLE_PYNVJITLINK", bool, None |
90 | | -) |
91 | | -_pynvjitlink_enabled_in_cfg = getattr(config, "CUDA_ENABLE_PYNVJITLINK", None) |
| 76 | +USE_NV_BINDING = config.CUDA_USE_NVIDIA_BINDING |
92 | 77 |
|
93 | | -if _pynvjitlink_enabled_in_env is not None: |
94 | | - ENABLE_PYNVJITLINK = _pynvjitlink_enabled_in_env |
95 | | -elif _pynvjitlink_enabled_in_cfg is not None: |
96 | | - ENABLE_PYNVJITLINK = _pynvjitlink_enabled_in_cfg |
97 | | -else: |
98 | | - ENABLE_PYNVJITLINK = importlib.util.find_spec("pynvjitlink") is not None |
| 78 | +if USE_NV_BINDING: |
| 79 | + from cuda.bindings import driver as binding |
99 | 80 |
|
100 | | -if not hasattr(config, "CUDA_ENABLE_PYNVJITLINK"): |
101 | | - config.CUDA_ENABLE_PYNVJITLINK = ENABLE_PYNVJITLINK |
| 81 | + # There is no definition of the default stream in the Nvidia bindings (nor |
| 82 | + # is there at the C/C++ level), so we define it here so we don't need to |
| 83 | + # use a magic number 0 in places where we want the default stream. |
| 84 | + CU_STREAM_DEFAULT = 0 |
102 | 85 |
|
103 | 86 |
|
104 | 87 | def make_logger(): |
@@ -3192,7 +3175,6 @@ def __init__(self, max_registers=0, lineinfo=False, cc=None): |
3192 | 3175 |
|
3193 | 3176 | raw_keys = list(options.keys()) |
3194 | 3177 | raw_values = list(options.values()) |
3195 | | - |
3196 | 3178 | self.handle = driver.cuLinkCreate(len(raw_keys), raw_keys, raw_values) |
3197 | 3179 |
|
3198 | 3180 | weakref.finalize(self, driver.cuLinkDestroy, self.handle) |
|
0 commit comments