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
warp/tests/test_examples.py
CHANGED
|
@@ -44,15 +44,13 @@ from typing import Any, Dict, Optional, Type
|
|
|
44
44
|
|
|
45
45
|
import warp as wp
|
|
46
46
|
import warp.tests.unittest_utils
|
|
47
|
+
from warp._src.utils import check_p2p
|
|
47
48
|
from warp.tests.unittest_utils import (
|
|
48
49
|
USD_AVAILABLE,
|
|
49
50
|
get_selected_cuda_test_devices,
|
|
50
51
|
get_test_devices,
|
|
51
52
|
sanitize_identifier,
|
|
52
53
|
)
|
|
53
|
-
from warp.utils import check_p2p
|
|
54
|
-
|
|
55
|
-
wp.init() # For wp.context.runtime.core.wp_is_debug_enabled()
|
|
56
54
|
|
|
57
55
|
|
|
58
56
|
def _build_command_line_options(test_options: Dict[str, Any]) -> list:
|
|
@@ -280,25 +278,6 @@ class TestOptimExamples(unittest.TestCase):
|
|
|
280
278
|
pass
|
|
281
279
|
|
|
282
280
|
|
|
283
|
-
add_example_test(
|
|
284
|
-
TestOptimExamples,
|
|
285
|
-
name="optim.example_bounce",
|
|
286
|
-
devices=test_devices,
|
|
287
|
-
test_options_cpu={"train_iters": 3},
|
|
288
|
-
)
|
|
289
|
-
add_example_test(
|
|
290
|
-
TestOptimExamples,
|
|
291
|
-
name="optim.example_drone",
|
|
292
|
-
devices=test_devices,
|
|
293
|
-
test_options={"headless": True},
|
|
294
|
-
test_options_cpu={"num_frames": 10},
|
|
295
|
-
)
|
|
296
|
-
add_example_test(
|
|
297
|
-
TestOptimExamples,
|
|
298
|
-
name="optim.example_cloth_throw",
|
|
299
|
-
devices=test_devices,
|
|
300
|
-
test_options_cpu={"train_iters": 3},
|
|
301
|
-
)
|
|
302
281
|
add_example_test(
|
|
303
282
|
TestOptimExamples,
|
|
304
283
|
name="optim.example_diffray",
|
|
@@ -312,68 +291,6 @@ add_example_test(
|
|
|
312
291
|
devices=cuda_test_devices,
|
|
313
292
|
test_options={"headless": True, "train_iters": 5, "num_frames": 300, "pillow_required": True},
|
|
314
293
|
)
|
|
315
|
-
add_example_test(TestOptimExamples, name="optim.example_inverse_kinematics", devices=test_devices)
|
|
316
|
-
add_example_test(
|
|
317
|
-
TestOptimExamples,
|
|
318
|
-
name="optim.example_inverse_kinematics_torch",
|
|
319
|
-
devices=test_devices,
|
|
320
|
-
test_options={"torch_required": True},
|
|
321
|
-
)
|
|
322
|
-
add_example_test(TestOptimExamples, name="optim.example_spring_cage", devices=test_devices)
|
|
323
|
-
add_example_test(
|
|
324
|
-
TestOptimExamples,
|
|
325
|
-
name="optim.example_trajectory",
|
|
326
|
-
devices=test_devices,
|
|
327
|
-
test_options={"headless": True, "train_iters": 50},
|
|
328
|
-
)
|
|
329
|
-
add_example_test(
|
|
330
|
-
TestOptimExamples,
|
|
331
|
-
name="optim.example_softbody_properties",
|
|
332
|
-
devices=test_devices,
|
|
333
|
-
test_options_cuda={
|
|
334
|
-
"train_iters": 1 if warp.context.runtime.core.wp_is_debug_enabled() else 3,
|
|
335
|
-
},
|
|
336
|
-
test_options_cpu={"train_iters": 1},
|
|
337
|
-
)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
class TestSimExamples(unittest.TestCase):
|
|
341
|
-
pass
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
add_example_test(TestSimExamples, name="sim.example_cartpole", devices=test_devices)
|
|
345
|
-
add_example_test(
|
|
346
|
-
TestSimExamples,
|
|
347
|
-
name="sim.example_cloth",
|
|
348
|
-
devices=test_devices,
|
|
349
|
-
test_options={"usd_required": True},
|
|
350
|
-
test_options_cpu={"num_frames": 10},
|
|
351
|
-
)
|
|
352
|
-
add_example_test(
|
|
353
|
-
TestSimExamples, name="sim.example_granular", devices=test_devices, test_options_cpu={"num_frames": 10}
|
|
354
|
-
)
|
|
355
|
-
add_example_test(TestSimExamples, name="sim.example_granular_collision_sdf", devices=cuda_test_devices)
|
|
356
|
-
add_example_test(TestSimExamples, name="sim.example_jacobian_ik", devices=test_devices)
|
|
357
|
-
add_example_test(TestSimExamples, name="sim.example_particle_chain", devices=test_devices)
|
|
358
|
-
add_example_test(
|
|
359
|
-
TestSimExamples, name="sim.example_quadruped", devices=test_devices, test_options_cpu={"num_frames": 100}
|
|
360
|
-
)
|
|
361
|
-
add_example_test(TestSimExamples, name="sim.example_rigid_chain", devices=test_devices)
|
|
362
|
-
add_example_test(
|
|
363
|
-
TestSimExamples,
|
|
364
|
-
name="sim.example_rigid_contact",
|
|
365
|
-
devices=test_devices,
|
|
366
|
-
test_options={"usd_required": True},
|
|
367
|
-
test_options_cpu={"num_frames": 3},
|
|
368
|
-
)
|
|
369
|
-
add_example_test(
|
|
370
|
-
TestSimExamples, name="sim.example_rigid_soft_contact", devices=test_devices, test_options_cpu={"num_frames": 10}
|
|
371
|
-
)
|
|
372
|
-
add_example_test(TestSimExamples, name="sim.example_rigid_force", devices=test_devices)
|
|
373
|
-
add_example_test(TestSimExamples, name="sim.example_rigid_gyroscopic", devices=test_devices)
|
|
374
|
-
add_example_test(
|
|
375
|
-
TestSimExamples, name="sim.example_soft_body", devices=test_devices, test_options_cpu={"num_frames": 10}
|
|
376
|
-
)
|
|
377
294
|
|
|
378
295
|
|
|
379
296
|
class TestFemExamples(unittest.TestCase):
|
|
@@ -486,6 +403,21 @@ add_example_test(
|
|
|
486
403
|
test_options={"headless": True, "resolution": 16, "num_steps": 2},
|
|
487
404
|
)
|
|
488
405
|
|
|
406
|
+
|
|
407
|
+
class TestTileExamples(unittest.TestCase):
|
|
408
|
+
pass
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
add_example_test(
|
|
412
|
+
TestTileExamples,
|
|
413
|
+
name="tile.example_tile_mcgp",
|
|
414
|
+
devices=test_devices,
|
|
415
|
+
test_options={"height": 128, "headless": True, "usd_required": True},
|
|
416
|
+
test_options_cpu={"slices": 2},
|
|
417
|
+
test_options_cuda={"slices": 5},
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
|
|
489
421
|
if __name__ == "__main__":
|
|
490
422
|
# force rebuild of all kernels
|
|
491
423
|
wp.clear_kernel_cache()
|
warp/tests/test_fabricarray.py
CHANGED
|
@@ -26,14 +26,14 @@ from warp.tests.unittest_utils import *
|
|
|
26
26
|
|
|
27
27
|
# types to test fabric arrays
|
|
28
28
|
_fabric_types = [
|
|
29
|
-
*wp.types.scalar_types,
|
|
30
|
-
*[wp.types.vector(2, T) for T in wp.types.scalar_types],
|
|
31
|
-
*[wp.types.vector(3, T) for T in wp.types.scalar_types],
|
|
32
|
-
*[wp.types.vector(4, T) for T in wp.types.scalar_types],
|
|
33
|
-
*[wp.types.matrix((2, 2), T) for T in wp.types.scalar_types],
|
|
34
|
-
*[wp.types.matrix((3, 3), T) for T in wp.types.scalar_types],
|
|
35
|
-
*[wp.types.matrix((4, 4), T) for T in wp.types.scalar_types],
|
|
36
|
-
*[wp.types.quaternion(T) for T in wp.types.float_types],
|
|
29
|
+
*wp._src.types.scalar_types,
|
|
30
|
+
*[wp._src.types.vector(2, T) for T in wp._src.types.scalar_types],
|
|
31
|
+
*[wp._src.types.vector(3, T) for T in wp._src.types.scalar_types],
|
|
32
|
+
*[wp._src.types.vector(4, T) for T in wp._src.types.scalar_types],
|
|
33
|
+
*[wp._src.types.matrix((2, 2), T) for T in wp._src.types.scalar_types],
|
|
34
|
+
*[wp._src.types.matrix((3, 3), T) for T in wp._src.types.scalar_types],
|
|
35
|
+
*[wp._src.types.matrix((4, 4), T) for T in wp._src.types.scalar_types],
|
|
36
|
+
*[wp._src.types.quaternion(T) for T in wp._src.types.float_types],
|
|
37
37
|
]
|
|
38
38
|
|
|
39
39
|
|
|
@@ -114,7 +114,7 @@ def _create_fabric_array_interface(data: wp.array, attrib: str, bucket_sizes: li
|
|
|
114
114
|
# empty data array
|
|
115
115
|
bucket_sizes = []
|
|
116
116
|
|
|
117
|
-
dtype_size = wp.types.type_size_in_bytes(data.dtype)
|
|
117
|
+
dtype_size = wp._src.types.type_size_in_bytes(data.dtype)
|
|
118
118
|
p = int(data.ptr) if data.ptr else 0
|
|
119
119
|
pointers = []
|
|
120
120
|
counts = []
|
|
@@ -189,10 +189,10 @@ def _create_fabric_array_array_interface(data: list, attrib: str, bucket_sizes:
|
|
|
189
189
|
_array_lengths.append(data[i].size)
|
|
190
190
|
|
|
191
191
|
array_pointers = wp.array(_array_pointers, dtype=wp.uint64, device=device)
|
|
192
|
-
pointer_size = wp.types.type_size_in_bytes(array_pointers.dtype)
|
|
192
|
+
pointer_size = wp._src.types.type_size_in_bytes(array_pointers.dtype)
|
|
193
193
|
|
|
194
194
|
lengths = wp.array(_array_lengths, dtype=wp.uint64, device=device)
|
|
195
|
-
length_size = wp.types.type_size_in_bytes(lengths.dtype)
|
|
195
|
+
length_size = wp._src.types.type_size_in_bytes(lengths.dtype)
|
|
196
196
|
|
|
197
197
|
p_pointers = int(array_pointers.ptr)
|
|
198
198
|
p_lengths = int(lengths.ptr)
|
|
@@ -296,9 +296,9 @@ def fa_generic_dtype_kernel_indexed(a: wp.indexedfabricarray(dtype=Any), b: wp.i
|
|
|
296
296
|
def test_fabricarray_generic_dtype(test, device):
|
|
297
297
|
for T in _fabric_types:
|
|
298
298
|
if hasattr(T, "_wp_scalar_type_"):
|
|
299
|
-
nptype = wp.types.warp_type_to_np_dtype[T._wp_scalar_type_]
|
|
299
|
+
nptype = wp._src.types.warp_type_to_np_dtype[T._wp_scalar_type_]
|
|
300
300
|
else:
|
|
301
|
-
nptype = wp.types.warp_type_to_np_dtype[T]
|
|
301
|
+
nptype = wp._src.types.warp_type_to_np_dtype[T]
|
|
302
302
|
|
|
303
303
|
data = wp.array(data=np.arange(10, dtype=nptype), device=device)
|
|
304
304
|
data_iface = _create_fabric_array_interface(data, "foo", copy=True)
|
|
@@ -345,9 +345,9 @@ def fa_generic_array_kernel(a: Any, b: Any):
|
|
|
345
345
|
def test_fabricarray_generic_array(test, device):
|
|
346
346
|
for T in _fabric_types:
|
|
347
347
|
if hasattr(T, "_wp_scalar_type_"):
|
|
348
|
-
nptype = wp.types.warp_type_to_np_dtype[T._wp_scalar_type_]
|
|
348
|
+
nptype = wp._src.types.warp_type_to_np_dtype[T._wp_scalar_type_]
|
|
349
349
|
else:
|
|
350
|
-
nptype = wp.types.warp_type_to_np_dtype[T]
|
|
350
|
+
nptype = wp._src.types.warp_type_to_np_dtype[T]
|
|
351
351
|
|
|
352
352
|
data = wp.array(data=np.arange(100, dtype=nptype), device=device)
|
|
353
353
|
data_iface = _create_fabric_array_interface(data, "foo", copy=True)
|
|
@@ -393,9 +393,9 @@ def test_fabricarray_empty(test, device):
|
|
|
393
393
|
# scalar, vector, or matrix
|
|
394
394
|
if ncols > 0:
|
|
395
395
|
if nrows > 0:
|
|
396
|
-
wptype = wp.types.matrix((nrows, ncols), wptype)
|
|
396
|
+
wptype = wp._src.types.matrix((nrows, ncols), wptype)
|
|
397
397
|
else:
|
|
398
|
-
wptype = wp.types.vector(ncols, wptype)
|
|
398
|
+
wptype = wp._src.types.vector(ncols, wptype)
|
|
399
399
|
dtype_shape = wptype._shape_
|
|
400
400
|
else:
|
|
401
401
|
dtype_shape = ()
|
|
@@ -461,7 +461,7 @@ def test_fabricarray_empty(test, device):
|
|
|
461
461
|
test.assertEqual(ifa.list(), [])
|
|
462
462
|
|
|
463
463
|
# test with scalars, vectors, and matrices
|
|
464
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
464
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
465
465
|
# scalars
|
|
466
466
|
test_empty_ops(0, 0, wptype, nptype)
|
|
467
467
|
|
|
@@ -473,7 +473,7 @@ def test_fabricarray_empty(test, device):
|
|
|
473
473
|
|
|
474
474
|
|
|
475
475
|
def test_fabricarray_fill_scalar(test, device):
|
|
476
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
476
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
477
477
|
# create a data array
|
|
478
478
|
data = wp.zeros(100, dtype=wptype, device=device)
|
|
479
479
|
iface = _create_fabric_array_interface(data, "foo", copy=True)
|
|
@@ -489,7 +489,7 @@ def test_fabricarray_fill_scalar(test, device):
|
|
|
489
489
|
fa.zero_()
|
|
490
490
|
assert_np_equal(fa.numpy(), np.zeros(fa.shape, dtype=nptype))
|
|
491
491
|
|
|
492
|
-
if wptype in wp.types.float_types:
|
|
492
|
+
if wptype in wp._src.types.float_types:
|
|
493
493
|
# fill with float value
|
|
494
494
|
fill_value = 13.37
|
|
495
495
|
fa.fill_(fill_value)
|
|
@@ -524,7 +524,7 @@ def test_fabricarray_fill_scalar(test, device):
|
|
|
524
524
|
assert_np_equal(ifa.numpy(), np.zeros(ifa.shape, dtype=nptype))
|
|
525
525
|
assert_np_equal(ifb.numpy(), np.zeros(ifb.shape, dtype=nptype))
|
|
526
526
|
|
|
527
|
-
if wptype in wp.types.float_types:
|
|
527
|
+
if wptype in wp._src.types.float_types:
|
|
528
528
|
# fill with float value
|
|
529
529
|
fill_value = 13.37
|
|
530
530
|
ifa.fill_(fill_value)
|
|
@@ -541,13 +541,13 @@ def test_fabricarray_fill_scalar(test, device):
|
|
|
541
541
|
def test_fabricarray_fill_vector(test, device):
|
|
542
542
|
# test filling a vector array with scalar or vector values (vec_type, list, or numpy array)
|
|
543
543
|
|
|
544
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
544
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
545
545
|
# vector types
|
|
546
546
|
vector_types = [
|
|
547
|
-
wp.types.vector(2, wptype),
|
|
548
|
-
wp.types.vector(3, wptype),
|
|
549
|
-
wp.types.vector(4, wptype),
|
|
550
|
-
wp.types.vector(5, wptype),
|
|
547
|
+
wp._src.types.vector(2, wptype),
|
|
548
|
+
wp._src.types.vector(3, wptype),
|
|
549
|
+
wp._src.types.vector(4, wptype),
|
|
550
|
+
wp._src.types.vector(5, wptype),
|
|
551
551
|
]
|
|
552
552
|
|
|
553
553
|
for vec_type in vector_types:
|
|
@@ -593,7 +593,7 @@ def test_fabricarray_fill_vector(test, device):
|
|
|
593
593
|
fa.fill_(fill_vec)
|
|
594
594
|
assert_np_equal(fa.numpy(), expected)
|
|
595
595
|
|
|
596
|
-
if wptype in wp.types.float_types:
|
|
596
|
+
if wptype in wp._src.types.float_types:
|
|
597
597
|
# fill with float scalar
|
|
598
598
|
fill_value = 13.37
|
|
599
599
|
fa.fill_(fill_value)
|
|
@@ -661,7 +661,7 @@ def test_fabricarray_fill_vector(test, device):
|
|
|
661
661
|
assert_np_equal(ifa.numpy(), expected)
|
|
662
662
|
assert_np_equal(ifb.numpy(), np.zeros((*ifb.shape, vec_len), dtype=nptype))
|
|
663
663
|
|
|
664
|
-
if wptype in wp.types.float_types:
|
|
664
|
+
if wptype in wp._src.types.float_types:
|
|
665
665
|
# fill with float scalar
|
|
666
666
|
fill_value = 13.37
|
|
667
667
|
ifa.fill_(fill_value)
|
|
@@ -682,14 +682,14 @@ def test_fabricarray_fill_vector(test, device):
|
|
|
682
682
|
def test_fabricarray_fill_matrix(test, device):
|
|
683
683
|
# test filling a matrix array with scalar or matrix values (mat_type, nested list, or 2d numpy array)
|
|
684
684
|
|
|
685
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
685
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
686
686
|
# matrix types
|
|
687
687
|
matrix_types = [
|
|
688
688
|
# square matrices only
|
|
689
|
-
wp.types.matrix((2, 2), wptype),
|
|
690
|
-
wp.types.matrix((3, 3), wptype),
|
|
691
|
-
wp.types.matrix((4, 4), wptype),
|
|
692
|
-
wp.types.matrix((5, 5), wptype),
|
|
689
|
+
wp._src.types.matrix((2, 2), wptype),
|
|
690
|
+
wp._src.types.matrix((3, 3), wptype),
|
|
691
|
+
wp._src.types.matrix((4, 4), wptype),
|
|
692
|
+
wp._src.types.matrix((5, 5), wptype),
|
|
693
693
|
]
|
|
694
694
|
|
|
695
695
|
for mat_type in matrix_types:
|
|
@@ -896,9 +896,9 @@ def fa_generic_sums_kernel_indexed(a: wp.indexedfabricarrayarray(dtype=Any), sum
|
|
|
896
896
|
def test_fabricarrayarray(test, device):
|
|
897
897
|
for T in _fabric_types:
|
|
898
898
|
if hasattr(T, "_wp_scalar_type_"):
|
|
899
|
-
nptype = wp.types.warp_type_to_np_dtype[T._wp_scalar_type_]
|
|
899
|
+
nptype = wp._src.types.warp_type_to_np_dtype[T._wp_scalar_type_]
|
|
900
900
|
else:
|
|
901
|
-
nptype = wp.types.warp_type_to_np_dtype[T]
|
|
901
|
+
nptype = wp._src.types.warp_type_to_np_dtype[T]
|
|
902
902
|
|
|
903
903
|
n = 100
|
|
904
904
|
|
warp/tests/test_fast_math.py
CHANGED
warp/tests/test_fem.py
CHANGED
|
@@ -22,19 +22,18 @@ import numpy as np
|
|
|
22
22
|
|
|
23
23
|
import warp as wp
|
|
24
24
|
import warp.fem as fem
|
|
25
|
-
from warp.fem import
|
|
25
|
+
from warp._src.fem.geometry.closest_point import project_on_tet_at_origin, project_on_tri_at_origin
|
|
26
|
+
from warp._src.fem.space import shape
|
|
27
|
+
from warp.fem import Coords, D, Domain, Field, Sample, curl, div, grad, integrand, make_free_sample, normal
|
|
26
28
|
from warp.fem.cache import dynamic_kernel
|
|
27
|
-
from warp.fem.geometry.closest_point import project_on_tet_at_origin, project_on_tri_at_origin
|
|
28
29
|
from warp.fem.linalg import inverse_qr, spherical_part, symmetric_eigenvalues_qr, symmetric_part
|
|
29
|
-
from warp.fem.space import shape
|
|
30
|
-
from warp.fem.types import make_free_sample
|
|
31
30
|
from warp.fem.utils import (
|
|
32
31
|
grid_to_hexes,
|
|
33
32
|
grid_to_quads,
|
|
34
33
|
grid_to_tets,
|
|
35
34
|
grid_to_tris,
|
|
36
35
|
)
|
|
37
|
-
from warp.sparse import bsr_zeros
|
|
36
|
+
from warp.sparse import bsr_set_zero, bsr_zeros
|
|
38
37
|
from warp.tests.unittest_utils import *
|
|
39
38
|
|
|
40
39
|
vec6f = wp.vec(length=6, dtype=float)
|
|
@@ -586,7 +585,7 @@ def _launch_test_geometry_kernel(geo: fem.Geometry, device):
|
|
|
586
585
|
fem.interpolate(
|
|
587
586
|
_test_geo_sides,
|
|
588
587
|
quadrature=side_quadrature,
|
|
589
|
-
values={"side_measures": side_measures, "ref_measure": geo.reference_side().measure()},
|
|
588
|
+
values={"side_measures": side_measures, "ref_measure": geo.reference_side().prototype.measure()},
|
|
590
589
|
)
|
|
591
590
|
|
|
592
591
|
if geo.side_normal is not None:
|
|
@@ -775,7 +774,7 @@ def _refinement_field(x: wp.vec3):
|
|
|
775
774
|
def test_adaptive_nanogrid(test, device):
|
|
776
775
|
# 3 res-1 voxels, 8 res-0 voxels
|
|
777
776
|
|
|
778
|
-
if platform.system() == "Windows" or (device.is_cuda and wp.context.runtime.toolkit_version[0] == 11):
|
|
777
|
+
if platform.system() == "Windows" or (device.is_cuda and wp._src.context.runtime.toolkit_version[0] == 11):
|
|
779
778
|
test.skipTest("Skipping test due to NVRTC bug on CUDA 11 and Windows")
|
|
780
779
|
|
|
781
780
|
res0 = wp.array(
|
|
@@ -1045,7 +1044,7 @@ def test_closest_point_queries(test, device):
|
|
|
1045
1044
|
|
|
1046
1045
|
|
|
1047
1046
|
def test_regular_quadrature(test, device):
|
|
1048
|
-
from warp.fem.geometry.element import LinearEdge, Polynomial, Triangle
|
|
1047
|
+
from warp._src.fem.geometry.element import LinearEdge, Polynomial, Triangle
|
|
1049
1048
|
|
|
1050
1049
|
for family in Polynomial:
|
|
1051
1050
|
# test integrating monomials
|
|
@@ -1573,7 +1572,9 @@ def test_particle_quadratures(test, device):
|
|
|
1573
1572
|
domain = fem.Cells(geo)
|
|
1574
1573
|
|
|
1575
1574
|
# Explicit quadrature
|
|
1576
|
-
points, weights = domain.reference_element().instantiate_quadrature(
|
|
1575
|
+
points, weights = domain.reference_element().prototype.instantiate_quadrature(
|
|
1576
|
+
order=4, family=fem.Polynomial.GAUSS_LEGENDRE
|
|
1577
|
+
)
|
|
1577
1578
|
points_per_cell = len(points)
|
|
1578
1579
|
|
|
1579
1580
|
points = points * domain.element_count()
|
|
@@ -2046,7 +2047,7 @@ def test_array_axpy(test, device):
|
|
|
2046
2047
|
|
|
2047
2048
|
tape = wp.Tape()
|
|
2048
2049
|
with tape:
|
|
2049
|
-
fem.
|
|
2050
|
+
fem.linalg.array_axpy(x=x, y=y, alpha=alpha, beta=beta)
|
|
2050
2051
|
|
|
2051
2052
|
assert_np_equal(x.numpy(), np.full(N, 2.0))
|
|
2052
2053
|
assert_np_equal(y.numpy(), alpha * x.numpy() + beta * np.arange(N))
|
|
@@ -2097,6 +2098,50 @@ def test_integrate_high_order(test_field, device):
|
|
|
2097
2098
|
assert_np_equal(h0.values[:h0_nnz].numpy(), h1.values[:h1_nnz].numpy(), tol=1.0e-6)
|
|
2098
2099
|
|
|
2099
2100
|
|
|
2101
|
+
def test_capturability(test, device):
|
|
2102
|
+
A = bsr_zeros(0, 0, block_type=wp.float32, device=device)
|
|
2103
|
+
|
|
2104
|
+
def test_body():
|
|
2105
|
+
geo = fem.Grid3D(res=(4, 4, 4))
|
|
2106
|
+
space = fem.make_polynomial_space(geo, degree=1)
|
|
2107
|
+
|
|
2108
|
+
cell_mask = wp.zeros(geo.cell_count(), dtype=int, device=device)
|
|
2109
|
+
cell_mask[16:32].fill_(1)
|
|
2110
|
+
|
|
2111
|
+
geo_partition = fem.ExplicitGeometryPartition(geo, cell_mask, max_cell_count=32, max_side_count=0)
|
|
2112
|
+
space_partition = fem.make_space_partition(space, geo_partition, with_halo=False, max_node_count=64)
|
|
2113
|
+
|
|
2114
|
+
test_field = fem.make_test(space, space_partition=space_partition)
|
|
2115
|
+
trial_field = fem.make_trial(space, space_partition=space_partition)
|
|
2116
|
+
bsr_set_zero(
|
|
2117
|
+
A,
|
|
2118
|
+
rows_of_blocks=test_field.space_partition.node_count(),
|
|
2119
|
+
cols_of_blocks=trial_field.space_partition.node_count(),
|
|
2120
|
+
)
|
|
2121
|
+
fem.integrate(
|
|
2122
|
+
bilinear_form,
|
|
2123
|
+
fields={"v": test_field, "u": trial_field},
|
|
2124
|
+
kernel_options={"enable_backward": False},
|
|
2125
|
+
output=A,
|
|
2126
|
+
)
|
|
2127
|
+
|
|
2128
|
+
with wp.ScopedDevice(device):
|
|
2129
|
+
test_body()
|
|
2130
|
+
assert A.shape == (64, 64)
|
|
2131
|
+
nnz_ref = A.nnz_sync()
|
|
2132
|
+
values_ref = A.values.numpy()[:nnz_ref]
|
|
2133
|
+
columns_ref = A.columns.numpy()[:nnz_ref]
|
|
2134
|
+
bsr_set_zero(A)
|
|
2135
|
+
assert A.nnz_sync() == 0
|
|
2136
|
+
|
|
2137
|
+
with wp.ScopedCapture() as capture:
|
|
2138
|
+
test_body()
|
|
2139
|
+
wp.capture_launch(capture.graph)
|
|
2140
|
+
assert A.nnz_sync() == nnz_ref
|
|
2141
|
+
assert_np_equal(A.values.numpy()[:nnz_ref], values_ref)
|
|
2142
|
+
assert_np_equal(A.columns.numpy()[:nnz_ref], columns_ref)
|
|
2143
|
+
|
|
2144
|
+
|
|
2100
2145
|
devices = get_test_devices()
|
|
2101
2146
|
cuda_devices = get_selected_cuda_test_devices()
|
|
2102
2147
|
|
|
@@ -2152,6 +2197,7 @@ add_function_test(TestFemShapeFunctions, "test_cube_shape_functions", test_cube_
|
|
|
2152
2197
|
add_function_test(TestFemShapeFunctions, "test_tri_shape_functions", test_tri_shape_functions)
|
|
2153
2198
|
add_function_test(TestFemShapeFunctions, "test_tet_shape_functions", test_tet_shape_functions)
|
|
2154
2199
|
|
|
2200
|
+
add_function_test(TestFemShapeFunctions, "test_capturability", test_capturability, devices=cuda_devices)
|
|
2155
2201
|
|
|
2156
2202
|
if __name__ == "__main__":
|
|
2157
2203
|
wp.clear_kernel_cache()
|
warp/tests/test_fixedarray.py
CHANGED
|
@@ -115,7 +115,7 @@ def test_error_invalid_func_return_annotation(test, device):
|
|
|
115
115
|
arr = func()
|
|
116
116
|
|
|
117
117
|
with test.assertRaisesRegex(
|
|
118
|
-
wp.codegen.WarpCodegenError,
|
|
118
|
+
wp._src.codegen.WarpCodegenError,
|
|
119
119
|
r"The function `func` returns a fixed-size array whereas it has its return type annotated as `Array\[int32\]`.$",
|
|
120
120
|
):
|
|
121
121
|
wp.launch(kernel, 1, device=device)
|
|
@@ -152,8 +152,8 @@ def test_capture_if_kernel():
|
|
|
152
152
|
def test_capture_if(test, device):
|
|
153
153
|
if (
|
|
154
154
|
not wp.get_device(device).is_cuda
|
|
155
|
-
or wp.context.runtime.toolkit_version < (12, 4)
|
|
156
|
-
or wp.context.runtime.driver_version < (12, 4)
|
|
155
|
+
or wp._src.context.runtime.toolkit_version < (12, 4)
|
|
156
|
+
or wp._src.context.runtime.driver_version < (12, 4)
|
|
157
157
|
):
|
|
158
158
|
return
|
|
159
159
|
|
warp/tests/test_func.py
CHANGED
|
@@ -396,7 +396,7 @@ class TestFunc(unittest.TestCase):
|
|
|
396
396
|
t = wp.transform(*wp.transform(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0))
|
|
397
397
|
self.assertSequenceEqual(t, (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0))
|
|
398
398
|
|
|
399
|
-
transformf = wp.types.transformation(dtype=float)
|
|
399
|
+
transformf = wp._src.types.transformation(dtype=float)
|
|
400
400
|
|
|
401
401
|
t = wp.transformf((1.0, 2.0, 3.0), (4.0, 5.0, 6.0, 7.0))
|
|
402
402
|
self.assertSequenceEqual(
|
|
@@ -408,6 +408,12 @@ class TestFunc(unittest.TestCase):
|
|
|
408
408
|
(-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0),
|
|
409
409
|
)
|
|
410
410
|
|
|
411
|
+
with self.assertRaisesRegex(
|
|
412
|
+
TypeError,
|
|
413
|
+
r"^got an unexpected keyword argument 'pos'$",
|
|
414
|
+
):
|
|
415
|
+
wp.transform(pos=wp.vec3(), rot=wp.quat())
|
|
416
|
+
|
|
411
417
|
f = wp.sin(math.pi * 0.5)
|
|
412
418
|
self.assertAlmostEqual(f, 1.0, places=3)
|
|
413
419
|
|
|
@@ -443,10 +449,7 @@ class TestFunc(unittest.TestCase):
|
|
|
443
449
|
a * b
|
|
444
450
|
|
|
445
451
|
def test_cpython_call_user_function_with_error(self):
|
|
446
|
-
with self.
|
|
447
|
-
ZeroDivisionError,
|
|
448
|
-
"float division by zero",
|
|
449
|
-
):
|
|
452
|
+
with self.assertRaises(ZeroDivisionError):
|
|
450
453
|
divide_by_zero(1.0)
|
|
451
454
|
|
|
452
455
|
def test_cpython_call_user_function_with_wrong_argument_types(self):
|
warp/tests/test_generics.py
CHANGED
|
@@ -521,7 +521,7 @@ def test_type_attribute_error(test, device):
|
|
|
521
521
|
a = wp.vec3(0.0)
|
|
522
522
|
_ = a.dtype.shape
|
|
523
523
|
|
|
524
|
-
with test.assertRaisesRegex(AttributeError, r"`shape` is not an attribute of '<class 'warp.types.float32'>'"):
|
|
524
|
+
with test.assertRaisesRegex(AttributeError, r"`shape` is not an attribute of '<class 'warp._src.types.float32'>'"):
|
|
525
525
|
wp.launch(
|
|
526
526
|
kernel,
|
|
527
527
|
dim=1,
|
warp/tests/test_indexedarray.py
CHANGED
|
@@ -268,9 +268,9 @@ def test_indexedarray_mixed(test, device):
|
|
|
268
268
|
wp.launch(kernel_3d, dim=iarr.shape, inputs=[iarr, expected_arr], device=device)
|
|
269
269
|
|
|
270
270
|
|
|
271
|
-
vec2i = wp.types.vector(length=2, dtype=wp.int32)
|
|
272
|
-
vec3i = wp.types.vector(length=3, dtype=wp.int32)
|
|
273
|
-
vec4i = wp.types.vector(length=4, dtype=wp.int32)
|
|
271
|
+
vec2i = wp._src.types.vector(length=2, dtype=wp.int32)
|
|
272
|
+
vec3i = wp._src.types.vector(length=3, dtype=wp.int32)
|
|
273
|
+
vec4i = wp._src.types.vector(length=4, dtype=wp.int32)
|
|
274
274
|
|
|
275
275
|
|
|
276
276
|
@wp.kernel
|
|
@@ -571,13 +571,13 @@ def test_indexedarray_empty(test, device):
|
|
|
571
571
|
data_shape = (1,) * ndim
|
|
572
572
|
dtype_shape = ()
|
|
573
573
|
|
|
574
|
-
if wptype in wp.types.scalar_types:
|
|
574
|
+
if wptype in wp._src.types.scalar_types:
|
|
575
575
|
# scalar, vector, or matrix
|
|
576
576
|
if ncols > 0:
|
|
577
577
|
if nrows > 0:
|
|
578
|
-
wptype = wp.types.matrix((nrows, ncols), wptype)
|
|
578
|
+
wptype = wp._src.types.matrix((nrows, ncols), wptype)
|
|
579
579
|
else:
|
|
580
|
-
wptype = wp.types.vector(ncols, wptype)
|
|
580
|
+
wptype = wp._src.types.vector(ncols, wptype)
|
|
581
581
|
dtype_shape = wptype._shape_
|
|
582
582
|
fill_value = wptype(42)
|
|
583
583
|
else:
|
|
@@ -620,7 +620,7 @@ def test_indexedarray_empty(test, device):
|
|
|
620
620
|
|
|
621
621
|
for ndim in range(1, 5):
|
|
622
622
|
# test with scalars, vectors, and matrices
|
|
623
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
623
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
624
624
|
# scalars
|
|
625
625
|
test_empty_ops(ndim, 0, 0, wptype, nptype)
|
|
626
626
|
|
|
@@ -643,7 +643,7 @@ def test_indexedarray_empty(test, device):
|
|
|
643
643
|
def test_indexedarray_fill_scalar(test, device):
|
|
644
644
|
dim_x = 4
|
|
645
645
|
|
|
646
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
646
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
647
647
|
data1 = wp.zeros(dim_x, dtype=wptype, device=device)
|
|
648
648
|
data2 = wp.zeros((dim_x, dim_x), dtype=wptype, device=device)
|
|
649
649
|
data3 = wp.zeros((dim_x, dim_x, dim_x), dtype=wptype, device=device)
|
|
@@ -684,7 +684,7 @@ def test_indexedarray_fill_scalar(test, device):
|
|
|
684
684
|
assert_np_equal(a3.numpy(), np.zeros(a3.shape, dtype=nptype))
|
|
685
685
|
assert_np_equal(a4.numpy(), np.zeros(a4.shape, dtype=nptype))
|
|
686
686
|
|
|
687
|
-
if wptype in wp.types.float_types:
|
|
687
|
+
if wptype in wp._src.types.float_types:
|
|
688
688
|
# fill with float value
|
|
689
689
|
fill_value = 13.37
|
|
690
690
|
|
|
@@ -717,13 +717,13 @@ def test_indexedarray_fill_vector(test, device):
|
|
|
717
717
|
|
|
718
718
|
dim_x = 4
|
|
719
719
|
|
|
720
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
720
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
721
721
|
# vector types
|
|
722
722
|
vector_types = [
|
|
723
|
-
wp.types.vector(2, wptype),
|
|
724
|
-
wp.types.vector(3, wptype),
|
|
725
|
-
wp.types.vector(4, wptype),
|
|
726
|
-
wp.types.vector(5, wptype),
|
|
723
|
+
wp._src.types.vector(2, wptype),
|
|
724
|
+
wp._src.types.vector(3, wptype),
|
|
725
|
+
wp._src.types.vector(4, wptype),
|
|
726
|
+
wp._src.types.vector(5, wptype),
|
|
727
727
|
]
|
|
728
728
|
|
|
729
729
|
for vec_type in vector_types:
|
|
@@ -825,7 +825,7 @@ def test_indexedarray_fill_vector(test, device):
|
|
|
825
825
|
assert_np_equal(a3.numpy(), expected3)
|
|
826
826
|
assert_np_equal(a4.numpy(), expected4)
|
|
827
827
|
|
|
828
|
-
if wptype in wp.types.float_types:
|
|
828
|
+
if wptype in wp._src.types.float_types:
|
|
829
829
|
# fill with float scalar
|
|
830
830
|
fill_value = 13.37
|
|
831
831
|
|
|
@@ -863,19 +863,19 @@ def test_indexedarray_fill_matrix(test, device):
|
|
|
863
863
|
|
|
864
864
|
dim_x = 4
|
|
865
865
|
|
|
866
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
866
|
+
for nptype, wptype in wp._src.types.np_dtype_to_warp_type.items():
|
|
867
867
|
# matrix types
|
|
868
868
|
matrix_types = [
|
|
869
869
|
# square matrices
|
|
870
|
-
wp.types.matrix((2, 2), wptype),
|
|
871
|
-
wp.types.matrix((3, 3), wptype),
|
|
872
|
-
wp.types.matrix((4, 4), wptype),
|
|
873
|
-
wp.types.matrix((5, 5), wptype),
|
|
870
|
+
wp._src.types.matrix((2, 2), wptype),
|
|
871
|
+
wp._src.types.matrix((3, 3), wptype),
|
|
872
|
+
wp._src.types.matrix((4, 4), wptype),
|
|
873
|
+
wp._src.types.matrix((5, 5), wptype),
|
|
874
874
|
# non-square matrices
|
|
875
|
-
wp.types.matrix((2, 3), wptype),
|
|
876
|
-
wp.types.matrix((3, 2), wptype),
|
|
877
|
-
wp.types.matrix((3, 4), wptype),
|
|
878
|
-
wp.types.matrix((4, 3), wptype),
|
|
875
|
+
wp._src.types.matrix((2, 3), wptype),
|
|
876
|
+
wp._src.types.matrix((3, 2), wptype),
|
|
877
|
+
wp._src.types.matrix((3, 4), wptype),
|
|
878
|
+
wp._src.types.matrix((4, 3), wptype),
|
|
879
879
|
]
|
|
880
880
|
|
|
881
881
|
for mat_type in matrix_types:
|