numba-cuda 0.22.0__cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.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.
Potentially problematic release.
This version of numba-cuda might be problematic. Click here for more details.
- _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 +580 -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.cpp +159 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpython-312-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_devicearray.h +29 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpp +1098 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpython-312-aarch64-linux-gnu.so +0 -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.cpython-312-aarch64-linux-gnu.so +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.cpp +206 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpython-312-aarch64-linux-gnu.so +0 -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.cpython-312-aarch64-linux-gnu.so +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 +543 -0
- numba_cuda/numba/cuda/cudadrv/__init__.py +14 -0
- numba_cuda/numba/cuda/cudadrv/devicearray.py +954 -0
- numba_cuda/numba/cuda/cudadrv/devices.py +249 -0
- numba_cuda/numba/cuda/cudadrv/driver.py +3238 -0
- numba_cuda/numba/cuda/cudadrv/drvapi.py +435 -0
- numba_cuda/numba/cuda/cudadrv/dummyarray.py +562 -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 +983 -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 +997 -0
- numba_cuda/numba/cuda/decorators.py +294 -0
- numba_cuda/numba/cuda/descriptor.py +35 -0
- numba_cuda/numba/cuda/device_init.py +155 -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/intrinsics.py +531 -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 +1980 -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 +624 -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 +191 -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 +200 -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 +978 -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 +446 -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 +452 -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.22.0.dist-info/METADATA +109 -0
- numba_cuda-0.22.0.dist-info/RECORD +487 -0
- numba_cuda-0.22.0.dist-info/WHEEL +6 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE +26 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE.numba +24 -0
- numba_cuda-0.22.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pytest
|
|
7
|
+
from numba.cuda.testing import (
|
|
8
|
+
skip_unless_cc_53,
|
|
9
|
+
unittest,
|
|
10
|
+
CUDATestCase,
|
|
11
|
+
skip_on_cudasim,
|
|
12
|
+
)
|
|
13
|
+
from numba.cuda.np import numpy_support
|
|
14
|
+
from numba import cuda, vectorize
|
|
15
|
+
from numba.cuda import float32, float64, int32, void, int64
|
|
16
|
+
import math
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def math_acos(A, B):
|
|
20
|
+
i = cuda.grid(1)
|
|
21
|
+
B[i] = math.acos(A[i])
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def math_asin(A, B):
|
|
25
|
+
i = cuda.grid(1)
|
|
26
|
+
B[i] = math.asin(A[i])
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def math_atan(A, B):
|
|
30
|
+
i = cuda.grid(1)
|
|
31
|
+
B[i] = math.atan(A[i])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def math_acosh(A, B):
|
|
35
|
+
i = cuda.grid(1)
|
|
36
|
+
B[i] = math.acosh(A[i])
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def math_asinh(A, B):
|
|
40
|
+
i = cuda.grid(1)
|
|
41
|
+
B[i] = math.asinh(A[i])
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def math_atanh(A, B):
|
|
45
|
+
i = cuda.grid(1)
|
|
46
|
+
B[i] = math.atanh(A[i])
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def math_cos(A, B):
|
|
50
|
+
i = cuda.grid(1)
|
|
51
|
+
B[i] = math.cos(A[i])
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def math_sin(A, B):
|
|
55
|
+
i = cuda.grid(1)
|
|
56
|
+
B[i] = math.sin(A[i])
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def math_tan(A, B):
|
|
60
|
+
i = cuda.grid(1)
|
|
61
|
+
B[i] = math.tan(A[i])
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def math_cosh(A, B):
|
|
65
|
+
i = cuda.grid(1)
|
|
66
|
+
B[i] = math.cosh(A[i])
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def math_sinh(A, B):
|
|
70
|
+
i = cuda.grid(1)
|
|
71
|
+
B[i] = math.sinh(A[i])
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def math_tanh(A, B):
|
|
75
|
+
i = cuda.grid(1)
|
|
76
|
+
B[i] = math.tanh(A[i])
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def math_atan2(A, B, C):
|
|
80
|
+
i = cuda.grid(1)
|
|
81
|
+
C[i] = math.atan2(A[i], B[i])
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def math_exp(A, B):
|
|
85
|
+
i = cuda.grid(1)
|
|
86
|
+
B[i] = math.exp(A[i])
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def math_exp2(A, B):
|
|
90
|
+
i = cuda.grid(1)
|
|
91
|
+
B[i] = math.exp2(A[i])
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def math_erf(A, B):
|
|
95
|
+
i = cuda.grid(1)
|
|
96
|
+
B[i] = math.erf(A[i])
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def math_erfc(A, B):
|
|
100
|
+
i = cuda.grid(1)
|
|
101
|
+
B[i] = math.erfc(A[i])
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def math_expm1(A, B):
|
|
105
|
+
i = cuda.grid(1)
|
|
106
|
+
B[i] = math.expm1(A[i])
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def math_fabs(A, B):
|
|
110
|
+
i = cuda.grid(1)
|
|
111
|
+
B[i] = math.fabs(A[i])
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def math_gamma(A, B):
|
|
115
|
+
i = cuda.grid(1)
|
|
116
|
+
B[i] = math.gamma(A[i])
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def math_lgamma(A, B):
|
|
120
|
+
i = cuda.grid(1)
|
|
121
|
+
B[i] = math.lgamma(A[i])
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def math_log(A, B):
|
|
125
|
+
i = cuda.grid(1)
|
|
126
|
+
B[i] = math.log(A[i])
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def math_log2(A, B):
|
|
130
|
+
i = cuda.grid(1)
|
|
131
|
+
B[i] = math.log2(A[i])
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def math_log10(A, B):
|
|
135
|
+
i = cuda.grid(1)
|
|
136
|
+
B[i] = math.log10(A[i])
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def math_log1p(A, B):
|
|
140
|
+
i = cuda.grid(1)
|
|
141
|
+
B[i] = math.log1p(A[i])
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def math_remainder(A, B, C):
|
|
145
|
+
i = cuda.grid(1)
|
|
146
|
+
C[i] = math.remainder(A[i], B[i])
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def math_nextafter(A, B, C):
|
|
150
|
+
i = cuda.grid(1)
|
|
151
|
+
C[i] = math.nextafter(A[i], B[i])
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def math_sqrt(A, B):
|
|
155
|
+
i = cuda.grid(1)
|
|
156
|
+
B[i] = math.sqrt(A[i])
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def math_hypot(A, B, C):
|
|
160
|
+
i = cuda.grid(1)
|
|
161
|
+
C[i] = math.hypot(A[i], B[i])
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def math_pow(A, B, C):
|
|
165
|
+
i = cuda.grid(1)
|
|
166
|
+
C[i] = math.pow(A[i], B[i])
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def math_ceil(A, B):
|
|
170
|
+
i = cuda.grid(1)
|
|
171
|
+
B[i] = math.ceil(A[i])
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def math_floor(A, B):
|
|
175
|
+
i = cuda.grid(1)
|
|
176
|
+
B[i] = math.floor(A[i])
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def math_copysign(A, B, C):
|
|
180
|
+
i = cuda.grid(1)
|
|
181
|
+
C[i] = math.copysign(A[i], B[i])
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def math_fmod(A, B, C):
|
|
185
|
+
i = cuda.grid(1)
|
|
186
|
+
C[i] = math.fmod(A[i], B[i])
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def math_modf(A, B, C):
|
|
190
|
+
i = cuda.grid(1)
|
|
191
|
+
B[i], C[i] = math.modf(A[i])
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def math_isnan(A, B):
|
|
195
|
+
i = cuda.grid(1)
|
|
196
|
+
B[i] = math.isnan(A[i])
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def math_isinf(A, B):
|
|
200
|
+
i = cuda.grid(1)
|
|
201
|
+
B[i] = math.isinf(A[i])
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def math_isfinite(A, B):
|
|
205
|
+
i = cuda.grid(1)
|
|
206
|
+
B[i] = math.isfinite(A[i])
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def math_degrees(A, B):
|
|
210
|
+
i = cuda.grid(1)
|
|
211
|
+
B[i] = math.degrees(A[i])
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def math_radians(A, B):
|
|
215
|
+
i = cuda.grid(1)
|
|
216
|
+
B[i] = math.radians(A[i])
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def math_trunc(A, B):
|
|
220
|
+
i = cuda.grid(1)
|
|
221
|
+
B[i] = math.trunc(A[i])
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def math_pow_binop(A, B, C):
|
|
225
|
+
i = cuda.grid(1)
|
|
226
|
+
C[i] = A[i] ** B[i]
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def math_mod_binop(A, B, C):
|
|
230
|
+
i = cuda.grid(1)
|
|
231
|
+
C[i] = A[i] % B[i]
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class TestCudaMath(CUDATestCase):
|
|
235
|
+
def unary_template_float16(self, func, npfunc, start=0, stop=1):
|
|
236
|
+
self.unary_template(func, npfunc, np.float16, np.float16, start, stop)
|
|
237
|
+
|
|
238
|
+
def unary_template_float32(self, func, npfunc, start=0, stop=1):
|
|
239
|
+
self.unary_template(func, npfunc, np.float32, np.float32, start, stop)
|
|
240
|
+
|
|
241
|
+
def unary_template_float64(self, func, npfunc, start=0, stop=1):
|
|
242
|
+
self.unary_template(func, npfunc, np.float64, np.float64, start, stop)
|
|
243
|
+
|
|
244
|
+
def unary_template_int64(self, func, npfunc, start=0, stop=50):
|
|
245
|
+
self.unary_template(func, npfunc, np.int64, np.float64, start, stop)
|
|
246
|
+
|
|
247
|
+
def unary_template_uint64(self, func, npfunc, start=0, stop=50):
|
|
248
|
+
self.unary_template(func, npfunc, np.uint64, np.float64, start, stop)
|
|
249
|
+
|
|
250
|
+
def unary_template(self, func, npfunc, npdtype, nprestype, start, stop):
|
|
251
|
+
nelem = 50
|
|
252
|
+
A = np.linspace(start, stop, nelem, dtype=npdtype)
|
|
253
|
+
B = np.empty_like(A, dtype=nprestype)
|
|
254
|
+
arytype = numpy_support.from_dtype(npdtype)[::1]
|
|
255
|
+
restype = numpy_support.from_dtype(nprestype)[::1]
|
|
256
|
+
cfunc = cuda.jit((arytype, restype))(func)
|
|
257
|
+
cfunc[1, nelem](A, B)
|
|
258
|
+
|
|
259
|
+
# When this test was originally written it used
|
|
260
|
+
# assertTrue(np.allclose(...), which has different default tolerance
|
|
261
|
+
# values to assert_allclose. The tolerance values here are chosen as
|
|
262
|
+
# the tightest under which the tests will pass.
|
|
263
|
+
if npdtype == np.float64:
|
|
264
|
+
rtol = 1e-13
|
|
265
|
+
elif npdtype == np.float32:
|
|
266
|
+
rtol = 1e-6
|
|
267
|
+
else:
|
|
268
|
+
rtol = 1e-3
|
|
269
|
+
np.testing.assert_allclose(npfunc(A), B, rtol=rtol)
|
|
270
|
+
|
|
271
|
+
def unary_bool_special_values(self, func, npfunc, npdtype, npmtype):
|
|
272
|
+
fi = np.finfo(npdtype)
|
|
273
|
+
denorm = fi.tiny / 4
|
|
274
|
+
A = np.array(
|
|
275
|
+
[0.0, denorm, fi.tiny, 0.5, 1.0, fi.max, np.inf, np.nan],
|
|
276
|
+
dtype=npdtype,
|
|
277
|
+
)
|
|
278
|
+
B = np.empty_like(A, dtype=np.int32)
|
|
279
|
+
cfunc = cuda.jit((npmtype[::1], int32[::1]))(func)
|
|
280
|
+
|
|
281
|
+
cfunc[1, A.size](A, B)
|
|
282
|
+
np.testing.assert_array_equal(B, npfunc(A))
|
|
283
|
+
|
|
284
|
+
cfunc[1, A.size](-A, B)
|
|
285
|
+
np.testing.assert_array_equal(B, npfunc(-A))
|
|
286
|
+
|
|
287
|
+
def unary_bool_special_values_float32(self, func, npfunc):
|
|
288
|
+
self.unary_bool_special_values(func, npfunc, np.float32, float32)
|
|
289
|
+
|
|
290
|
+
def unary_bool_special_values_float64(self, func, npfunc):
|
|
291
|
+
self.unary_bool_special_values(func, npfunc, np.float64, float64)
|
|
292
|
+
|
|
293
|
+
def unary_bool_template_float32(self, func, npfunc, start=0, stop=1):
|
|
294
|
+
self.unary_template(func, npfunc, np.float32, np.float32, start, stop)
|
|
295
|
+
|
|
296
|
+
def unary_bool_template_float64(self, func, npfunc, start=0, stop=1):
|
|
297
|
+
self.unary_template(func, npfunc, np.float64, np.float64, start, stop)
|
|
298
|
+
|
|
299
|
+
def unary_bool_template_int32(self, func, npfunc, start=0, stop=49):
|
|
300
|
+
self.unary_template(func, npfunc, np.int32, np.int32, start, stop)
|
|
301
|
+
|
|
302
|
+
def unary_bool_template_int64(self, func, npfunc, start=0, stop=49):
|
|
303
|
+
self.unary_template(func, npfunc, np.int64, np.int64, start, stop)
|
|
304
|
+
|
|
305
|
+
def unary_bool_template(self, func, npfunc, npdtype, npmtype, start, stop):
|
|
306
|
+
nelem = 50
|
|
307
|
+
A = np.linspace(start, stop, nelem).astype(npdtype)
|
|
308
|
+
B = np.empty(A.shape, dtype=np.int32)
|
|
309
|
+
iarytype = npmtype[::1]
|
|
310
|
+
oarytype = int32[::1]
|
|
311
|
+
cfunc = cuda.jit((iarytype, oarytype))(func)
|
|
312
|
+
cfunc[1, nelem](A, B)
|
|
313
|
+
np.testing.assert_allclose(npfunc(A), B)
|
|
314
|
+
|
|
315
|
+
def binary_template_float32(self, func, npfunc, start=0, stop=1):
|
|
316
|
+
self.binary_template(func, npfunc, np.float32, np.float32, start, stop)
|
|
317
|
+
|
|
318
|
+
def binary_template_float64(self, func, npfunc, start=0, stop=1):
|
|
319
|
+
self.binary_template(func, npfunc, np.float64, np.float64, start, stop)
|
|
320
|
+
|
|
321
|
+
def binary_template_int64(self, func, npfunc, start=0, stop=50):
|
|
322
|
+
self.binary_template(func, npfunc, np.int64, np.float64, start, stop)
|
|
323
|
+
|
|
324
|
+
def binary_template_uint64(self, func, npfunc, start=0, stop=50):
|
|
325
|
+
self.binary_template(func, npfunc, np.uint64, np.float64, start, stop)
|
|
326
|
+
|
|
327
|
+
def binary_template(self, func, npfunc, npdtype, nprestype, start, stop):
|
|
328
|
+
nelem = 50
|
|
329
|
+
A = np.linspace(start, stop, nelem).astype(npdtype)
|
|
330
|
+
B = np.empty_like(A).astype(nprestype)
|
|
331
|
+
arytype = numpy_support.from_dtype(npdtype)[::1]
|
|
332
|
+
restype = numpy_support.from_dtype(nprestype)[::1]
|
|
333
|
+
cfunc = cuda.jit((arytype, arytype, restype))(func)
|
|
334
|
+
cfunc[1, nelem](A, A, B)
|
|
335
|
+
np.testing.assert_allclose(npfunc(A, A), B)
|
|
336
|
+
|
|
337
|
+
# ---------------------------------------------------------------------------
|
|
338
|
+
# test_math_acos
|
|
339
|
+
|
|
340
|
+
def test_math_acos(self):
|
|
341
|
+
self.unary_template_float32(math_acos, np.arccos)
|
|
342
|
+
self.unary_template_float64(math_acos, np.arccos)
|
|
343
|
+
# For integers we can only test with zero, since <=-1 and >=1 result in
|
|
344
|
+
# invalid values.
|
|
345
|
+
self.unary_template_int64(math_acos, np.arccos, start=0, stop=0)
|
|
346
|
+
self.unary_template_uint64(math_acos, np.arccos, start=0, stop=0)
|
|
347
|
+
|
|
348
|
+
# ---------------------------------------------------------------------------
|
|
349
|
+
# test_math_asin
|
|
350
|
+
|
|
351
|
+
def test_math_asin(self):
|
|
352
|
+
self.unary_template_float32(math_asin, np.arcsin)
|
|
353
|
+
self.unary_template_float64(math_asin, np.arcsin)
|
|
354
|
+
# For integers we can only test with zero, since <=-1 and >=1 result in
|
|
355
|
+
# invalid values.
|
|
356
|
+
self.unary_template_int64(math_asin, np.arcsin, start=0, stop=0)
|
|
357
|
+
self.unary_template_uint64(math_asin, np.arcsin, start=0, stop=0)
|
|
358
|
+
|
|
359
|
+
# ---------------------------------------------------------------------------
|
|
360
|
+
# test_math_atan
|
|
361
|
+
|
|
362
|
+
def test_math_atan(self):
|
|
363
|
+
self.unary_template_float32(math_atan, np.arctan)
|
|
364
|
+
self.unary_template_float64(math_atan, np.arctan)
|
|
365
|
+
self.unary_template_int64(math_atan, np.arctan)
|
|
366
|
+
self.unary_template_uint64(math_atan, np.arctan)
|
|
367
|
+
|
|
368
|
+
# ---------------------------------------------------------------------------
|
|
369
|
+
# test_math_acosh
|
|
370
|
+
|
|
371
|
+
def test_math_acosh(self):
|
|
372
|
+
self.unary_template_float32(math_acosh, np.arccosh, start=1, stop=2)
|
|
373
|
+
self.unary_template_float64(math_acosh, np.arccosh, start=1, stop=2)
|
|
374
|
+
self.unary_template_int64(math_acosh, np.arccosh, start=1, stop=2)
|
|
375
|
+
self.unary_template_uint64(math_acosh, np.arccosh, start=1, stop=2)
|
|
376
|
+
|
|
377
|
+
# ---------------------------------------------------------------------------
|
|
378
|
+
# test_math_asinh
|
|
379
|
+
|
|
380
|
+
def test_math_asinh(self):
|
|
381
|
+
self.unary_template_float32(math_asinh, np.arcsinh)
|
|
382
|
+
self.unary_template_float64(math_asinh, np.arcsinh)
|
|
383
|
+
self.unary_template_int64(math_asinh, np.arcsinh)
|
|
384
|
+
self.unary_template_uint64(math_asinh, np.arcsinh)
|
|
385
|
+
|
|
386
|
+
# ---------------------------------------------------------------------------
|
|
387
|
+
# test_math_atanh
|
|
388
|
+
|
|
389
|
+
def test_math_atanh(self):
|
|
390
|
+
self.unary_template_float32(math_atanh, np.arctanh, start=0, stop=0.9)
|
|
391
|
+
self.unary_template_float64(math_atanh, np.arctanh, start=0, stop=0.9)
|
|
392
|
+
self.unary_template_int64(math_atanh, np.arctanh, start=0, stop=0.9)
|
|
393
|
+
self.unary_template_uint64(math_atanh, np.arctanh, start=0, stop=0.9)
|
|
394
|
+
|
|
395
|
+
# ---------------------------------------------------------------------------
|
|
396
|
+
# test_math_cos
|
|
397
|
+
|
|
398
|
+
def test_math_cos(self):
|
|
399
|
+
self.unary_template_float32(math_cos, np.cos)
|
|
400
|
+
self.unary_template_float64(math_cos, np.cos)
|
|
401
|
+
self.unary_template_int64(math_cos, np.cos)
|
|
402
|
+
self.unary_template_uint64(math_cos, np.cos)
|
|
403
|
+
|
|
404
|
+
@skip_unless_cc_53
|
|
405
|
+
def test_math_fp16(self):
|
|
406
|
+
self.unary_template_float16(math_sin, np.sin)
|
|
407
|
+
self.unary_template_float16(math_cos, np.cos)
|
|
408
|
+
self.unary_template_float16(math_exp, np.exp)
|
|
409
|
+
self.unary_template_float16(math_log, np.log, start=1)
|
|
410
|
+
self.unary_template_float16(math_log2, np.log2, start=1)
|
|
411
|
+
self.unary_template_float16(math_log10, np.log10, start=1)
|
|
412
|
+
self.unary_template_float16(math_fabs, np.fabs, start=-1)
|
|
413
|
+
self.unary_template_float16(math_sqrt, np.sqrt)
|
|
414
|
+
self.unary_template_float16(math_ceil, np.ceil)
|
|
415
|
+
self.unary_template_float16(math_floor, np.floor)
|
|
416
|
+
if sys.version_info >= (3, 11):
|
|
417
|
+
self.unary_template_float16(math_exp2, np.exp2)
|
|
418
|
+
|
|
419
|
+
@skip_on_cudasim("numpy does not support trunc for float16")
|
|
420
|
+
@skip_unless_cc_53
|
|
421
|
+
def test_math_fp16_trunc(self):
|
|
422
|
+
self.unary_template_float16(math_trunc, np.trunc)
|
|
423
|
+
|
|
424
|
+
# ---------------------------------------------------------------------------
|
|
425
|
+
# test_math_sin
|
|
426
|
+
|
|
427
|
+
def test_math_sin(self):
|
|
428
|
+
self.unary_template_float32(math_sin, np.sin)
|
|
429
|
+
self.unary_template_float64(math_sin, np.sin)
|
|
430
|
+
self.unary_template_int64(math_sin, np.sin)
|
|
431
|
+
self.unary_template_uint64(math_sin, np.sin)
|
|
432
|
+
|
|
433
|
+
# ---------------------------------------------------------------------------
|
|
434
|
+
# test_math_tan
|
|
435
|
+
|
|
436
|
+
def test_math_tan(self):
|
|
437
|
+
self.unary_template_float32(math_tan, np.tan)
|
|
438
|
+
self.unary_template_float64(math_tan, np.tan)
|
|
439
|
+
self.unary_template_int64(math_tan, np.tan)
|
|
440
|
+
self.unary_template_uint64(math_tan, np.tan)
|
|
441
|
+
|
|
442
|
+
# ---------------------------------------------------------------------------
|
|
443
|
+
# test_math_cosh
|
|
444
|
+
|
|
445
|
+
def test_math_cosh(self):
|
|
446
|
+
self.unary_template_float32(math_cosh, np.cosh)
|
|
447
|
+
self.unary_template_float64(math_cosh, np.cosh)
|
|
448
|
+
self.unary_template_int64(math_cosh, np.cosh)
|
|
449
|
+
self.unary_template_uint64(math_cosh, np.cosh)
|
|
450
|
+
|
|
451
|
+
# ---------------------------------------------------------------------------
|
|
452
|
+
# test_math_sinh
|
|
453
|
+
|
|
454
|
+
def test_math_sinh(self):
|
|
455
|
+
self.unary_template_float32(math_sinh, np.sinh)
|
|
456
|
+
self.unary_template_float64(math_sinh, np.sinh)
|
|
457
|
+
self.unary_template_int64(math_sinh, np.sinh)
|
|
458
|
+
self.unary_template_uint64(math_sinh, np.sinh)
|
|
459
|
+
|
|
460
|
+
# ---------------------------------------------------------------------------
|
|
461
|
+
# test_math_tanh
|
|
462
|
+
|
|
463
|
+
def test_math_tanh(self):
|
|
464
|
+
self.unary_template_float32(math_tanh, np.tanh)
|
|
465
|
+
self.unary_template_float64(math_tanh, np.tanh)
|
|
466
|
+
self.unary_template_int64(math_tanh, np.tanh)
|
|
467
|
+
self.unary_template_uint64(math_tanh, np.tanh)
|
|
468
|
+
|
|
469
|
+
# ---------------------------------------------------------------------------
|
|
470
|
+
# test_math_atan2
|
|
471
|
+
|
|
472
|
+
def test_math_atan2(self):
|
|
473
|
+
self.binary_template_float32(math_atan2, np.arctan2)
|
|
474
|
+
self.binary_template_float64(math_atan2, np.arctan2)
|
|
475
|
+
self.binary_template_int64(math_atan2, np.arctan2)
|
|
476
|
+
self.binary_template_uint64(math_atan2, np.arctan2)
|
|
477
|
+
|
|
478
|
+
# ---------------------------------------------------------------------------
|
|
479
|
+
# test_math_erf
|
|
480
|
+
|
|
481
|
+
def test_math_erf(self):
|
|
482
|
+
@vectorize
|
|
483
|
+
def ufunc(x):
|
|
484
|
+
return math.erf(x)
|
|
485
|
+
|
|
486
|
+
self.unary_template_float32(math_erf, ufunc)
|
|
487
|
+
self.unary_template_float64(math_erf, ufunc)
|
|
488
|
+
self.unary_template_int64(math_erf, ufunc)
|
|
489
|
+
self.unary_template_uint64(math_erf, ufunc)
|
|
490
|
+
|
|
491
|
+
# ---------------------------------------------------------------------------
|
|
492
|
+
# test_math_erfc
|
|
493
|
+
|
|
494
|
+
def test_math_erfc(self):
|
|
495
|
+
@vectorize
|
|
496
|
+
def ufunc(x):
|
|
497
|
+
return math.erfc(x)
|
|
498
|
+
|
|
499
|
+
self.unary_template_float32(math_erfc, ufunc)
|
|
500
|
+
self.unary_template_float64(math_erfc, ufunc)
|
|
501
|
+
self.unary_template_int64(math_erfc, ufunc)
|
|
502
|
+
self.unary_template_uint64(math_erfc, ufunc)
|
|
503
|
+
|
|
504
|
+
# ---------------------------------------------------------------------------
|
|
505
|
+
# test_math_exp
|
|
506
|
+
|
|
507
|
+
def test_math_exp(self):
|
|
508
|
+
self.unary_template_float32(math_exp, np.exp)
|
|
509
|
+
self.unary_template_float64(math_exp, np.exp)
|
|
510
|
+
self.unary_template_int64(math_exp, np.exp)
|
|
511
|
+
self.unary_template_uint64(math_exp, np.exp)
|
|
512
|
+
|
|
513
|
+
# ---------------------------------------------------------------------------
|
|
514
|
+
# test_math_exp2
|
|
515
|
+
|
|
516
|
+
@unittest.skipUnless(sys.version_info >= (3, 11), "Python 3.11+ required")
|
|
517
|
+
def test_math_exp2(self):
|
|
518
|
+
self.unary_template_float32(math_exp2, np.exp2)
|
|
519
|
+
self.unary_template_float64(math_exp2, np.exp2)
|
|
520
|
+
self.unary_template_int64(math_exp2, np.exp2)
|
|
521
|
+
self.unary_template_uint64(math_exp2, np.exp2)
|
|
522
|
+
|
|
523
|
+
# ---------------------------------------------------------------------------
|
|
524
|
+
# test_math_expm1
|
|
525
|
+
|
|
526
|
+
def test_math_expm1(self):
|
|
527
|
+
self.unary_template_float32(math_expm1, np.expm1)
|
|
528
|
+
self.unary_template_float64(math_expm1, np.expm1)
|
|
529
|
+
self.unary_template_int64(math_expm1, np.expm1)
|
|
530
|
+
self.unary_template_uint64(math_expm1, np.expm1)
|
|
531
|
+
|
|
532
|
+
# ---------------------------------------------------------------------------
|
|
533
|
+
# test_math_fabs
|
|
534
|
+
|
|
535
|
+
def test_math_fabs(self):
|
|
536
|
+
self.unary_template_float32(math_fabs, np.fabs, start=-1)
|
|
537
|
+
self.unary_template_float64(math_fabs, np.fabs, start=-1)
|
|
538
|
+
self.unary_template_int64(math_fabs, np.fabs, start=-1)
|
|
539
|
+
self.unary_template_uint64(math_fabs, np.fabs, start=0)
|
|
540
|
+
|
|
541
|
+
# ---------------------------------------------------------------------------
|
|
542
|
+
# test_math_gamma
|
|
543
|
+
|
|
544
|
+
def test_math_gamma(self):
|
|
545
|
+
@vectorize
|
|
546
|
+
def ufunc(x):
|
|
547
|
+
return math.gamma(x)
|
|
548
|
+
|
|
549
|
+
self.unary_template_float32(math_gamma, ufunc, start=0.1)
|
|
550
|
+
self.unary_template_float64(math_gamma, ufunc, start=0.1)
|
|
551
|
+
self.unary_template_int64(math_gamma, ufunc, start=1)
|
|
552
|
+
self.unary_template_uint64(math_gamma, ufunc, start=1)
|
|
553
|
+
|
|
554
|
+
# ---------------------------------------------------------------------------
|
|
555
|
+
# test_math_lgamma
|
|
556
|
+
|
|
557
|
+
def test_math_lgamma(self):
|
|
558
|
+
@vectorize
|
|
559
|
+
def ufunc(x):
|
|
560
|
+
return math.lgamma(x)
|
|
561
|
+
|
|
562
|
+
self.unary_template_float32(math_lgamma, ufunc, start=0.1)
|
|
563
|
+
self.unary_template_float64(math_lgamma, ufunc, start=0.1)
|
|
564
|
+
self.unary_template_int64(math_lgamma, ufunc, start=1)
|
|
565
|
+
self.unary_template_uint64(math_lgamma, ufunc, start=1)
|
|
566
|
+
|
|
567
|
+
# ---------------------------------------------------------------------------
|
|
568
|
+
# test_math_log
|
|
569
|
+
|
|
570
|
+
def test_math_log(self):
|
|
571
|
+
self.unary_template_float32(math_log, np.log, start=1)
|
|
572
|
+
self.unary_template_float64(math_log, np.log, start=1)
|
|
573
|
+
self.unary_template_int64(math_log, np.log, start=1)
|
|
574
|
+
self.unary_template_uint64(math_log, np.log, start=1)
|
|
575
|
+
|
|
576
|
+
# ---------------------------------------------------------------------------
|
|
577
|
+
# test_math_log2
|
|
578
|
+
|
|
579
|
+
def test_math_log2(self):
|
|
580
|
+
self.unary_template_float32(math_log2, np.log2, start=1)
|
|
581
|
+
self.unary_template_float64(math_log2, np.log2, start=1)
|
|
582
|
+
self.unary_template_int64(math_log2, np.log2, start=1)
|
|
583
|
+
self.unary_template_uint64(math_log2, np.log2, start=1)
|
|
584
|
+
|
|
585
|
+
# ---------------------------------------------------------------------------
|
|
586
|
+
# test_math_log10
|
|
587
|
+
|
|
588
|
+
def test_math_log10(self):
|
|
589
|
+
self.unary_template_float32(math_log10, np.log10, start=1)
|
|
590
|
+
self.unary_template_float64(math_log10, np.log10, start=1)
|
|
591
|
+
self.unary_template_int64(math_log10, np.log10, start=1)
|
|
592
|
+
self.unary_template_uint64(math_log10, np.log10, start=1)
|
|
593
|
+
|
|
594
|
+
# ---------------------------------------------------------------------------
|
|
595
|
+
# test_math_log1p
|
|
596
|
+
|
|
597
|
+
def test_math_log1p(self):
|
|
598
|
+
self.unary_template_float32(math_log1p, np.log1p)
|
|
599
|
+
self.unary_template_float64(math_log1p, np.log1p)
|
|
600
|
+
self.unary_template_int64(math_log1p, np.log1p)
|
|
601
|
+
self.unary_template_uint64(math_log1p, np.log1p)
|
|
602
|
+
|
|
603
|
+
# ---------------------------------------------------------------------------
|
|
604
|
+
# test_math_remainder
|
|
605
|
+
|
|
606
|
+
def test_math_remainder(self):
|
|
607
|
+
self.binary_template_float32(math_remainder, np.remainder, start=1e-11)
|
|
608
|
+
self.binary_template_float64(math_remainder, np.remainder, start=1e-11)
|
|
609
|
+
self.binary_template_int64(math_remainder, np.remainder, start=1)
|
|
610
|
+
self.binary_template_uint64(math_remainder, np.remainder, start=1)
|
|
611
|
+
|
|
612
|
+
@skip_on_cudasim("math.remainder(0, 0) raises a ValueError on CUDASim")
|
|
613
|
+
def test_math_remainder_0_0(self):
|
|
614
|
+
@cuda.jit(void(float64[::1], int64, int64))
|
|
615
|
+
def test_0_0(r, x, y):
|
|
616
|
+
r[0] = math.remainder(x, y)
|
|
617
|
+
|
|
618
|
+
r = np.zeros(1, np.float64)
|
|
619
|
+
test_0_0[1, 1](r, 0, 0)
|
|
620
|
+
self.assertTrue(np.isnan(r[0]))
|
|
621
|
+
|
|
622
|
+
# ---------------------------------------------------------------------------
|
|
623
|
+
# test_math_nextafter
|
|
624
|
+
|
|
625
|
+
def test_math_nextafter(self):
|
|
626
|
+
self.binary_template_float32(math_nextafter, np.nextafter, start=1e-11)
|
|
627
|
+
self.binary_template_float64(math_remainder, np.remainder, start=1e-11)
|
|
628
|
+
self.binary_template_int64(math_remainder, np.remainder, start=1)
|
|
629
|
+
self.binary_template_uint64(math_remainder, np.remainder, start=1)
|
|
630
|
+
|
|
631
|
+
# ---------------------------------------------------------------------------
|
|
632
|
+
# test_math_sqrt
|
|
633
|
+
|
|
634
|
+
def test_math_sqrt(self):
|
|
635
|
+
self.unary_template_float32(math_sqrt, np.sqrt)
|
|
636
|
+
self.unary_template_float64(math_sqrt, np.sqrt)
|
|
637
|
+
self.unary_template_int64(math_sqrt, np.sqrt)
|
|
638
|
+
self.unary_template_uint64(math_sqrt, np.sqrt)
|
|
639
|
+
|
|
640
|
+
# ---------------------------------------------------------------------------
|
|
641
|
+
# test_math_hypot
|
|
642
|
+
|
|
643
|
+
def test_math_hypot(self):
|
|
644
|
+
self.binary_template_float32(math_hypot, np.hypot)
|
|
645
|
+
self.binary_template_float64(math_hypot, np.hypot)
|
|
646
|
+
self.binary_template_int64(math_hypot, np.hypot)
|
|
647
|
+
self.binary_template_uint64(math_hypot, np.hypot)
|
|
648
|
+
|
|
649
|
+
# ---------------------------------------------------------------------------
|
|
650
|
+
# test_math_pow
|
|
651
|
+
|
|
652
|
+
def pow_template_int32(self, npdtype):
|
|
653
|
+
nelem = 50
|
|
654
|
+
A = np.linspace(0, 25, nelem).astype(npdtype)
|
|
655
|
+
B = np.arange(nelem, dtype=np.int32)
|
|
656
|
+
C = np.empty_like(A)
|
|
657
|
+
arytype = numpy_support.from_dtype(npdtype)[::1]
|
|
658
|
+
cfunc = cuda.jit((arytype, int32[::1], arytype))(math_pow)
|
|
659
|
+
cfunc[1, nelem](A, B, C)
|
|
660
|
+
|
|
661
|
+
# NumPy casting rules result in a float64 output always, which doesn't
|
|
662
|
+
# match the overflow to inf of math.pow and libdevice.powi for large
|
|
663
|
+
# values of float32, so we compute the reference result with math.pow.
|
|
664
|
+
Cref = np.empty_like(A)
|
|
665
|
+
for i in range(len(A)):
|
|
666
|
+
Cref[i] = math.pow(A[i], B[i])
|
|
667
|
+
|
|
668
|
+
np.testing.assert_allclose(np.power(A, B).astype(npdtype), C, rtol=1e-6)
|
|
669
|
+
|
|
670
|
+
def test_math_pow(self):
|
|
671
|
+
self.binary_template_float32(math_pow, np.power)
|
|
672
|
+
self.binary_template_float64(math_pow, np.power)
|
|
673
|
+
with pytest.warns(RuntimeWarning, match="overflow encountered in cast"):
|
|
674
|
+
self.pow_template_int32(np.float32)
|
|
675
|
+
self.pow_template_int32(np.float64)
|
|
676
|
+
|
|
677
|
+
# ---------------------------------------------------------------------------
|
|
678
|
+
# test_math_pow_binop
|
|
679
|
+
|
|
680
|
+
def test_math_pow_binop(self):
|
|
681
|
+
self.binary_template_float32(math_pow_binop, np.power)
|
|
682
|
+
self.binary_template_float64(math_pow_binop, np.power)
|
|
683
|
+
|
|
684
|
+
# ---------------------------------------------------------------------------
|
|
685
|
+
# test_math_ceil
|
|
686
|
+
|
|
687
|
+
def test_math_ceil(self):
|
|
688
|
+
self.unary_template_float32(math_ceil, np.ceil)
|
|
689
|
+
self.unary_template_float64(math_ceil, np.ceil)
|
|
690
|
+
self.unary_template_int64(math_ceil, np.ceil)
|
|
691
|
+
self.unary_template_uint64(math_ceil, np.ceil)
|
|
692
|
+
|
|
693
|
+
# ---------------------------------------------------------------------------
|
|
694
|
+
# test_math_floor
|
|
695
|
+
|
|
696
|
+
def test_math_floor(self):
|
|
697
|
+
self.unary_template_float32(math_floor, np.floor)
|
|
698
|
+
self.unary_template_float64(math_floor, np.floor)
|
|
699
|
+
self.unary_template_int64(math_floor, np.floor)
|
|
700
|
+
self.unary_template_uint64(math_floor, np.floor)
|
|
701
|
+
|
|
702
|
+
# ---------------------------------------------------------------------------
|
|
703
|
+
# test_math_trunc
|
|
704
|
+
#
|
|
705
|
+
# Note that math.trunc() is only supported on NumPy float64s, and not
|
|
706
|
+
# other float types or int types. See NumPy Issue #13375:
|
|
707
|
+
#
|
|
708
|
+
# - https://github.com/numpy/numpy/issues/13375 - "Add methods from the
|
|
709
|
+
# builtin float types to the numpy floating point types"
|
|
710
|
+
|
|
711
|
+
def test_math_trunc(self):
|
|
712
|
+
self.unary_template_float64(math_trunc, np.trunc)
|
|
713
|
+
|
|
714
|
+
@skip_on_cudasim("trunc only supported on NumPy float64")
|
|
715
|
+
def test_math_trunc_non_float64(self):
|
|
716
|
+
self.unary_template_float32(math_trunc, np.trunc)
|
|
717
|
+
self.unary_template_int64(math_trunc, np.trunc)
|
|
718
|
+
self.unary_template_uint64(math_trunc, np.trunc)
|
|
719
|
+
|
|
720
|
+
# ---------------------------------------------------------------------------
|
|
721
|
+
# test_math_copysign
|
|
722
|
+
|
|
723
|
+
def test_math_copysign(self):
|
|
724
|
+
self.binary_template_float32(math_copysign, np.copysign, start=-1)
|
|
725
|
+
self.binary_template_float64(math_copysign, np.copysign, start=-1)
|
|
726
|
+
|
|
727
|
+
# ---------------------------------------------------------------------------
|
|
728
|
+
# test_math_modf
|
|
729
|
+
|
|
730
|
+
def test_math_modf(self):
|
|
731
|
+
def modf_template_nan(dtype, arytype):
|
|
732
|
+
A = np.array([np.nan], dtype=dtype)
|
|
733
|
+
B = np.zeros_like(A)
|
|
734
|
+
C = np.zeros_like(A)
|
|
735
|
+
cfunc = cuda.jit((arytype, arytype, arytype))(math_modf)
|
|
736
|
+
cfunc[1, len(A)](A, B, C)
|
|
737
|
+
self.assertTrue(np.isnan(B))
|
|
738
|
+
self.assertTrue(np.isnan(C))
|
|
739
|
+
|
|
740
|
+
def modf_template_compare(A, dtype, arytype):
|
|
741
|
+
A = A.astype(dtype)
|
|
742
|
+
B = np.zeros_like(A)
|
|
743
|
+
C = np.zeros_like(A)
|
|
744
|
+
cfunc = cuda.jit((arytype, arytype, arytype))(math_modf)
|
|
745
|
+
cfunc[1, len(A)](A, B, C)
|
|
746
|
+
D, E = np.modf(A)
|
|
747
|
+
self.assertTrue(np.array_equal(B, D))
|
|
748
|
+
self.assertTrue(np.array_equal(C, E))
|
|
749
|
+
|
|
750
|
+
nelem = 50
|
|
751
|
+
# 32 bit float
|
|
752
|
+
with self.subTest("float32 modf on simple float"):
|
|
753
|
+
modf_template_compare(
|
|
754
|
+
np.linspace(0, 10, nelem), dtype=np.float32, arytype=float32[:]
|
|
755
|
+
)
|
|
756
|
+
with self.subTest("float32 modf on +- infinity"):
|
|
757
|
+
modf_template_compare(
|
|
758
|
+
np.array([np.inf, -np.inf]),
|
|
759
|
+
dtype=np.float32,
|
|
760
|
+
arytype=float32[:],
|
|
761
|
+
)
|
|
762
|
+
with self.subTest("float32 modf on nan"):
|
|
763
|
+
modf_template_nan(dtype=np.float32, arytype=float32[:])
|
|
764
|
+
|
|
765
|
+
# 64 bit float
|
|
766
|
+
with self.subTest("float64 modf on simple float"):
|
|
767
|
+
modf_template_compare(
|
|
768
|
+
np.linspace(0, 10, nelem), dtype=np.float64, arytype=float64[:]
|
|
769
|
+
)
|
|
770
|
+
with self.subTest("float64 modf on +- infinity"):
|
|
771
|
+
modf_template_compare(
|
|
772
|
+
np.array([np.inf, -np.inf]),
|
|
773
|
+
dtype=np.float64,
|
|
774
|
+
arytype=float64[:],
|
|
775
|
+
)
|
|
776
|
+
with self.subTest("float64 modf on nan"):
|
|
777
|
+
modf_template_nan(dtype=np.float64, arytype=float64[:])
|
|
778
|
+
|
|
779
|
+
# ---------------------------------------------------------------------------
|
|
780
|
+
# test_math_fmod
|
|
781
|
+
|
|
782
|
+
def test_math_fmod(self):
|
|
783
|
+
self.binary_template_float32(math_fmod, np.fmod, start=1)
|
|
784
|
+
self.binary_template_float64(math_fmod, np.fmod, start=1)
|
|
785
|
+
|
|
786
|
+
# ---------------------------------------------------------------------------
|
|
787
|
+
# test_math_mod_binop
|
|
788
|
+
|
|
789
|
+
def test_math_mod_binop(self):
|
|
790
|
+
self.binary_template_float32(math_mod_binop, np.fmod, start=1)
|
|
791
|
+
self.binary_template_float64(math_mod_binop, np.fmod, start=1)
|
|
792
|
+
|
|
793
|
+
# ---------------------------------------------------------------------------
|
|
794
|
+
# test_math_isnan
|
|
795
|
+
|
|
796
|
+
def test_math_isnan(self):
|
|
797
|
+
self.unary_bool_template_float32(math_isnan, np.isnan)
|
|
798
|
+
self.unary_bool_template_float64(math_isnan, np.isnan)
|
|
799
|
+
self.unary_bool_template_int32(math_isnan, np.isnan)
|
|
800
|
+
self.unary_bool_template_int64(math_isnan, np.isnan)
|
|
801
|
+
self.unary_bool_special_values_float32(math_isnan, np.isnan)
|
|
802
|
+
self.unary_bool_special_values_float64(math_isnan, np.isnan)
|
|
803
|
+
|
|
804
|
+
# ---------------------------------------------------------------------------
|
|
805
|
+
# test_math_isinf
|
|
806
|
+
|
|
807
|
+
def test_math_isinf(self):
|
|
808
|
+
self.unary_bool_template_float32(math_isinf, np.isinf)
|
|
809
|
+
self.unary_bool_template_float64(math_isinf, np.isinf)
|
|
810
|
+
self.unary_bool_template_int32(math_isinf, np.isinf)
|
|
811
|
+
self.unary_bool_template_int64(math_isinf, np.isinf)
|
|
812
|
+
self.unary_bool_special_values_float32(math_isinf, np.isinf)
|
|
813
|
+
self.unary_bool_special_values_float64(math_isinf, np.isinf)
|
|
814
|
+
|
|
815
|
+
# ---------------------------------------------------------------------------
|
|
816
|
+
# test_math_isfinite
|
|
817
|
+
|
|
818
|
+
def test_math_isfinite(self):
|
|
819
|
+
self.unary_bool_template_float32(math_isfinite, np.isfinite)
|
|
820
|
+
self.unary_bool_template_float64(math_isfinite, np.isfinite)
|
|
821
|
+
self.unary_bool_template_int32(math_isfinite, np.isfinite)
|
|
822
|
+
self.unary_bool_template_int64(math_isfinite, np.isfinite)
|
|
823
|
+
self.unary_bool_special_values_float32(math_isfinite, np.isfinite)
|
|
824
|
+
self.unary_bool_special_values_float64(math_isfinite, np.isfinite)
|
|
825
|
+
|
|
826
|
+
# ---------------------------------------------------------------------------
|
|
827
|
+
# test_math_degrees
|
|
828
|
+
|
|
829
|
+
def test_math_degrees(self):
|
|
830
|
+
self.unary_bool_template_float32(math_degrees, np.degrees)
|
|
831
|
+
self.unary_bool_template_float64(math_degrees, np.degrees)
|
|
832
|
+
|
|
833
|
+
# ---------------------------------------------------------------------------
|
|
834
|
+
# test_math_radians
|
|
835
|
+
|
|
836
|
+
def test_math_radians(self):
|
|
837
|
+
self.unary_bool_template_float32(math_radians, np.radians)
|
|
838
|
+
self.unary_bool_template_float64(math_radians, np.radians)
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
if __name__ == "__main__":
|
|
842
|
+
unittest.main()
|