Skip to content

Commit

Permalink
rename errors
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-b-miller committed Aug 22, 2024
1 parent 421fdfb commit 16314a7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions numba_cuda/numba/cuda/cudadrv/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
_py_decref.argtypes = [ctypes.py_object]
_py_incref.argtypes = [ctypes.py_object]

_MVC_ERROR_MESSAGE_CU12 = None
_PYNVJITLINK_ERR_MSG = None


def _readenv(name, ctor, default):
Expand All @@ -78,12 +78,12 @@ def _readenv(name, ctor, default):
return default


_MVC_ERROR_MESSAGE_CU11 = (
_MVC_ERROR_MESSAGE = (
"Minor version compatibility requires ptxcompiler and cubinlinker packages "
"to be available"
)

_MVC_ERROR_MESSAGE_CU12 = (
_PYNVJITLINK_ERR_MSG = (
"Using pynvjitlink requires the pynvjitlink package to be available"
)

Expand All @@ -96,7 +96,7 @@ def _readenv(name, ctor, default):
try:
from pynvjitlink.api import NvJitLinker, NvJitLinkError
except ImportError:
raise ImportError(_MVC_ERROR_MESSAGE_CU12)
raise ImportError(_PYNVJITLINK_ERR_MSG)

if config.CUDA_ENABLE_MINOR_VERSION_COMPATIBILITY:
raise ValueError(
Expand Down Expand Up @@ -2751,7 +2751,7 @@ def __init__(self, max_registers=None, lineinfo=False, cc=None):
try:
from cubinlinker import CubinLinker
except ImportError as err:
raise ImportError(_MVC_ERROR_MESSAGE_CU11) from err
raise ImportError(_MVC_ERROR_MESSAGE) from err

if cc is None:
raise RuntimeError("MVCLinker requires Compute Capability to be "
Expand Down Expand Up @@ -2783,7 +2783,7 @@ def add_ptx(self, ptx, name='<cudapy-ptx>'):
from ptxcompiler import compile_ptx
from cubinlinker import CubinLinkerError
except ImportError as err:
raise ImportError(_MVC_ERROR_MESSAGE_CU11) from err
raise ImportError(_MVC_ERROR_MESSAGE) from err
compile_result = compile_ptx(ptx.decode(), self.ptx_compile_options)
try:
self._linker.add_cubin(compile_result.compiled_program, name)
Expand All @@ -2794,7 +2794,7 @@ def add_file(self, path, kind):
try:
from cubinlinker import CubinLinkerError
except ImportError as err:
raise ImportError(_MVC_ERROR_MESSAGE_CU11) from err
raise ImportError(_MVC_ERROR_MESSAGE) from err

try:
with open(path, 'rb') as f:
Expand Down Expand Up @@ -2823,7 +2823,7 @@ def complete(self):
try:
from cubinlinker import CubinLinkerError
except ImportError as err:
raise ImportError(_MVC_ERROR_MESSAGE_CU11) from err
raise ImportError(_MVC_ERROR_MESSAGE) from err

try:
return self._linker.complete()
Expand Down

0 comments on commit 16314a7

Please sign in to comment.