warp-lang 1.9.1__py3-none-manylinux_2_34_aarch64.whl → 1.10.0rc2__py3-none-manylinux_2_34_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 warp-lang might be problematic. Click here for more details.
- warp/__init__.py +301 -287
- warp/__init__.pyi +794 -305
- 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} +1382 -377
- 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.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +8 -588
- warp/build_dll.py +6 -721
- warp/codegen.py +6 -4251
- warp/constants.py +6 -39
- warp/context.py +12 -8062
- 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 +1 -1
- 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 -365
- warp/jax_experimental/ffi.py +17 -873
- warp/jax_experimental/xla_ffi.py +5 -605
- warp/marching_cubes.py +5 -689
- warp/math.py +16 -393
- warp/native/array.h +385 -37
- warp/native/builtin.h +314 -37
- 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/sparse.cu +7 -3
- warp/native/spatial.h +12 -0
- warp/native/tile.h +681 -89
- 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 -0
- 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 +57 -29
- warp/native/warp.cu +253 -171
- warp/native/warp.h +11 -8
- 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 -3618
- warp/render/render_usd.py +6 -919
- 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_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 +772 -49
- 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 +527 -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 +33 -14
- 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 +56 -10
- 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 +35 -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_types.py +27 -15
- 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 +178 -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 -5764
- warp/utils.py +10 -1659
- {warp_lang-1.9.1.dist-info → warp_lang-1.10.0rc2.dist-info}/METADATA +46 -99
- 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.1.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.1.dist-info → warp_lang-1.10.0rc2.dist-info}/WHEEL +0 -0
- {warp_lang-1.9.1.dist-info → warp_lang-1.10.0rc2.dist-info}/licenses/LICENSE.md +0 -0
- {warp_lang-1.9.1.dist-info → warp_lang-1.10.0rc2.dist-info}/top_level.txt +0 -0
|
@@ -75,13 +75,13 @@ def get_select_kernel(dtype):
|
|
|
75
75
|
def test_arrays(test, device, dtype):
|
|
76
76
|
rng = np.random.default_rng(123)
|
|
77
77
|
|
|
78
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
78
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
79
79
|
|
|
80
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
81
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
82
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
83
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
84
|
-
mat32 = wp.types.matrix(shape=(3, 2), dtype=wptype)
|
|
80
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
81
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
82
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
83
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
84
|
+
mat32 = wp._src.types.matrix(shape=(3, 2), dtype=wptype)
|
|
85
85
|
|
|
86
86
|
v2_np = randvals(rng, [10, 2, 2], dtype)
|
|
87
87
|
v3_np = randvals(rng, [10, 3, 3], dtype)
|
|
@@ -101,9 +101,9 @@ def test_arrays(test, device, dtype):
|
|
|
101
101
|
assert_np_equal(v5.numpy(), v5_np, tol=1.0e-6)
|
|
102
102
|
assert_np_equal(v32.numpy(), v32_np, tol=1.0e-6)
|
|
103
103
|
|
|
104
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
105
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
106
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
104
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
105
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
106
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
107
107
|
|
|
108
108
|
v2 = wp.array(v2_np, dtype=mat22, requires_grad=True, device=device)
|
|
109
109
|
v3 = wp.array(v3_np, dtype=mat33, requires_grad=True, device=device)
|
|
@@ -118,8 +118,8 @@ def test_components(test, device, dtype):
|
|
|
118
118
|
# test accessing matrix components from Python - this is especially important
|
|
119
119
|
# for float16, which requires special handling internally
|
|
120
120
|
|
|
121
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
122
|
-
mat23 = wp.types.matrix(shape=(2, 3), dtype=wptype)
|
|
121
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
122
|
+
mat23 = wp._src.types.matrix(shape=(2, 3), dtype=wptype)
|
|
123
123
|
|
|
124
124
|
m = mat23(1, 2, 3, 4, 5, 6)
|
|
125
125
|
|
|
@@ -167,12 +167,12 @@ def test_components(test, device, dtype):
|
|
|
167
167
|
|
|
168
168
|
|
|
169
169
|
def test_constants(test, device, dtype, register_kernels=False):
|
|
170
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
171
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
172
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
173
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
174
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
175
|
-
mat32 = wp.types.matrix(shape=(3, 2), dtype=wptype)
|
|
170
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
171
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
172
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
173
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
174
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
175
|
+
mat32 = wp._src.types.matrix(shape=(3, 2), dtype=wptype)
|
|
176
176
|
|
|
177
177
|
cm22 = wp.constant(mat22(22))
|
|
178
178
|
cm33 = wp.constant(mat33(33))
|
|
@@ -202,15 +202,15 @@ def test_constructors(test, device, dtype, register_kernels=False):
|
|
|
202
202
|
np.float64: 1.0e-8,
|
|
203
203
|
}.get(dtype, 0)
|
|
204
204
|
|
|
205
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
206
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
207
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
208
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
209
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
210
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
211
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
212
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
213
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
205
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
206
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
207
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
208
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
209
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
210
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
211
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
212
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
213
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
214
214
|
|
|
215
215
|
output_select_kernel = get_select_kernel(wptype)
|
|
216
216
|
|
|
@@ -446,7 +446,7 @@ def test_anon_type_instance(test, device, dtype, register_kernels=False):
|
|
|
446
446
|
np.float64: 1.0e-8,
|
|
447
447
|
}.get(dtype, 0)
|
|
448
448
|
|
|
449
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
449
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
450
450
|
|
|
451
451
|
def check_scalar_init(
|
|
452
452
|
input: wp.array(dtype=wptype),
|
|
@@ -629,7 +629,7 @@ def test_anon_type_instance(test, device, dtype, register_kernels=False):
|
|
|
629
629
|
|
|
630
630
|
|
|
631
631
|
def test_identity(test, device, dtype, register_kernels=False):
|
|
632
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
632
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
633
633
|
|
|
634
634
|
def check_identity_mat(
|
|
635
635
|
output: wp.array(dtype=wptype),
|
|
@@ -679,11 +679,11 @@ def test_indexing(test, device, dtype, register_kernels=False):
|
|
|
679
679
|
np.float64: 1.0e-8,
|
|
680
680
|
}.get(dtype, 0)
|
|
681
681
|
|
|
682
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
683
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
684
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
685
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
686
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
682
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
683
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
684
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
685
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
686
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
687
687
|
|
|
688
688
|
output_select_kernel = get_select_kernel(wptype)
|
|
689
689
|
|
|
@@ -755,11 +755,11 @@ def test_indexing(test, device, dtype, register_kernels=False):
|
|
|
755
755
|
|
|
756
756
|
|
|
757
757
|
def test_equality(test, device, dtype, register_kernels=False):
|
|
758
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
759
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
760
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
761
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
762
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
758
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
759
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
760
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
761
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
762
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
763
763
|
|
|
764
764
|
def check_mat_equality():
|
|
765
765
|
wp.expect_eq(
|
|
@@ -1029,11 +1029,11 @@ def test_scalar_multiplication(test, device, dtype, register_kernels=False):
|
|
|
1029
1029
|
np.float64: 1.0e-8,
|
|
1030
1030
|
}.get(dtype, 0)
|
|
1031
1031
|
|
|
1032
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1033
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1034
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1035
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1036
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1032
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1033
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1034
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1035
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1036
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1037
1037
|
|
|
1038
1038
|
output_select_kernel = get_select_kernel(wptype)
|
|
1039
1039
|
|
|
@@ -1216,17 +1216,17 @@ def test_matvec_multiplication(test, device, dtype, register_kernels=False):
|
|
|
1216
1216
|
np.float64: 1.0e-8,
|
|
1217
1217
|
}.get(dtype, 0)
|
|
1218
1218
|
|
|
1219
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1220
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1221
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1222
|
-
mat32 = wp.types.matrix(shape=(3, 2), dtype=wptype)
|
|
1223
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1224
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1219
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1220
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1221
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1222
|
+
mat32 = wp._src.types.matrix(shape=(3, 2), dtype=wptype)
|
|
1223
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1224
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1225
1225
|
|
|
1226
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1227
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1228
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1229
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1226
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1227
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1228
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1229
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1230
1230
|
|
|
1231
1231
|
output_select_kernel = get_select_kernel(wptype)
|
|
1232
1232
|
|
|
@@ -1363,17 +1363,17 @@ def test_vecmat_multiplication(test, device, dtype, register_kernels=False):
|
|
|
1363
1363
|
np.float64: 1.0e-8,
|
|
1364
1364
|
}.get(dtype, 0)
|
|
1365
1365
|
|
|
1366
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1367
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1368
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1369
|
-
mat23 = wp.types.matrix(shape=(2, 3), dtype=wptype)
|
|
1370
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1371
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1366
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1367
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1368
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1369
|
+
mat23 = wp._src.types.matrix(shape=(2, 3), dtype=wptype)
|
|
1370
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1371
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1372
1372
|
|
|
1373
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1374
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1375
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1376
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1373
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1374
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1375
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1376
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1377
1377
|
|
|
1378
1378
|
output_select_kernel = get_select_kernel(wptype)
|
|
1379
1379
|
|
|
@@ -1512,12 +1512,12 @@ def test_matmat_multiplication(test, device, dtype, register_kernels=False):
|
|
|
1512
1512
|
np.float64: 5.0e-7,
|
|
1513
1513
|
}.get(dtype, 0)
|
|
1514
1514
|
|
|
1515
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1516
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1517
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1518
|
-
mat32 = wp.types.matrix(shape=(3, 2), dtype=wptype)
|
|
1519
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1520
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1515
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1516
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1517
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1518
|
+
mat32 = wp._src.types.matrix(shape=(3, 2), dtype=wptype)
|
|
1519
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1520
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1521
1521
|
|
|
1522
1522
|
output_select_kernel = get_select_kernel(wptype)
|
|
1523
1523
|
|
|
@@ -1691,11 +1691,11 @@ def test_cw_multiplication(test, device, dtype, register_kernels=False):
|
|
|
1691
1691
|
np.float64: 1.0e-8,
|
|
1692
1692
|
}.get(dtype, 0)
|
|
1693
1693
|
|
|
1694
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1695
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1696
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1697
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1698
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1694
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1695
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1696
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1697
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1698
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1699
1699
|
|
|
1700
1700
|
output_select_kernel = get_select_kernel(wptype)
|
|
1701
1701
|
|
|
@@ -1823,11 +1823,11 @@ def test_cw_division(test, device, dtype, register_kernels=False):
|
|
|
1823
1823
|
np.float64: 1.0e-8,
|
|
1824
1824
|
}.get(dtype, 0)
|
|
1825
1825
|
|
|
1826
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1827
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1828
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1829
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1830
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1826
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1827
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
1828
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
1829
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
1830
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
1831
1831
|
|
|
1832
1832
|
output_select_kernel = get_select_kernel(wptype)
|
|
1833
1833
|
|
|
@@ -1980,11 +1980,11 @@ def test_outer_product(test, device, dtype, register_kernels=False):
|
|
|
1980
1980
|
np.float64: 1.0e-8,
|
|
1981
1981
|
}.get(dtype, 0)
|
|
1982
1982
|
|
|
1983
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1984
|
-
vec2 = wp.types.vector(length=2, dtype=wptype)
|
|
1985
|
-
vec3 = wp.types.vector(length=3, dtype=wptype)
|
|
1986
|
-
vec4 = wp.types.vector(length=4, dtype=wptype)
|
|
1987
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
1983
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
1984
|
+
vec2 = wp._src.types.vector(length=2, dtype=wptype)
|
|
1985
|
+
vec3 = wp._src.types.vector(length=3, dtype=wptype)
|
|
1986
|
+
vec4 = wp._src.types.vector(length=4, dtype=wptype)
|
|
1987
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
1988
1988
|
|
|
1989
1989
|
output_select_kernel = get_select_kernel(wptype)
|
|
1990
1990
|
|
|
@@ -2120,12 +2120,12 @@ def test_transpose(test, device, dtype, register_kernels=False):
|
|
|
2120
2120
|
np.float64: 1.0e-8,
|
|
2121
2121
|
}.get(dtype, 0)
|
|
2122
2122
|
|
|
2123
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2124
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2125
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2126
|
-
mat32 = wp.types.matrix(shape=(3, 2), dtype=wptype)
|
|
2127
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2128
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2123
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2124
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2125
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2126
|
+
mat32 = wp._src.types.matrix(shape=(3, 2), dtype=wptype)
|
|
2127
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2128
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2129
2129
|
|
|
2130
2130
|
output_select_kernel = get_select_kernel(wptype)
|
|
2131
2131
|
|
|
@@ -2219,11 +2219,11 @@ def test_scalar_division(test, device, dtype, register_kernels=False):
|
|
|
2219
2219
|
np.float64: 1.0e-8,
|
|
2220
2220
|
}.get(dtype, 0)
|
|
2221
2221
|
|
|
2222
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2223
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2224
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2225
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2226
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2222
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2223
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2224
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2225
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2226
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2227
2227
|
|
|
2228
2228
|
output_select_kernel = get_select_kernel(wptype)
|
|
2229
2229
|
|
|
@@ -2321,11 +2321,11 @@ def test_addition(test, device, dtype, register_kernels=False):
|
|
|
2321
2321
|
np.float64: 1.0e-8,
|
|
2322
2322
|
}.get(dtype, 0)
|
|
2323
2323
|
|
|
2324
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2325
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2326
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2327
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2328
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2324
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2325
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2326
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2327
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2328
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2329
2329
|
|
|
2330
2330
|
output_select_kernel = get_select_kernel(wptype)
|
|
2331
2331
|
|
|
@@ -2451,11 +2451,11 @@ def test_ddot(test, device, dtype, register_kernels=False):
|
|
|
2451
2451
|
np.float64: 1.0e-8,
|
|
2452
2452
|
}.get(dtype, 0)
|
|
2453
2453
|
|
|
2454
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2455
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2456
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2457
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2458
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2454
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2455
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2456
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2457
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2458
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2459
2459
|
|
|
2460
2460
|
def check_mat_dot(
|
|
2461
2461
|
s2: wp.array(dtype=mat22),
|
|
@@ -2574,11 +2574,11 @@ def test_trace(test, device, dtype, register_kernels=False):
|
|
|
2574
2574
|
np.float64: 1.0e-8,
|
|
2575
2575
|
}.get(dtype, 0)
|
|
2576
2576
|
|
|
2577
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2578
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2579
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2580
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2581
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2577
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2578
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2579
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2580
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2581
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2582
2582
|
|
|
2583
2583
|
def check_mat_trace(
|
|
2584
2584
|
v2: wp.array(dtype=mat22),
|
|
@@ -2666,8 +2666,8 @@ def test_diag(test, device, dtype, register_kernels=False):
|
|
|
2666
2666
|
np.float64: 1.0e-8,
|
|
2667
2667
|
}.get(dtype, 0)
|
|
2668
2668
|
|
|
2669
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2670
|
-
vec5 = wp.types.vector(length=5, dtype=wptype)
|
|
2669
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2670
|
+
vec5 = wp._src.types.vector(length=5, dtype=wptype)
|
|
2671
2671
|
|
|
2672
2672
|
output_select_kernel = get_select_kernel(wptype)
|
|
2673
2673
|
|
|
@@ -2716,19 +2716,19 @@ def test_diag(test, device, dtype, register_kernels=False):
|
|
|
2716
2716
|
|
|
2717
2717
|
|
|
2718
2718
|
def test_equivalent_types(test, device, dtype, register_kernels=False):
|
|
2719
|
-
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2719
|
+
wptype = wp._src.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
2720
2720
|
|
|
2721
2721
|
# matrix types
|
|
2722
|
-
mat22 = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2723
|
-
mat33 = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2724
|
-
mat44 = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2725
|
-
mat55 = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2722
|
+
mat22 = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2723
|
+
mat33 = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2724
|
+
mat44 = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2725
|
+
mat55 = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2726
2726
|
|
|
2727
2727
|
# matrix types equivalent to the above
|
|
2728
|
-
mat22_equiv = wp.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2729
|
-
mat33_equiv = wp.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2730
|
-
mat44_equiv = wp.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2731
|
-
mat55_equiv = wp.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2728
|
+
mat22_equiv = wp._src.types.matrix(shape=(2, 2), dtype=wptype)
|
|
2729
|
+
mat33_equiv = wp._src.types.matrix(shape=(3, 3), dtype=wptype)
|
|
2730
|
+
mat44_equiv = wp._src.types.matrix(shape=(4, 4), dtype=wptype)
|
|
2731
|
+
mat55_equiv = wp._src.types.matrix(shape=(5, 5), dtype=wptype)
|
|
2732
2732
|
|
|
2733
2733
|
# declare kernel with original types
|
|
2734
2734
|
def check_equivalence(
|
warp/tests/test_math.py
CHANGED
|
@@ -58,6 +58,39 @@ def test_scalar_math(test, device):
|
|
|
58
58
|
assert_np_equal(tape.gradients[x].numpy(), np.array([adj_float_results_expected[i]]), tol=1e-6)
|
|
59
59
|
|
|
60
60
|
|
|
61
|
+
@wp.kernel
|
|
62
|
+
def erf_kernel(x: wp.array(dtype=Any), out: wp.array(dtype=Any)):
|
|
63
|
+
i = wp.tid()
|
|
64
|
+
|
|
65
|
+
if i == 0:
|
|
66
|
+
out[i] = wp.erf(x[i])
|
|
67
|
+
elif i == 1:
|
|
68
|
+
out[i] = wp.erfc(x[i])
|
|
69
|
+
elif i == 2:
|
|
70
|
+
out[i] = wp.erfinv(x[i])
|
|
71
|
+
elif i == 3:
|
|
72
|
+
out[i] = wp.erfcinv(x[i])
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_erf_math(test, device):
|
|
76
|
+
for type, tol in ((wp.float16, 1e-3), (wp.float32, 1e-6), (wp.float64, 1e-6)):
|
|
77
|
+
x = wp.full(4, value=0.123, dtype=type, requires_grad=True, device=device)
|
|
78
|
+
out = wp.zeros(4, dtype=type, requires_grad=True, device=device)
|
|
79
|
+
|
|
80
|
+
with wp.Tape() as tape:
|
|
81
|
+
wp.launch(erf_kernel, dim=4, inputs=[x], outputs=[out], device=device)
|
|
82
|
+
|
|
83
|
+
out.grad = wp.ones_like(out)
|
|
84
|
+
|
|
85
|
+
tape.backward()
|
|
86
|
+
|
|
87
|
+
out_true = np.array([0.13809388, 0.86190612, 0.10944129, 1.09057285])
|
|
88
|
+
adj_x_true = np.array([1.11143641, -1.11143641, 0.89690544, -2.91120449])
|
|
89
|
+
|
|
90
|
+
assert_np_equal(out.numpy(), out_true, tol=tol)
|
|
91
|
+
assert_np_equal(adj_x_true, x.grad.numpy(), tol=tol)
|
|
92
|
+
|
|
93
|
+
|
|
61
94
|
@wp.kernel
|
|
62
95
|
def test_vec_norm_kernel(vs: wp.array(dtype=Any), out: wp.array(dtype=float, ndim=2)):
|
|
63
96
|
tid = wp.tid()
|
|
@@ -170,6 +203,7 @@ class TestMath(unittest.TestCase):
|
|
|
170
203
|
|
|
171
204
|
|
|
172
205
|
add_function_test(TestMath, "test_scalar_math", test_scalar_math, devices=devices)
|
|
206
|
+
add_function_test(TestMath, "test_erf_math", test_erf_math, devices=devices)
|
|
173
207
|
add_function_test(TestMath, "test_vec_norm", test_vec_norm, devices=devices)
|
|
174
208
|
|
|
175
209
|
|
warp/tests/test_module_aot.py
CHANGED
|
@@ -226,14 +226,14 @@ class TestModuleAOT(unittest.TestCase):
|
|
|
226
226
|
if wp.get_cuda_device_count() == 0:
|
|
227
227
|
self.skipTest("No CUDA devices found")
|
|
228
228
|
|
|
229
|
-
if len(wp.context.runtime.nvrtc_supported_archs) < 2:
|
|
229
|
+
if len(wp._src.context.runtime.nvrtc_supported_archs) < 2:
|
|
230
230
|
self.skipTest("NVRTC must support at least two architectures to run this test")
|
|
231
231
|
|
|
232
232
|
try:
|
|
233
233
|
shutil.rmtree(TEST_CACHE_DIR, ignore_errors=True)
|
|
234
234
|
TEST_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
|
235
235
|
|
|
236
|
-
archs = list(wp.context.runtime.nvrtc_supported_archs)[:2]
|
|
236
|
+
archs = list(wp._src.context.runtime.nvrtc_supported_archs)[:2]
|
|
237
237
|
|
|
238
238
|
wp.compile_aot_module(warp.tests.aux_test_module_aot, arch=archs, module_dir=TEST_CACHE_DIR, use_ptx=True)
|
|
239
239
|
|
|
@@ -254,14 +254,14 @@ class TestModuleAOT(unittest.TestCase):
|
|
|
254
254
|
if wp.get_cuda_device_count() == 0:
|
|
255
255
|
self.skipTest("No CUDA devices found")
|
|
256
256
|
|
|
257
|
-
if len(wp.context.runtime.nvrtc_supported_archs) < 2:
|
|
257
|
+
if len(wp._src.context.runtime.nvrtc_supported_archs) < 2:
|
|
258
258
|
self.skipTest("NVRTC must support at least two architectures to run this test")
|
|
259
259
|
|
|
260
260
|
try:
|
|
261
261
|
shutil.rmtree(TEST_CACHE_DIR, ignore_errors=True)
|
|
262
262
|
TEST_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
|
263
263
|
|
|
264
|
-
archs = list(wp.context.runtime.nvrtc_supported_archs)[:2]
|
|
264
|
+
archs = list(wp._src.context.runtime.nvrtc_supported_archs)[:2]
|
|
265
265
|
|
|
266
266
|
wp.compile_aot_module(warp.tests.aux_test_module_aot, arch=archs, module_dir=TEST_CACHE_DIR, use_ptx=False)
|
|
267
267
|
|
warp/tests/test_modules_lite.py
CHANGED
|
@@ -16,21 +16,30 @@
|
|
|
16
16
|
import unittest
|
|
17
17
|
|
|
18
18
|
import warp as wp
|
|
19
|
+
import warp._src.utils
|
|
19
20
|
from warp.tests.unittest_utils import *
|
|
20
21
|
|
|
21
22
|
devices = get_test_devices()
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
# This kernel is needed to ensure this test module is registered as a Warp module.
|
|
26
|
+
# wp.load_module() requires the module to contain at least one Warp kernel, function, or struct.
|
|
27
|
+
@wp.kernel
|
|
28
|
+
def print_values():
|
|
29
|
+
i = wp.tid()
|
|
30
|
+
wp.print(i)
|
|
31
|
+
|
|
32
|
+
|
|
24
33
|
class TestModuleLite(unittest.TestCase):
|
|
25
34
|
def test_module_lite_load(self):
|
|
26
35
|
# Load current module
|
|
27
36
|
wp.load_module()
|
|
28
37
|
|
|
29
38
|
# Load named module
|
|
30
|
-
wp.load_module(
|
|
39
|
+
wp.load_module(warp._src.utils)
|
|
31
40
|
|
|
32
41
|
# Load named module (string)
|
|
33
|
-
wp.load_module(
|
|
42
|
+
wp.load_module("warp._src.utils", recursive=True)
|
|
34
43
|
|
|
35
44
|
def test_module_lite_options(self):
|
|
36
45
|
wp.set_module_options({"max_unroll": 8})
|
|
@@ -38,6 +47,23 @@ class TestModuleLite(unittest.TestCase):
|
|
|
38
47
|
self.assertIsInstance(module_options, dict)
|
|
39
48
|
self.assertEqual(module_options["max_unroll"], 8)
|
|
40
49
|
|
|
50
|
+
def test_module_lite_load_nonexistent(self):
|
|
51
|
+
# Test that loading a non-existent module raises RuntimeError
|
|
52
|
+
with self.assertRaises(RuntimeError) as context:
|
|
53
|
+
wp.load_module("nonexistent_module_that_does_not_exist")
|
|
54
|
+
|
|
55
|
+
self.assertIn("does not contain any Warp kernels, functions, or structs", str(context.exception))
|
|
56
|
+
self.assertIn("nonexistent_module_that_does_not_exist", str(context.exception))
|
|
57
|
+
|
|
58
|
+
def test_module_lite_load_no_warp_content(self):
|
|
59
|
+
# Test that loading a module without Warp content raises RuntimeError
|
|
60
|
+
# Use a standard library module that definitely has no Warp kernels
|
|
61
|
+
with self.assertRaises(RuntimeError) as context:
|
|
62
|
+
wp.load_module(unittest)
|
|
63
|
+
|
|
64
|
+
self.assertIn("does not contain any Warp kernels, functions, or structs", str(context.exception))
|
|
65
|
+
self.assertIn("unittest", str(context.exception))
|
|
66
|
+
|
|
41
67
|
|
|
42
68
|
if __name__ == "__main__":
|
|
43
69
|
wp.clear_kernel_cache()
|
warp/tests/test_print.py
CHANGED
|
@@ -234,14 +234,14 @@ class SimpleStruct:
|
|
|
234
234
|
y: float
|
|
235
235
|
|
|
236
236
|
|
|
237
|
-
generic_print_types = [*wp.types.scalar_types]
|
|
238
|
-
for scalar_type in wp.types.scalar_types:
|
|
239
|
-
generic_print_types.append(wp.types.vector(2, scalar_type))
|
|
240
|
-
generic_print_types.append(wp.types.vector(3, scalar_type))
|
|
241
|
-
generic_print_types.append(wp.types.vector(4, scalar_type))
|
|
242
|
-
generic_print_types.append(wp.types.matrix((2, 2), scalar_type))
|
|
243
|
-
generic_print_types.append(wp.types.matrix((3, 3), scalar_type))
|
|
244
|
-
generic_print_types.append(wp.types.matrix((4, 4), scalar_type))
|
|
237
|
+
generic_print_types = [*wp._src.types.scalar_types]
|
|
238
|
+
for scalar_type in wp._src.types.scalar_types:
|
|
239
|
+
generic_print_types.append(wp._src.types.vector(2, scalar_type))
|
|
240
|
+
generic_print_types.append(wp._src.types.vector(3, scalar_type))
|
|
241
|
+
generic_print_types.append(wp._src.types.vector(4, scalar_type))
|
|
242
|
+
generic_print_types.append(wp._src.types.matrix((2, 2), scalar_type))
|
|
243
|
+
generic_print_types.append(wp._src.types.matrix((3, 3), scalar_type))
|
|
244
|
+
generic_print_types.append(wp._src.types.matrix((4, 4), scalar_type))
|
|
245
245
|
generic_print_types.append(wp.bool)
|
|
246
246
|
generic_print_types.append(SimpleStruct)
|
|
247
247
|
generic_print_types.append(wp.array(dtype=float))
|
|
@@ -251,7 +251,7 @@ for T in generic_print_types:
|
|
|
251
251
|
|
|
252
252
|
|
|
253
253
|
def test_print_adjoint(test, device):
|
|
254
|
-
for scalar_type in wp.types.scalar_types:
|
|
254
|
+
for scalar_type in wp._src.types.scalar_types:
|
|
255
255
|
# scalar
|
|
256
256
|
capture = StdOutCapture()
|
|
257
257
|
capture.begin()
|
|
@@ -272,7 +272,7 @@ def test_print_adjoint(test, device):
|
|
|
272
272
|
|
|
273
273
|
for dim in (2, 3, 4):
|
|
274
274
|
# vector
|
|
275
|
-
vec_type = wp.types.vector(dim, scalar_type)
|
|
275
|
+
vec_type = wp._src.types.vector(dim, scalar_type)
|
|
276
276
|
vec_data = np.arange(vec_type._length_, dtype=wp.dtype_to_numpy(scalar_type))
|
|
277
277
|
v = vec_type(vec_data)
|
|
278
278
|
adj_v = vec_type(vec_data[::-1])
|
|
@@ -290,7 +290,7 @@ def test_print_adjoint(test, device):
|
|
|
290
290
|
test.assertRegex(s, rf"{expected_forward}{os.linesep}adj: {expected_adjoint}{os.linesep}")
|
|
291
291
|
|
|
292
292
|
# matrix
|
|
293
|
-
mat_type = wp.types.matrix((dim, dim), scalar_type)
|
|
293
|
+
mat_type = wp._src.types.matrix((dim, dim), scalar_type)
|
|
294
294
|
mat_data = np.arange(mat_type._length_, dtype=wp.dtype_to_numpy(scalar_type))
|
|
295
295
|
m = mat_type(mat_data)
|
|
296
296
|
adj_m = mat_type(mat_data[::-1])
|