numba-cuda 0.0.21__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _numba_cuda_redirector.py +9 -3
- numba_cuda/VERSION +1 -1
- numba_cuda/numba/cuda/compiler.py +4 -0
- numba_cuda/numba/cuda/cudadecl.py +5 -0
- numba_cuda/numba/cuda/cudadrv/driver.py +16 -14
- numba_cuda/numba/cuda/cudaimpl.py +8 -0
- numba_cuda/numba/cuda/dispatcher.py +6 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +76 -3
- {numba_cuda-0.0.21.dist-info → numba_cuda-0.2.0.dist-info}/METADATA +1 -1
- {numba_cuda-0.0.21.dist-info → numba_cuda-0.2.0.dist-info}/RECORD +13 -13
- {numba_cuda-0.0.21.dist-info → numba_cuda-0.2.0.dist-info}/LICENSE +0 -0
- {numba_cuda-0.0.21.dist-info → numba_cuda-0.2.0.dist-info}/WHEEL +0 -0
- {numba_cuda-0.0.21.dist-info → numba_cuda-0.2.0.dist-info}/top_level.txt +0 -0
_numba_cuda_redirector.py
CHANGED
@@ -67,9 +67,15 @@ class NumbaCudaFinder(importlib.abc.MetaPathFinder):
|
|
67
67
|
oot_path = [p.replace(self.numba_path, self.numba_cuda_path)
|
68
68
|
for p in path]
|
69
69
|
for finder in sys.meta_path:
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
try:
|
71
|
+
spec = finder.find_spec(name, oot_path, target)
|
72
|
+
except AttributeError:
|
73
|
+
# Finders written to a pre-Python 3.4 spec for finders will
|
74
|
+
# not implement find_spec. We can skip those altogether.
|
75
|
+
continue
|
76
|
+
else:
|
77
|
+
if spec is not None:
|
78
|
+
return spec
|
73
79
|
|
74
80
|
|
75
81
|
finder = NumbaCudaFinder()
|
numba_cuda/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.2.0
|
@@ -206,6 +206,7 @@ def compile_cuda(pyfunc, return_type, args, debug=False, lineinfo=False,
|
|
206
206
|
|
207
207
|
if debug:
|
208
208
|
flags.error_model = 'python'
|
209
|
+
flags.dbg_extend_lifetimes = True
|
209
210
|
else:
|
210
211
|
flags.error_model = 'numpy'
|
211
212
|
|
@@ -497,6 +498,9 @@ def compile(pyfunc, sig, debug=None, lineinfo=False, device=True,
|
|
497
498
|
'opt': 3 if opt else 0
|
498
499
|
}
|
499
500
|
|
501
|
+
if debug:
|
502
|
+
nvvm_options['g'] = None
|
503
|
+
|
500
504
|
if lto:
|
501
505
|
nvvm_options['gen-lto'] = None
|
502
506
|
|
@@ -508,6 +508,11 @@ class Cuda_atomic_cas(AbstractTemplate):
|
|
508
508
|
return signature(dty, ary, idx, dty, dty)
|
509
509
|
|
510
510
|
|
511
|
+
@register_global(breakpoint)
|
512
|
+
class Cuda_breakpoint(ConcreteTemplate):
|
513
|
+
cases = [signature(types.none)]
|
514
|
+
|
515
|
+
|
511
516
|
@register
|
512
517
|
class Cuda_nanosleep(ConcreteTemplate):
|
513
518
|
key = cuda.nanosleep
|
@@ -42,6 +42,11 @@ from .mappings import FILE_EXTENSION_MAP
|
|
42
42
|
from .linkable_code import LinkableCode, LTOIR, Fatbin, Object
|
43
43
|
from numba.cuda.cudadrv import enums, drvapi, nvrtc
|
44
44
|
|
45
|
+
try:
|
46
|
+
from pynvjitlink.api import NvJitLinker, NvJitLinkError
|
47
|
+
except ImportError:
|
48
|
+
NvJitLinker, NvJitLinkError = None, None
|
49
|
+
|
45
50
|
USE_NV_BINDING = config.CUDA_USE_NVIDIA_BINDING
|
46
51
|
|
47
52
|
if USE_NV_BINDING:
|
@@ -92,20 +97,6 @@ ENABLE_PYNVJITLINK = (
|
|
92
97
|
if not hasattr(config, "CUDA_ENABLE_PYNVJITLINK"):
|
93
98
|
config.CUDA_ENABLE_PYNVJITLINK = ENABLE_PYNVJITLINK
|
94
99
|
|
95
|
-
if ENABLE_PYNVJITLINK:
|
96
|
-
try:
|
97
|
-
from pynvjitlink.api import NvJitLinker, NvJitLinkError
|
98
|
-
except ImportError:
|
99
|
-
raise ImportError(
|
100
|
-
"Using pynvjitlink requires the pynvjitlink package to be available"
|
101
|
-
)
|
102
|
-
|
103
|
-
if config.CUDA_ENABLE_MINOR_VERSION_COMPATIBILITY:
|
104
|
-
raise ValueError(
|
105
|
-
"Can't set CUDA_ENABLE_MINOR_VERSION_COMPATIBILITY and "
|
106
|
-
"CUDA_ENABLE_PYNVJITLINK at the same time"
|
107
|
-
)
|
108
|
-
|
109
100
|
|
110
101
|
def make_logger():
|
111
102
|
logger = logging.getLogger(__name__)
|
@@ -3061,6 +3052,17 @@ class PyNvJitLinker(Linker):
|
|
3061
3052
|
lto=False,
|
3062
3053
|
additional_flags=None,
|
3063
3054
|
):
|
3055
|
+
if NvJitLinker is None:
|
3056
|
+
raise ImportError(
|
3057
|
+
"Using pynvjitlink requires the pynvjitlink package to be "
|
3058
|
+
"available"
|
3059
|
+
)
|
3060
|
+
|
3061
|
+
if config.CUDA_ENABLE_MINOR_VERSION_COMPATIBILITY:
|
3062
|
+
raise ValueError(
|
3063
|
+
"Can't set CUDA_ENABLE_MINOR_VERSION_COMPATIBILITY and "
|
3064
|
+
"CUDA_ENABLE_PYNVJITLINK at the same time"
|
3065
|
+
)
|
3064
3066
|
|
3065
3067
|
if cc is None:
|
3066
3068
|
raise RuntimeError("PyNvJitLinker requires CC to be specified")
|
@@ -934,6 +934,14 @@ def ptx_atomic_cas(context, builder, sig, args):
|
|
934
934
|
|
935
935
|
# -----------------------------------------------------------------------------
|
936
936
|
|
937
|
+
|
938
|
+
@lower(breakpoint)
|
939
|
+
def ptx_brkpt(context, builder, sig, args):
|
940
|
+
brkpt = ir.InlineAsm(ir.FunctionType(ir.VoidType(), []),
|
941
|
+
"brkpt;", '', side_effect=True)
|
942
|
+
builder.call(brkpt, ())
|
943
|
+
|
944
|
+
|
937
945
|
@lower(stubs.nanosleep, types.uint32)
|
938
946
|
def ptx_nanosleep(context, builder, sig, args):
|
939
947
|
nanosleep = ir.InlineAsm(ir.FunctionType(ir.VoidType(), [ir.IntType(32)]),
|
@@ -95,6 +95,9 @@ class _Kernel(serialize.ReduceMixin):
|
|
95
95
|
'opt': 3 if opt else 0
|
96
96
|
}
|
97
97
|
|
98
|
+
if debug:
|
99
|
+
nvvm_options['g'] = None
|
100
|
+
|
98
101
|
cc = get_current_device().compute_capability
|
99
102
|
cres = compile_cuda(self.py_func, types.void, self.argtypes,
|
100
103
|
debug=self.debug,
|
@@ -918,6 +921,9 @@ class CUDADispatcher(Dispatcher, serialize.ReduceMixin):
|
|
918
921
|
'fastmath': fastmath
|
919
922
|
}
|
920
923
|
|
924
|
+
if debug:
|
925
|
+
nvvm_options['g'] = None
|
926
|
+
|
921
927
|
cc = get_current_device().compute_capability
|
922
928
|
cres = compile_cuda(self.py_func, return_type, args,
|
923
929
|
debug=debug,
|
@@ -2,6 +2,18 @@ from numba.cuda.testing import unittest
|
|
2
2
|
from numba.cuda.testing import skip_on_cudasim
|
3
3
|
from numba.cuda.testing import CUDATestCase
|
4
4
|
from numba.cuda.cudadrv.driver import PyNvJitLinker
|
5
|
+
from numba.cuda import get_current_device
|
6
|
+
|
7
|
+
from numba import cuda
|
8
|
+
from numba import config
|
9
|
+
from numba.tests.support import run_in_subprocess, override_config
|
10
|
+
|
11
|
+
try:
|
12
|
+
import pynvjitlink # noqa: F401
|
13
|
+
PYNVJITLINK_INSTALLED = True
|
14
|
+
except ImportError:
|
15
|
+
PYNVJITLINK_INSTALLED = False
|
16
|
+
|
5
17
|
|
6
18
|
import itertools
|
7
19
|
import os
|
@@ -9,9 +21,6 @@ import io
|
|
9
21
|
import contextlib
|
10
22
|
import warnings
|
11
23
|
|
12
|
-
from numba.cuda import get_current_device
|
13
|
-
from numba import cuda
|
14
|
-
from numba import config
|
15
24
|
|
16
25
|
TEST_BIN_DIR = os.getenv("NUMBA_CUDA_TEST_BIN_DIR")
|
17
26
|
if TEST_BIN_DIR:
|
@@ -251,5 +260,69 @@ class TestLinker(CUDATestCase):
|
|
251
260
|
pass
|
252
261
|
|
253
262
|
|
263
|
+
@unittest.skipIf(
|
264
|
+
not PYNVJITLINK_INSTALLED, reason="Pynvjitlink is not installed"
|
265
|
+
)
|
266
|
+
class TestLinkerUsage(CUDATestCase):
|
267
|
+
"""Test that whether pynvjitlink can be enabled by both environment variable
|
268
|
+
and modification of config at runtime.
|
269
|
+
"""
|
270
|
+
|
271
|
+
src = """if 1:
|
272
|
+
import os
|
273
|
+
from numba import cuda, config
|
274
|
+
|
275
|
+
{config}
|
276
|
+
|
277
|
+
TEST_BIN_DIR = os.getenv("NUMBA_CUDA_TEST_BIN_DIR")
|
278
|
+
if TEST_BIN_DIR:
|
279
|
+
test_device_functions_cubin = os.path.join(
|
280
|
+
TEST_BIN_DIR, "test_device_functions.cubin"
|
281
|
+
)
|
282
|
+
|
283
|
+
sig = "uint32(uint32, uint32)"
|
284
|
+
add_from_numba = cuda.declare_device("add_from_numba", sig)
|
285
|
+
|
286
|
+
@cuda.jit(link=[test_device_functions_cubin], lto=True)
|
287
|
+
def kernel(result):
|
288
|
+
result[0] = add_from_numba(1, 2)
|
289
|
+
|
290
|
+
result = cuda.device_array(1)
|
291
|
+
kernel[1, 1](result)
|
292
|
+
assert result[0] == 3
|
293
|
+
"""
|
294
|
+
|
295
|
+
def test_linker_enabled_envvar(self):
|
296
|
+
env = os.environ.copy()
|
297
|
+
env['NUMBA_CUDA_ENABLE_PYNVJITLINK'] = "1"
|
298
|
+
run_in_subprocess(self.src.format(config=""), env=env)
|
299
|
+
|
300
|
+
def test_linker_disabled_envvar(self):
|
301
|
+
env = os.environ.copy()
|
302
|
+
env.pop('NUMBA_CUDA_ENABLE_PYNVJITLINK', None)
|
303
|
+
with self.assertRaisesRegex(
|
304
|
+
AssertionError, "LTO and additional flags require PyNvJitLinker"
|
305
|
+
):
|
306
|
+
# Actual error raised is `ValueError`, but `run_in_subprocess`
|
307
|
+
# reraises as AssertionError.
|
308
|
+
run_in_subprocess(self.src.format(config=""), env=env)
|
309
|
+
|
310
|
+
def test_linker_enabled_config(self):
|
311
|
+
env = os.environ.copy()
|
312
|
+
env.pop('NUMBA_CUDA_ENABLE_PYNVJITLINK', None)
|
313
|
+
run_in_subprocess(self.src.format(
|
314
|
+
config="config.CUDA_ENABLE_PYNVJITLINK = True"), env=env)
|
315
|
+
|
316
|
+
def test_linker_disabled_config(self):
|
317
|
+
env = os.environ.copy()
|
318
|
+
env.pop('NUMBA_CUDA_ENABLE_PYNVJITLINK', None)
|
319
|
+
with override_config("CUDA_ENABLE_PYNVJITLINK", False):
|
320
|
+
with self.assertRaisesRegex(
|
321
|
+
AssertionError, "LTO and additional flags require PyNvJitLinker"
|
322
|
+
):
|
323
|
+
run_in_subprocess(self.src.format(
|
324
|
+
config="config.CUDA_ENABLE_PYNVJITLINK = False"), env=env)
|
325
|
+
|
326
|
+
|
254
327
|
if __name__ == "__main__":
|
255
328
|
unittest.main()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
_numba_cuda_redirector.pth,sha256=cmfMMmV0JPh3yEpl4bGeM9AuXiVVMSo6Z_b7RaQL3XE,30
|
2
|
-
_numba_cuda_redirector.py,sha256=
|
3
|
-
numba_cuda/VERSION,sha256=
|
2
|
+
_numba_cuda_redirector.py,sha256=QKJmYICSQvjvph0Zw9OW015MsuKxIF28GPFjR35AXLM,2681
|
3
|
+
numba_cuda/VERSION,sha256=H5MN0fEzwfl6lP46y42zQ3LPTAH_2ys_9Mpy-UlBIek,6
|
4
4
|
numba_cuda/__init__.py,sha256=atXeUvJKR3JHcAiCFbXCVOJQUHgB1TulmsqSL_9RT3Q,114
|
5
5
|
numba_cuda/_version.py,sha256=jbdUsbR7sVllw0KxQNB0-FMd929CGg3kH2fhHdrlkuc,719
|
6
6
|
numba_cuda/numba/cuda/__init__.py,sha256=idyVHOObC9lTYnp62v7rVprSacRM4d5F6vhXfG5ElTI,621
|
@@ -9,19 +9,19 @@ numba_cuda/numba/cuda/api_util.py,sha256=aQfUV2-4RM_oGVvckMjbMr5e3effOQNX04v1T0O
|
|
9
9
|
numba_cuda/numba/cuda/args.py,sha256=HloHkw_PQal2DT-I70Xf_XbnGObS1jiUgcRrQ85Gq28,1978
|
10
10
|
numba_cuda/numba/cuda/cg.py,sha256=9V1uZqyGOJX1aFd9c6GAPbLSqq83lE8LoP-vxxrKENY,1490
|
11
11
|
numba_cuda/numba/cuda/codegen.py,sha256=ghdYBKZ3Mzk2UlLE64HkrAjb60PN9fibSNkWFRQuj4M,13184
|
12
|
-
numba_cuda/numba/cuda/compiler.py,sha256=
|
12
|
+
numba_cuda/numba/cuda/compiler.py,sha256=_0qfSjnLnF29B-t8NQRJt4FBUIKxZJE6xN47_G7oRio,21339
|
13
13
|
numba_cuda/numba/cuda/cpp_function_wrappers.cu,sha256=iv84_F6Q9kFjV_kclrQz1msh6Dud8mI3qNkswTid7Qc,953
|
14
14
|
numba_cuda/numba/cuda/cuda_fp16.h,sha256=1IC0mdNdkvKbvAe0-f4uYVS7WFrVqOyI1nRUbBiqr6A,126844
|
15
15
|
numba_cuda/numba/cuda/cuda_fp16.hpp,sha256=vJ7NUr2X2tKhAP7ojydAiCoOjVO6n4QGoXD6m9Srrlw,89130
|
16
16
|
numba_cuda/numba/cuda/cuda_paths.py,sha256=C0gA72QLWUMfvXkFpw1WqqaFqfsQ7HM72hQVXG0A7RU,10023
|
17
|
-
numba_cuda/numba/cuda/cudadecl.py,sha256=
|
18
|
-
numba_cuda/numba/cuda/cudaimpl.py,sha256=
|
17
|
+
numba_cuda/numba/cuda/cudadecl.py,sha256=ZUssRdTvS4sVwvJWTmaRTvrMXMbkPZ_qVp8JMXoXFoc,23300
|
18
|
+
numba_cuda/numba/cuda/cudaimpl.py,sha256=0oHjDwBC4JmfpwS1Fsn1bm5YWVru5vZvvnO414P4TS0,38840
|
19
19
|
numba_cuda/numba/cuda/cudamath.py,sha256=EFNtdzEytAZuwijdRoFGzVKCeal76UzzaNy7wUFQx8I,3978
|
20
20
|
numba_cuda/numba/cuda/decorators.py,sha256=qSpir16-jPYSe2YuRZ6g9INeobmsMNg6ab9IZpwJocM,7823
|
21
21
|
numba_cuda/numba/cuda/descriptor.py,sha256=rNMaurJkjNjIBmHPozDoLC35DMURE0fn_LtnXRmaG_w,985
|
22
22
|
numba_cuda/numba/cuda/device_init.py,sha256=lP79tCsQ0Np9xcbjv_lXcH4JOiVZvV8nwg3INdETxsc,3586
|
23
23
|
numba_cuda/numba/cuda/deviceufunc.py,sha256=yxAH71dpgJWK8okmCJm0FUV6z2AqdThCYOTZspT7z0M,30775
|
24
|
-
numba_cuda/numba/cuda/dispatcher.py,sha256=
|
24
|
+
numba_cuda/numba/cuda/dispatcher.py,sha256=nDfPCzxJ7UwA4uiz-fsMMgQb2WXByvzHLtkLMXW9JXk,41244
|
25
25
|
numba_cuda/numba/cuda/errors.py,sha256=XwWHzCllx0DXU6BQdoRH0m3pznGxnTFOBTVYXMmCfqg,1724
|
26
26
|
numba_cuda/numba/cuda/extending.py,sha256=URsyBYls2te-mgE0yvDY6akvawYCA0blBFfD7Lf9DO4,142
|
27
27
|
numba_cuda/numba/cuda/initialize.py,sha256=TQGHGLQoq4ch4J6CLDcJdGsZzXM-g2kDgdyO1u-Rbhg,546
|
@@ -47,7 +47,7 @@ numba_cuda/numba/cuda/vectorizers.py,sha256=u_0EzaD5tqVH8uOz4Gmqn3FgPC1rckwDAQuR
|
|
47
47
|
numba_cuda/numba/cuda/cudadrv/__init__.py,sha256=0TL4MZcJXUoo9qA7uu0vLv7eHrXRerVmyfi7O149ITw,199
|
48
48
|
numba_cuda/numba/cuda/cudadrv/devicearray.py,sha256=06kM7iFcx1TYiFhs1o9r1kyoA3k5yS7mFAdZDf6nrxA,31215
|
49
49
|
numba_cuda/numba/cuda/cudadrv/devices.py,sha256=6SneNmoq83gue0txFWWx4A65vViAa8xA06FzkApoqAk,7992
|
50
|
-
numba_cuda/numba/cuda/cudadrv/driver.py,sha256=
|
50
|
+
numba_cuda/numba/cuda/cudadrv/driver.py,sha256=FONYaUzgexmPUIMsSq0zr_FgD9eLbWT8m1APEVrLJRo,114887
|
51
51
|
numba_cuda/numba/cuda/cudadrv/drvapi.py,sha256=52ms3X6hfPaQB8E1jb6g7QKqRvHzBMlDQ-V2DM1rXxQ,17178
|
52
52
|
numba_cuda/numba/cuda/cudadrv/dummyarray.py,sha256=nXRngdr-k3h_BNGQuJUxmp89yGNWxqEDJedpwDPEZ44,14209
|
53
53
|
numba_cuda/numba/cuda/cudadrv/enums.py,sha256=Wy5dzukTk4TnWCowg_PLceET_v2xEyiWLu9TyH8pXr8,23742
|
@@ -103,7 +103,7 @@ numba_cuda/numba/cuda/tests/cudadrv/test_is_fp16.py,sha256=0KPe4E9wOZsSV_0QI0Lmj
|
|
103
103
|
numba_cuda/numba/cuda/tests/cudadrv/test_linker.py,sha256=_l2_EQEko2Jet5ooj4XMT0L4BjOuqLjbONGj1_MVI50,10161
|
104
104
|
numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py,sha256=kYXYMkx_3GPAITKp4reLeM8KSzKkpxiC8nxnBvXpaTA,4979
|
105
105
|
numba_cuda/numba/cuda/tests/cudadrv/test_mvc.py,sha256=984jATSa01SRoSrVqxPeO6ujJ7w2jsnZa39ABInFLVI,1529
|
106
|
-
numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py,sha256=
|
106
|
+
numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py,sha256=oZywLDuX-l1LJvIIU4QCsE7UCwtIKbBP7u6GxVDpD_g,11316
|
107
107
|
numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py,sha256=DF7KV5uh-yMztks0f47NhpalV64dvsNy-f8HY6GhAhE,7373
|
108
108
|
numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py,sha256=u_TthSS2N-2J4eBIuF4PGg33AjD-wxly7MKpz0vRAKc,944
|
109
109
|
numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py,sha256=MQWZx1j3lbEpWmIpQ1bV9szrGOV3VHN0QrEnJRjAhW4,508
|
@@ -236,8 +236,8 @@ numba_cuda/numba/cuda/tests/test_binary_generation/Makefile,sha256=P2WzCc5d64JGq
|
|
236
236
|
numba_cuda/numba/cuda/tests/test_binary_generation/generate_raw_ltoir.py,sha256=V0raLZLGSiWbE_K-JluI0CnmNkXbhlMVj-TH7P1OV8E,5014
|
237
237
|
numba_cuda/numba/cuda/tests/test_binary_generation/test_device_functions.cu,sha256=cUf-t6ZM9MK_x7X_aKwsrKW1LdR97XcpR-qnYr5faOE,453
|
238
238
|
numba_cuda/numba/cuda/tests/test_binary_generation/undefined_extern.cu,sha256=q3oxZziT8KDodeNcEBiWULH6vMrHCWucmJmtrg8C0d0,128
|
239
|
-
numba_cuda-0.0.
|
240
|
-
numba_cuda-0.0.
|
241
|
-
numba_cuda-0.0.
|
242
|
-
numba_cuda-0.0.
|
243
|
-
numba_cuda-0.0.
|
239
|
+
numba_cuda-0.2.0.dist-info/LICENSE,sha256=eHeYE-XjASmwbxfsP5AImgfzRwZurZGqH1f6OFwJ4io,1326
|
240
|
+
numba_cuda-0.2.0.dist-info/METADATA,sha256=u3e2Hm6iPkdyyDwsvGJ7B3RecpE7X3zA2SHrX-z7Kc4,1496
|
241
|
+
numba_cuda-0.2.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
242
|
+
numba_cuda-0.2.0.dist-info/top_level.txt,sha256=C50SsH-8tXDmt7I0Y3nlJYhS5s6pqWflCPdobe9vx2M,11
|
243
|
+
numba_cuda-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|