numba-cuda 0.21.1__cp313-cp313-win_amd64.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.pth +4 -0
- _numba_cuda_redirector.py +89 -0
- numba_cuda/VERSION +1 -0
- numba_cuda/__init__.py +6 -0
- numba_cuda/_version.py +11 -0
- numba_cuda/numba/cuda/__init__.py +70 -0
- numba_cuda/numba/cuda/_internal/cuda_bf16.py +16394 -0
- numba_cuda/numba/cuda/_internal/cuda_fp16.py +8112 -0
- numba_cuda/numba/cuda/api.py +577 -0
- numba_cuda/numba/cuda/api_util.py +76 -0
- numba_cuda/numba/cuda/args.py +72 -0
- numba_cuda/numba/cuda/bf16.py +397 -0
- numba_cuda/numba/cuda/cache_hints.py +287 -0
- numba_cuda/numba/cuda/cext/__init__.py +2 -0
- numba_cuda/numba/cuda/cext/_devicearray.cp313-win_amd64.pyd +0 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpp +159 -0
- numba_cuda/numba/cuda/cext/_devicearray.h +29 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cp313-win_amd64.pyd +0 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpp +1098 -0
- numba_cuda/numba/cuda/cext/_hashtable.cpp +532 -0
- numba_cuda/numba/cuda/cext/_hashtable.h +135 -0
- numba_cuda/numba/cuda/cext/_helperlib.c +71 -0
- numba_cuda/numba/cuda/cext/_helperlib.cp313-win_amd64.pyd +0 -0
- numba_cuda/numba/cuda/cext/_helpermod.c +82 -0
- numba_cuda/numba/cuda/cext/_pymodule.h +38 -0
- numba_cuda/numba/cuda/cext/_typeconv.cp313-win_amd64.pyd +0 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpp +206 -0
- numba_cuda/numba/cuda/cext/_typeof.cpp +1159 -0
- numba_cuda/numba/cuda/cext/_typeof.h +19 -0
- numba_cuda/numba/cuda/cext/capsulethunk.h +111 -0
- numba_cuda/numba/cuda/cext/mviewbuf.c +385 -0
- numba_cuda/numba/cuda/cext/mviewbuf.cp313-win_amd64.pyd +0 -0
- numba_cuda/numba/cuda/cext/typeconv.cpp +212 -0
- numba_cuda/numba/cuda/cext/typeconv.hpp +101 -0
- numba_cuda/numba/cuda/cg.py +67 -0
- numba_cuda/numba/cuda/cgutils.py +1294 -0
- numba_cuda/numba/cuda/cloudpickle/__init__.py +21 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle.py +1598 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle_fast.py +17 -0
- numba_cuda/numba/cuda/codegen.py +541 -0
- numba_cuda/numba/cuda/compiler.py +1396 -0
- numba_cuda/numba/cuda/core/analysis.py +758 -0
- numba_cuda/numba/cuda/core/annotations/__init__.py +0 -0
- numba_cuda/numba/cuda/core/annotations/pretty_annotate.py +288 -0
- numba_cuda/numba/cuda/core/annotations/type_annotations.py +305 -0
- numba_cuda/numba/cuda/core/base.py +1332 -0
- numba_cuda/numba/cuda/core/boxing.py +1411 -0
- numba_cuda/numba/cuda/core/bytecode.py +728 -0
- numba_cuda/numba/cuda/core/byteflow.py +2346 -0
- numba_cuda/numba/cuda/core/caching.py +744 -0
- numba_cuda/numba/cuda/core/callconv.py +392 -0
- numba_cuda/numba/cuda/core/codegen.py +171 -0
- numba_cuda/numba/cuda/core/compiler.py +199 -0
- numba_cuda/numba/cuda/core/compiler_lock.py +85 -0
- numba_cuda/numba/cuda/core/compiler_machinery.py +497 -0
- numba_cuda/numba/cuda/core/config.py +650 -0
- numba_cuda/numba/cuda/core/consts.py +124 -0
- numba_cuda/numba/cuda/core/controlflow.py +989 -0
- numba_cuda/numba/cuda/core/entrypoints.py +57 -0
- numba_cuda/numba/cuda/core/environment.py +66 -0
- numba_cuda/numba/cuda/core/errors.py +917 -0
- numba_cuda/numba/cuda/core/event.py +511 -0
- numba_cuda/numba/cuda/core/funcdesc.py +330 -0
- numba_cuda/numba/cuda/core/generators.py +387 -0
- numba_cuda/numba/cuda/core/imputils.py +509 -0
- numba_cuda/numba/cuda/core/inline_closurecall.py +1787 -0
- numba_cuda/numba/cuda/core/interpreter.py +3617 -0
- numba_cuda/numba/cuda/core/ir.py +1812 -0
- numba_cuda/numba/cuda/core/ir_utils.py +2638 -0
- numba_cuda/numba/cuda/core/optional.py +129 -0
- numba_cuda/numba/cuda/core/options.py +262 -0
- numba_cuda/numba/cuda/core/postproc.py +249 -0
- numba_cuda/numba/cuda/core/pythonapi.py +1859 -0
- numba_cuda/numba/cuda/core/registry.py +46 -0
- numba_cuda/numba/cuda/core/removerefctpass.py +123 -0
- numba_cuda/numba/cuda/core/rewrites/__init__.py +26 -0
- numba_cuda/numba/cuda/core/rewrites/ir_print.py +91 -0
- numba_cuda/numba/cuda/core/rewrites/registry.py +104 -0
- numba_cuda/numba/cuda/core/rewrites/static_binop.py +41 -0
- numba_cuda/numba/cuda/core/rewrites/static_getitem.py +189 -0
- numba_cuda/numba/cuda/core/rewrites/static_raise.py +100 -0
- numba_cuda/numba/cuda/core/sigutils.py +68 -0
- numba_cuda/numba/cuda/core/ssa.py +498 -0
- numba_cuda/numba/cuda/core/targetconfig.py +330 -0
- numba_cuda/numba/cuda/core/tracing.py +231 -0
- numba_cuda/numba/cuda/core/transforms.py +956 -0
- numba_cuda/numba/cuda/core/typed_passes.py +867 -0
- numba_cuda/numba/cuda/core/typeinfer.py +1950 -0
- numba_cuda/numba/cuda/core/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/core/unsafe/bytes.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/eh.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/refcount.py +98 -0
- numba_cuda/numba/cuda/core/untyped_passes.py +1979 -0
- numba_cuda/numba/cuda/cpython/builtins.py +1153 -0
- numba_cuda/numba/cuda/cpython/charseq.py +1218 -0
- numba_cuda/numba/cuda/cpython/cmathimpl.py +560 -0
- numba_cuda/numba/cuda/cpython/enumimpl.py +103 -0
- numba_cuda/numba/cuda/cpython/iterators.py +167 -0
- numba_cuda/numba/cuda/cpython/listobj.py +1326 -0
- numba_cuda/numba/cuda/cpython/mathimpl.py +499 -0
- numba_cuda/numba/cuda/cpython/numbers.py +1475 -0
- numba_cuda/numba/cuda/cpython/rangeobj.py +289 -0
- numba_cuda/numba/cuda/cpython/slicing.py +322 -0
- numba_cuda/numba/cuda/cpython/tupleobj.py +456 -0
- numba_cuda/numba/cuda/cpython/unicode.py +2865 -0
- numba_cuda/numba/cuda/cpython/unicode_support.py +1597 -0
- numba_cuda/numba/cuda/cpython/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/cpython/unsafe/numbers.py +64 -0
- numba_cuda/numba/cuda/cpython/unsafe/tuple.py +92 -0
- numba_cuda/numba/cuda/cuda_paths.py +691 -0
- numba_cuda/numba/cuda/cudadecl.py +556 -0
- numba_cuda/numba/cuda/cudadrv/__init__.py +14 -0
- numba_cuda/numba/cuda/cudadrv/devicearray.py +951 -0
- numba_cuda/numba/cuda/cudadrv/devices.py +249 -0
- numba_cuda/numba/cuda/cudadrv/driver.py +3222 -0
- numba_cuda/numba/cuda/cudadrv/drvapi.py +435 -0
- numba_cuda/numba/cuda/cudadrv/dummyarray.py +558 -0
- numba_cuda/numba/cuda/cudadrv/enums.py +613 -0
- numba_cuda/numba/cuda/cudadrv/error.py +48 -0
- numba_cuda/numba/cuda/cudadrv/libs.py +220 -0
- numba_cuda/numba/cuda/cudadrv/linkable_code.py +184 -0
- numba_cuda/numba/cuda/cudadrv/mappings.py +14 -0
- numba_cuda/numba/cuda/cudadrv/ndarray.py +26 -0
- numba_cuda/numba/cuda/cudadrv/nvrtc.py +193 -0
- numba_cuda/numba/cuda/cudadrv/nvvm.py +756 -0
- numba_cuda/numba/cuda/cudadrv/rtapi.py +13 -0
- numba_cuda/numba/cuda/cudadrv/runtime.py +34 -0
- numba_cuda/numba/cuda/cudaimpl.py +995 -0
- numba_cuda/numba/cuda/cudamath.py +149 -0
- numba_cuda/numba/cuda/datamodel/__init__.py +7 -0
- numba_cuda/numba/cuda/datamodel/cuda_manager.py +66 -0
- numba_cuda/numba/cuda/datamodel/cuda_models.py +1446 -0
- numba_cuda/numba/cuda/datamodel/cuda_packer.py +224 -0
- numba_cuda/numba/cuda/datamodel/cuda_registry.py +22 -0
- numba_cuda/numba/cuda/datamodel/cuda_testing.py +153 -0
- numba_cuda/numba/cuda/datamodel/manager.py +11 -0
- numba_cuda/numba/cuda/datamodel/models.py +9 -0
- numba_cuda/numba/cuda/datamodel/packer.py +9 -0
- numba_cuda/numba/cuda/datamodel/registry.py +11 -0
- numba_cuda/numba/cuda/datamodel/testing.py +11 -0
- numba_cuda/numba/cuda/debuginfo.py +903 -0
- numba_cuda/numba/cuda/decorators.py +294 -0
- numba_cuda/numba/cuda/descriptor.py +35 -0
- numba_cuda/numba/cuda/device_init.py +158 -0
- numba_cuda/numba/cuda/deviceufunc.py +1021 -0
- numba_cuda/numba/cuda/dispatcher.py +2463 -0
- numba_cuda/numba/cuda/errors.py +72 -0
- numba_cuda/numba/cuda/extending.py +697 -0
- numba_cuda/numba/cuda/flags.py +178 -0
- numba_cuda/numba/cuda/fp16.py +357 -0
- 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/include/13/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/13/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/initialize.py +24 -0
- numba_cuda/numba/cuda/intrinsic_wrapper.py +41 -0
- numba_cuda/numba/cuda/intrinsics.py +382 -0
- numba_cuda/numba/cuda/itanium_mangler.py +214 -0
- numba_cuda/numba/cuda/kernels/__init__.py +2 -0
- numba_cuda/numba/cuda/kernels/reduction.py +265 -0
- numba_cuda/numba/cuda/kernels/transpose.py +65 -0
- numba_cuda/numba/cuda/libdevice.py +3386 -0
- numba_cuda/numba/cuda/libdevicedecl.py +20 -0
- numba_cuda/numba/cuda/libdevicefuncs.py +1060 -0
- numba_cuda/numba/cuda/libdeviceimpl.py +88 -0
- numba_cuda/numba/cuda/locks.py +19 -0
- numba_cuda/numba/cuda/lowering.py +1951 -0
- numba_cuda/numba/cuda/mathimpl.py +374 -0
- numba_cuda/numba/cuda/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/memory_management/memsys.cu +99 -0
- numba_cuda/numba/cuda/memory_management/memsys.cuh +22 -0
- numba_cuda/numba/cuda/memory_management/nrt.cu +212 -0
- numba_cuda/numba/cuda/memory_management/nrt.cuh +48 -0
- numba_cuda/numba/cuda/memory_management/nrt.py +390 -0
- numba_cuda/numba/cuda/memory_management/nrt_context.py +438 -0
- numba_cuda/numba/cuda/misc/appdirs.py +594 -0
- numba_cuda/numba/cuda/misc/cffiimpl.py +24 -0
- numba_cuda/numba/cuda/misc/coverage_support.py +43 -0
- numba_cuda/numba/cuda/misc/dump_style.py +41 -0
- numba_cuda/numba/cuda/misc/findlib.py +75 -0
- numba_cuda/numba/cuda/misc/firstlinefinder.py +96 -0
- numba_cuda/numba/cuda/misc/gdb_hook.py +240 -0
- numba_cuda/numba/cuda/misc/literal.py +28 -0
- numba_cuda/numba/cuda/misc/llvm_pass_timings.py +412 -0
- numba_cuda/numba/cuda/misc/special.py +94 -0
- numba_cuda/numba/cuda/models.py +56 -0
- numba_cuda/numba/cuda/np/arraymath.py +5130 -0
- numba_cuda/numba/cuda/np/arrayobj.py +7635 -0
- numba_cuda/numba/cuda/np/extensions.py +11 -0
- numba_cuda/numba/cuda/np/linalg.py +3087 -0
- numba_cuda/numba/cuda/np/math/__init__.py +0 -0
- numba_cuda/numba/cuda/np/math/cmathimpl.py +558 -0
- numba_cuda/numba/cuda/np/math/mathimpl.py +487 -0
- numba_cuda/numba/cuda/np/math/numbers.py +1461 -0
- numba_cuda/numba/cuda/np/npdatetime.py +969 -0
- numba_cuda/numba/cuda/np/npdatetime_helpers.py +217 -0
- numba_cuda/numba/cuda/np/npyfuncs.py +1808 -0
- numba_cuda/numba/cuda/np/npyimpl.py +1027 -0
- numba_cuda/numba/cuda/np/numpy_support.py +798 -0
- numba_cuda/numba/cuda/np/polynomial/__init__.py +4 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_core.py +242 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_functions.py +380 -0
- numba_cuda/numba/cuda/np/ufunc/__init__.py +4 -0
- numba_cuda/numba/cuda/np/ufunc/decorators.py +203 -0
- numba_cuda/numba/cuda/np/ufunc/sigparse.py +68 -0
- numba_cuda/numba/cuda/np/ufunc/ufuncbuilder.py +65 -0
- numba_cuda/numba/cuda/np/ufunc_db.py +1282 -0
- numba_cuda/numba/cuda/np/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/np/unsafe/ndarray.py +84 -0
- numba_cuda/numba/cuda/nvvmutils.py +254 -0
- numba_cuda/numba/cuda/printimpl.py +126 -0
- numba_cuda/numba/cuda/random.py +308 -0
- numba_cuda/numba/cuda/reshape_funcs.cu +156 -0
- numba_cuda/numba/cuda/serialize.py +267 -0
- numba_cuda/numba/cuda/simulator/__init__.py +63 -0
- numba_cuda/numba/cuda/simulator/_internal/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/_internal/cuda_bf16.py +2 -0
- numba_cuda/numba/cuda/simulator/api.py +179 -0
- numba_cuda/numba/cuda/simulator/bf16.py +4 -0
- numba_cuda/numba/cuda/simulator/compiler.py +38 -0
- numba_cuda/numba/cuda/simulator/cudadrv/__init__.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devicearray.py +462 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devices.py +122 -0
- numba_cuda/numba/cuda/simulator/cudadrv/driver.py +66 -0
- numba_cuda/numba/cuda/simulator/cudadrv/drvapi.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/dummyarray.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/error.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/libs.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/linkable_code.py +61 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvrtc.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvvm.py +32 -0
- numba_cuda/numba/cuda/simulator/cudadrv/runtime.py +22 -0
- numba_cuda/numba/cuda/simulator/dispatcher.py +11 -0
- numba_cuda/numba/cuda/simulator/kernel.py +320 -0
- numba_cuda/numba/cuda/simulator/kernelapi.py +509 -0
- numba_cuda/numba/cuda/simulator/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/memory_management/nrt.py +21 -0
- numba_cuda/numba/cuda/simulator/reduction.py +19 -0
- numba_cuda/numba/cuda/simulator/tests/support.py +4 -0
- numba_cuda/numba/cuda/simulator/vector_types.py +65 -0
- numba_cuda/numba/cuda/simulator_init.py +18 -0
- numba_cuda/numba/cuda/stubs.py +635 -0
- numba_cuda/numba/cuda/target.py +505 -0
- numba_cuda/numba/cuda/testing.py +347 -0
- numba_cuda/numba/cuda/tests/__init__.py +62 -0
- numba_cuda/numba/cuda/tests/benchmarks/__init__.py +0 -0
- numba_cuda/numba/cuda/tests/benchmarks/test_kernel_launch.py +119 -0
- numba_cuda/numba/cuda/tests/cloudpickle_main_class.py +9 -0
- numba_cuda/numba/cuda/tests/core/serialize_usecases.py +113 -0
- numba_cuda/numba/cuda/tests/core/test_itanium_mangler.py +83 -0
- numba_cuda/numba/cuda/tests/core/test_serialize.py +371 -0
- numba_cuda/numba/cuda/tests/cudadrv/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_array_attr.py +147 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +161 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_array_slicing.py +397 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_auto_context.py +24 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_devicerecord.py +180 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +313 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +187 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +621 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +247 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +100 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +198 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_events.py +53 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_host_alloc.py +72 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_init.py +138 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_inline_ptx.py +43 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_is_fp16.py +15 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linkable_code.py +58 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +348 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +128 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_module_callbacks.py +301 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +174 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvrtc.py +28 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +185 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py +39 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py +23 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_reset_device.py +38 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_runtime.py +48 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_select_device.py +44 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_streams.py +127 -0
- numba_cuda/numba/cuda/tests/cudapy/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_usecases.py +231 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_with_cpu_usecases.py +50 -0
- numba_cuda/numba/cuda/tests/cudapy/cg_cache_usecases.py +36 -0
- numba_cuda/numba/cuda/tests/cudapy/complex_usecases.py +116 -0
- numba_cuda/numba/cuda/tests/cudapy/enum_usecases.py +59 -0
- numba_cuda/numba/cuda/tests/cudapy/extensions_usecases.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/jitlink.ptx +28 -0
- numba_cuda/numba/cuda/tests/cudapy/overload_usecases.py +33 -0
- numba_cuda/numba/cuda/tests/cudapy/recursion_usecases.py +104 -0
- numba_cuda/numba/cuda/tests/cudapy/test_alignment.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_analysis.py +1122 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array.py +344 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_alignment.py +268 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_args.py +203 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_methods.py +63 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_reductions.py +360 -0
- numba_cuda/numba/cuda/tests/cudapy/test_atomics.py +1815 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16.py +599 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16_bindings.py +377 -0
- numba_cuda/numba/cuda/tests/cudapy/test_blackscholes.py +160 -0
- numba_cuda/numba/cuda/tests/cudapy/test_boolean.py +27 -0
- numba_cuda/numba/cuda/tests/cudapy/test_byteflow.py +98 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cache_hints.py +210 -0
- numba_cuda/numba/cuda/tests/cudapy/test_caching.py +683 -0
- numba_cuda/numba/cuda/tests/cudapy/test_casting.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +718 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex.py +370 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex_kernel.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_const_string.py +142 -0
- numba_cuda/numba/cuda/tests/cudapy/test_constmem.py +178 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cooperative_groups.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_copy_propagate.py +131 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +438 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_datetime.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debug.py +105 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +889 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo_types.py +476 -0
- numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +500 -0
- numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +820 -0
- numba_cuda/numba/cuda/tests/cudapy/test_enums.py +152 -0
- numba_cuda/numba/cuda/tests/cudapy/test_errors.py +111 -0
- numba_cuda/numba/cuda/tests/cudapy/test_exception.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending.py +1088 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending_types.py +71 -0
- numba_cuda/numba/cuda/tests/cudapy/test_fastmath.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_flow_control.py +1433 -0
- numba_cuda/numba/cuda/tests/cudapy/test_forall.py +57 -0
- numba_cuda/numba/cuda/tests/cudapy/test_freevar.py +34 -0
- numba_cuda/numba/cuda/tests/cudapy/test_frexp_ldexp.py +69 -0
- numba_cuda/numba/cuda/tests/cudapy/test_globals.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +474 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scalar.py +167 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scheduling.py +92 -0
- numba_cuda/numba/cuda/tests/cudapy/test_idiv.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inline.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inspect.py +255 -0
- numba_cuda/numba/cuda/tests/cudapy/test_intrinsics.py +1219 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +263 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir.py +598 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir_utils.py +276 -0
- numba_cuda/numba/cuda/tests/cudapy/test_iterators.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lang.py +68 -0
- numba_cuda/numba/cuda/tests/cudapy/test_laplace.py +123 -0
- numba_cuda/numba/cuda/tests/cudapy/test_libdevice.py +194 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +220 -0
- numba_cuda/numba/cuda/tests/cudapy/test_localmem.py +173 -0
- numba_cuda/numba/cuda/tests/cudapy/test_make_function_to_jit_function.py +364 -0
- numba_cuda/numba/cuda/tests/cudapy/test_mandel.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_math.py +842 -0
- numba_cuda/numba/cuda/tests/cudapy/test_matmul.py +76 -0
- numba_cuda/numba/cuda/tests/cudapy/test_minmax.py +78 -0
- numba_cuda/numba/cuda/tests/cudapy/test_montecarlo.py +25 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multigpu.py +145 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multiprocessing.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multithreads.py +82 -0
- numba_cuda/numba/cuda/tests/cudapy/test_nondet.py +53 -0
- numba_cuda/numba/cuda/tests/cudapy/test_operator.py +504 -0
- numba_cuda/numba/cuda/tests/cudapy/test_optimization.py +93 -0
- numba_cuda/numba/cuda/tests/cudapy/test_overload.py +402 -0
- numba_cuda/numba/cuda/tests/cudapy/test_powi.py +128 -0
- numba_cuda/numba/cuda/tests/cudapy/test_print.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_py2_div_issue.py +37 -0
- numba_cuda/numba/cuda/tests/cudapy/test_random.py +117 -0
- numba_cuda/numba/cuda/tests/cudapy/test_record_dtype.py +614 -0
- numba_cuda/numba/cuda/tests/cudapy/test_recursion.py +130 -0
- numba_cuda/numba/cuda/tests/cudapy/test_reduction.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_retrieve_autoconverted_arrays.py +83 -0
- numba_cuda/numba/cuda/tests/cudapy/test_serialize.py +86 -0
- numba_cuda/numba/cuda/tests/cudapy/test_slicing.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm.py +457 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm_creation.py +233 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ssa.py +454 -0
- numba_cuda/numba/cuda/tests/cudapy/test_stream_api.py +56 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sync.py +277 -0
- numba_cuda/numba/cuda/tests/cudapy/test_tracing.py +200 -0
- numba_cuda/numba/cuda/tests/cudapy/test_transpose.py +90 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeconv.py +333 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeinfer.py +538 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +585 -0
- numba_cuda/numba/cuda/tests/cudapy/test_userexc.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vector_type.py +485 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize.py +312 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_complex.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_decor.py +183 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_device.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_scalar_arg.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warning.py +206 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +331 -0
- numba_cuda/numba/cuda/tests/cudasim/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/support.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/test_cudasim_issues.py +111 -0
- numba_cuda/numba/cuda/tests/data/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/data/cta_barrier.cu +28 -0
- numba_cuda/numba/cuda/tests/data/cuda_include.cu +10 -0
- numba_cuda/numba/cuda/tests/data/error.cu +12 -0
- numba_cuda/numba/cuda/tests/data/include/add.cuh +8 -0
- numba_cuda/numba/cuda/tests/data/jitlink.cu +28 -0
- numba_cuda/numba/cuda/tests/data/jitlink.ptx +49 -0
- numba_cuda/numba/cuda/tests/data/warn.cu +12 -0
- numba_cuda/numba/cuda/tests/doc_examples/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/functions.cu +54 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/include/mul.cuh +8 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/saxpy.cu +14 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cg.py +86 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpointer.py +68 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +81 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +141 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +160 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +180 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +119 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_random.py +66 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +80 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +206 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ufunc.py +53 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +76 -0
- numba_cuda/numba/cuda/tests/nocuda/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +391 -0
- numba_cuda/numba/cuda/tests/nocuda/test_function_resolution.py +48 -0
- numba_cuda/numba/cuda/tests/nocuda/test_import.py +63 -0
- numba_cuda/numba/cuda/tests/nocuda/test_library_lookup.py +252 -0
- numba_cuda/numba/cuda/tests/nocuda/test_nvvm.py +59 -0
- numba_cuda/numba/cuda/tests/nrt/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt.py +387 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +124 -0
- numba_cuda/numba/cuda/tests/support.py +900 -0
- numba_cuda/numba/cuda/typeconv/__init__.py +4 -0
- numba_cuda/numba/cuda/typeconv/castgraph.py +137 -0
- numba_cuda/numba/cuda/typeconv/rules.py +63 -0
- numba_cuda/numba/cuda/typeconv/typeconv.py +121 -0
- numba_cuda/numba/cuda/types/__init__.py +233 -0
- numba_cuda/numba/cuda/types/__init__.pyi +167 -0
- numba_cuda/numba/cuda/types/abstract.py +9 -0
- numba_cuda/numba/cuda/types/common.py +9 -0
- numba_cuda/numba/cuda/types/containers.py +9 -0
- numba_cuda/numba/cuda/types/cuda_abstract.py +533 -0
- numba_cuda/numba/cuda/types/cuda_common.py +110 -0
- numba_cuda/numba/cuda/types/cuda_containers.py +971 -0
- numba_cuda/numba/cuda/types/cuda_function_type.py +230 -0
- numba_cuda/numba/cuda/types/cuda_functions.py +798 -0
- numba_cuda/numba/cuda/types/cuda_iterators.py +120 -0
- numba_cuda/numba/cuda/types/cuda_misc.py +569 -0
- numba_cuda/numba/cuda/types/cuda_npytypes.py +690 -0
- numba_cuda/numba/cuda/types/cuda_scalars.py +280 -0
- numba_cuda/numba/cuda/types/ext_types.py +101 -0
- numba_cuda/numba/cuda/types/function_type.py +11 -0
- numba_cuda/numba/cuda/types/functions.py +9 -0
- numba_cuda/numba/cuda/types/iterators.py +9 -0
- numba_cuda/numba/cuda/types/misc.py +9 -0
- numba_cuda/numba/cuda/types/npytypes.py +9 -0
- numba_cuda/numba/cuda/types/scalars.py +9 -0
- numba_cuda/numba/cuda/typing/__init__.py +19 -0
- numba_cuda/numba/cuda/typing/arraydecl.py +939 -0
- numba_cuda/numba/cuda/typing/asnumbatype.py +130 -0
- numba_cuda/numba/cuda/typing/bufproto.py +70 -0
- numba_cuda/numba/cuda/typing/builtins.py +1209 -0
- numba_cuda/numba/cuda/typing/cffi_utils.py +219 -0
- numba_cuda/numba/cuda/typing/cmathdecl.py +47 -0
- numba_cuda/numba/cuda/typing/collections.py +138 -0
- numba_cuda/numba/cuda/typing/context.py +782 -0
- numba_cuda/numba/cuda/typing/ctypes_utils.py +125 -0
- numba_cuda/numba/cuda/typing/dictdecl.py +63 -0
- numba_cuda/numba/cuda/typing/enumdecl.py +74 -0
- numba_cuda/numba/cuda/typing/listdecl.py +147 -0
- numba_cuda/numba/cuda/typing/mathdecl.py +158 -0
- numba_cuda/numba/cuda/typing/npdatetime.py +322 -0
- numba_cuda/numba/cuda/typing/npydecl.py +749 -0
- numba_cuda/numba/cuda/typing/setdecl.py +115 -0
- numba_cuda/numba/cuda/typing/templates.py +1446 -0
- numba_cuda/numba/cuda/typing/typeof.py +301 -0
- numba_cuda/numba/cuda/ufuncs.py +746 -0
- numba_cuda/numba/cuda/utils.py +724 -0
- numba_cuda/numba/cuda/vector_types.py +214 -0
- numba_cuda/numba/cuda/vectorizers.py +260 -0
- numba_cuda-0.21.1.dist-info/METADATA +109 -0
- numba_cuda-0.21.1.dist-info/RECORD +488 -0
- numba_cuda-0.21.1.dist-info/WHEEL +5 -0
- numba_cuda-0.21.1.dist-info/licenses/LICENSE +26 -0
- numba_cuda-0.21.1.dist-info/licenses/LICENSE.numba +24 -0
- numba_cuda-0.21.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
import unittest
|
|
5
|
+
import itertools
|
|
6
|
+
import numpy as np
|
|
7
|
+
from numba.cuda.cudadrv.dummyarray import Array
|
|
8
|
+
from numba.cuda.testing import skip_on_cudasim
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@skip_on_cudasim("Tests internals of the CUDA driver device array")
|
|
12
|
+
class TestSlicing(unittest.TestCase):
|
|
13
|
+
def assertSameContig(self, arr, nparr):
|
|
14
|
+
attrs = "C_CONTIGUOUS", "F_CONTIGUOUS"
|
|
15
|
+
for attr in attrs:
|
|
16
|
+
if arr.flags[attr] != nparr.flags[attr]:
|
|
17
|
+
if arr.size == 0 and nparr.size == 0:
|
|
18
|
+
# numpy <=1.7 bug that some empty array are contiguous and
|
|
19
|
+
# some are not
|
|
20
|
+
pass
|
|
21
|
+
else:
|
|
22
|
+
self.fail(
|
|
23
|
+
"contiguous flag mismatch:\ngot=%s\nexpect=%s"
|
|
24
|
+
% (arr.flags, nparr.flags)
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
#### 1D
|
|
28
|
+
|
|
29
|
+
def test_slice0_1d(self):
|
|
30
|
+
nparr = np.empty(4)
|
|
31
|
+
arr = Array.from_desc(
|
|
32
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
33
|
+
)
|
|
34
|
+
self.assertSameContig(arr, nparr)
|
|
35
|
+
xx = -2, -1, 0, 1, 2
|
|
36
|
+
for x in xx:
|
|
37
|
+
expect = nparr[x:]
|
|
38
|
+
got = arr[x:]
|
|
39
|
+
self.assertSameContig(got, expect)
|
|
40
|
+
self.assertEqual(got.shape, expect.shape)
|
|
41
|
+
self.assertEqual(got.strides, expect.strides)
|
|
42
|
+
|
|
43
|
+
def test_slice1_1d(self):
|
|
44
|
+
nparr = np.empty(4)
|
|
45
|
+
arr = Array.from_desc(
|
|
46
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
47
|
+
)
|
|
48
|
+
xx = -2, -1, 0, 1, 2
|
|
49
|
+
for x in xx:
|
|
50
|
+
expect = nparr[:x]
|
|
51
|
+
got = arr[:x]
|
|
52
|
+
self.assertSameContig(got, expect)
|
|
53
|
+
self.assertEqual(got.shape, expect.shape)
|
|
54
|
+
self.assertEqual(got.strides, expect.strides)
|
|
55
|
+
|
|
56
|
+
def test_slice2_1d(self):
|
|
57
|
+
nparr = np.empty(4)
|
|
58
|
+
arr = Array.from_desc(
|
|
59
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
60
|
+
)
|
|
61
|
+
xx = -2, -1, 0, 1, 2
|
|
62
|
+
for x, y in itertools.product(xx, xx):
|
|
63
|
+
expect = nparr[x:y]
|
|
64
|
+
got = arr[x:y]
|
|
65
|
+
self.assertSameContig(got, expect)
|
|
66
|
+
self.assertEqual(got.shape, expect.shape)
|
|
67
|
+
self.assertEqual(got.strides, expect.strides)
|
|
68
|
+
|
|
69
|
+
#### 2D
|
|
70
|
+
|
|
71
|
+
def test_slice0_2d(self):
|
|
72
|
+
nparr = np.empty((4, 5))
|
|
73
|
+
arr = Array.from_desc(
|
|
74
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
75
|
+
)
|
|
76
|
+
xx = -2, 0, 1, 2
|
|
77
|
+
for x in xx:
|
|
78
|
+
expect = nparr[x:]
|
|
79
|
+
got = arr[x:]
|
|
80
|
+
self.assertSameContig(got, expect)
|
|
81
|
+
self.assertEqual(got.shape, expect.shape)
|
|
82
|
+
self.assertEqual(got.strides, expect.strides)
|
|
83
|
+
|
|
84
|
+
for x, y in itertools.product(xx, xx):
|
|
85
|
+
expect = nparr[x:, y:]
|
|
86
|
+
got = arr[x:, y:]
|
|
87
|
+
self.assertSameContig(got, expect)
|
|
88
|
+
self.assertEqual(got.shape, expect.shape)
|
|
89
|
+
self.assertEqual(got.strides, expect.strides)
|
|
90
|
+
|
|
91
|
+
def test_slice1_2d(self):
|
|
92
|
+
nparr = np.empty((4, 5))
|
|
93
|
+
arr = Array.from_desc(
|
|
94
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
95
|
+
)
|
|
96
|
+
xx = -2, 0, 2
|
|
97
|
+
for x in xx:
|
|
98
|
+
expect = nparr[:x]
|
|
99
|
+
got = arr[:x]
|
|
100
|
+
self.assertEqual(got.shape, expect.shape)
|
|
101
|
+
self.assertEqual(got.strides, expect.strides)
|
|
102
|
+
self.assertSameContig(got, expect)
|
|
103
|
+
|
|
104
|
+
for x, y in itertools.product(xx, xx):
|
|
105
|
+
expect = nparr[:x, :y]
|
|
106
|
+
got = arr[:x, :y]
|
|
107
|
+
self.assertEqual(got.shape, expect.shape)
|
|
108
|
+
self.assertEqual(got.strides, expect.strides)
|
|
109
|
+
self.assertSameContig(got, expect)
|
|
110
|
+
|
|
111
|
+
def test_slice2_2d(self):
|
|
112
|
+
nparr = np.empty((4, 5))
|
|
113
|
+
arr = Array.from_desc(
|
|
114
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
115
|
+
)
|
|
116
|
+
xx = -2, 0, 2
|
|
117
|
+
for s, t, u, v in itertools.product(xx, xx, xx, xx):
|
|
118
|
+
expect = nparr[s:t, u:v]
|
|
119
|
+
got = arr[s:t, u:v]
|
|
120
|
+
self.assertSameContig(got, expect)
|
|
121
|
+
self.assertEqual(got.shape, expect.shape)
|
|
122
|
+
self.assertEqual(got.strides, expect.strides)
|
|
123
|
+
|
|
124
|
+
for x, y in itertools.product(xx, xx):
|
|
125
|
+
expect = nparr[s:t, u:v]
|
|
126
|
+
got = arr[s:t, u:v]
|
|
127
|
+
self.assertSameContig(got, expect)
|
|
128
|
+
self.assertEqual(got.shape, expect.shape)
|
|
129
|
+
self.assertEqual(got.strides, expect.strides)
|
|
130
|
+
|
|
131
|
+
#### Strided
|
|
132
|
+
|
|
133
|
+
def test_strided_1d(self):
|
|
134
|
+
nparr = np.empty(4)
|
|
135
|
+
arr = Array.from_desc(
|
|
136
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
137
|
+
)
|
|
138
|
+
xx = -2, -1, 1, 2
|
|
139
|
+
for x in xx:
|
|
140
|
+
expect = nparr[::x]
|
|
141
|
+
got = arr[::x]
|
|
142
|
+
self.assertSameContig(got, expect)
|
|
143
|
+
self.assertEqual(got.shape, expect.shape)
|
|
144
|
+
self.assertEqual(got.strides, expect.strides)
|
|
145
|
+
|
|
146
|
+
def test_strided_2d(self):
|
|
147
|
+
nparr = np.empty((4, 5))
|
|
148
|
+
arr = Array.from_desc(
|
|
149
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
150
|
+
)
|
|
151
|
+
xx = -2, -1, 1, 2
|
|
152
|
+
for a, b in itertools.product(xx, xx):
|
|
153
|
+
expect = nparr[::a, ::b]
|
|
154
|
+
got = arr[::a, ::b]
|
|
155
|
+
self.assertSameContig(got, expect)
|
|
156
|
+
self.assertEqual(got.shape, expect.shape)
|
|
157
|
+
self.assertEqual(got.strides, expect.strides)
|
|
158
|
+
|
|
159
|
+
def test_strided_3d(self):
|
|
160
|
+
nparr = np.empty((4, 5, 6))
|
|
161
|
+
arr = Array.from_desc(
|
|
162
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
163
|
+
)
|
|
164
|
+
xx = -2, -1, 1, 2
|
|
165
|
+
for a, b, c in itertools.product(xx, xx, xx):
|
|
166
|
+
expect = nparr[::a, ::b, ::c]
|
|
167
|
+
got = arr[::a, ::b, ::c]
|
|
168
|
+
self.assertSameContig(got, expect)
|
|
169
|
+
self.assertEqual(got.shape, expect.shape)
|
|
170
|
+
self.assertEqual(got.strides, expect.strides)
|
|
171
|
+
|
|
172
|
+
def test_issue_2766(self):
|
|
173
|
+
z = np.empty((1, 2, 3))
|
|
174
|
+
z = np.transpose(z, axes=(2, 0, 1))
|
|
175
|
+
arr = Array.from_desc(0, z.shape, z.strides, z.itemsize)
|
|
176
|
+
self.assertEqual(z.flags["C_CONTIGUOUS"], arr.flags["C_CONTIGUOUS"])
|
|
177
|
+
self.assertEqual(z.flags["F_CONTIGUOUS"], arr.flags["F_CONTIGUOUS"])
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
@skip_on_cudasim("Tests internals of the CUDA driver device array")
|
|
181
|
+
class TestReshape(unittest.TestCase):
|
|
182
|
+
def test_reshape_2d2d(self):
|
|
183
|
+
nparr = np.empty((4, 5))
|
|
184
|
+
arr = Array.from_desc(
|
|
185
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
186
|
+
)
|
|
187
|
+
expect = nparr.reshape(5, 4)
|
|
188
|
+
got = arr.reshape(5, 4)[0]
|
|
189
|
+
self.assertEqual(got.shape, expect.shape)
|
|
190
|
+
self.assertEqual(got.strides, expect.strides)
|
|
191
|
+
|
|
192
|
+
def test_reshape_2d1d(self):
|
|
193
|
+
nparr = np.empty((4, 5))
|
|
194
|
+
arr = Array.from_desc(
|
|
195
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
196
|
+
)
|
|
197
|
+
expect = nparr.reshape(5 * 4)
|
|
198
|
+
got = arr.reshape(5 * 4)[0]
|
|
199
|
+
self.assertEqual(got.shape, expect.shape)
|
|
200
|
+
self.assertEqual(got.strides, expect.strides)
|
|
201
|
+
|
|
202
|
+
def test_reshape_3d3d(self):
|
|
203
|
+
nparr = np.empty((3, 4, 5))
|
|
204
|
+
arr = Array.from_desc(
|
|
205
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
206
|
+
)
|
|
207
|
+
expect = nparr.reshape(5, 3, 4)
|
|
208
|
+
got = arr.reshape(5, 3, 4)[0]
|
|
209
|
+
self.assertEqual(got.shape, expect.shape)
|
|
210
|
+
self.assertEqual(got.strides, expect.strides)
|
|
211
|
+
|
|
212
|
+
def test_reshape_3d2d(self):
|
|
213
|
+
nparr = np.empty((3, 4, 5))
|
|
214
|
+
arr = Array.from_desc(
|
|
215
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
216
|
+
)
|
|
217
|
+
expect = nparr.reshape(3 * 4, 5)
|
|
218
|
+
got = arr.reshape(3 * 4, 5)[0]
|
|
219
|
+
self.assertEqual(got.shape, expect.shape)
|
|
220
|
+
self.assertEqual(got.strides, expect.strides)
|
|
221
|
+
|
|
222
|
+
def test_reshape_3d1d(self):
|
|
223
|
+
nparr = np.empty((3, 4, 5))
|
|
224
|
+
arr = Array.from_desc(
|
|
225
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
226
|
+
)
|
|
227
|
+
expect = nparr.reshape(3 * 4 * 5)
|
|
228
|
+
got = arr.reshape(3 * 4 * 5)[0]
|
|
229
|
+
self.assertEqual(got.shape, expect.shape)
|
|
230
|
+
self.assertEqual(got.strides, expect.strides)
|
|
231
|
+
|
|
232
|
+
def test_reshape_infer2d2d(self):
|
|
233
|
+
nparr = np.empty((4, 5))
|
|
234
|
+
arr = Array.from_desc(
|
|
235
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
236
|
+
)
|
|
237
|
+
expect = nparr.reshape(-1, 4)
|
|
238
|
+
got = arr.reshape(-1, 4)[0]
|
|
239
|
+
self.assertEqual(got.shape, expect.shape)
|
|
240
|
+
self.assertEqual(got.strides, expect.strides)
|
|
241
|
+
|
|
242
|
+
def test_reshape_infer2d1d(self):
|
|
243
|
+
nparr = np.empty((4, 5))
|
|
244
|
+
arr = Array.from_desc(
|
|
245
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
246
|
+
)
|
|
247
|
+
expect = nparr.reshape(-1)
|
|
248
|
+
got = arr.reshape(-1)[0]
|
|
249
|
+
self.assertEqual(got.shape, expect.shape)
|
|
250
|
+
self.assertEqual(got.strides, expect.strides)
|
|
251
|
+
|
|
252
|
+
def test_reshape_infer3d3d(self):
|
|
253
|
+
nparr = np.empty((3, 4, 5))
|
|
254
|
+
arr = Array.from_desc(
|
|
255
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
256
|
+
)
|
|
257
|
+
expect = nparr.reshape(5, -1, 4)
|
|
258
|
+
got = arr.reshape(5, -1, 4)[0]
|
|
259
|
+
self.assertEqual(got.shape, expect.shape)
|
|
260
|
+
self.assertEqual(got.strides, expect.strides)
|
|
261
|
+
|
|
262
|
+
def test_reshape_infer3d2d(self):
|
|
263
|
+
nparr = np.empty((3, 4, 5))
|
|
264
|
+
arr = Array.from_desc(
|
|
265
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
266
|
+
)
|
|
267
|
+
expect = nparr.reshape(3, -1)
|
|
268
|
+
got = arr.reshape(3, -1)[0]
|
|
269
|
+
self.assertEqual(got.shape, expect.shape)
|
|
270
|
+
self.assertEqual(got.strides, expect.strides)
|
|
271
|
+
|
|
272
|
+
def test_reshape_infer3d1d(self):
|
|
273
|
+
nparr = np.empty((3, 4, 5))
|
|
274
|
+
arr = Array.from_desc(
|
|
275
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
276
|
+
)
|
|
277
|
+
expect = nparr.reshape(-1)
|
|
278
|
+
got = arr.reshape(-1)[0]
|
|
279
|
+
self.assertEqual(got.shape, expect.shape)
|
|
280
|
+
self.assertEqual(got.strides, expect.strides)
|
|
281
|
+
|
|
282
|
+
def test_reshape_infer_two_unknowns(self):
|
|
283
|
+
nparr = np.empty((3, 4, 5))
|
|
284
|
+
arr = Array.from_desc(
|
|
285
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
with self.assertRaises(ValueError) as raises:
|
|
289
|
+
arr.reshape(-1, -1, 3)
|
|
290
|
+
self.assertIn(
|
|
291
|
+
"can only specify one unknown dimension", str(raises.exception)
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
def test_reshape_infer_invalid_shape(self):
|
|
295
|
+
nparr = np.empty((3, 4, 5))
|
|
296
|
+
arr = Array.from_desc(
|
|
297
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
with self.assertRaises(ValueError) as raises:
|
|
301
|
+
arr.reshape(-1, 7)
|
|
302
|
+
|
|
303
|
+
expected_message = "cannot infer valid shape for unknown dimension"
|
|
304
|
+
self.assertIn(expected_message, str(raises.exception))
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
@skip_on_cudasim("Tests internals of the CUDA driver device array")
|
|
308
|
+
class TestSqueeze(unittest.TestCase):
|
|
309
|
+
def test_squeeze(self):
|
|
310
|
+
nparr = np.empty((1, 2, 1, 4, 1, 3))
|
|
311
|
+
arr = Array.from_desc(
|
|
312
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
def _assert_equal_shape_strides(arr1, arr2):
|
|
316
|
+
self.assertEqual(arr1.shape, arr2.shape)
|
|
317
|
+
self.assertEqual(arr1.strides, arr2.strides)
|
|
318
|
+
|
|
319
|
+
_assert_equal_shape_strides(arr, nparr)
|
|
320
|
+
_assert_equal_shape_strides(arr.squeeze()[0], nparr.squeeze())
|
|
321
|
+
for axis in (0, 2, 4, (0, 2), (0, 4), (2, 4), (0, 2, 4)):
|
|
322
|
+
_assert_equal_shape_strides(
|
|
323
|
+
arr.squeeze(axis=axis)[0], nparr.squeeze(axis=axis)
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
def test_squeeze_invalid_axis(self):
|
|
327
|
+
nparr = np.empty((1, 2, 1, 4, 1, 3))
|
|
328
|
+
arr = Array.from_desc(
|
|
329
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
330
|
+
)
|
|
331
|
+
with self.assertRaises(ValueError):
|
|
332
|
+
arr.squeeze(axis=1)
|
|
333
|
+
with self.assertRaises(ValueError):
|
|
334
|
+
arr.squeeze(axis=(2, 3))
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
@skip_on_cudasim("Tests internals of the CUDA driver device array")
|
|
338
|
+
class TestExtent(unittest.TestCase):
|
|
339
|
+
def test_extent_1d(self):
|
|
340
|
+
nparr = np.empty(4)
|
|
341
|
+
arr = Array.from_desc(
|
|
342
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
343
|
+
)
|
|
344
|
+
s, e = arr.extent
|
|
345
|
+
self.assertEqual(e - s, nparr.size * nparr.dtype.itemsize)
|
|
346
|
+
|
|
347
|
+
def test_extent_2d(self):
|
|
348
|
+
nparr = np.empty((4, 5))
|
|
349
|
+
arr = Array.from_desc(
|
|
350
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
351
|
+
)
|
|
352
|
+
s, e = arr.extent
|
|
353
|
+
self.assertEqual(e - s, nparr.size * nparr.dtype.itemsize)
|
|
354
|
+
|
|
355
|
+
def test_extent_iter_1d(self):
|
|
356
|
+
nparr = np.empty(4)
|
|
357
|
+
arr = Array.from_desc(
|
|
358
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
359
|
+
)
|
|
360
|
+
[ext] = list(arr.iter_contiguous_extent())
|
|
361
|
+
self.assertEqual(ext, arr.extent)
|
|
362
|
+
|
|
363
|
+
def test_extent_iter_2d(self):
|
|
364
|
+
nparr = np.empty((4, 5))
|
|
365
|
+
arr = Array.from_desc(
|
|
366
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
367
|
+
)
|
|
368
|
+
[ext] = list(arr.iter_contiguous_extent())
|
|
369
|
+
self.assertEqual(ext, arr.extent)
|
|
370
|
+
|
|
371
|
+
self.assertEqual(len(list(arr[::2].iter_contiguous_extent())), 2)
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
@skip_on_cudasim("Tests internals of the CUDA driver device array")
|
|
375
|
+
class TestIterate(unittest.TestCase):
|
|
376
|
+
def test_for_loop(self):
|
|
377
|
+
# for #4201
|
|
378
|
+
N = 5
|
|
379
|
+
nparr = np.empty(N)
|
|
380
|
+
arr = Array.from_desc(
|
|
381
|
+
0, nparr.shape, nparr.strides, nparr.dtype.itemsize
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
x = 0 # just a placeholder
|
|
385
|
+
# this loop should not raise AssertionError
|
|
386
|
+
for val in arr:
|
|
387
|
+
x = val # noqa: F841
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
if __name__ == "__main__":
|
|
391
|
+
unittest.main()
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
from numba.cuda.testing import unittest, skip_on_cudasim
|
|
5
|
+
import operator
|
|
6
|
+
from numba.cuda import types, typing
|
|
7
|
+
from numba.cuda.cudadrv import nvvm
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@unittest.skipIf(not nvvm.is_available(), "No libNVVM")
|
|
11
|
+
@skip_on_cudasim("Skip on simulator due to use of cuda_target")
|
|
12
|
+
class TestFunctionResolution(unittest.TestCase):
|
|
13
|
+
def test_fp16_binary_operators(self):
|
|
14
|
+
from numba.cuda.descriptor import cuda_target
|
|
15
|
+
|
|
16
|
+
ops = (
|
|
17
|
+
operator.add,
|
|
18
|
+
operator.iadd,
|
|
19
|
+
operator.sub,
|
|
20
|
+
operator.isub,
|
|
21
|
+
operator.mul,
|
|
22
|
+
operator.imul,
|
|
23
|
+
)
|
|
24
|
+
for op in ops:
|
|
25
|
+
fp16 = types.float16
|
|
26
|
+
typingctx = cuda_target.typing_context
|
|
27
|
+
typingctx.refresh()
|
|
28
|
+
fnty = typingctx.resolve_value_type(op)
|
|
29
|
+
out = typingctx.resolve_function_type(fnty, (fp16, fp16), {})
|
|
30
|
+
self.assertEqual(
|
|
31
|
+
out, typing.signature(fp16, fp16, fp16), msg=str(out)
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def test_fp16_unary_operators(self):
|
|
35
|
+
from numba.cuda.descriptor import cuda_target
|
|
36
|
+
|
|
37
|
+
ops = (operator.neg, abs)
|
|
38
|
+
for op in ops:
|
|
39
|
+
fp16 = types.float16
|
|
40
|
+
typingctx = cuda_target.typing_context
|
|
41
|
+
typingctx.refresh()
|
|
42
|
+
fnty = typingctx.resolve_value_type(op)
|
|
43
|
+
out = typingctx.resolve_function_type(fnty, (fp16,), {})
|
|
44
|
+
self.assertEqual(out, typing.signature(fp16, fp16), msg=str(out))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
unittest.main()
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
from numba.cuda.tests.support import run_in_subprocess
|
|
5
|
+
import unittest
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestImport(unittest.TestCase):
|
|
9
|
+
def test_no_impl_import(self):
|
|
10
|
+
"""
|
|
11
|
+
Tests that importing cuda doesn't trigger the import of modules
|
|
12
|
+
containing lowering implementation that would likely install things in
|
|
13
|
+
the builtins registry and have side effects impacting other targets.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
banlist = (
|
|
17
|
+
"numba.cpython.slicing",
|
|
18
|
+
"numba.cpython.tupleobj",
|
|
19
|
+
"numba.cpython.enumimpl",
|
|
20
|
+
"numba.cpython.hashing",
|
|
21
|
+
"numba.cpython.heapq",
|
|
22
|
+
"numba.cpython.iterators",
|
|
23
|
+
"numba.cpython.numbers",
|
|
24
|
+
"numba.cpython.rangeobj",
|
|
25
|
+
"numba.cpython.cmathimpl",
|
|
26
|
+
"numba.cpython.mathimpl",
|
|
27
|
+
"numba.cpython.printimpl",
|
|
28
|
+
"numba.cuda.python.slicing",
|
|
29
|
+
"numba.cuda.python.tupleobj",
|
|
30
|
+
"numba.cuda.python.enumimpl",
|
|
31
|
+
"numba.cuda.python.hashing",
|
|
32
|
+
"numba.cuda.python.heapq",
|
|
33
|
+
"numba.cuda.python.iterators",
|
|
34
|
+
"numba.cuda.python.numbers",
|
|
35
|
+
"numba.cuda.python.rangeobj",
|
|
36
|
+
"numba.cuda.python.cmathimpl",
|
|
37
|
+
"numba.cuda.python.mathimpl",
|
|
38
|
+
"numba.cuda.python.printimpl",
|
|
39
|
+
"numba.cuda.core.optional",
|
|
40
|
+
"numba.cuda.misc.gdb_hook",
|
|
41
|
+
"numba.cuda.misc.cffiimpl",
|
|
42
|
+
"numba.np.linalg",
|
|
43
|
+
"numba.np.polynomial",
|
|
44
|
+
"numba.np.arraymath",
|
|
45
|
+
"numba.np.npdatetime",
|
|
46
|
+
"numba.np.npyimpl",
|
|
47
|
+
"numba.cuda.np.linalg",
|
|
48
|
+
"numba.cuda.np.polynomial",
|
|
49
|
+
"numba.cuda.np.arraymath",
|
|
50
|
+
"numba.cuda.np.npdatetime",
|
|
51
|
+
"numba.cuda.np.npyimpl",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
code = "import sys; from numba import cuda; print(list(sys.modules))"
|
|
55
|
+
|
|
56
|
+
out, _ = run_in_subprocess(code)
|
|
57
|
+
modlist = set(eval(out.strip()))
|
|
58
|
+
unexpected = set(banlist) & set(modlist)
|
|
59
|
+
self.assertFalse(unexpected, "some modules unexpectedly imported")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
unittest.main()
|