numba-cuda 0.8.1__py3-none-any.whl → 0.9.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.
Files changed (227) hide show
  1. _numba_cuda_redirector.py +17 -13
  2. numba_cuda/VERSION +1 -1
  3. numba_cuda/_version.py +4 -1
  4. numba_cuda/numba/cuda/__init__.py +6 -2
  5. numba_cuda/numba/cuda/api.py +129 -86
  6. numba_cuda/numba/cuda/api_util.py +3 -3
  7. numba_cuda/numba/cuda/args.py +12 -16
  8. numba_cuda/numba/cuda/cg.py +6 -6
  9. numba_cuda/numba/cuda/codegen.py +74 -43
  10. numba_cuda/numba/cuda/compiler.py +232 -113
  11. numba_cuda/numba/cuda/cpp_function_wrappers.cu +1 -2
  12. numba_cuda/numba/cuda/cuda_fp16.h +661 -661
  13. numba_cuda/numba/cuda/cuda_fp16.hpp +3 -3
  14. numba_cuda/numba/cuda/cuda_paths.py +291 -99
  15. numba_cuda/numba/cuda/cudadecl.py +125 -69
  16. numba_cuda/numba/cuda/cudadrv/__init__.py +3 -1
  17. numba_cuda/numba/cuda/cudadrv/devicearray.py +185 -135
  18. numba_cuda/numba/cuda/cudadrv/devices.py +16 -11
  19. numba_cuda/numba/cuda/cudadrv/driver.py +460 -297
  20. numba_cuda/numba/cuda/cudadrv/drvapi.py +241 -207
  21. numba_cuda/numba/cuda/cudadrv/dummyarray.py +66 -54
  22. numba_cuda/numba/cuda/cudadrv/enums.py +1 -1
  23. numba_cuda/numba/cuda/cudadrv/error.py +6 -2
  24. numba_cuda/numba/cuda/cudadrv/libs.py +67 -63
  25. numba_cuda/numba/cuda/cudadrv/linkable_code.py +16 -1
  26. numba_cuda/numba/cuda/cudadrv/mappings.py +16 -14
  27. numba_cuda/numba/cuda/cudadrv/nvrtc.py +138 -29
  28. numba_cuda/numba/cuda/cudadrv/nvvm.py +296 -161
  29. numba_cuda/numba/cuda/cudadrv/rtapi.py +1 -1
  30. numba_cuda/numba/cuda/cudadrv/runtime.py +20 -8
  31. numba_cuda/numba/cuda/cudaimpl.py +317 -233
  32. numba_cuda/numba/cuda/cudamath.py +1 -1
  33. numba_cuda/numba/cuda/debuginfo.py +8 -6
  34. numba_cuda/numba/cuda/decorators.py +75 -45
  35. numba_cuda/numba/cuda/descriptor.py +1 -1
  36. numba_cuda/numba/cuda/device_init.py +69 -18
  37. numba_cuda/numba/cuda/deviceufunc.py +143 -98
  38. numba_cuda/numba/cuda/dispatcher.py +300 -213
  39. numba_cuda/numba/cuda/errors.py +13 -10
  40. numba_cuda/numba/cuda/extending.py +1 -1
  41. numba_cuda/numba/cuda/initialize.py +5 -3
  42. numba_cuda/numba/cuda/intrinsic_wrapper.py +3 -3
  43. numba_cuda/numba/cuda/intrinsics.py +31 -27
  44. numba_cuda/numba/cuda/kernels/reduction.py +13 -13
  45. numba_cuda/numba/cuda/kernels/transpose.py +3 -6
  46. numba_cuda/numba/cuda/libdevice.py +317 -317
  47. numba_cuda/numba/cuda/libdeviceimpl.py +3 -2
  48. numba_cuda/numba/cuda/locks.py +16 -0
  49. numba_cuda/numba/cuda/mathimpl.py +62 -57
  50. numba_cuda/numba/cuda/models.py +1 -5
  51. numba_cuda/numba/cuda/nvvmutils.py +103 -88
  52. numba_cuda/numba/cuda/printimpl.py +9 -5
  53. numba_cuda/numba/cuda/random.py +46 -36
  54. numba_cuda/numba/cuda/reshape_funcs.cu +1 -1
  55. numba_cuda/numba/cuda/runtime/__init__.py +1 -1
  56. numba_cuda/numba/cuda/runtime/memsys.cu +1 -1
  57. numba_cuda/numba/cuda/runtime/memsys.cuh +1 -1
  58. numba_cuda/numba/cuda/runtime/nrt.cu +3 -3
  59. numba_cuda/numba/cuda/runtime/nrt.py +48 -43
  60. numba_cuda/numba/cuda/simulator/__init__.py +22 -12
  61. numba_cuda/numba/cuda/simulator/api.py +38 -22
  62. numba_cuda/numba/cuda/simulator/compiler.py +2 -2
  63. numba_cuda/numba/cuda/simulator/cudadrv/__init__.py +8 -2
  64. numba_cuda/numba/cuda/simulator/cudadrv/devicearray.py +63 -55
  65. numba_cuda/numba/cuda/simulator/cudadrv/devices.py +13 -11
  66. numba_cuda/numba/cuda/simulator/cudadrv/driver.py +5 -5
  67. numba_cuda/numba/cuda/simulator/cudadrv/drvapi.py +2 -2
  68. numba_cuda/numba/cuda/simulator/cudadrv/libs.py +1 -1
  69. numba_cuda/numba/cuda/simulator/cudadrv/nvvm.py +3 -3
  70. numba_cuda/numba/cuda/simulator/cudadrv/runtime.py +3 -3
  71. numba_cuda/numba/cuda/simulator/kernel.py +43 -34
  72. numba_cuda/numba/cuda/simulator/kernelapi.py +31 -26
  73. numba_cuda/numba/cuda/simulator/reduction.py +1 -0
  74. numba_cuda/numba/cuda/simulator/vector_types.py +13 -9
  75. numba_cuda/numba/cuda/simulator_init.py +2 -4
  76. numba_cuda/numba/cuda/stubs.py +139 -102
  77. numba_cuda/numba/cuda/target.py +64 -47
  78. numba_cuda/numba/cuda/testing.py +24 -19
  79. numba_cuda/numba/cuda/tests/__init__.py +14 -12
  80. numba_cuda/numba/cuda/tests/cudadrv/test_array_attr.py +16 -17
  81. numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +7 -7
  82. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_array_slicing.py +73 -54
  83. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_auto_context.py +1 -1
  84. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_devicerecord.py +48 -50
  85. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +47 -29
  86. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_libraries.py +3 -3
  87. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +19 -19
  88. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +108 -103
  89. numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +20 -11
  90. numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +20 -17
  91. numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +8 -6
  92. numba_cuda/numba/cuda/tests/cudadrv/test_events.py +1 -1
  93. numba_cuda/numba/cuda/tests/cudadrv/test_host_alloc.py +8 -7
  94. numba_cuda/numba/cuda/tests/cudadrv/test_init.py +13 -13
  95. numba_cuda/numba/cuda/tests/cudadrv/test_inline_ptx.py +12 -9
  96. numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +36 -31
  97. numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +8 -7
  98. numba_cuda/numba/cuda/tests/cudadrv/test_module_callbacks.py +294 -0
  99. numba_cuda/numba/cuda/tests/cudadrv/test_mvc.py +10 -7
  100. numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +24 -15
  101. numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +43 -41
  102. numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py +4 -5
  103. numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py +2 -2
  104. numba_cuda/numba/cuda/tests/cudadrv/test_ptds.py +28 -17
  105. numba_cuda/numba/cuda/tests/cudadrv/test_reset_device.py +1 -2
  106. numba_cuda/numba/cuda/tests/cudadrv/test_runtime.py +22 -14
  107. numba_cuda/numba/cuda/tests/cudadrv/test_select_device.py +1 -1
  108. numba_cuda/numba/cuda/tests/cudadrv/test_streams.py +4 -3
  109. numba_cuda/numba/cuda/tests/cudapy/cache_usecases.py +10 -4
  110. numba_cuda/numba/cuda/tests/cudapy/cache_with_cpu_usecases.py +1 -0
  111. numba_cuda/numba/cuda/tests/cudapy/extensions_usecases.py +7 -6
  112. numba_cuda/numba/cuda/tests/cudapy/jitlink.ptx +0 -2
  113. numba_cuda/numba/cuda/tests/cudapy/recursion_usecases.py +1 -0
  114. numba_cuda/numba/cuda/tests/cudapy/test_alignment.py +6 -5
  115. numba_cuda/numba/cuda/tests/cudapy/test_array.py +52 -42
  116. numba_cuda/numba/cuda/tests/cudapy/test_array_args.py +5 -6
  117. numba_cuda/numba/cuda/tests/cudapy/test_array_methods.py +1 -1
  118. numba_cuda/numba/cuda/tests/cudapy/test_atomics.py +501 -304
  119. numba_cuda/numba/cuda/tests/cudapy/test_blackscholes.py +57 -21
  120. numba_cuda/numba/cuda/tests/cudapy/test_boolean.py +3 -3
  121. numba_cuda/numba/cuda/tests/cudapy/test_caching.py +50 -37
  122. numba_cuda/numba/cuda/tests/cudapy/test_casting.py +29 -24
  123. numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +11 -6
  124. numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +84 -50
  125. numba_cuda/numba/cuda/tests/cudapy/test_complex.py +144 -73
  126. numba_cuda/numba/cuda/tests/cudapy/test_complex_kernel.py +2 -2
  127. numba_cuda/numba/cuda/tests/cudapy/test_const_string.py +37 -27
  128. numba_cuda/numba/cuda/tests/cudapy/test_constmem.py +43 -45
  129. numba_cuda/numba/cuda/tests/cudapy/test_cooperative_groups.py +21 -14
  130. numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +60 -55
  131. numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +3 -2
  132. numba_cuda/numba/cuda/tests/cudapy/test_datetime.py +26 -22
  133. numba_cuda/numba/cuda/tests/cudapy/test_debug.py +29 -27
  134. numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +31 -28
  135. numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +52 -45
  136. numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +55 -43
  137. numba_cuda/numba/cuda/tests/cudapy/test_enums.py +6 -7
  138. numba_cuda/numba/cuda/tests/cudapy/test_errors.py +30 -15
  139. numba_cuda/numba/cuda/tests/cudapy/test_exception.py +11 -12
  140. numba_cuda/numba/cuda/tests/cudapy/test_extending.py +19 -12
  141. numba_cuda/numba/cuda/tests/cudapy/test_fastmath.py +77 -66
  142. numba_cuda/numba/cuda/tests/cudapy/test_forall.py +5 -3
  143. numba_cuda/numba/cuda/tests/cudapy/test_freevar.py +5 -3
  144. numba_cuda/numba/cuda/tests/cudapy/test_frexp_ldexp.py +1 -1
  145. numba_cuda/numba/cuda/tests/cudapy/test_globals.py +3 -5
  146. numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +144 -126
  147. numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scalar.py +23 -18
  148. numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scheduling.py +16 -22
  149. numba_cuda/numba/cuda/tests/cudapy/test_idiv.py +1 -3
  150. numba_cuda/numba/cuda/tests/cudapy/test_inspect.py +29 -20
  151. numba_cuda/numba/cuda/tests/cudapy/test_intrinsics.py +147 -99
  152. numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +50 -36
  153. numba_cuda/numba/cuda/tests/cudapy/test_iterators.py +1 -2
  154. numba_cuda/numba/cuda/tests/cudapy/test_lang.py +4 -4
  155. numba_cuda/numba/cuda/tests/cudapy/test_laplace.py +6 -6
  156. numba_cuda/numba/cuda/tests/cudapy/test_libdevice.py +24 -20
  157. numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +36 -31
  158. numba_cuda/numba/cuda/tests/cudapy/test_localmem.py +13 -13
  159. numba_cuda/numba/cuda/tests/cudapy/test_mandel.py +13 -6
  160. numba_cuda/numba/cuda/tests/cudapy/test_math.py +83 -66
  161. numba_cuda/numba/cuda/tests/cudapy/test_matmul.py +1 -3
  162. numba_cuda/numba/cuda/tests/cudapy/test_minmax.py +19 -58
  163. numba_cuda/numba/cuda/tests/cudapy/test_montecarlo.py +4 -4
  164. numba_cuda/numba/cuda/tests/cudapy/test_multigpu.py +9 -7
  165. numba_cuda/numba/cuda/tests/cudapy/test_multiprocessing.py +9 -8
  166. numba_cuda/numba/cuda/tests/cudapy/test_multithreads.py +12 -10
  167. numba_cuda/numba/cuda/tests/cudapy/test_nondet.py +1 -1
  168. numba_cuda/numba/cuda/tests/cudapy/test_operator.py +180 -96
  169. numba_cuda/numba/cuda/tests/cudapy/test_optimization.py +5 -5
  170. numba_cuda/numba/cuda/tests/cudapy/test_overload.py +37 -18
  171. numba_cuda/numba/cuda/tests/cudapy/test_powi.py +7 -7
  172. numba_cuda/numba/cuda/tests/cudapy/test_print.py +9 -7
  173. numba_cuda/numba/cuda/tests/cudapy/test_py2_div_issue.py +1 -1
  174. numba_cuda/numba/cuda/tests/cudapy/test_random.py +15 -10
  175. numba_cuda/numba/cuda/tests/cudapy/test_record_dtype.py +88 -87
  176. numba_cuda/numba/cuda/tests/cudapy/test_recursion.py +12 -10
  177. numba_cuda/numba/cuda/tests/cudapy/test_reduction.py +26 -11
  178. numba_cuda/numba/cuda/tests/cudapy/test_retrieve_autoconverted_arrays.py +7 -10
  179. numba_cuda/numba/cuda/tests/cudapy/test_serialize.py +4 -6
  180. numba_cuda/numba/cuda/tests/cudapy/test_slicing.py +1 -1
  181. numba_cuda/numba/cuda/tests/cudapy/test_sm.py +10 -9
  182. numba_cuda/numba/cuda/tests/cudapy/test_sm_creation.py +62 -43
  183. numba_cuda/numba/cuda/tests/cudapy/test_stream_api.py +7 -3
  184. numba_cuda/numba/cuda/tests/cudapy/test_sync.py +7 -5
  185. numba_cuda/numba/cuda/tests/cudapy/test_transpose.py +18 -11
  186. numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +111 -88
  187. numba_cuda/numba/cuda/tests/cudapy/test_userexc.py +2 -3
  188. numba_cuda/numba/cuda/tests/cudapy/test_vector_type.py +305 -130
  189. numba_cuda/numba/cuda/tests/cudapy/test_vectorize.py +33 -36
  190. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_complex.py +5 -5
  191. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_decor.py +16 -12
  192. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_device.py +7 -7
  193. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_scalar_arg.py +6 -7
  194. numba_cuda/numba/cuda/tests/cudapy/test_warning.py +31 -29
  195. numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +31 -25
  196. numba_cuda/numba/cuda/tests/cudasim/test_cudasim_issues.py +19 -13
  197. numba_cuda/numba/cuda/tests/data/jitlink.cu +1 -1
  198. numba_cuda/numba/cuda/tests/data/jitlink.ptx +0 -2
  199. numba_cuda/numba/cuda/tests/doc_examples/test_cg.py +15 -8
  200. numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +4 -7
  201. numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +14 -9
  202. numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +22 -18
  203. numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +7 -4
  204. numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +2 -0
  205. numba_cuda/numba/cuda/tests/doc_examples/test_random.py +8 -4
  206. numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +2 -1
  207. numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +94 -19
  208. numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +2 -2
  209. numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +91 -62
  210. numba_cuda/numba/cuda/tests/nocuda/test_function_resolution.py +14 -5
  211. numba_cuda/numba/cuda/tests/nocuda/test_import.py +25 -25
  212. numba_cuda/numba/cuda/tests/nocuda/test_library_lookup.py +40 -40
  213. numba_cuda/numba/cuda/tests/nocuda/test_nvvm.py +12 -10
  214. numba_cuda/numba/cuda/tests/nrt/test_nrt.py +16 -20
  215. numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +12 -10
  216. numba_cuda/numba/cuda/tests/test_binary_generation/generate_raw_ltoir.py +2 -2
  217. numba_cuda/numba/cuda/types.py +5 -2
  218. numba_cuda/numba/cuda/ufuncs.py +382 -362
  219. numba_cuda/numba/cuda/utils.py +2 -2
  220. numba_cuda/numba/cuda/vector_types.py +2 -2
  221. numba_cuda/numba/cuda/vectorizers.py +37 -32
  222. {numba_cuda-0.8.1.dist-info → numba_cuda-0.9.0.dist-info}/METADATA +1 -1
  223. numba_cuda-0.9.0.dist-info/RECORD +253 -0
  224. {numba_cuda-0.8.1.dist-info → numba_cuda-0.9.0.dist-info}/WHEEL +1 -1
  225. numba_cuda-0.8.1.dist-info/RECORD +0 -251
  226. {numba_cuda-0.8.1.dist-info → numba_cuda-0.9.0.dist-info}/licenses/LICENSE +0 -0
  227. {numba_cuda-0.8.1.dist-info → numba_cuda-0.9.0.dist-info}/top_level.txt +0 -0
@@ -2,8 +2,11 @@ import multiprocessing as mp
2
2
  import logging
3
3
  import traceback
4
4
  from numba.cuda.testing import unittest, CUDATestCase
5
- from numba.cuda.testing import (skip_on_cudasim, skip_with_cuda_python,
6
- skip_under_cuda_memcheck)
5
+ from numba.cuda.testing import (
6
+ skip_on_cudasim,
7
+ skip_with_cuda_python,
8
+ skip_under_cuda_memcheck,
9
+ )
7
10
  from numba.tests.support import linux_only
8
11
 
9
12
 
@@ -23,12 +26,12 @@ def child_test():
23
26
  # used.
24
27
  logbuf = io.StringIO()
25
28
  handler = logging.StreamHandler(logbuf)
26
- cudadrv_logger = logging.getLogger('numba.cuda.cudadrv.driver')
29
+ cudadrv_logger = logging.getLogger("numba.cuda.cudadrv.driver")
27
30
  cudadrv_logger.addHandler(handler)
28
31
  cudadrv_logger.setLevel(logging.DEBUG)
29
32
 
30
33
  # Set up data for our test, and copy over to the device
31
- N = 2 ** 16
34
+ N = 2**16
32
35
  N_THREADS = 10
33
36
  N_ADDITIONS = 4096
34
37
 
@@ -65,8 +68,10 @@ def child_test():
65
68
  f[n_blocks, n_threads, stream](rs[n], xs[n])
66
69
 
67
70
  # Create threads
68
- threads = [threading.Thread(target=kernel_thread, args=(i,))
69
- for i in range(N_THREADS)]
71
+ threads = [
72
+ threading.Thread(target=kernel_thread, args=(i,))
73
+ for i in range(N_THREADS)
74
+ ]
70
75
 
71
76
  # Start all threads
72
77
  for thread in threads:
@@ -95,7 +100,7 @@ def child_test_wrapper(result_queue):
95
100
  output = child_test()
96
101
  success = True
97
102
  # Catch anything raised so it can be propagated
98
- except: # noqa: E722
103
+ except: # noqa: E722
99
104
  output = traceback.format_exc()
100
105
  success = False
101
106
 
@@ -105,13 +110,13 @@ def child_test_wrapper(result_queue):
105
110
  # Run on Linux only until the reason for test hangs on Windows (Issue #8635,
106
111
  # https://github.com/numba/numba/issues/8635) is diagnosed
107
112
  @linux_only
108
- @skip_under_cuda_memcheck('Hangs cuda-memcheck')
109
- @skip_on_cudasim('Streams not supported on the simulator')
113
+ @skip_under_cuda_memcheck("Hangs cuda-memcheck")
114
+ @skip_on_cudasim("Streams not supported on the simulator")
110
115
  class TestPTDS(CUDATestCase):
111
- @skip_with_cuda_python('Function names unchanged for PTDS with NV Binding')
116
+ @skip_with_cuda_python("Function names unchanged for PTDS with NV Binding")
112
117
  def test_ptds(self):
113
118
  # Run a test with PTDS enabled in a child process
114
- ctx = mp.get_context('spawn')
119
+ ctx = mp.get_context("spawn")
115
120
  result_queue = ctx.Queue()
116
121
  proc = ctx.Process(target=child_test_wrapper, args=(result_queue,))
117
122
  proc.start()
@@ -124,8 +129,11 @@ class TestPTDS(CUDATestCase):
124
129
 
125
130
  # Functions with a per-thread default stream variant that we expect to
126
131
  # see in the output
127
- ptds_functions = ('cuMemcpyHtoD_v2_ptds', 'cuLaunchKernel_ptsz',
128
- 'cuMemcpyDtoH_v2_ptds')
132
+ ptds_functions = (
133
+ "cuMemcpyHtoD_v2_ptds",
134
+ "cuLaunchKernel_ptsz",
135
+ "cuMemcpyDtoH_v2_ptds",
136
+ )
129
137
 
130
138
  for fn in ptds_functions:
131
139
  with self.subTest(fn=fn, expected=True):
@@ -133,17 +141,20 @@ class TestPTDS(CUDATestCase):
133
141
 
134
142
  # Non-PTDS versions of the functions that we should not see in the
135
143
  # output:
136
- legacy_functions = ('cuMemcpyHtoD_v2', 'cuLaunchKernel',
137
- 'cuMemcpyDtoH_v2')
144
+ legacy_functions = (
145
+ "cuMemcpyHtoD_v2",
146
+ "cuLaunchKernel",
147
+ "cuMemcpyDtoH_v2",
148
+ )
138
149
 
139
150
  for fn in legacy_functions:
140
151
  with self.subTest(fn=fn, expected=False):
141
152
  # Ensure we only spot these function names appearing without a
142
153
  # _ptds or _ptsz suffix by checking including the end of the
143
154
  # line in the log
144
- fn_at_end = f'{fn}\n'
155
+ fn_at_end = f"{fn}\n"
145
156
  self.assertNotIn(fn_at_end, output)
146
157
 
147
158
 
148
- if __name__ == '__main__':
159
+ if __name__ == "__main__":
149
160
  unittest.main()
@@ -7,7 +7,6 @@ from queue import Queue
7
7
 
8
8
  class TestResetDevice(ContextResettingTestCase):
9
9
  def test_reset_device(self):
10
-
11
10
  def newthread(exception_queue):
12
11
  try:
13
12
  devices = range(driver.get_device_count())
@@ -32,5 +31,5 @@ class TestResetDevice(ContextResettingTestCase):
32
31
  self.assertEqual(exceptions, [])
33
32
 
34
33
 
35
- if __name__ == '__main__':
34
+ if __name__ == "__main__":
36
35
  unittest.main()
@@ -11,32 +11,40 @@ def set_visible_devices_and_check(q):
11
11
  from numba import cuda
12
12
  import os
13
13
 
14
- os.environ['CUDA_VISIBLE_DEVICES'] = '0'
14
+ os.environ["CUDA_VISIBLE_DEVICES"] = "0"
15
15
  q.put(len(cuda.gpus.lst))
16
- except: # noqa: E722
16
+ except: # noqa: E722
17
17
  # Sentinel value for error executing test code
18
18
  q.put(-1)
19
19
 
20
20
 
21
21
  if config.ENABLE_CUDASIM:
22
- SUPPORTED_VERSIONS = (-1, -1),
22
+ SUPPORTED_VERSIONS = ((-1, -1),)
23
23
  else:
24
- SUPPORTED_VERSIONS = ((11, 0), (11, 1), (11, 2), (11, 3), (11, 4), (11, 5),
25
- (11, 6), (11, 7))
24
+ SUPPORTED_VERSIONS = (
25
+ (11, 0),
26
+ (11, 1),
27
+ (11, 2),
28
+ (11, 3),
29
+ (11, 4),
30
+ (11, 5),
31
+ (11, 6),
32
+ (11, 7),
33
+ )
26
34
 
27
35
 
28
36
  class TestRuntime(unittest.TestCase):
29
37
  def test_is_supported_version_true(self):
30
38
  for v in SUPPORTED_VERSIONS:
31
- with patch.object(runtime, 'get_version', return_value=v):
39
+ with patch.object(runtime, "get_version", return_value=v):
32
40
  self.assertTrue(runtime.is_supported_version())
33
41
 
34
- @skip_on_cudasim('The simulator always simulates a supported runtime')
42
+ @skip_on_cudasim("The simulator always simulates a supported runtime")
35
43
  def test_is_supported_version_false(self):
36
44
  # Check with an old unsupported version and some potential future
37
45
  # versions
38
46
  for v in ((10, 2), (11, 8), (12, 0)):
39
- with patch.object(runtime, 'get_version', return_value=v):
47
+ with patch.object(runtime, "get_version", return_value=v):
40
48
  self.assertFalse(runtime.is_supported_version())
41
49
 
42
50
  def test_supported_versions(self):
@@ -57,13 +65,13 @@ class TestVisibleDevices(unittest.TestCase, SerialMixin):
57
65
  from numba import cuda
58
66
 
59
67
  if len(cuda.gpus.lst) in (0, 1):
60
- self.skipTest('This test requires multiple GPUs')
68
+ self.skipTest("This test requires multiple GPUs")
61
69
 
62
- if os.environ.get('CUDA_VISIBLE_DEVICES'):
63
- msg = 'Cannot test when CUDA_VISIBLE_DEVICES already set'
70
+ if os.environ.get("CUDA_VISIBLE_DEVICES"):
71
+ msg = "Cannot test when CUDA_VISIBLE_DEVICES already set"
64
72
  self.skipTest(msg)
65
73
 
66
- ctx = multiprocessing.get_context('spawn')
74
+ ctx = multiprocessing.get_context("spawn")
67
75
  q = ctx.Queue()
68
76
  p = ctx.Process(target=set_visible_devices_and_check, args=(q,))
69
77
  p.start()
@@ -74,12 +82,12 @@ class TestVisibleDevices(unittest.TestCase, SerialMixin):
74
82
 
75
83
  # Make an obvious distinction between an error running the test code
76
84
  # and an incorrect number of GPUs in the list
77
- msg = 'Error running set_visible_devices_and_check'
85
+ msg = "Error running set_visible_devices_and_check"
78
86
  self.assertNotEqual(visible_gpu_count, -1, msg=msg)
79
87
 
80
88
  # The actual check that we see only one GPU
81
89
  self.assertEqual(visible_gpu_count, 1)
82
90
 
83
91
 
84
- if __name__ == '__main__':
92
+ if __name__ == "__main__":
85
93
  unittest.main()
@@ -37,5 +37,5 @@ class TestSelectDevice(ContextResettingTestCase):
37
37
  self.assertEqual(exceptions, [])
38
38
 
39
39
 
40
- if __name__ == '__main__':
40
+ if __name__ == "__main__":
41
41
  unittest.main()
@@ -15,10 +15,11 @@ def with_asyncio_loop(f):
15
15
  return loop.run_until_complete(f(*args, **kwds))
16
16
  finally:
17
17
  loop.close()
18
+
18
19
  return runner
19
20
 
20
21
 
21
- @skip_on_cudasim('CUDA Driver API unsupported in the simulator')
22
+ @skip_on_cudasim("CUDA Driver API unsupported in the simulator")
22
23
  class TestCudaStream(CUDATestCase):
23
24
  def test_add_callback(self):
24
25
  def callback(stream, status, event):
@@ -89,7 +90,7 @@ class TestCudaStream(CUDATestCase):
89
90
  self.assertTrue(done2.done())
90
91
 
91
92
 
92
- @skip_on_cudasim('CUDA Driver API unsupported in the simulator')
93
+ @skip_on_cudasim("CUDA Driver API unsupported in the simulator")
93
94
  class TestFailingStream(CUDATestCase):
94
95
  # This test can only be run in isolation because it corrupts the CUDA
95
96
  # context, which cannot be recovered from within the same process. It is
@@ -118,5 +119,5 @@ class TestFailingStream(CUDATestCase):
118
119
  self.assertIsNotNone(done.exception())
119
120
 
120
121
 
121
- if __name__ == '__main__':
122
+ if __name__ == "__main__":
122
123
  unittest.main()
@@ -17,6 +17,7 @@ class UseCase:
17
17
  The return type is inferred from the type of the first argument, unless it
18
18
  is explicitly overridden by the ``retty`` kwarg.
19
19
  """
20
+
20
21
  def __init__(self, func, retty=None):
21
22
  self._func = func
22
23
  self._retty = retty
@@ -59,6 +60,7 @@ Z = 1
59
60
 
60
61
  # Inner / outer cached / uncached cases
61
62
 
63
+
62
64
  @cuda.jit(cache=True)
63
65
  def inner(x, y):
64
66
  return x + y + Z
@@ -81,13 +83,13 @@ outer_uncached = CUDAUseCase(outer_uncached_kernel)
81
83
  # Exercise returning a record instance. This used to hardcode the dtype
82
84
  # pointer's value in the bitcode.
83
85
 
84
- packed_record_type = np.dtype([('a', np.int8), ('b', np.float64)])
85
- aligned_record_type = np.dtype([('a', np.int8), ('b', np.float64)], align=True)
86
+ packed_record_type = np.dtype([("a", np.int8), ("b", np.float64)])
87
+ aligned_record_type = np.dtype([("a", np.int8), ("b", np.float64)], align=True)
86
88
 
87
89
  packed_arr = np.empty(2, dtype=packed_record_type)
88
90
  for i in range(packed_arr.size):
89
- packed_arr[i]['a'] = i + 1
90
- packed_arr[i]['b'] = i + 42.5
91
+ packed_arr[i]["a"] = i + 1
92
+ packed_arr[i]["b"] = i + 42.5
91
93
 
92
94
  aligned_arr = np.array(packed_arr, dtype=aligned_record_type)
93
95
 
@@ -103,6 +105,7 @@ record_return_aligned = CUDAUseCase(record_return, retty=aligned_record_type)
103
105
 
104
106
  # Closure test cases
105
107
 
108
+
106
109
  def make_closure(x):
107
110
  @cuda.jit(cache=True)
108
111
  def closure(r, y):
@@ -119,6 +122,7 @@ closure4 = make_closure(9)
119
122
 
120
123
  # Ambiguous / renamed functions
121
124
 
125
+
122
126
  @cuda.jit(cache=True)
123
127
  def ambiguous_function(r, x):
124
128
  r[()] = x[()] + 2
@@ -190,6 +194,7 @@ def many_locals():
190
194
 
191
195
  # Simple use case for multiprocessing test
192
196
 
197
+
193
198
  @cuda.jit(cache=True)
194
199
  def simple_usecase_kernel(r, x):
195
200
  r[()] = x[()]
@@ -200,6 +205,7 @@ simple_usecase_caller = CUDAUseCase(simple_usecase_kernel)
200
205
 
201
206
  # Usecase with cooperative groups
202
207
 
208
+
203
209
  @cuda.jit(cache=True)
204
210
  def cg_usecase_kernel(r, x):
205
211
  grid = cuda.cg.this_grid()
@@ -12,6 +12,7 @@ class CPUUseCase(UseCase):
12
12
 
13
13
  # Using the same function as a cached CPU and CUDA-jitted function
14
14
 
15
+
15
16
  def target_shared_assign(r, x):
16
17
  r[()] = x[()]
17
18
 
@@ -23,7 +23,7 @@ if not config.ENABLE_CUDASIM:
23
23
  register_model,
24
24
  make_attribute_wrapper,
25
25
  typeof_impl,
26
- type_callable
26
+ type_callable,
27
27
  )
28
28
  from numba.cuda.cudaimpl import lower
29
29
  from numba.core import cgutils
@@ -38,21 +38,22 @@ if not config.ENABLE_CUDASIM:
38
38
  members = [("x", int32), ("y", int32)]
39
39
  super().__init__(dmm, fe_type, members)
40
40
 
41
- make_attribute_wrapper(TestStructModelType, 'x', 'x')
42
- make_attribute_wrapper(TestStructModelType, 'y', 'y')
41
+ make_attribute_wrapper(TestStructModelType, "x", "x")
42
+ make_attribute_wrapper(TestStructModelType, "y", "y")
43
43
 
44
44
  @type_callable(TestStruct)
45
45
  def type_test_struct(context):
46
46
  def typer(x, y):
47
47
  if isinstance(x, types.Integer) and isinstance(y, types.Integer):
48
48
  return test_struct_model_type
49
+
49
50
  return typer
50
51
 
51
52
  @lower(TestStruct, types.Integer, types.Integer)
52
53
  def lower_test_type_ctor(context, builder, sig, args):
53
- obj = cgutils.create_struct_proxy(
54
- test_struct_model_type
55
- )(context, builder)
54
+ obj = cgutils.create_struct_proxy(test_struct_model_type)(
55
+ context, builder
56
+ )
56
57
  obj.x = args[0]
57
58
  obj.y = args[1]
58
59
  return obj._getvalue()
@@ -26,5 +26,3 @@
26
26
  st.param.b32 [func_retval0+0], %r3;
27
27
  ret;
28
28
  }
29
-
30
-
@@ -97,4 +97,5 @@ def make_growing_tuple_case(jit=lambda x: x):
97
97
  return None
98
98
 
99
99
  return (n, make_list(n - 1))
100
+
100
101
  return make_list
@@ -6,7 +6,7 @@ import unittest
6
6
 
7
7
  class TestAlignment(CUDATestCase):
8
8
  def test_record_alignment(self):
9
- rec_dtype = np.dtype([('a', 'int32'), ('b', 'float64')], align=True)
9
+ rec_dtype = np.dtype([("a", "int32"), ("b", "float64")], align=True)
10
10
  rec = from_dtype(rec_dtype)
11
11
 
12
12
  @cuda.jit((rec[:],))
@@ -24,19 +24,20 @@ class TestAlignment(CUDATestCase):
24
24
 
25
25
  self.assertTrue(np.all(a_recarray.a == a_recarray.b))
26
26
 
27
- @skip_on_cudasim('Simulator does not check alignment')
27
+ @skip_on_cudasim("Simulator does not check alignment")
28
28
  def test_record_alignment_error(self):
29
- rec_dtype = np.dtype([('a', 'int32'), ('b', 'float64')])
29
+ rec_dtype = np.dtype([("a", "int32"), ("b", "float64")])
30
30
  rec = from_dtype(rec_dtype)
31
31
 
32
32
  with self.assertRaises(Exception) as raises:
33
+
33
34
  @cuda.jit((rec[:],))
34
35
  def foo(a):
35
36
  i = cuda.grid(1)
36
37
  a[i].a = a[i].b
37
38
 
38
- self.assertTrue('type float64 is not aligned' in str(raises.exception))
39
+ self.assertTrue("type float64 is not aligned" in str(raises.exception))
39
40
 
40
41
 
41
- if __name__ == '__main__':
42
+ if __name__ == "__main__":
42
43
  unittest.main()
@@ -8,8 +8,11 @@ from numba import config, cuda
8
8
  if config.ENABLE_CUDASIM:
9
9
  ARRAY_LIKE_FUNCTIONS = (cuda.device_array_like, cuda.pinned_array_like)
10
10
  else:
11
- ARRAY_LIKE_FUNCTIONS = (cuda.device_array_like, cuda.mapped_array_like,
12
- cuda.pinned_array_like)
11
+ ARRAY_LIKE_FUNCTIONS = (
12
+ cuda.device_array_like,
13
+ cuda.mapped_array_like,
14
+ cuda.pinned_array_like,
15
+ )
13
16
 
14
17
 
15
18
  def array_reshape1d(arr, newshape, got):
@@ -55,8 +58,7 @@ class TestCudaArray(CUDATestCase):
55
58
  self.assertEqual(shape2, null_shape)
56
59
 
57
60
  def test_gpu_array_strided(self):
58
-
59
- @cuda.jit('void(double[:])')
61
+ @cuda.jit("void(double[:])")
60
62
  def kernel(x):
61
63
  i = cuda.grid(1)
62
64
  if i < x.shape[0]:
@@ -69,8 +71,7 @@ class TestCudaArray(CUDATestCase):
69
71
  self.assertTrue(np.allclose(z, list(range(9))))
70
72
 
71
73
  def test_gpu_array_interleaved(self):
72
-
73
- @cuda.jit('void(double[:], double[:])')
74
+ @cuda.jit("void(double[:], double[:])")
74
75
  def copykernel(x, y):
75
76
  i = cuda.grid(1)
76
77
  if i < x.shape[0]:
@@ -86,8 +87,10 @@ class TestCudaArray(CUDATestCase):
86
87
  except ValueError:
87
88
  pass
88
89
  else:
89
- raise AssertionError("Should raise exception complaining the "
90
- "contiguous-ness of the array.")
90
+ raise AssertionError(
91
+ "Should raise exception complaining the "
92
+ "contiguous-ness of the array."
93
+ )
91
94
  # Should we handle this use case?
92
95
  # assert z.size == y.size
93
96
  # copykernel[1, n](y, x)
@@ -108,55 +111,57 @@ class TestCudaArray(CUDATestCase):
108
111
  self.assertEqual(array.shape, array_like.shape)
109
112
  self.assertEqual(array.strides, array_like.strides)
110
113
  self.assertEqual(array.dtype, array_like.dtype)
111
- self.assertEqual(array.flags['C_CONTIGUOUS'],
112
- array_like.flags['C_CONTIGUOUS'])
113
- self.assertEqual(array.flags['F_CONTIGUOUS'],
114
- array_like.flags['F_CONTIGUOUS'])
114
+ self.assertEqual(
115
+ array.flags["C_CONTIGUOUS"], array_like.flags["C_CONTIGUOUS"]
116
+ )
117
+ self.assertEqual(
118
+ array.flags["F_CONTIGUOUS"], array_like.flags["F_CONTIGUOUS"]
119
+ )
115
120
 
116
121
  def test_array_like_1d(self):
117
- d_a = cuda.device_array(10, order='C')
122
+ d_a = cuda.device_array(10, order="C")
118
123
  for like_func in ARRAY_LIKE_FUNCTIONS:
119
124
  with self.subTest(like_func=like_func):
120
125
  self._test_array_like_same(like_func, d_a)
121
126
 
122
127
  def test_array_like_2d(self):
123
- d_a = cuda.device_array((10, 12), order='C')
128
+ d_a = cuda.device_array((10, 12), order="C")
124
129
  for like_func in ARRAY_LIKE_FUNCTIONS:
125
130
  with self.subTest(like_func=like_func):
126
131
  self._test_array_like_same(like_func, d_a)
127
132
 
128
133
  def test_array_like_2d_transpose(self):
129
- d_a = cuda.device_array((10, 12), order='C')
134
+ d_a = cuda.device_array((10, 12), order="C")
130
135
  for like_func in ARRAY_LIKE_FUNCTIONS:
131
136
  with self.subTest(like_func=like_func):
132
137
  self._test_array_like_same(like_func, d_a)
133
138
 
134
139
  def test_array_like_3d(self):
135
- d_a = cuda.device_array((10, 12, 14), order='C')
140
+ d_a = cuda.device_array((10, 12, 14), order="C")
136
141
  for like_func in ARRAY_LIKE_FUNCTIONS:
137
142
  with self.subTest(like_func=like_func):
138
143
  self._test_array_like_same(like_func, d_a)
139
144
 
140
145
  def test_array_like_1d_f(self):
141
- d_a = cuda.device_array(10, order='F')
146
+ d_a = cuda.device_array(10, order="F")
142
147
  for like_func in ARRAY_LIKE_FUNCTIONS:
143
148
  with self.subTest(like_func=like_func):
144
149
  self._test_array_like_same(like_func, d_a)
145
150
 
146
151
  def test_array_like_2d_f(self):
147
- d_a = cuda.device_array((10, 12), order='F')
152
+ d_a = cuda.device_array((10, 12), order="F")
148
153
  for like_func in ARRAY_LIKE_FUNCTIONS:
149
154
  with self.subTest(like_func=like_func):
150
155
  self._test_array_like_same(like_func, d_a)
151
156
 
152
157
  def test_array_like_2d_f_transpose(self):
153
- d_a = cuda.device_array((10, 12), order='F')
158
+ d_a = cuda.device_array((10, 12), order="F")
154
159
  for like_func in ARRAY_LIKE_FUNCTIONS:
155
160
  with self.subTest(like_func=like_func):
156
161
  self._test_array_like_same(like_func, d_a)
157
162
 
158
163
  def test_array_like_3d_f(self):
159
- d_a = cuda.device_array((10, 12, 14), order='F')
164
+ d_a = cuda.device_array((10, 12, 14), order="F")
160
165
  for like_func in ARRAY_LIKE_FUNCTIONS:
161
166
  with self.subTest(like_func=like_func):
162
167
  self._test_array_like_same(like_func, d_a)
@@ -173,10 +178,12 @@ class TestCudaArray(CUDATestCase):
173
178
  # Use NumPy as a reference for the expected strides
174
179
  np_like = np.zeros_like(view)
175
180
  self.assertEqual(nb_like.strides, np_like.strides)
176
- self.assertEqual(nb_like.flags['C_CONTIGUOUS'],
177
- np_like.flags['C_CONTIGUOUS'])
178
- self.assertEqual(nb_like.flags['F_CONTIGUOUS'],
179
- np_like.flags['F_CONTIGUOUS'])
181
+ self.assertEqual(
182
+ nb_like.flags["C_CONTIGUOUS"], np_like.flags["C_CONTIGUOUS"]
183
+ )
184
+ self.assertEqual(
185
+ nb_like.flags["F_CONTIGUOUS"], np_like.flags["F_CONTIGUOUS"]
186
+ )
180
187
 
181
188
  def test_array_like_1d_view(self):
182
189
  shape = 10
@@ -188,8 +195,8 @@ class TestCudaArray(CUDATestCase):
188
195
 
189
196
  def test_array_like_1d_view_f(self):
190
197
  shape = 10
191
- view = np.zeros(shape, order='F')[::2]
192
- d_view = cuda.device_array(shape, order='F')[::2]
198
+ view = np.zeros(shape, order="F")[::2]
199
+ d_view = cuda.device_array(shape, order="F")[::2]
193
200
  for like_func in ARRAY_LIKE_FUNCTIONS:
194
201
  with self.subTest(like_func=like_func):
195
202
  self._test_array_like_view(like_func, view, d_view)
@@ -204,13 +211,13 @@ class TestCudaArray(CUDATestCase):
204
211
 
205
212
  def test_array_like_2d_view_f(self):
206
213
  shape = (10, 12)
207
- view = np.zeros(shape, order='F')[::2, ::2]
208
- d_view = cuda.device_array(shape, order='F')[::2, ::2]
214
+ view = np.zeros(shape, order="F")[::2, ::2]
215
+ d_view = cuda.device_array(shape, order="F")[::2, ::2]
209
216
  for like_func in ARRAY_LIKE_FUNCTIONS:
210
217
  with self.subTest(like_func=like_func):
211
218
  self._test_array_like_view(like_func, view, d_view)
212
219
 
213
- @skip_on_cudasim('Numba and NumPy stride semantics differ for transpose')
220
+ @skip_on_cudasim("Numba and NumPy stride semantics differ for transpose")
214
221
  def test_array_like_2d_view_transpose_device(self):
215
222
  shape = (10, 12)
216
223
  d_view = cuda.device_array(shape)[::2, ::2].T
@@ -224,11 +231,12 @@ class TestCudaArray(CUDATestCase):
224
231
  self.assertEqual(d_view.shape, like.shape)
225
232
  self.assertEqual(d_view.dtype, like.dtype)
226
233
  self.assertEqual((40, 8), like.strides)
227
- self.assertTrue(like.flags['C_CONTIGUOUS'])
228
- self.assertFalse(like.flags['F_CONTIGUOUS'])
234
+ self.assertTrue(like.flags["C_CONTIGUOUS"])
235
+ self.assertFalse(like.flags["F_CONTIGUOUS"])
229
236
 
230
- @skip_unless_cudasim('Numba and NumPy stride semantics differ for '
231
- 'transpose')
237
+ @skip_unless_cudasim(
238
+ "Numba and NumPy stride semantics differ for transpose"
239
+ )
232
240
  def test_array_like_2d_view_transpose_simulator(self):
233
241
  shape = (10, 12)
234
242
  view = np.zeros(shape)[::2, ::2].T
@@ -243,20 +251,22 @@ class TestCudaArray(CUDATestCase):
243
251
  self.assertEqual(d_view.shape, nb_like.shape)
244
252
  self.assertEqual(d_view.dtype, nb_like.dtype)
245
253
  self.assertEqual(np_like.strides, nb_like.strides)
246
- self.assertEqual(np_like.flags['C_CONTIGUOUS'],
247
- nb_like.flags['C_CONTIGUOUS'])
248
- self.assertEqual(np_like.flags['F_CONTIGUOUS'],
249
- nb_like.flags['F_CONTIGUOUS'])
254
+ self.assertEqual(
255
+ np_like.flags["C_CONTIGUOUS"], nb_like.flags["C_CONTIGUOUS"]
256
+ )
257
+ self.assertEqual(
258
+ np_like.flags["F_CONTIGUOUS"], nb_like.flags["F_CONTIGUOUS"]
259
+ )
250
260
 
251
261
  def test_array_like_2d_view_f_transpose(self):
252
262
  shape = (10, 12)
253
- view = np.zeros(shape, order='F')[::2, ::2].T
254
- d_view = cuda.device_array(shape, order='F')[::2, ::2].T
263
+ view = np.zeros(shape, order="F")[::2, ::2].T
264
+ d_view = cuda.device_array(shape, order="F")[::2, ::2].T
255
265
  for like_func in ARRAY_LIKE_FUNCTIONS:
256
266
  with self.subTest(like_func=like_func):
257
267
  self._test_array_like_view(like_func, view, d_view)
258
268
 
259
- @skip_on_cudasim('Kernel overloads not created in the simulator')
269
+ @skip_on_cudasim("Kernel overloads not created in the simulator")
260
270
  def test_issue_4628(self):
261
271
  # CUDA Device arrays were reported as always being typed with 'A' order
262
272
  # so launching the kernel with a host array and then a device array
@@ -318,7 +328,7 @@ class TestCudaArray(CUDATestCase):
318
328
  check(array_reshape, array_reshape3d, arr, (8, 1, 3))
319
329
 
320
330
  # Test negative shape value
321
- arr = np.arange(25).reshape(5,5)
331
+ arr = np.arange(25).reshape(5, 5)
322
332
  check(array_reshape, array_reshape1d, arr, -1)
323
333
  check(array_reshape, array_reshape1d, arr, (-1,))
324
334
  check(array_reshape, array_reshape2d, arr, (-1, 5))
@@ -329,5 +339,5 @@ class TestCudaArray(CUDATestCase):
329
339
  check_empty(arr)
330
340
 
331
341
 
332
- if __name__ == '__main__':
342
+ if __name__ == "__main__":
333
343
  unittest.main()
@@ -7,12 +7,11 @@ from numba.cuda.testing import unittest, CUDATestCase
7
7
 
8
8
  class TestCudaArrayArg(CUDATestCase):
9
9
  def test_array_ary(self):
10
-
11
- @cuda.jit('double(double[:],int64)', device=True, inline=True)
10
+ @cuda.jit("double(double[:],int64)", device=True, inline=True)
12
11
  def device_function(a, c):
13
12
  return a[c]
14
13
 
15
- @cuda.jit('void(double[:],double[:])')
14
+ @cuda.jit("void(double[:],double[:])")
16
15
  def kernel(x, y):
17
16
  i = cuda.grid(1)
18
17
  y[i] = device_function(x, i)
@@ -63,7 +62,7 @@ class TestCudaArrayArg(CUDATestCase):
63
62
  r[0] = x.x
64
63
  r[1] = x.y
65
64
 
66
- Point = namedtuple('Point', ('x', 'y'))
65
+ Point = namedtuple("Point", ("x", "y"))
67
66
  x = Point(1, 2)
68
67
  r = np.zeros(len(x), dtype=np.int64)
69
68
  f[1, 1](r, x)
@@ -78,7 +77,7 @@ class TestCudaArrayArg(CUDATestCase):
78
77
  r1[1] = x.y
79
78
  r2[0] = x.r
80
79
 
81
- Point = namedtuple('Point', ('x', 'y', 'r'))
80
+ Point = namedtuple("Point", ("x", "y", "r"))
82
81
  x = Point(1, 2, 2.236)
83
82
  r1 = np.zeros(2, dtype=np.int64)
84
83
  r2 = np.zeros(1, dtype=np.float64)
@@ -197,5 +196,5 @@ class TestCudaArrayArg(CUDATestCase):
197
196
  self.assertEqual(r[4], 3)
198
197
 
199
198
 
200
- if __name__ == '__main__':
199
+ if __name__ == "__main__":
201
200
  unittest.main()