Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
9 changes: 9 additions & 0 deletions numba/cuda/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ def __init__(self, py_func, argtypes, link=None, debug=False,
if (f'__numba_wrapper_{fn}' in lib.get_asm_str())]

if res:
if not config.CUDA_USE_NVIDIA_BINDING:
s = "https://numba.readthedocs.io/en/stable/cuda/bindings.html"
msg = ("Use of float16 requires the use of the NVIDIA CUDA "
"bindings and settng the "
Comment thread
gmarkall marked this conversation as resolved.
Resolved
"NUMBA_CUDA_USE_NVIDIA_BINDING environment variable to "
"1. Relevant documentation is available here:\n"
f"{s}")
Comment on lines +115 to +119

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some simplification of this comment (and the typo fix suggested yesterday incorporated):

Suggested change
msg = ("Use of float16 requires the use of the NVIDIA CUDA "
"bindings and settng the "
"NUMBA_CUDA_USE_NVIDIA_BINDING environment variable to "
"1. Relevant documentation is available here:\n"
f"{s}")
msg = ("Use of float16 requires the NVIDIA CUDA bindings and "
"setting the NUMBA_CUDA_USE_NVIDIA_BINDING environment "
f"variable to 1. See {s}")

raise NotImplementedError(msg)

# Path to the source containing the foreign function

basedir = os.path.dirname(os.path.abspath(__file__))
Expand Down
18 changes: 13 additions & 5 deletions numba/cuda/tests/cudadrv/test_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import warnings
from numba.cuda.testing import unittest
from numba.cuda.testing import (skip_on_cudasim, skip_unless_cuda_python,
skip_if_cuda_includes_missing,
skip_with_cuda_python)
skip_if_cuda_includes_missing)
from numba.cuda.testing import CUDATestCase
from numba.cuda.cudadrv.driver import Linker, LinkerError, NvrtcError
from numba.cuda import require_context
from numba.tests.support import ignore_internal_warnings
from numba.tests.support import TestCase, ignore_internal_warnings
from numba import cuda, void, float64, int64, int32, typeof

CONST1D = np.arange(10, dtype=np.float64)
Expand Down Expand Up @@ -92,6 +91,7 @@ def simple_lmem(A, B, dty):

@skip_on_cudasim('Linking unsupported in the simulator')
class TestLinker(CUDATestCase):
_NUMBA_NVIDIA_BINDING_0_ENV = {'NUMBA_CUDA_USE_NVIDIA_BINDING': '0'}

@require_context
def test_linker_basic(self):
Expand Down Expand Up @@ -189,12 +189,20 @@ def kernel(x):
# Check the filename is reported correctly
self.assertIn('in the compilation of "error.cu"', msg)

@skip_with_cuda_python
# We need to run the test ina subprocess because the Linker class

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# We need to run the test ina subprocess because the Linker class
# We need to run the test in a subprocess because the Linker class

# that instantiates either the CudaPythonLinker or CtypesLinker
# sets USE_NV_BINDING = config.CUDA_USE_NVIDIA_BINDING at
# module import time, so overriding the config variable does
# not help.

@TestCase.run_test_in_subprocess(envvars=_NUMBA_NVIDIA_BINDING_0_ENV)
def test_linking_cu_ctypes_unsupported(self):
link = os.path.join(os.path.dirname(__file__), 'data', 'jitlink.cu')
msg = ('Linking CUDA source files is not supported with the ctypes '
'binding')

with self.assertRaisesRegex(NotImplementedError, msg):
@cuda.jit('void()', link=['jitlink.cu'])
@cuda.jit('void()', link=[link])
def f():
pass

Expand Down