numba-cuda 0.8.1__py3-none-any.whl → 0.10.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 +17 -13
- numba_cuda/VERSION +1 -1
- numba_cuda/_version.py +4 -1
- numba_cuda/numba/cuda/__init__.py +6 -2
- numba_cuda/numba/cuda/api.py +129 -86
- numba_cuda/numba/cuda/api_util.py +3 -3
- numba_cuda/numba/cuda/args.py +12 -16
- numba_cuda/numba/cuda/cg.py +6 -6
- numba_cuda/numba/cuda/codegen.py +74 -43
- numba_cuda/numba/cuda/compiler.py +246 -114
- numba_cuda/numba/cuda/cpp_function_wrappers.cu +1 -2
- numba_cuda/numba/cuda/cuda_bf16.py +5155 -0
- numba_cuda/numba/cuda/cuda_paths.py +293 -99
- numba_cuda/numba/cuda/cudadecl.py +93 -79
- numba_cuda/numba/cuda/cudadrv/__init__.py +3 -1
- numba_cuda/numba/cuda/cudadrv/devicearray.py +185 -135
- numba_cuda/numba/cuda/cudadrv/devices.py +16 -11
- numba_cuda/numba/cuda/cudadrv/driver.py +460 -297
- numba_cuda/numba/cuda/cudadrv/drvapi.py +241 -207
- numba_cuda/numba/cuda/cudadrv/dummyarray.py +66 -54
- numba_cuda/numba/cuda/cudadrv/enums.py +1 -1
- numba_cuda/numba/cuda/cudadrv/error.py +6 -2
- numba_cuda/numba/cuda/cudadrv/libs.py +67 -63
- numba_cuda/numba/cuda/cudadrv/linkable_code.py +27 -3
- numba_cuda/numba/cuda/cudadrv/mappings.py +16 -14
- numba_cuda/numba/cuda/cudadrv/nvrtc.py +146 -30
- numba_cuda/numba/cuda/cudadrv/nvvm.py +296 -161
- numba_cuda/numba/cuda/cudadrv/rtapi.py +1 -1
- numba_cuda/numba/cuda/cudadrv/runtime.py +20 -8
- numba_cuda/numba/cuda/cudaimpl.py +296 -275
- numba_cuda/numba/cuda/cudamath.py +1 -1
- numba_cuda/numba/cuda/debuginfo.py +99 -7
- numba_cuda/numba/cuda/decorators.py +87 -45
- numba_cuda/numba/cuda/descriptor.py +1 -1
- numba_cuda/numba/cuda/device_init.py +68 -18
- numba_cuda/numba/cuda/deviceufunc.py +143 -98
- numba_cuda/numba/cuda/dispatcher.py +300 -213
- numba_cuda/numba/cuda/errors.py +13 -10
- numba_cuda/numba/cuda/extending.py +55 -1
- numba_cuda/numba/cuda/include/11/cuda_bf16.h +3749 -0
- numba_cuda/numba/cuda/include/11/cuda_bf16.hpp +2683 -0
- numba_cuda/numba/cuda/{cuda_fp16.h → include/11/cuda_fp16.h} +1090 -927
- numba_cuda/numba/cuda/{cuda_fp16.hpp → include/11/cuda_fp16.hpp} +468 -319
- numba_cuda/numba/cuda/include/12/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/12/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/initialize.py +5 -3
- numba_cuda/numba/cuda/intrinsic_wrapper.py +0 -39
- numba_cuda/numba/cuda/intrinsics.py +203 -28
- numba_cuda/numba/cuda/kernels/reduction.py +13 -13
- numba_cuda/numba/cuda/kernels/transpose.py +3 -6
- numba_cuda/numba/cuda/libdevice.py +317 -317
- numba_cuda/numba/cuda/libdeviceimpl.py +3 -2
- numba_cuda/numba/cuda/locks.py +16 -0
- numba_cuda/numba/cuda/lowering.py +43 -0
- numba_cuda/numba/cuda/mathimpl.py +62 -57
- numba_cuda/numba/cuda/models.py +1 -5
- numba_cuda/numba/cuda/nvvmutils.py +103 -88
- numba_cuda/numba/cuda/printimpl.py +9 -5
- numba_cuda/numba/cuda/random.py +46 -36
- numba_cuda/numba/cuda/reshape_funcs.cu +1 -1
- numba_cuda/numba/cuda/runtime/__init__.py +1 -1
- numba_cuda/numba/cuda/runtime/memsys.cu +1 -1
- numba_cuda/numba/cuda/runtime/memsys.cuh +1 -1
- numba_cuda/numba/cuda/runtime/nrt.cu +3 -3
- numba_cuda/numba/cuda/runtime/nrt.py +48 -43
- numba_cuda/numba/cuda/simulator/__init__.py +22 -12
- numba_cuda/numba/cuda/simulator/api.py +38 -22
- numba_cuda/numba/cuda/simulator/compiler.py +2 -2
- numba_cuda/numba/cuda/simulator/cudadrv/__init__.py +8 -2
- numba_cuda/numba/cuda/simulator/cudadrv/devicearray.py +63 -55
- numba_cuda/numba/cuda/simulator/cudadrv/devices.py +13 -11
- numba_cuda/numba/cuda/simulator/cudadrv/driver.py +5 -5
- numba_cuda/numba/cuda/simulator/cudadrv/drvapi.py +2 -2
- numba_cuda/numba/cuda/simulator/cudadrv/libs.py +1 -1
- numba_cuda/numba/cuda/simulator/cudadrv/nvvm.py +3 -3
- numba_cuda/numba/cuda/simulator/cudadrv/runtime.py +3 -3
- numba_cuda/numba/cuda/simulator/kernel.py +43 -34
- numba_cuda/numba/cuda/simulator/kernelapi.py +31 -26
- numba_cuda/numba/cuda/simulator/reduction.py +1 -0
- numba_cuda/numba/cuda/simulator/vector_types.py +13 -9
- numba_cuda/numba/cuda/simulator_init.py +2 -4
- numba_cuda/numba/cuda/stubs.py +134 -108
- numba_cuda/numba/cuda/target.py +92 -47
- numba_cuda/numba/cuda/testing.py +24 -19
- numba_cuda/numba/cuda/tests/__init__.py +14 -12
- numba_cuda/numba/cuda/tests/cudadrv/test_array_attr.py +16 -17
- numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +7 -7
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_array_slicing.py +73 -54
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_auto_context.py +1 -1
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_devicerecord.py +48 -50
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +47 -29
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_libraries.py +3 -3
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +19 -19
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +108 -103
- numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +20 -11
- numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +20 -17
- numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +8 -6
- numba_cuda/numba/cuda/tests/cudadrv/test_events.py +1 -1
- numba_cuda/numba/cuda/tests/cudadrv/test_host_alloc.py +8 -7
- numba_cuda/numba/cuda/tests/cudadrv/test_init.py +13 -13
- numba_cuda/numba/cuda/tests/cudadrv/test_inline_ptx.py +12 -9
- numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +36 -31
- numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +8 -7
- numba_cuda/numba/cuda/tests/cudadrv/test_module_callbacks.py +294 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_mvc.py +10 -7
- numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +24 -15
- numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +43 -41
- numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py +4 -5
- numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py +2 -2
- numba_cuda/numba/cuda/tests/cudadrv/test_ptds.py +28 -17
- numba_cuda/numba/cuda/tests/cudadrv/test_reset_device.py +1 -2
- numba_cuda/numba/cuda/tests/cudadrv/test_runtime.py +22 -14
- numba_cuda/numba/cuda/tests/cudadrv/test_select_device.py +1 -1
- numba_cuda/numba/cuda/tests/cudadrv/test_streams.py +4 -3
- numba_cuda/numba/cuda/tests/cudapy/cache_usecases.py +10 -4
- numba_cuda/numba/cuda/tests/cudapy/cache_with_cpu_usecases.py +1 -0
- numba_cuda/numba/cuda/tests/cudapy/extensions_usecases.py +10 -7
- numba_cuda/numba/cuda/tests/cudapy/jitlink.ptx +0 -2
- numba_cuda/numba/cuda/tests/cudapy/recursion_usecases.py +1 -0
- numba_cuda/numba/cuda/tests/cudapy/test_alignment.py +6 -5
- numba_cuda/numba/cuda/tests/cudapy/test_array.py +52 -42
- numba_cuda/numba/cuda/tests/cudapy/test_array_args.py +5 -6
- numba_cuda/numba/cuda/tests/cudapy/test_array_methods.py +1 -1
- numba_cuda/numba/cuda/tests/cudapy/test_atomics.py +501 -304
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16_bindings.py +257 -0
- numba_cuda/numba/cuda/tests/cudapy/test_blackscholes.py +59 -23
- numba_cuda/numba/cuda/tests/cudapy/test_boolean.py +3 -3
- numba_cuda/numba/cuda/tests/cudapy/test_caching.py +50 -37
- numba_cuda/numba/cuda/tests/cudapy/test_casting.py +29 -24
- numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +11 -6
- numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +84 -50
- numba_cuda/numba/cuda/tests/cudapy/test_complex.py +144 -73
- numba_cuda/numba/cuda/tests/cudapy/test_complex_kernel.py +2 -2
- numba_cuda/numba/cuda/tests/cudapy/test_const_string.py +37 -27
- numba_cuda/numba/cuda/tests/cudapy/test_constmem.py +43 -45
- numba_cuda/numba/cuda/tests/cudapy/test_cooperative_groups.py +21 -14
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +60 -55
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +3 -2
- numba_cuda/numba/cuda/tests/cudapy/test_datetime.py +26 -22
- numba_cuda/numba/cuda/tests/cudapy/test_debug.py +29 -27
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +77 -28
- numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +52 -45
- numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +55 -43
- numba_cuda/numba/cuda/tests/cudapy/test_enums.py +24 -7
- numba_cuda/numba/cuda/tests/cudapy/test_errors.py +30 -15
- numba_cuda/numba/cuda/tests/cudapy/test_exception.py +11 -12
- numba_cuda/numba/cuda/tests/cudapy/test_extending.py +21 -12
- numba_cuda/numba/cuda/tests/cudapy/test_fastmath.py +77 -66
- numba_cuda/numba/cuda/tests/cudapy/test_forall.py +5 -3
- numba_cuda/numba/cuda/tests/cudapy/test_freevar.py +5 -3
- numba_cuda/numba/cuda/tests/cudapy/test_frexp_ldexp.py +1 -1
- numba_cuda/numba/cuda/tests/cudapy/test_globals.py +3 -5
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +144 -126
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scalar.py +23 -18
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scheduling.py +16 -22
- numba_cuda/numba/cuda/tests/cudapy/test_idiv.py +1 -3
- numba_cuda/numba/cuda/tests/cudapy/test_inline.py +59 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inspect.py +29 -20
- numba_cuda/numba/cuda/tests/cudapy/test_intrinsics.py +147 -99
- numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +50 -36
- numba_cuda/numba/cuda/tests/cudapy/test_iterators.py +1 -2
- numba_cuda/numba/cuda/tests/cudapy/test_lang.py +4 -4
- numba_cuda/numba/cuda/tests/cudapy/test_laplace.py +7 -7
- numba_cuda/numba/cuda/tests/cudapy/test_libdevice.py +24 -20
- numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +36 -31
- numba_cuda/numba/cuda/tests/cudapy/test_localmem.py +13 -13
- numba_cuda/numba/cuda/tests/cudapy/test_mandel.py +13 -6
- numba_cuda/numba/cuda/tests/cudapy/test_math.py +83 -66
- numba_cuda/numba/cuda/tests/cudapy/test_matmul.py +1 -3
- numba_cuda/numba/cuda/tests/cudapy/test_minmax.py +19 -58
- numba_cuda/numba/cuda/tests/cudapy/test_montecarlo.py +4 -4
- numba_cuda/numba/cuda/tests/cudapy/test_multigpu.py +9 -7
- numba_cuda/numba/cuda/tests/cudapy/test_multiprocessing.py +9 -8
- numba_cuda/numba/cuda/tests/cudapy/test_multithreads.py +12 -10
- numba_cuda/numba/cuda/tests/cudapy/test_nondet.py +1 -1
- numba_cuda/numba/cuda/tests/cudapy/test_operator.py +180 -96
- numba_cuda/numba/cuda/tests/cudapy/test_optimization.py +5 -5
- numba_cuda/numba/cuda/tests/cudapy/test_overload.py +37 -18
- numba_cuda/numba/cuda/tests/cudapy/test_powi.py +7 -7
- numba_cuda/numba/cuda/tests/cudapy/test_print.py +9 -7
- numba_cuda/numba/cuda/tests/cudapy/test_py2_div_issue.py +1 -1
- numba_cuda/numba/cuda/tests/cudapy/test_random.py +15 -10
- numba_cuda/numba/cuda/tests/cudapy/test_record_dtype.py +88 -87
- numba_cuda/numba/cuda/tests/cudapy/test_recursion.py +12 -10
- numba_cuda/numba/cuda/tests/cudapy/test_reduction.py +26 -11
- numba_cuda/numba/cuda/tests/cudapy/test_retrieve_autoconverted_arrays.py +7 -10
- numba_cuda/numba/cuda/tests/cudapy/test_serialize.py +4 -6
- numba_cuda/numba/cuda/tests/cudapy/test_slicing.py +1 -1
- numba_cuda/numba/cuda/tests/cudapy/test_sm.py +10 -9
- numba_cuda/numba/cuda/tests/cudapy/test_sm_creation.py +62 -43
- numba_cuda/numba/cuda/tests/cudapy/test_stream_api.py +7 -3
- numba_cuda/numba/cuda/tests/cudapy/test_sync.py +7 -5
- numba_cuda/numba/cuda/tests/cudapy/test_transpose.py +18 -11
- numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +111 -88
- numba_cuda/numba/cuda/tests/cudapy/test_userexc.py +2 -3
- numba_cuda/numba/cuda/tests/cudapy/test_vector_type.py +305 -130
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize.py +33 -36
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_complex.py +5 -5
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_decor.py +16 -12
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_device.py +7 -7
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_scalar_arg.py +6 -7
- numba_cuda/numba/cuda/tests/cudapy/test_warning.py +31 -29
- numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +81 -30
- numba_cuda/numba/cuda/tests/cudasim/test_cudasim_issues.py +19 -13
- numba_cuda/numba/cuda/tests/data/jitlink.cu +1 -1
- numba_cuda/numba/cuda/tests/data/jitlink.ptx +0 -2
- numba_cuda/numba/cuda/tests/doc_examples/test_cg.py +15 -8
- numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +4 -7
- numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +14 -9
- numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +22 -18
- numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +7 -4
- numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +2 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_random.py +8 -4
- numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +2 -1
- numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +94 -19
- numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +2 -2
- numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +91 -62
- numba_cuda/numba/cuda/tests/nocuda/test_function_resolution.py +14 -5
- numba_cuda/numba/cuda/tests/nocuda/test_import.py +25 -25
- numba_cuda/numba/cuda/tests/nocuda/test_library_lookup.py +40 -40
- numba_cuda/numba/cuda/tests/nocuda/test_nvvm.py +12 -10
- numba_cuda/numba/cuda/tests/nrt/test_nrt.py +16 -20
- numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +12 -10
- numba_cuda/numba/cuda/tests/test_binary_generation/generate_raw_ltoir.py +2 -2
- numba_cuda/numba/cuda/types.py +5 -2
- numba_cuda/numba/cuda/ufuncs.py +382 -362
- numba_cuda/numba/cuda/utils.py +2 -2
- numba_cuda/numba/cuda/vector_types.py +5 -3
- numba_cuda/numba/cuda/vectorizers.py +38 -33
- {numba_cuda-0.8.1.dist-info → numba_cuda-0.10.0.dist-info}/METADATA +1 -1
- numba_cuda-0.10.0.dist-info/RECORD +263 -0
- {numba_cuda-0.8.1.dist-info → numba_cuda-0.10.0.dist-info}/WHEEL +1 -1
- numba_cuda-0.8.1.dist-info/RECORD +0 -251
- {numba_cuda-0.8.1.dist-info → numba_cuda-0.10.0.dist-info}/licenses/LICENSE +0 -0
- {numba_cuda-0.8.1.dist-info → numba_cuda-0.10.0.dist-info}/top_level.txt +0 -0
@@ -78,24 +78,17 @@ def record_read_2d_array(r, a):
|
|
78
78
|
|
79
79
|
recordtype = np.dtype(
|
80
80
|
[
|
81
|
-
(
|
82
|
-
(
|
83
|
-
(
|
84
|
-
(
|
81
|
+
("a", np.float64),
|
82
|
+
("b", np.int32),
|
83
|
+
("c", np.complex64),
|
84
|
+
("d", (np.uint8, 5)),
|
85
85
|
],
|
86
|
-
align=True
|
86
|
+
align=True,
|
87
87
|
)
|
88
88
|
|
89
|
-
recordwitharray = np.dtype(
|
90
|
-
[
|
91
|
-
('g', np.int32),
|
92
|
-
('h', np.float32, 2)
|
93
|
-
],
|
94
|
-
align=True
|
95
|
-
)
|
89
|
+
recordwitharray = np.dtype([("g", np.int32), ("h", np.float32, 2)], align=True)
|
96
90
|
|
97
|
-
recordwith2darray = np.dtype([(
|
98
|
-
('j', np.float32, (3, 2))])
|
91
|
+
recordwith2darray = np.dtype([("i", np.int32), ("j", np.float32, (3, 2))])
|
99
92
|
|
100
93
|
nested_array1_dtype = np.dtype([("array1", np.int16, (3,))], align=True)
|
101
94
|
|
@@ -104,12 +97,13 @@ nested_array2_dtype = np.dtype([("array2", np.int16, (3, 2))], align=True)
|
|
104
97
|
|
105
98
|
# Functions used for "full array" tests
|
106
99
|
|
100
|
+
|
107
101
|
def record_write_full_array(rec):
|
108
102
|
rec.j[:, :] = np.ones((3, 2))
|
109
103
|
|
110
104
|
|
111
105
|
def record_write_full_array_alt(rec):
|
112
|
-
rec[
|
106
|
+
rec["j"][:, :] = np.ones((3, 2))
|
113
107
|
|
114
108
|
|
115
109
|
def recarray_set_record(ary, rec):
|
@@ -122,7 +116,7 @@ def recarray_write_array_of_nestedarray_broadcast(ary):
|
|
122
116
|
|
123
117
|
|
124
118
|
def record_setitem_array(rec_source, rec_dest):
|
125
|
-
rec_dest[
|
119
|
+
rec_dest["j"] = rec_source["j"]
|
126
120
|
|
127
121
|
|
128
122
|
def recarray_write_array_of_nestedarray(ary):
|
@@ -135,7 +129,7 @@ def recarray_getitem_return(ary):
|
|
135
129
|
|
136
130
|
|
137
131
|
def recarray_getitem_field_return(ary):
|
138
|
-
return ary[
|
132
|
+
return ary["h"]
|
139
133
|
|
140
134
|
|
141
135
|
def recarray_getitem_field_return2(ary):
|
@@ -171,15 +165,14 @@ def record_read_2d_array01(ary):
|
|
171
165
|
|
172
166
|
|
173
167
|
def assign_array_to_nested(dest, src):
|
174
|
-
dest[
|
168
|
+
dest["array1"] = src
|
175
169
|
|
176
170
|
|
177
171
|
def assign_array_to_nested_2d(dest, src):
|
178
|
-
dest[
|
172
|
+
dest["array2"] = src
|
179
173
|
|
180
174
|
|
181
175
|
class TestRecordDtype(CUDATestCase):
|
182
|
-
|
183
176
|
def _createSampleArrays(self):
|
184
177
|
self.sample1d = np.recarray(3, dtype=recordtype)
|
185
178
|
self.samplerec1darr = np.recarray(1, dtype=recordwitharray)[0]
|
@@ -192,10 +185,10 @@ class TestRecordDtype(CUDATestCase):
|
|
192
185
|
ary = self.sample1d
|
193
186
|
for i in range(ary.size):
|
194
187
|
x = i + 1
|
195
|
-
ary[i][
|
196
|
-
ary[i][
|
197
|
-
ary[i][
|
198
|
-
ary[i][
|
188
|
+
ary[i]["a"] = x / 2
|
189
|
+
ary[i]["b"] = x
|
190
|
+
ary[i]["c"] = x * 1j
|
191
|
+
ary[i]["d"] = "%d" % x
|
199
192
|
|
200
193
|
def get_cfunc(self, pyfunc, argspec):
|
201
194
|
return cuda.jit()(pyfunc)
|
@@ -221,7 +214,7 @@ class TestRecordDtype(CUDATestCase):
|
|
221
214
|
def test_set_a(self):
|
222
215
|
self._test_set_equal(set_a, 3.1415, types.float64)
|
223
216
|
# Test again to check if coercion works
|
224
|
-
self._test_set_equal(set_a, 3
|
217
|
+
self._test_set_equal(set_a, 3.0, types.float32)
|
225
218
|
|
226
219
|
def test_set_b(self):
|
227
220
|
self._test_set_equal(set_b, 123, types.int32)
|
@@ -259,13 +252,13 @@ class TestRecordDtype(CUDATestCase):
|
|
259
252
|
np.testing.assert_equal(rec[f], v)
|
260
253
|
|
261
254
|
def test_rec_set_a(self):
|
262
|
-
self._test_rec_set(np.float64(1.5), record_set_a,
|
255
|
+
self._test_rec_set(np.float64(1.5), record_set_a, "a")
|
263
256
|
|
264
257
|
def test_rec_set_b(self):
|
265
|
-
self._test_rec_set(np.int32(2), record_set_b,
|
258
|
+
self._test_rec_set(np.int32(2), record_set_b, "b")
|
266
259
|
|
267
260
|
def test_rec_set_c(self):
|
268
|
-
self._test_rec_set(np.complex64(4.0 + 5.0j), record_set_c,
|
261
|
+
self._test_rec_set(np.complex64(4.0 + 5.0j), record_set_c, "c")
|
269
262
|
|
270
263
|
def _test_rec_read(self, v, pyfunc, f):
|
271
264
|
rec = self.sample1d.copy()[0]
|
@@ -277,81 +270,83 @@ class TestRecordDtype(CUDATestCase):
|
|
277
270
|
np.testing.assert_equal(arr[0], v)
|
278
271
|
|
279
272
|
def test_rec_read_a(self):
|
280
|
-
self._test_rec_read(np.float64(1.5), record_read_a,
|
273
|
+
self._test_rec_read(np.float64(1.5), record_read_a, "a")
|
281
274
|
|
282
275
|
def test_rec_read_b(self):
|
283
|
-
self._test_rec_read(np.int32(2), record_read_b,
|
276
|
+
self._test_rec_read(np.int32(2), record_read_b, "b")
|
284
277
|
|
285
278
|
def test_rec_read_c(self):
|
286
|
-
self._test_rec_read(np.complex64(4.0 + 5.0j), record_read_c,
|
279
|
+
self._test_rec_read(np.complex64(4.0 + 5.0j), record_read_c, "c")
|
287
280
|
|
288
281
|
def test_record_write_1d_array(self):
|
289
|
-
|
282
|
+
"""
|
290
283
|
Test writing to a 1D array within a structured type
|
291
|
-
|
284
|
+
"""
|
292
285
|
rec = self.samplerec1darr.copy()
|
293
286
|
nbrecord = numpy_support.from_dtype(recordwitharray)
|
294
287
|
cfunc = self.get_cfunc(record_write_array, (nbrecord,))
|
295
288
|
|
296
289
|
cfunc[1, 1](rec)
|
297
290
|
expected = self.samplerec1darr.copy()
|
298
|
-
expected[
|
299
|
-
expected[
|
300
|
-
expected[
|
291
|
+
expected["g"] = 2
|
292
|
+
expected["h"][0] = 3.0
|
293
|
+
expected["h"][1] = 4.0
|
301
294
|
|
302
295
|
np.testing.assert_equal(expected, rec)
|
303
296
|
|
304
297
|
def test_record_write_2d_array(self):
|
305
|
-
|
298
|
+
"""
|
306
299
|
Test writing to a 2D array within a structured type
|
307
|
-
|
300
|
+
"""
|
308
301
|
rec = self.samplerec2darr.copy()
|
309
302
|
nbrecord = numpy_support.from_dtype(recordwith2darray)
|
310
303
|
cfunc = self.get_cfunc(record_write_2d_array, (nbrecord,))
|
311
304
|
cfunc[1, 1](rec)
|
312
305
|
|
313
306
|
expected = self.samplerec2darr.copy()
|
314
|
-
expected[
|
315
|
-
expected[
|
316
|
-
|
307
|
+
expected["i"] = 3
|
308
|
+
expected["j"][:] = np.asarray(
|
309
|
+
[5.0, 6.0, 7.0, 8.0, 9.0, 10.0], np.float32
|
310
|
+
).reshape(3, 2)
|
317
311
|
np.testing.assert_equal(expected, rec)
|
318
312
|
|
319
313
|
def test_record_read_1d_array(self):
|
320
|
-
|
314
|
+
"""
|
321
315
|
Test reading from a 1D array within a structured type
|
322
|
-
|
316
|
+
"""
|
323
317
|
rec = self.samplerec1darr.copy()
|
324
|
-
rec[
|
325
|
-
rec[
|
318
|
+
rec["h"][0] = 4.0
|
319
|
+
rec["h"][1] = 5.0
|
326
320
|
|
327
321
|
nbrecord = numpy_support.from_dtype(recordwitharray)
|
328
322
|
cfunc = self.get_cfunc(record_read_array, (nbrecord,))
|
329
|
-
arr = np.zeros(2, dtype=rec[
|
323
|
+
arr = np.zeros(2, dtype=rec["h"].dtype)
|
330
324
|
cfunc[1, 1](rec, arr)
|
331
325
|
|
332
|
-
np.testing.assert_equal(rec[
|
326
|
+
np.testing.assert_equal(rec["h"], arr)
|
333
327
|
|
334
328
|
def test_record_read_2d_array(self):
|
335
|
-
|
329
|
+
"""
|
336
330
|
Test reading from a 2D array within a structured type
|
337
|
-
|
331
|
+
"""
|
338
332
|
rec = self.samplerec2darr.copy()
|
339
|
-
rec[
|
340
|
-
|
333
|
+
rec["j"][:] = np.asarray(
|
334
|
+
[5.0, 6.0, 7.0, 8.0, 9.0, 10.0], np.float32
|
335
|
+
).reshape(3, 2)
|
341
336
|
|
342
337
|
nbrecord = numpy_support.from_dtype(recordwith2darray)
|
343
338
|
cfunc = self.get_cfunc(record_read_2d_array, (nbrecord,))
|
344
|
-
arr = np.zeros((3,2), dtype=rec[
|
339
|
+
arr = np.zeros((3, 2), dtype=rec["j"].dtype)
|
345
340
|
cfunc[1, 1](rec, arr)
|
346
341
|
|
347
|
-
np.testing.assert_equal(rec[
|
342
|
+
np.testing.assert_equal(rec["j"], arr)
|
348
343
|
|
349
344
|
|
350
|
-
@skip_on_cudasim(
|
345
|
+
@skip_on_cudasim("Structured array attr access not supported in simulator")
|
351
346
|
class TestRecordDtypeWithStructArrays(TestRecordDtype):
|
352
|
-
|
347
|
+
"""
|
353
348
|
Same as TestRecordDtype, but using structured arrays instead of recarrays.
|
354
|
-
|
349
|
+
"""
|
355
350
|
|
356
351
|
def _createSampleArrays(self):
|
357
352
|
self.sample1d = np.zeros(3, dtype=recordtype)
|
@@ -360,7 +355,6 @@ class TestRecordDtypeWithStructArrays(TestRecordDtype):
|
|
360
355
|
|
361
356
|
|
362
357
|
class TestNestedArrays(CUDATestCase):
|
363
|
-
|
364
358
|
# These tests mirror those from
|
365
359
|
# numba.tests.test_record_dtype.TestNestedArrays added in PR
|
366
360
|
# #7359: https://github.com/numba/numba/pull/7359
|
@@ -405,8 +399,9 @@ class TestNestedArrays(CUDATestCase):
|
|
405
399
|
def test_record_read_2d_array(self):
|
406
400
|
# Test reading from a 2D array within a structured type
|
407
401
|
nbval = np.recarray(1, dtype=recordwith2darray)
|
408
|
-
nbval[0].j = np.asarray(
|
409
|
-
|
402
|
+
nbval[0].j = np.asarray(
|
403
|
+
[1.5, 2.5, 3.5, 4.5, 5.5, 6.5], np.float32
|
404
|
+
).reshape(3, 2)
|
410
405
|
cfunc = self.get_cfunc(record_read_2d_array00, np.float32)
|
411
406
|
res = cfunc(nbval[0])
|
412
407
|
np.testing.assert_equal(res, nbval[0].j[0, 0])
|
@@ -422,12 +417,15 @@ class TestNestedArrays(CUDATestCase):
|
|
422
417
|
def test_setitem(self):
|
423
418
|
def gen():
|
424
419
|
nbarr1 = np.recarray(1, dtype=recordwith2darray)
|
425
|
-
nbarr1[0] = np.array(
|
426
|
-
|
420
|
+
nbarr1[0] = np.array(
|
421
|
+
[(1, ((1, 2), (4, 5), (2, 3)))], dtype=recordwith2darray
|
422
|
+
)[0]
|
427
423
|
nbarr2 = np.recarray(1, dtype=recordwith2darray)
|
428
|
-
nbarr2[0] = np.array(
|
429
|
-
|
424
|
+
nbarr2[0] = np.array(
|
425
|
+
[(10, ((10, 20), (40, 50), (20, 30)))], dtype=recordwith2darray
|
426
|
+
)[0]
|
430
427
|
return nbarr1[0], nbarr2[0]
|
428
|
+
|
431
429
|
pyfunc = record_setitem_array
|
432
430
|
pyargs = gen()
|
433
431
|
pyfunc(*pyargs)
|
@@ -453,7 +451,7 @@ class TestNestedArrays(CUDATestCase):
|
|
453
451
|
|
454
452
|
# Writing to records / recarrays
|
455
453
|
|
456
|
-
@skip_on_cudasim(
|
454
|
+
@skip_on_cudasim("Structured array attr access not supported in simulator")
|
457
455
|
def test_set_record(self):
|
458
456
|
# Test setting an entire record
|
459
457
|
rec = np.ones(2, dtype=recordwith2darray).view(np.recarray)[0]
|
@@ -492,20 +490,18 @@ class TestNestedArrays(CUDATestCase):
|
|
492
490
|
np.testing.assert_array_equal(expected, got)
|
493
491
|
|
494
492
|
def test_issue_7693(self):
|
495
|
-
src_dtype = np.dtype(
|
496
|
-
("user", np.float64),
|
497
|
-
|
498
|
-
align=True)
|
493
|
+
src_dtype = np.dtype(
|
494
|
+
[("user", np.float64), ("array", np.int16, (3,))], align=True
|
495
|
+
)
|
499
496
|
|
500
|
-
dest_dtype = np.dtype(
|
501
|
-
("user1", np.float64),
|
502
|
-
|
503
|
-
align=True)
|
497
|
+
dest_dtype = np.dtype(
|
498
|
+
[("user1", np.float64), ("array1", np.int16, (3,))], align=True
|
499
|
+
)
|
504
500
|
|
505
501
|
@cuda.jit
|
506
502
|
def copy(index, src, dest):
|
507
|
-
dest[
|
508
|
-
dest[
|
503
|
+
dest["user1"] = src[index]["user"]
|
504
|
+
dest["array1"] = src[index]["array"]
|
509
505
|
|
510
506
|
source = np.zeros(2, dtype=src_dtype)
|
511
507
|
got = np.zeros(2, dtype=dest_dtype)
|
@@ -528,10 +524,13 @@ class TestNestedArrays(CUDATestCase):
|
|
528
524
|
# This test returning a record when passing an array and
|
529
525
|
# return the first item when passing a record
|
530
526
|
nbarr = np.recarray(2, dtype=recordwith2darray)
|
531
|
-
nbarr[0] = np.array(
|
532
|
-
|
533
|
-
|
534
|
-
|
527
|
+
nbarr[0] = np.array(
|
528
|
+
[(1, ((1, 2), (4, 5), (2, 3)))], dtype=recordwith2darray
|
529
|
+
)[0]
|
530
|
+
for arg, retty in [
|
531
|
+
(nbarr, recordwith2darray),
|
532
|
+
(nbarr[0], (np.float32, (3, 2))),
|
533
|
+
]:
|
535
534
|
pyfunc = recarray_getitem_field_return2_2d
|
536
535
|
arr_expected = pyfunc(arg)
|
537
536
|
cfunc = self.get_cfunc(pyfunc, retty)
|
@@ -545,10 +544,12 @@ class TestNestedArrays(CUDATestCase):
|
|
545
544
|
# This tests returning a array of nestedarrays when passing an array and
|
546
545
|
# returning a nestedarray when passing a record
|
547
546
|
nbarr = np.recarray(2, dtype=recordwitharray)
|
548
|
-
nbarr[0] = np.array([(1, (2,3))], dtype=recordwitharray)[0]
|
547
|
+
nbarr[0] = np.array([(1, (2, 3))], dtype=recordwitharray)[0]
|
549
548
|
for arg, retty in [(nbarr, recordwitharray), (nbarr[0], np.float32)]:
|
550
|
-
for pyfunc in [
|
551
|
-
|
549
|
+
for pyfunc in [
|
550
|
+
recarray_getitem_field_return,
|
551
|
+
recarray_getitem_field_return2,
|
552
|
+
]:
|
552
553
|
arr_expected = pyfunc(arg)
|
553
554
|
cfunc = self.get_cfunc(pyfunc, retty)
|
554
555
|
arr_res = cfunc(arg)
|
@@ -570,17 +571,17 @@ class TestNestedArrays(CUDATestCase):
|
|
570
571
|
def test_return_array(self):
|
571
572
|
# Test getitem record AND array within record and returning it
|
572
573
|
nbval = np.recarray(2, dtype=recordwitharray)
|
573
|
-
nbval[0] = np.array([(1, (2,3))], dtype=recordwitharray)[0]
|
574
|
+
nbval[0] = np.array([(1, (2, 3))], dtype=recordwitharray)[0]
|
574
575
|
pyfunc = record_read_array0
|
575
576
|
arr_expected = pyfunc(nbval)
|
576
577
|
cfunc = self.get_cfunc(pyfunc, np.float32)
|
577
578
|
arr_res = cfunc(nbval)
|
578
579
|
np.testing.assert_equal(arr_expected, arr_res)
|
579
580
|
|
580
|
-
@skip_on_cudasim(
|
581
|
+
@skip_on_cudasim("Will unexpectedly pass on cudasim")
|
581
582
|
@unittest.expectedFailure
|
582
583
|
def test_set_array(self):
|
583
|
-
#Test setting an entire array within one record
|
584
|
+
# Test setting an entire array within one record
|
584
585
|
arr = np.zeros(2, dtype=recordwith2darray).view(np.recarray)
|
585
586
|
rec = arr[0]
|
586
587
|
nbarr = np.zeros(2, dtype=recordwith2darray).view(np.recarray)
|
@@ -597,8 +598,8 @@ class TestNestedArrays(CUDATestCase):
|
|
597
598
|
arr = np.zeros(2, dtype=recordwith2darray).view(np.recarray)
|
598
599
|
nbarr = np.zeros(2, dtype=recordwith2darray).view(np.recarray)
|
599
600
|
for pyfunc in (
|
600
|
-
|
601
|
-
|
601
|
+
recarray_write_array_of_nestedarray_broadcast,
|
602
|
+
recarray_write_array_of_nestedarray,
|
602
603
|
):
|
603
604
|
arr_expected = pyfunc(arr)
|
604
605
|
cfunc = self.get_cfunc(pyfunc, nbarr.dtype)
|
@@ -606,5 +607,5 @@ class TestNestedArrays(CUDATestCase):
|
|
606
607
|
np.testing.assert_equal(arr_res, arr_expected)
|
607
608
|
|
608
609
|
|
609
|
-
if __name__ ==
|
610
|
+
if __name__ == "__main__":
|
610
611
|
unittest.main()
|
@@ -6,11 +6,11 @@ import unittest
|
|
6
6
|
|
7
7
|
|
8
8
|
class TestSelfRecursion(CUDATestCase):
|
9
|
-
|
10
9
|
def setUp(self):
|
11
10
|
# Avoid importing this module at the top level, as it triggers
|
12
11
|
# compilation and can therefore fail
|
13
12
|
from numba.cuda.tests.cudapy import recursion_usecases
|
13
|
+
|
14
14
|
self.mod = recursion_usecases
|
15
15
|
super().setUp()
|
16
16
|
|
@@ -36,19 +36,20 @@ class TestSelfRecursion(CUDATestCase):
|
|
36
36
|
def test_global_implicit_sig(self):
|
37
37
|
self.check_fib(self.mod.fib3)
|
38
38
|
|
39
|
-
@skip_on_cudasim(
|
39
|
+
@skip_on_cudasim("Simulator does not compile")
|
40
40
|
def test_runaway(self):
|
41
41
|
with self.assertRaises(TypingError) as raises:
|
42
42
|
cfunc = self.mod.runaway_self
|
43
43
|
|
44
|
-
@cuda.jit(
|
44
|
+
@cuda.jit("void()")
|
45
45
|
def kernel():
|
46
46
|
cfunc(1)
|
47
47
|
|
48
|
-
self.assertIn(
|
49
|
-
|
48
|
+
self.assertIn(
|
49
|
+
"cannot type infer runaway recursion", str(raises.exception)
|
50
|
+
)
|
50
51
|
|
51
|
-
@unittest.skip(
|
52
|
+
@unittest.skip("Needs insert_unresolved_ref support in target")
|
52
53
|
def test_type_change(self):
|
53
54
|
pfunc = self.mod.type_change_self.py_func
|
54
55
|
cfunc = self.mod.type_change_self
|
@@ -79,7 +80,7 @@ class TestSelfRecursion(CUDATestCase):
|
|
79
80
|
|
80
81
|
self.assertEqual(str(raises.exception), "raise_self")
|
81
82
|
|
82
|
-
@unittest.skip(
|
83
|
+
@unittest.skip("Needs insert_unresolved_ref support in target")
|
83
84
|
def test_optional_return(self):
|
84
85
|
pfunc = self.mod.make_optional_return_case()
|
85
86
|
cfunc = self.mod.make_optional_return_case(cuda.jit)
|
@@ -106,12 +107,13 @@ class TestSelfRecursion(CUDATestCase):
|
|
106
107
|
|
107
108
|
self.assertEqual(expected, actual)
|
108
109
|
|
109
|
-
@skip_on_cudasim(
|
110
|
+
@skip_on_cudasim("Recursion handled because simulator does not compile")
|
110
111
|
def test_growing_return_tuple(self):
|
111
112
|
cfunc = self.mod.make_growing_tuple_case(cuda.jit)
|
112
113
|
|
113
114
|
with self.assertRaises(TypingError) as raises:
|
114
|
-
|
115
|
+
|
116
|
+
@cuda.jit("void()")
|
115
117
|
def kernel():
|
116
118
|
cfunc(100)
|
117
119
|
|
@@ -121,5 +123,5 @@ class TestSelfRecursion(CUDATestCase):
|
|
121
123
|
)
|
122
124
|
|
123
125
|
|
124
|
-
if __name__ ==
|
126
|
+
if __name__ == "__main__":
|
125
127
|
unittest.main()
|
@@ -10,7 +10,7 @@ sum_reduce = cuda.Reduce(lambda a, b: a + b)
|
|
10
10
|
|
11
11
|
class TestReduction(CUDATestCase):
|
12
12
|
def _sum_reduce(self, n):
|
13
|
-
A =
|
13
|
+
A = np.arange(n, dtype=np.float64) + 1
|
14
14
|
expect = A.sum()
|
15
15
|
got = sum_reduce(A)
|
16
16
|
self.assertEqual(expect, got)
|
@@ -19,24 +19,39 @@ class TestReduction(CUDATestCase):
|
|
19
19
|
if ENABLE_CUDASIM:
|
20
20
|
# Minimal test set for the simulator (which only wraps
|
21
21
|
# functools.reduce)
|
22
|
-
test_sizes = [
|
22
|
+
test_sizes = [1, 16]
|
23
23
|
else:
|
24
24
|
# Tests around the points where blocksize changes, and around larger
|
25
25
|
# powers of two, sums of powers of two, and some "random" sizes
|
26
|
-
test_sizes = [
|
27
|
-
|
26
|
+
test_sizes = [
|
27
|
+
1,
|
28
|
+
15,
|
29
|
+
16,
|
30
|
+
17,
|
31
|
+
127,
|
32
|
+
128,
|
33
|
+
129,
|
34
|
+
1023,
|
35
|
+
1024,
|
36
|
+
1025,
|
37
|
+
1536,
|
38
|
+
1048576,
|
39
|
+
1049600,
|
40
|
+
1049728,
|
41
|
+
34567,
|
42
|
+
]
|
28
43
|
# Avoid recompilation by keeping sum_reduce here
|
29
44
|
for n in test_sizes:
|
30
45
|
self._sum_reduce(n)
|
31
46
|
|
32
47
|
def test_empty_array_host(self):
|
33
|
-
A =
|
48
|
+
A = np.arange(0, dtype=np.float64) + 1
|
34
49
|
expect = A.sum()
|
35
50
|
got = sum_reduce(A)
|
36
51
|
self.assertEqual(expect, got)
|
37
52
|
|
38
53
|
def test_empty_array_device(self):
|
39
|
-
A =
|
54
|
+
A = np.arange(0, dtype=np.float64) + 1
|
40
55
|
dA = cuda.to_device(A)
|
41
56
|
expect = A.sum()
|
42
57
|
got = sum_reduce(dA)
|
@@ -44,27 +59,27 @@ class TestReduction(CUDATestCase):
|
|
44
59
|
|
45
60
|
def test_prod_reduce(self):
|
46
61
|
prod_reduce = cuda.reduce(lambda a, b: a * b)
|
47
|
-
A =
|
62
|
+
A = np.arange(64, dtype=np.float64) + 1
|
48
63
|
expect = A.prod()
|
49
64
|
got = prod_reduce(A, init=1)
|
50
65
|
np.testing.assert_allclose(expect, got)
|
51
66
|
|
52
67
|
def test_max_reduce(self):
|
53
68
|
max_reduce = cuda.Reduce(lambda a, b: max(a, b))
|
54
|
-
A =
|
69
|
+
A = np.arange(3717, dtype=np.float64) + 1
|
55
70
|
expect = A.max()
|
56
71
|
got = max_reduce(A, init=0)
|
57
72
|
self.assertEqual(expect, got)
|
58
73
|
|
59
74
|
def test_non_identity_init(self):
|
60
75
|
init = 3
|
61
|
-
A =
|
76
|
+
A = np.arange(10, dtype=np.float64) + 1
|
62
77
|
expect = A.sum() + init
|
63
78
|
got = sum_reduce(A, init=init)
|
64
79
|
self.assertEqual(expect, got)
|
65
80
|
|
66
81
|
def test_result_on_device(self):
|
67
|
-
A =
|
82
|
+
A = np.arange(10, dtype=np.float64) + 1
|
68
83
|
got = cuda.to_device(np.zeros(1, dtype=np.float64))
|
69
84
|
expect = A.sum()
|
70
85
|
res = sum_reduce(A, res=got)
|
@@ -72,5 +87,5 @@ class TestReduction(CUDATestCase):
|
|
72
87
|
self.assertEqual(expect, got[0])
|
73
88
|
|
74
89
|
|
75
|
-
if __name__ ==
|
90
|
+
if __name__ == "__main__":
|
76
91
|
unittest.main()
|
@@ -21,13 +21,10 @@ def set_array_to_three(arr):
|
|
21
21
|
|
22
22
|
|
23
23
|
def set_record_to_three(rec):
|
24
|
-
rec[0][
|
24
|
+
rec[0]["b"] = 3
|
25
25
|
|
26
26
|
|
27
|
-
recordtype = np.dtype(
|
28
|
-
[('b', np.int32)],
|
29
|
-
align=True
|
30
|
-
)
|
27
|
+
recordtype = np.dtype([("b", np.int32)], align=True)
|
31
28
|
|
32
29
|
|
33
30
|
class TestRetrieveAutoconvertedArrays(CUDATestCase):
|
@@ -61,23 +58,23 @@ class TestRetrieveAutoconvertedArrays(CUDATestCase):
|
|
61
58
|
def test_record_in(self):
|
62
59
|
host_rec = np.zeros(1, dtype=recordtype)
|
63
60
|
self.set_record_to_three[1, 1](cuda.In(host_rec))
|
64
|
-
self.assertEqual(0, host_rec[0][
|
61
|
+
self.assertEqual(0, host_rec[0]["b"])
|
65
62
|
|
66
63
|
def test_record_inout(self):
|
67
64
|
host_rec = np.zeros(1, dtype=recordtype)
|
68
65
|
self.set_record_to_three[1, 1](cuda.InOut(host_rec))
|
69
|
-
self.assertEqual(3, host_rec[0][
|
66
|
+
self.assertEqual(3, host_rec[0]["b"])
|
70
67
|
|
71
68
|
def test_record_default(self):
|
72
69
|
host_rec = np.zeros(1, dtype=recordtype)
|
73
70
|
self.set_record_to_three[1, 1](host_rec)
|
74
|
-
self.assertEqual(3, host_rec[0][
|
71
|
+
self.assertEqual(3, host_rec[0]["b"])
|
75
72
|
|
76
73
|
def test_record_in_from_config(self):
|
77
74
|
host_rec = np.zeros(1, dtype=recordtype)
|
78
75
|
self.set_record_to_three_nocopy[1, 1](host_rec)
|
79
|
-
self.assertEqual(0, host_rec[0][
|
76
|
+
self.assertEqual(0, host_rec[0]["b"])
|
80
77
|
|
81
78
|
|
82
|
-
if __name__ ==
|
79
|
+
if __name__ == "__main__":
|
83
80
|
unittest.main()
|
@@ -7,9 +7,8 @@ import unittest
|
|
7
7
|
from numba.np import numpy_support
|
8
8
|
|
9
9
|
|
10
|
-
@skip_on_cudasim(
|
10
|
+
@skip_on_cudasim("pickling not supported in CUDASIM")
|
11
11
|
class TestPickle(CUDATestCase):
|
12
|
-
|
13
12
|
def check_call(self, callee):
|
14
13
|
arr = np.array([100])
|
15
14
|
expected = callee[1, 1](arr)
|
@@ -41,14 +40,13 @@ class TestPickle(CUDATestCase):
|
|
41
40
|
def inner(a):
|
42
41
|
return a + 1
|
43
42
|
|
44
|
-
@cuda.jit(
|
43
|
+
@cuda.jit("void(intp[:])")
|
45
44
|
def foo(arr):
|
46
45
|
arr[0] = inner(arr[0])
|
47
46
|
|
48
47
|
self.check_call(foo)
|
49
48
|
|
50
49
|
def test_pickling_jit(self):
|
51
|
-
|
52
50
|
@cuda.jit(device=True)
|
53
51
|
def inner(a):
|
54
52
|
return a + 1
|
@@ -60,7 +58,7 @@ class TestPickle(CUDATestCase):
|
|
60
58
|
self.check_call(foo)
|
61
59
|
|
62
60
|
def test_pickling_vectorize(self):
|
63
|
-
@vectorize([
|
61
|
+
@vectorize(["intp(intp)", "float64(float64)"], target="cuda")
|
64
62
|
def cuda_vect(x):
|
65
63
|
return x * 2
|
66
64
|
|
@@ -81,5 +79,5 @@ class TestPickle(CUDATestCase):
|
|
81
79
|
np.testing.assert_equal(expected, got2)
|
82
80
|
|
83
81
|
|
84
|
-
if __name__ ==
|
82
|
+
if __name__ == "__main__":
|
85
83
|
unittest.main()
|