warp-lang 1.9.0__py3-none-win_amd64.whl → 1.10.0rc2__py3-none-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.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +301 -287
- warp/__init__.pyi +2220 -313
- warp/_src/__init__.py +14 -0
- warp/_src/autograd.py +1075 -0
- warp/_src/build.py +618 -0
- warp/_src/build_dll.py +640 -0
- warp/{builtins.py → _src/builtins.py} +1497 -226
- warp/_src/codegen.py +4359 -0
- warp/{config.py → _src/config.py} +178 -169
- warp/_src/constants.py +57 -0
- warp/_src/context.py +8294 -0
- warp/_src/dlpack.py +462 -0
- warp/_src/fabric.py +355 -0
- warp/_src/fem/__init__.py +14 -0
- warp/_src/fem/adaptivity.py +508 -0
- warp/_src/fem/cache.py +687 -0
- warp/_src/fem/dirichlet.py +188 -0
- warp/{fem → _src/fem}/domain.py +40 -30
- warp/_src/fem/field/__init__.py +131 -0
- warp/_src/fem/field/field.py +701 -0
- warp/{fem → _src/fem}/field/nodal_field.py +30 -15
- warp/{fem → _src/fem}/field/restriction.py +1 -1
- warp/{fem → _src/fem}/field/virtual.py +53 -27
- warp/_src/fem/geometry/__init__.py +32 -0
- warp/{fem → _src/fem}/geometry/adaptive_nanogrid.py +77 -163
- warp/_src/fem/geometry/closest_point.py +97 -0
- warp/{fem → _src/fem}/geometry/deformed_geometry.py +14 -22
- warp/{fem → _src/fem}/geometry/element.py +32 -10
- warp/{fem → _src/fem}/geometry/geometry.py +48 -20
- warp/{fem → _src/fem}/geometry/grid_2d.py +12 -23
- warp/{fem → _src/fem}/geometry/grid_3d.py +12 -23
- warp/{fem → _src/fem}/geometry/hexmesh.py +40 -63
- warp/{fem → _src/fem}/geometry/nanogrid.py +255 -248
- warp/{fem → _src/fem}/geometry/partition.py +121 -63
- warp/{fem → _src/fem}/geometry/quadmesh.py +26 -45
- warp/{fem → _src/fem}/geometry/tetmesh.py +40 -63
- warp/{fem → _src/fem}/geometry/trimesh.py +26 -45
- warp/{fem → _src/fem}/integrate.py +164 -158
- warp/_src/fem/linalg.py +383 -0
- warp/_src/fem/operator.py +396 -0
- warp/_src/fem/polynomial.py +229 -0
- warp/{fem → _src/fem}/quadrature/pic_quadrature.py +15 -20
- warp/{fem → _src/fem}/quadrature/quadrature.py +95 -47
- warp/_src/fem/space/__init__.py +248 -0
- warp/{fem → _src/fem}/space/basis_function_space.py +20 -11
- warp/_src/fem/space/basis_space.py +679 -0
- warp/{fem → _src/fem}/space/dof_mapper.py +3 -3
- warp/{fem → _src/fem}/space/function_space.py +14 -13
- warp/{fem → _src/fem}/space/grid_2d_function_space.py +4 -7
- warp/{fem → _src/fem}/space/grid_3d_function_space.py +4 -4
- warp/{fem → _src/fem}/space/hexmesh_function_space.py +4 -10
- warp/{fem → _src/fem}/space/nanogrid_function_space.py +3 -9
- warp/{fem → _src/fem}/space/partition.py +117 -60
- warp/{fem → _src/fem}/space/quadmesh_function_space.py +4 -10
- warp/{fem → _src/fem}/space/restriction.py +66 -33
- warp/_src/fem/space/shape/__init__.py +152 -0
- warp/{fem → _src/fem}/space/shape/cube_shape_function.py +9 -9
- warp/{fem → _src/fem}/space/shape/shape_function.py +8 -9
- warp/{fem → _src/fem}/space/shape/square_shape_function.py +6 -6
- warp/{fem → _src/fem}/space/shape/tet_shape_function.py +3 -3
- warp/{fem → _src/fem}/space/shape/triangle_shape_function.py +3 -3
- warp/{fem → _src/fem}/space/tetmesh_function_space.py +3 -9
- warp/_src/fem/space/topology.py +459 -0
- warp/{fem → _src/fem}/space/trimesh_function_space.py +3 -9
- warp/_src/fem/types.py +112 -0
- warp/_src/fem/utils.py +486 -0
- warp/_src/jax.py +186 -0
- warp/_src/jax_experimental/__init__.py +14 -0
- warp/_src/jax_experimental/custom_call.py +387 -0
- warp/_src/jax_experimental/ffi.py +1284 -0
- warp/_src/jax_experimental/xla_ffi.py +656 -0
- warp/_src/marching_cubes.py +708 -0
- warp/_src/math.py +414 -0
- warp/_src/optim/__init__.py +14 -0
- warp/_src/optim/adam.py +163 -0
- warp/_src/optim/linear.py +1606 -0
- warp/_src/optim/sgd.py +112 -0
- warp/_src/paddle.py +406 -0
- warp/_src/render/__init__.py +14 -0
- warp/_src/render/imgui_manager.py +289 -0
- warp/_src/render/render_opengl.py +3636 -0
- warp/_src/render/render_usd.py +937 -0
- warp/_src/render/utils.py +160 -0
- warp/_src/sparse.py +2716 -0
- warp/_src/tape.py +1206 -0
- warp/{thirdparty → _src/thirdparty}/unittest_parallel.py +9 -2
- warp/_src/torch.py +391 -0
- warp/_src/types.py +5870 -0
- warp/_src/utils.py +1693 -0
- warp/autograd.py +12 -1054
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +8 -588
- warp/build_dll.py +6 -471
- warp/codegen.py +6 -4246
- warp/constants.py +6 -39
- warp/context.py +12 -7851
- warp/dlpack.py +6 -444
- warp/examples/distributed/example_jacobi_mpi.py +4 -5
- warp/examples/fem/example_adaptive_grid.py +1 -1
- warp/examples/fem/example_apic_fluid.py +1 -1
- warp/examples/fem/example_burgers.py +8 -8
- warp/examples/fem/example_diffusion.py +1 -1
- warp/examples/fem/example_distortion_energy.py +1 -1
- warp/examples/fem/example_mixed_elasticity.py +2 -2
- warp/examples/fem/example_navier_stokes.py +1 -1
- warp/examples/fem/example_nonconforming_contact.py +7 -7
- warp/examples/fem/example_stokes.py +1 -1
- warp/examples/fem/example_stokes_transfer.py +1 -1
- warp/examples/fem/utils.py +2 -2
- warp/examples/interop/example_jax_callable.py +1 -1
- warp/examples/interop/example_jax_ffi_callback.py +1 -1
- warp/examples/interop/example_jax_kernel.py +3 -2
- warp/examples/tile/example_tile_mcgp.py +191 -0
- warp/fabric.py +6 -337
- warp/fem/__init__.py +159 -97
- warp/fem/adaptivity.py +7 -489
- warp/fem/cache.py +9 -648
- warp/fem/dirichlet.py +6 -184
- warp/fem/field/__init__.py +8 -109
- warp/fem/field/field.py +7 -652
- warp/fem/geometry/__init__.py +7 -18
- warp/fem/geometry/closest_point.py +11 -77
- warp/fem/linalg.py +18 -366
- warp/fem/operator.py +11 -369
- warp/fem/polynomial.py +9 -209
- warp/fem/space/__init__.py +5 -211
- warp/fem/space/basis_space.py +6 -662
- warp/fem/space/shape/__init__.py +41 -118
- warp/fem/space/topology.py +6 -437
- warp/fem/types.py +6 -81
- warp/fem/utils.py +11 -444
- warp/jax.py +8 -165
- warp/jax_experimental/__init__.py +14 -1
- warp/jax_experimental/custom_call.py +8 -342
- warp/jax_experimental/ffi.py +17 -853
- warp/jax_experimental/xla_ffi.py +5 -596
- warp/marching_cubes.py +5 -689
- warp/math.py +16 -393
- warp/native/array.h +385 -37
- warp/native/builtin.h +316 -39
- warp/native/bvh.cpp +43 -9
- warp/native/bvh.cu +62 -27
- warp/native/bvh.h +310 -309
- warp/native/clang/clang.cpp +102 -97
- warp/native/coloring.cpp +0 -1
- warp/native/crt.h +208 -0
- warp/native/exports.h +156 -0
- warp/native/hashgrid.cu +2 -0
- warp/native/intersect.h +24 -1
- warp/native/intersect_tri.h +44 -35
- warp/native/mat.h +1456 -276
- warp/native/mesh.cpp +4 -4
- warp/native/mesh.cu +4 -2
- warp/native/mesh.h +176 -61
- warp/native/quat.h +0 -52
- warp/native/scan.cu +2 -0
- warp/native/sort.cu +22 -13
- warp/native/sort.h +2 -0
- warp/native/sparse.cu +7 -3
- warp/native/spatial.h +12 -0
- warp/native/tile.h +837 -70
- warp/native/tile_radix_sort.h +1 -1
- warp/native/tile_reduce.h +394 -46
- warp/native/tile_scan.h +4 -4
- warp/native/vec.h +469 -53
- warp/native/version.h +23 -0
- warp/native/volume.cpp +1 -1
- warp/native/volume.cu +1 -0
- warp/native/volume.h +1 -1
- warp/native/volume_builder.cu +2 -0
- warp/native/warp.cpp +60 -32
- warp/native/warp.cu +313 -201
- warp/native/warp.h +14 -11
- warp/optim/__init__.py +6 -3
- warp/optim/adam.py +6 -145
- warp/optim/linear.py +14 -1585
- warp/optim/sgd.py +6 -94
- warp/paddle.py +6 -388
- warp/render/__init__.py +8 -4
- warp/render/imgui_manager.py +7 -267
- warp/render/render_opengl.py +6 -3616
- warp/render/render_usd.py +6 -918
- warp/render/utils.py +6 -142
- warp/sparse.py +37 -2563
- warp/tape.py +6 -1188
- warp/tests/__main__.py +1 -1
- warp/tests/cuda/test_async.py +4 -4
- warp/tests/cuda/test_conditional_captures.py +1 -1
- warp/tests/cuda/test_multigpu.py +1 -1
- warp/tests/cuda/test_streams.py +58 -1
- warp/tests/geometry/test_bvh.py +157 -22
- warp/tests/geometry/test_hash_grid.py +38 -0
- warp/tests/geometry/test_marching_cubes.py +0 -1
- warp/tests/geometry/test_mesh.py +5 -3
- warp/tests/geometry/test_mesh_query_aabb.py +5 -12
- warp/tests/geometry/test_mesh_query_point.py +5 -2
- warp/tests/geometry/test_mesh_query_ray.py +15 -3
- warp/tests/geometry/test_volume_write.py +5 -5
- warp/tests/interop/test_dlpack.py +14 -14
- warp/tests/interop/test_jax.py +1382 -79
- warp/tests/interop/test_paddle.py +1 -1
- warp/tests/test_adam.py +0 -1
- warp/tests/test_arithmetic.py +9 -9
- warp/tests/test_array.py +529 -100
- warp/tests/test_array_reduce.py +3 -3
- warp/tests/test_atomic.py +12 -8
- warp/tests/test_atomic_bitwise.py +209 -0
- warp/tests/test_atomic_cas.py +4 -4
- warp/tests/test_bool.py +2 -2
- warp/tests/test_builtins_resolution.py +5 -571
- warp/tests/test_codegen.py +34 -15
- warp/tests/test_conditional.py +1 -1
- warp/tests/test_context.py +6 -6
- warp/tests/test_copy.py +242 -161
- warp/tests/test_ctypes.py +3 -3
- warp/tests/test_devices.py +24 -2
- warp/tests/test_examples.py +16 -84
- warp/tests/test_fabricarray.py +35 -35
- warp/tests/test_fast_math.py +0 -2
- warp/tests/test_fem.py +60 -14
- warp/tests/test_fixedarray.py +3 -3
- warp/tests/test_func.py +8 -5
- warp/tests/test_generics.py +1 -1
- warp/tests/test_indexedarray.py +24 -24
- warp/tests/test_intersect.py +39 -9
- warp/tests/test_large.py +1 -1
- warp/tests/test_lerp.py +3 -1
- warp/tests/test_linear_solvers.py +1 -1
- warp/tests/test_map.py +49 -4
- warp/tests/test_mat.py +52 -62
- warp/tests/test_mat_constructors.py +4 -5
- warp/tests/test_mat_lite.py +1 -1
- warp/tests/test_mat_scalar_ops.py +121 -121
- warp/tests/test_math.py +34 -0
- warp/tests/test_module_aot.py +4 -4
- warp/tests/test_modules_lite.py +28 -2
- warp/tests/test_print.py +11 -11
- warp/tests/test_quat.py +93 -58
- warp/tests/test_runlength_encode.py +1 -1
- warp/tests/test_scalar_ops.py +38 -10
- warp/tests/test_smoothstep.py +1 -1
- warp/tests/test_sparse.py +126 -15
- warp/tests/test_spatial.py +105 -87
- warp/tests/test_special_values.py +6 -6
- warp/tests/test_static.py +7 -7
- warp/tests/test_struct.py +13 -2
- warp/tests/test_triangle_closest_point.py +48 -1
- warp/tests/test_tuple.py +96 -0
- warp/tests/test_types.py +82 -9
- warp/tests/test_utils.py +52 -52
- warp/tests/test_vec.py +29 -29
- warp/tests/test_vec_constructors.py +5 -5
- warp/tests/test_vec_scalar_ops.py +97 -97
- warp/tests/test_version.py +75 -0
- warp/tests/tile/test_tile.py +239 -0
- warp/tests/tile/test_tile_atomic_bitwise.py +403 -0
- warp/tests/tile/test_tile_cholesky.py +7 -4
- warp/tests/tile/test_tile_load.py +26 -2
- warp/tests/tile/test_tile_mathdx.py +3 -3
- warp/tests/tile/test_tile_matmul.py +1 -1
- warp/tests/tile/test_tile_mlp.py +2 -4
- warp/tests/tile/test_tile_reduce.py +214 -13
- warp/tests/unittest_suites.py +6 -14
- warp/tests/unittest_utils.py +10 -9
- warp/tests/walkthrough_debug.py +3 -1
- warp/torch.py +6 -373
- warp/types.py +29 -5750
- warp/utils.py +10 -1659
- {warp_lang-1.9.0.dist-info → warp_lang-1.10.0rc2.dist-info}/METADATA +47 -103
- warp_lang-1.10.0rc2.dist-info/RECORD +468 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/Gaia-LICENSE.txt +6 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/appdirs-LICENSE.txt +22 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/asset_pixel_jpg-LICENSE.txt +3 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/cuda-LICENSE.txt +1582 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/dlpack-LICENSE.txt +201 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/fp16-LICENSE.txt +28 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/libmathdx-LICENSE.txt +220 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/llvm-LICENSE.txt +279 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/moller-LICENSE.txt +16 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/nanovdb-LICENSE.txt +2 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/nvrtc-LICENSE.txt +1592 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/svd-LICENSE.txt +23 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/unittest_parallel-LICENSE.txt +21 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/usd-LICENSE.txt +213 -0
- warp_lang-1.10.0rc2.dist-info/licenses/licenses/windingnumber-LICENSE.txt +21 -0
- warp/examples/assets/cartpole.urdf +0 -110
- warp/examples/assets/crazyflie.usd +0 -0
- warp/examples/assets/nv_ant.xml +0 -92
- warp/examples/assets/nv_humanoid.xml +0 -183
- warp/examples/assets/quadruped.urdf +0 -268
- warp/examples/optim/example_bounce.py +0 -266
- warp/examples/optim/example_cloth_throw.py +0 -228
- warp/examples/optim/example_drone.py +0 -870
- warp/examples/optim/example_inverse_kinematics.py +0 -182
- warp/examples/optim/example_inverse_kinematics_torch.py +0 -191
- warp/examples/optim/example_softbody_properties.py +0 -400
- warp/examples/optim/example_spring_cage.py +0 -245
- warp/examples/optim/example_trajectory.py +0 -227
- warp/examples/sim/example_cartpole.py +0 -143
- warp/examples/sim/example_cloth.py +0 -225
- warp/examples/sim/example_cloth_self_contact.py +0 -316
- warp/examples/sim/example_granular.py +0 -130
- warp/examples/sim/example_granular_collision_sdf.py +0 -202
- warp/examples/sim/example_jacobian_ik.py +0 -244
- warp/examples/sim/example_particle_chain.py +0 -124
- warp/examples/sim/example_quadruped.py +0 -203
- warp/examples/sim/example_rigid_chain.py +0 -203
- warp/examples/sim/example_rigid_contact.py +0 -195
- warp/examples/sim/example_rigid_force.py +0 -133
- warp/examples/sim/example_rigid_gyroscopic.py +0 -115
- warp/examples/sim/example_rigid_soft_contact.py +0 -140
- warp/examples/sim/example_soft_body.py +0 -196
- warp/examples/tile/example_tile_walker.py +0 -327
- warp/sim/__init__.py +0 -74
- warp/sim/articulation.py +0 -793
- warp/sim/collide.py +0 -2570
- warp/sim/graph_coloring.py +0 -307
- warp/sim/import_mjcf.py +0 -791
- warp/sim/import_snu.py +0 -227
- warp/sim/import_urdf.py +0 -579
- warp/sim/import_usd.py +0 -898
- warp/sim/inertia.py +0 -357
- warp/sim/integrator.py +0 -245
- warp/sim/integrator_euler.py +0 -2000
- warp/sim/integrator_featherstone.py +0 -2101
- warp/sim/integrator_vbd.py +0 -2487
- warp/sim/integrator_xpbd.py +0 -3295
- warp/sim/model.py +0 -4821
- warp/sim/particles.py +0 -121
- warp/sim/render.py +0 -431
- warp/sim/utils.py +0 -431
- warp/tests/sim/disabled_kinematics.py +0 -244
- warp/tests/sim/test_cloth.py +0 -863
- warp/tests/sim/test_collision.py +0 -743
- warp/tests/sim/test_coloring.py +0 -347
- warp/tests/sim/test_inertia.py +0 -161
- warp/tests/sim/test_model.py +0 -226
- warp/tests/sim/test_sim_grad.py +0 -287
- warp/tests/sim/test_sim_grad_bounce_linear.py +0 -212
- warp/tests/sim/test_sim_kinematics.py +0 -98
- warp/thirdparty/__init__.py +0 -0
- warp_lang-1.9.0.dist-info/RECORD +0 -456
- /warp/{fem → _src/fem}/quadrature/__init__.py +0 -0
- /warp/{tests/sim → _src/thirdparty}/__init__.py +0 -0
- /warp/{thirdparty → _src/thirdparty}/appdirs.py +0 -0
- /warp/{thirdparty → _src/thirdparty}/dlpack.py +0 -0
- {warp_lang-1.9.0.dist-info → warp_lang-1.10.0rc2.dist-info}/WHEEL +0 -0
- {warp_lang-1.9.0.dist-info → warp_lang-1.10.0rc2.dist-info}/licenses/LICENSE.md +0 -0
- {warp_lang-1.9.0.dist-info → warp_lang-1.10.0rc2.dist-info}/top_level.txt +0 -0
warp/tests/test_vec.py
CHANGED
|
@@ -83,11 +83,11 @@ def test_negation(test, device, dtype, register_kernels=False):
|
|
|
83
83
|
np.float64: 1.0e-8,
|
|
84
84
|
}.get(dtype, 0)
|
|
85
85
|
|
|
86
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
87
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
88
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
89
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
90
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
86
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
87
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
88
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
89
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
90
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
91
91
|
|
|
92
92
|
def check_negation(
|
|
93
93
|
v2: wp.array(dtype=vec2),
|
|
@@ -198,11 +198,11 @@ def test_negation(test, device, dtype, register_kernels=False):
|
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
def test_subtraction_unsigned(test, device, dtype, register_kernels=False):
|
|
201
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
202
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
203
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
204
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
205
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
201
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
202
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
203
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
204
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
205
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
206
206
|
|
|
207
207
|
def check_subtraction_unsigned():
|
|
208
208
|
wp.expect_eq(vec2(wptype(3), wptype(4)) - vec2(wptype(1), wptype(2)), vec2(wptype(2), wptype(2)))
|
|
@@ -237,11 +237,11 @@ def test_subtraction(test, device, dtype, register_kernels=False):
|
|
|
237
237
|
np.float64: 1.0e-8,
|
|
238
238
|
}.get(dtype, 0)
|
|
239
239
|
|
|
240
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
241
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
242
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
243
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
244
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
240
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
241
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
242
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
243
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
244
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
245
245
|
|
|
246
246
|
def check_subtraction(
|
|
247
247
|
s2: wp.array(dtype=vec2),
|
|
@@ -374,11 +374,11 @@ def test_length(test, device, dtype, register_kernels=False):
|
|
|
374
374
|
np.float64: 1.0e-7,
|
|
375
375
|
}.get(dtype, 0)
|
|
376
376
|
|
|
377
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
378
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
379
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
380
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
381
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
377
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
378
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
379
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
380
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
381
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
382
382
|
|
|
383
383
|
def check_length(
|
|
384
384
|
v2: wp.array(dtype=vec2),
|
|
@@ -496,11 +496,11 @@ def test_normalize(test, device, dtype, register_kernels=False):
|
|
|
496
496
|
np.float64: 1.0e-8,
|
|
497
497
|
}.get(dtype, 0)
|
|
498
498
|
|
|
499
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
500
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
501
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
502
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
503
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
499
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
500
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
501
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
502
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
503
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
504
504
|
|
|
505
505
|
def check_normalize(
|
|
506
506
|
v2: wp.array(dtype=vec2),
|
|
@@ -703,8 +703,8 @@ def test_crossproduct(test, device, dtype, register_kernels=False):
|
|
|
703
703
|
np.float64: 1.0e-8,
|
|
704
704
|
}.get(dtype, 0)
|
|
705
705
|
|
|
706
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
707
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
706
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
707
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
708
708
|
|
|
709
709
|
def check_cross(
|
|
710
710
|
s3: wp.array(dtype=vec3),
|
|
@@ -790,7 +790,7 @@ def test_crossproduct(test, device, dtype, register_kernels=False):
|
|
|
790
790
|
|
|
791
791
|
|
|
792
792
|
@wp.kernel(module="unique")
|
|
793
|
-
def test_vector_mutation(expected: wp.types.vector(length=10, dtype=float)):
|
|
793
|
+
def test_vector_mutation(expected: wp._src.types.vector(length=10, dtype=float)):
|
|
794
794
|
v = wp.vector(length=10, dtype=float)
|
|
795
795
|
|
|
796
796
|
# test element indexing
|
|
@@ -1349,7 +1349,7 @@ class TestVec(unittest.TestCase):
|
|
|
1349
1349
|
self.assertSequenceEqual(v, (0, 1, 2))
|
|
1350
1350
|
|
|
1351
1351
|
|
|
1352
|
-
vec10 = wp.types.vector(length=10, dtype=float)
|
|
1352
|
+
vec10 = wp._src.types.vector(length=10, dtype=float)
|
|
1353
1353
|
add_kernel_test(
|
|
1354
1354
|
TestVec,
|
|
1355
1355
|
test_vector_mutation,
|
|
@@ -105,17 +105,17 @@ def test_tpl_constructor_error_numeric_args_mismatch(test, device):
|
|
|
105
105
|
|
|
106
106
|
def test_casting_constructors(test, device, dtype, register_kernels=False):
|
|
107
107
|
np_type = np.dtype(dtype)
|
|
108
|
-
wp_type = wp.types.np_dtype_to_warp_type[np_type]
|
|
109
|
-
vec3 = wp.types.vector(length=3, dtype=wp_type)
|
|
108
|
+
wp_type = wp._src.types.np_dtype_to_warp_type[np_type]
|
|
109
|
+
vec3 = wp._src.types.vector(length=3, dtype=wp_type)
|
|
110
110
|
|
|
111
111
|
np16 = np.dtype(np.float16)
|
|
112
|
-
wp16 = wp.types.np_dtype_to_warp_type[np16]
|
|
112
|
+
wp16 = wp._src.types.np_dtype_to_warp_type[np16]
|
|
113
113
|
|
|
114
114
|
np32 = np.dtype(np.float32)
|
|
115
|
-
wp32 = wp.types.np_dtype_to_warp_type[np32]
|
|
115
|
+
wp32 = wp._src.types.np_dtype_to_warp_type[np32]
|
|
116
116
|
|
|
117
117
|
np64 = np.dtype(np.float64)
|
|
118
|
-
wp64 = wp.types.np_dtype_to_warp_type[np64]
|
|
118
|
+
wp64 = wp._src.types.np_dtype_to_warp_type[np64]
|
|
119
119
|
|
|
120
120
|
def cast_float16(a: wp.array(dtype=wp_type, ndim=2), b: wp.array(dtype=wp16, ndim=2)):
|
|
121
121
|
tid = wp.tid()
|
|
@@ -87,11 +87,11 @@ def get_select_kernel2(dtype):
|
|
|
87
87
|
def test_arrays(test, device, dtype):
|
|
88
88
|
rng = np.random.default_rng(123)
|
|
89
89
|
|
|
90
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
91
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
92
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
93
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
94
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
90
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
91
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
92
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
93
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
94
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
95
95
|
|
|
96
96
|
v2_np = randvals(rng, (10, 2), dtype)
|
|
97
97
|
v3_np = randvals(rng, (10, 3), dtype)
|
|
@@ -108,9 +108,9 @@ def test_arrays(test, device, dtype):
|
|
|
108
108
|
assert_np_equal(v4.numpy(), v4_np, tol=1.0e-6)
|
|
109
109
|
assert_np_equal(v5.numpy(), v5_np, tol=1.0e-6)
|
|
110
110
|
|
|
111
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
112
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
113
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
111
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
112
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
113
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
114
114
|
|
|
115
115
|
v2 = wp.array(v2_np, dtype=vec2, requires_grad=True, device=device)
|
|
116
116
|
v3 = wp.array(v3_np, dtype=vec3, requires_grad=True, device=device)
|
|
@@ -125,8 +125,8 @@ def test_components(test, device, dtype):
|
|
|
125
125
|
# test accessing vector components from Python - this is especially important
|
|
126
126
|
# for float16, which requires special handling internally
|
|
127
127
|
|
|
128
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
129
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
128
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
129
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
130
130
|
|
|
131
131
|
v = vec3(1, 2, 3)
|
|
132
132
|
|
|
@@ -184,10 +184,10 @@ def test_components(test, device, dtype):
|
|
|
184
184
|
|
|
185
185
|
|
|
186
186
|
def test_py_arithmetic_ops(test, device, dtype):
|
|
187
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
187
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
188
188
|
|
|
189
189
|
def make_vec(*args):
|
|
190
|
-
if wptype in wp.types.int_types:
|
|
190
|
+
if wptype in wp._src.types.int_types:
|
|
191
191
|
# Cast to the correct integer type to simulate wrapping.
|
|
192
192
|
return tuple(wptype._type_(x).value for x in args)
|
|
193
193
|
|
|
@@ -219,11 +219,11 @@ def test_constructors(test, device, dtype, register_kernels=False):
|
|
|
219
219
|
np.float64: 1.0e-8,
|
|
220
220
|
}.get(dtype, 0)
|
|
221
221
|
|
|
222
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
223
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
224
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
225
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
226
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
222
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
223
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
224
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
225
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
226
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
227
227
|
|
|
228
228
|
def check_scalar_constructor(
|
|
229
229
|
input: wp.array(dtype=wptype),
|
|
@@ -463,7 +463,7 @@ def test_anon_type_instance(test, device, dtype, register_kernels=False):
|
|
|
463
463
|
np.float64: 1.0e-8,
|
|
464
464
|
}.get(dtype, 0)
|
|
465
465
|
|
|
466
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
466
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
467
467
|
|
|
468
468
|
def check_scalar_init(
|
|
469
469
|
input: wp.array(dtype=wptype),
|
|
@@ -586,11 +586,11 @@ def test_indexing(test, device, dtype, register_kernels=False):
|
|
|
586
586
|
np.float64: 1.0e-8,
|
|
587
587
|
}.get(dtype, 0)
|
|
588
588
|
|
|
589
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
590
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
591
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
592
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
593
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
589
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
590
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
591
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
592
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
593
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
594
594
|
|
|
595
595
|
def check_indexing(
|
|
596
596
|
v2: wp.array(dtype=vec2),
|
|
@@ -691,11 +691,11 @@ def test_indexing(test, device, dtype, register_kernels=False):
|
|
|
691
691
|
|
|
692
692
|
|
|
693
693
|
def test_equality(test, device, dtype, register_kernels=False):
|
|
694
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
695
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
696
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
697
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
698
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
694
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
695
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
696
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
697
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
698
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
699
699
|
|
|
700
700
|
def check_unsigned_equality(
|
|
701
701
|
v20: wp.array(dtype=vec2),
|
|
@@ -821,11 +821,11 @@ def test_scalar_multiplication(test, device, dtype, register_kernels=False):
|
|
|
821
821
|
np.float64: 1.0e-8,
|
|
822
822
|
}.get(dtype, 0)
|
|
823
823
|
|
|
824
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
825
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
826
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
827
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
828
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
824
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
825
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
826
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
827
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
828
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
829
829
|
|
|
830
830
|
def check_mul(
|
|
831
831
|
s: wp.array(dtype=wptype),
|
|
@@ -953,11 +953,11 @@ def test_scalar_multiplication_rightmul(test, device, dtype, register_kernels=Fa
|
|
|
953
953
|
np.float64: 1.0e-8,
|
|
954
954
|
}.get(dtype, 0)
|
|
955
955
|
|
|
956
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
957
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
958
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
959
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
960
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
956
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
957
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
958
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
959
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
960
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
961
961
|
|
|
962
962
|
def check_rightmul(
|
|
963
963
|
s: wp.array(dtype=wptype),
|
|
@@ -1085,11 +1085,11 @@ def test_cw_multiplication(test, device, dtype, register_kernels=False):
|
|
|
1085
1085
|
np.float64: 1.0e-8,
|
|
1086
1086
|
}.get(dtype, 0)
|
|
1087
1087
|
|
|
1088
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1089
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1090
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1091
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1092
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1088
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1089
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1090
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1091
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1092
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1093
1093
|
|
|
1094
1094
|
def check_cw_mul(
|
|
1095
1095
|
s2: wp.array(dtype=vec2),
|
|
@@ -1230,11 +1230,11 @@ def test_scalar_division(test, device, dtype, register_kernels=False):
|
|
|
1230
1230
|
np.float64: 1.0e-8,
|
|
1231
1231
|
}.get(dtype, 0)
|
|
1232
1232
|
|
|
1233
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1234
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1235
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1236
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1237
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1233
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1234
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1235
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1236
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1237
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1238
1238
|
|
|
1239
1239
|
def check_div(
|
|
1240
1240
|
s: wp.array(dtype=wptype),
|
|
@@ -1386,11 +1386,11 @@ def test_cw_division(test, device, dtype, register_kernels=False):
|
|
|
1386
1386
|
np.float64: 1.0e-8,
|
|
1387
1387
|
}.get(dtype, 0)
|
|
1388
1388
|
|
|
1389
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1390
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1391
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1392
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1393
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1389
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1390
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1391
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1392
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1393
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1394
1394
|
|
|
1395
1395
|
def check_cw_div(
|
|
1396
1396
|
s2: wp.array(dtype=vec2),
|
|
@@ -1554,11 +1554,11 @@ def test_addition(test, device, dtype, register_kernels=False):
|
|
|
1554
1554
|
np.float64: 1.0e-8,
|
|
1555
1555
|
}.get(dtype, 0)
|
|
1556
1556
|
|
|
1557
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1558
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1559
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1560
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1561
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1557
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1558
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1559
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1560
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1561
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1562
1562
|
|
|
1563
1563
|
def check_add(
|
|
1564
1564
|
s2: wp.array(dtype=vec2),
|
|
@@ -1695,11 +1695,11 @@ def test_dotproduct(test, device, dtype, register_kernels=False):
|
|
|
1695
1695
|
np.float64: 1.0e-8,
|
|
1696
1696
|
}.get(dtype, 0)
|
|
1697
1697
|
|
|
1698
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1699
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1700
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1701
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1702
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1698
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1699
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1700
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1701
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1702
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1703
1703
|
|
|
1704
1704
|
def check_dot(
|
|
1705
1705
|
s2: wp.array(dtype=vec2),
|
|
@@ -1816,11 +1816,11 @@ def test_modulo(test, device, dtype, register_kernels=False):
|
|
|
1816
1816
|
np.float64: 1.0e-8,
|
|
1817
1817
|
}.get(dtype, 0)
|
|
1818
1818
|
|
|
1819
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1820
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1821
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1822
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1823
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1819
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1820
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1821
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1822
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1823
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1824
1824
|
|
|
1825
1825
|
def check_mod(
|
|
1826
1826
|
s2: wp.array(dtype=vec2),
|
|
@@ -1942,19 +1942,19 @@ def test_modulo(test, device, dtype, register_kernels=False):
|
|
|
1942
1942
|
|
|
1943
1943
|
|
|
1944
1944
|
def test_equivalent_types(test, device, dtype, register_kernels=False):
|
|
1945
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1945
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1946
1946
|
|
|
1947
1947
|
# vector types
|
|
1948
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1949
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1950
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1951
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1948
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1949
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1950
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1951
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1952
1952
|
|
|
1953
1953
|
# vector types equivalent to the above
|
|
1954
|
-
vec2_equiv = wp.types.vector(length=2, dtype=wptype)
|
|
1955
|
-
vec3_equiv = wp.types.vector(length=3, dtype=wptype)
|
|
1956
|
-
vec4_equiv = wp.types.vector(length=4, dtype=wptype)
|
|
1957
|
-
vec5_equiv = wp.types.vector(length=5, dtype=wptype)
|
|
1954
|
+
vec2_equiv = wp._src.types.vector(length=2, dtype=wptype)
|
|
1955
|
+
vec3_equiv = wp._src.types.vector(length=3, dtype=wptype)
|
|
1956
|
+
vec4_equiv = wp._src.types.vector(length=4, dtype=wptype)
|
|
1957
|
+
vec5_equiv = wp._src.types.vector(length=5, dtype=wptype)
|
|
1958
1958
|
|
|
1959
1959
|
# declare kernel with original types
|
|
1960
1960
|
def check_equivalence(
|
|
@@ -2021,11 +2021,11 @@ def test_conversions(test, device, dtype, register_kernels=False):
|
|
|
2021
2021
|
|
|
2022
2022
|
|
|
2023
2023
|
def test_constants(test, device, dtype, register_kernels=False):
|
|
2024
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2025
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
2026
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
2027
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
2028
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
2024
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2025
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
2026
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
2027
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
2028
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
2029
2029
|
|
|
2030
2030
|
cv2 = wp.constant(vec2(1, 2))
|
|
2031
2031
|
cv3 = wp.constant(vec3(1, 2, 3))
|
|
@@ -2047,11 +2047,11 @@ def test_constants(test, device, dtype, register_kernels=False):
|
|
|
2047
2047
|
|
|
2048
2048
|
|
|
2049
2049
|
def test_abs(test, device, dtype, register_kernels=False):
|
|
2050
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2051
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
2052
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
2053
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
2054
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
2050
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2051
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
2052
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
2053
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
2054
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
2055
2055
|
|
|
2056
2056
|
def check_vector_abs():
|
|
2057
2057
|
res2 = wp.abs(vec2(wptype(-1), wptype(2)))
|
|
@@ -2075,11 +2075,11 @@ def test_abs(test, device, dtype, register_kernels=False):
|
|
|
2075
2075
|
|
|
2076
2076
|
|
|
2077
2077
|
def test_sign(test, device, dtype, register_kernels=False):
|
|
2078
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2079
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
2080
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
2081
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
2082
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
2078
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2079
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
2080
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
2081
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
2082
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
2083
2083
|
|
|
2084
2084
|
def check_vector_sign():
|
|
2085
2085
|
res2 = wp.sign(vec2(wptype(-1), wptype(2)))
|
|
@@ -2113,11 +2113,11 @@ def test_minmax(test, device, dtype, register_kernels=False):
|
|
|
2113
2113
|
np.float16: 1.0e-2,
|
|
2114
2114
|
}.get(dtype, 0)
|
|
2115
2115
|
|
|
2116
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2117
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
2118
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
2119
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
2120
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
2116
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2117
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
2118
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
2119
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
2120
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
2121
2121
|
|
|
2122
2122
|
# \TODO: Also not quite sure why: this kernel compiles incredibly
|
|
2123
2123
|
# slowly though...
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import re
|
|
17
|
+
import unittest
|
|
18
|
+
|
|
19
|
+
import warp as wp
|
|
20
|
+
from warp._src.context import get_warp_clang_version, get_warp_version
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TestVersion(unittest.TestCase):
|
|
24
|
+
"""Tests for native library version verification using string comparison."""
|
|
25
|
+
|
|
26
|
+
def test_get_warp_version_returns_string(self):
|
|
27
|
+
"""Test that get_warp_version() returns a string."""
|
|
28
|
+
version = get_warp_version()
|
|
29
|
+
self.assertIsInstance(version, str)
|
|
30
|
+
self.assertRegex(version, r"^\d+\.\d+\.\d+")
|
|
31
|
+
|
|
32
|
+
def test_get_warp_clang_version_returns_string(self):
|
|
33
|
+
"""Test that get_warp_clang_version() returns a string."""
|
|
34
|
+
version = get_warp_clang_version()
|
|
35
|
+
self.assertIsInstance(version, str)
|
|
36
|
+
self.assertRegex(version, r"^\d+\.\d+\.\d+")
|
|
37
|
+
|
|
38
|
+
def test_dll_versions_match_python_version(self):
|
|
39
|
+
"""Test that native library versions match Python package version exactly."""
|
|
40
|
+
python_version = wp._src.config.version
|
|
41
|
+
warp_version = get_warp_version()
|
|
42
|
+
warp_clang_version = get_warp_clang_version()
|
|
43
|
+
|
|
44
|
+
self.assertEqual(
|
|
45
|
+
warp_version, python_version, f"Warp library version {warp_version} != Python version {python_version}"
|
|
46
|
+
)
|
|
47
|
+
self.assertEqual(
|
|
48
|
+
warp_clang_version,
|
|
49
|
+
python_version,
|
|
50
|
+
f"warp-clang library version {warp_clang_version} != Python version {python_version}",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def test_version_format_validation(self):
|
|
54
|
+
"""Test that versions follow PEP 440 versioning format."""
|
|
55
|
+
# PEP 440 pattern: [EPOCH!]MAJOR.MINOR.PATCH[{a|b|rc}N][.postN][.devN][+LOCAL]
|
|
56
|
+
# Examples: 1.10.0, 1.10.0.dev0, 1.10.0.dev20251017, 1.10.0a1, 1.10.0rc1, 1!1.10.0
|
|
57
|
+
pep440_pattern = (
|
|
58
|
+
r"^(\d+!)?" # Optional epoch
|
|
59
|
+
r"\d+\.\d+\.\d+" # Major.minor.patch
|
|
60
|
+
r"(\.?(a|alpha|b|beta|rc)\.?\d+)?" # Optional alpha/beta/rc (with or without dots)
|
|
61
|
+
r"(\.post\d+)?" # Optional post release
|
|
62
|
+
r"(\.dev\d+)?" # Optional dev release
|
|
63
|
+
r"(\+[a-zA-Z0-9.]+)?$" # Optional local version identifier
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
warp_version = get_warp_version()
|
|
67
|
+
warp_clang_version = get_warp_clang_version()
|
|
68
|
+
|
|
69
|
+
self.assertIsNotNone(re.match(pep440_pattern, warp_version))
|
|
70
|
+
self.assertIsNotNone(re.match(pep440_pattern, warp_clang_version))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
wp.clear_kernel_cache()
|
|
75
|
+
unittest.main(verbosity=2)
|