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/__main__.py
CHANGED
warp/tests/cuda/test_async.py
CHANGED
|
@@ -18,8 +18,8 @@ import unittest
|
|
|
18
18
|
import numpy as np
|
|
19
19
|
|
|
20
20
|
import warp as wp
|
|
21
|
+
from warp._src.utils import check_p2p
|
|
21
22
|
from warp.tests.unittest_utils import *
|
|
22
|
-
from warp.utils import check_p2p
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class Capturable:
|
|
@@ -426,13 +426,13 @@ def copy_template(test, src_ctor, dst_ctor, src_device, dst_device, n, params: C
|
|
|
426
426
|
if expected_error_type is not None:
|
|
427
427
|
# disable error output from Warp if we expect an exception
|
|
428
428
|
try:
|
|
429
|
-
saved_error_output_enabled = wp.context.runtime.core.wp_is_error_output_enabled()
|
|
430
|
-
wp.context.runtime.core.wp_set_error_output_enabled(False)
|
|
429
|
+
saved_error_output_enabled = wp._src.context.runtime.core.wp_is_error_output_enabled()
|
|
430
|
+
wp._src.context.runtime.core.wp_set_error_output_enabled(False)
|
|
431
431
|
with test.assertRaisesRegex(expected_error_type, expected_error_regex):
|
|
432
432
|
with Capturable(use_graph=params.use_graph, stream=stream):
|
|
433
433
|
wp.copy(dst, src, stream=stream_arg)
|
|
434
434
|
finally:
|
|
435
|
-
wp.context.runtime.core.wp_set_error_output_enabled(saved_error_output_enabled)
|
|
435
|
+
wp._src.context.runtime.core.wp_set_error_output_enabled(saved_error_output_enabled)
|
|
436
436
|
wp.synchronize()
|
|
437
437
|
|
|
438
438
|
# print(f"SUCCESSFUL ERROR PREDICTION: {expected_error_regex}")
|
warp/tests/cuda/test_multigpu.py
CHANGED
warp/tests/cuda/test_streams.py
CHANGED
|
@@ -18,8 +18,8 @@ import unittest
|
|
|
18
18
|
import numpy as np
|
|
19
19
|
|
|
20
20
|
import warp as wp
|
|
21
|
+
from warp._src.utils import check_p2p
|
|
21
22
|
from warp.tests.unittest_utils import *
|
|
22
|
-
from warp.utils import check_p2p
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
@wp.kernel
|
|
@@ -365,6 +365,41 @@ def test_event_elapsed_time_graph(test, device):
|
|
|
365
365
|
test.assertGreater(elapsed, 0)
|
|
366
366
|
|
|
367
367
|
|
|
368
|
+
def test_event_external(test, device):
|
|
369
|
+
with wp.ScopedDevice(device):
|
|
370
|
+
# event used to synchronize two graphs (external event)
|
|
371
|
+
event = wp.Event()
|
|
372
|
+
|
|
373
|
+
n = 1_000_000
|
|
374
|
+
a = wp.zeros(n, dtype=float)
|
|
375
|
+
b = wp.zeros(n, dtype=float)
|
|
376
|
+
c = wp.zeros(n, dtype=float)
|
|
377
|
+
|
|
378
|
+
with wp.ScopedCapture() as capture1:
|
|
379
|
+
wp.launch(inc, dim=n, inputs=[a])
|
|
380
|
+
wp.launch(inc, dim=n, inputs=[b])
|
|
381
|
+
# record in first graph
|
|
382
|
+
wp.record_event(event, external=True)
|
|
383
|
+
|
|
384
|
+
with wp.ScopedCapture() as capture2:
|
|
385
|
+
# wait in second graph
|
|
386
|
+
wp.wait_event(event, external=True)
|
|
387
|
+
wp.launch(sum, dim=n, inputs=[a, b, c])
|
|
388
|
+
|
|
389
|
+
stream1 = wp.Stream()
|
|
390
|
+
stream2 = wp.Stream()
|
|
391
|
+
num_iters = 10
|
|
392
|
+
|
|
393
|
+
for _ in range(num_iters):
|
|
394
|
+
# Launch graphs on different streams, but they should be
|
|
395
|
+
# synchronized using the external event.
|
|
396
|
+
wp.capture_launch(capture1.graph, stream=stream1)
|
|
397
|
+
wp.capture_launch(capture2.graph, stream=stream2)
|
|
398
|
+
|
|
399
|
+
expected = np.full(n, 2 * num_iters, dtype=np.float32)
|
|
400
|
+
assert_np_equal(c.numpy(), expected)
|
|
401
|
+
|
|
402
|
+
|
|
368
403
|
def test_stream_priority_basics(test, device):
|
|
369
404
|
standard_stream = wp.Stream(device)
|
|
370
405
|
test.assertEqual(standard_stream.priority, 0, "Default priority of streams must be 0.")
|
|
@@ -470,6 +505,25 @@ def test_stream_event_is_complete(test, device):
|
|
|
470
505
|
test.assertEqual(a.numpy()[0], (iter + 1) * threads)
|
|
471
506
|
|
|
472
507
|
|
|
508
|
+
def test_graph_destroy_during_capture(test, device):
|
|
509
|
+
with wp.ScopedDevice(device):
|
|
510
|
+
n = 10
|
|
511
|
+
a = wp.zeros(n, dtype=float)
|
|
512
|
+
|
|
513
|
+
with wp.ScopedCapture() as capture1:
|
|
514
|
+
wp.launch(inc, dim=n, inputs=[a])
|
|
515
|
+
|
|
516
|
+
wp.capture_launch(capture1.graph)
|
|
517
|
+
|
|
518
|
+
with wp.ScopedCapture() as capture2:
|
|
519
|
+
del capture1 # <--- should be deferred
|
|
520
|
+
wp.launch(inc, dim=n, inputs=[a])
|
|
521
|
+
|
|
522
|
+
wp.capture_launch(capture2.graph)
|
|
523
|
+
|
|
524
|
+
assert_np_equal(a.numpy(), np.full(n, 2, dtype=np.float32))
|
|
525
|
+
|
|
526
|
+
|
|
473
527
|
devices = get_selected_cuda_test_devices()
|
|
474
528
|
|
|
475
529
|
|
|
@@ -628,6 +682,9 @@ add_function_test(TestStreams, "test_stream_event_is_complete", test_stream_even
|
|
|
628
682
|
add_function_test(TestStreams, "test_event_synchronize", test_event_synchronize, devices=devices)
|
|
629
683
|
add_function_test(TestStreams, "test_event_elapsed_time", test_event_elapsed_time, devices=devices)
|
|
630
684
|
add_function_test(TestStreams, "test_event_elapsed_time_graph", test_event_elapsed_time_graph, devices=devices)
|
|
685
|
+
add_function_test(TestStreams, "test_event_external", test_event_external, devices=devices)
|
|
686
|
+
|
|
687
|
+
add_function_test(TestStreams, "test_graph_destroy_during_capture", test_graph_destroy_during_capture, devices=devices)
|
|
631
688
|
|
|
632
689
|
if __name__ == "__main__":
|
|
633
690
|
wp.clear_kernel_cache()
|
warp/tests/geometry/test_bvh.py
CHANGED
|
@@ -75,7 +75,7 @@ def intersect_ray_aabb(start, rcp_dir, lower, upper):
|
|
|
75
75
|
return 0
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
def test_bvh(test, type, device):
|
|
78
|
+
def test_bvh(test, type, device, leaf_size):
|
|
79
79
|
rng = np.random.default_rng(123)
|
|
80
80
|
|
|
81
81
|
num_bounds = 100
|
|
@@ -85,7 +85,7 @@ def test_bvh(test, type, device):
|
|
|
85
85
|
device_lowers = wp.array(lowers, dtype=wp.vec3, device=device)
|
|
86
86
|
device_uppers = wp.array(uppers, dtype=wp.vec3, device=device)
|
|
87
87
|
|
|
88
|
-
bvh = wp.Bvh(device_lowers, device_uppers)
|
|
88
|
+
bvh = wp.Bvh(device_lowers, device_uppers, leaf_size=leaf_size)
|
|
89
89
|
|
|
90
90
|
bounds_intersected = wp.zeros(shape=(num_bounds), dtype=int, device=device)
|
|
91
91
|
|
|
@@ -95,18 +95,16 @@ def test_bvh(test, type, device):
|
|
|
95
95
|
query_start = wp.vec3(0.0, 0.0, 0.0)
|
|
96
96
|
query_dir = wp.normalize(wp.vec3(1.0, 1.0, 1.0))
|
|
97
97
|
|
|
98
|
-
for test_case in range(
|
|
98
|
+
for test_case in range(3):
|
|
99
99
|
if type == "AABB":
|
|
100
100
|
wp.launch(
|
|
101
|
-
|
|
101
|
+
bvh_query_aabb,
|
|
102
102
|
dim=1,
|
|
103
103
|
inputs=[bvh.id, query_lower, query_upper, bounds_intersected],
|
|
104
104
|
device=device,
|
|
105
105
|
)
|
|
106
106
|
else:
|
|
107
|
-
wp.launch(
|
|
108
|
-
kernel=bvh_query_ray, dim=1, inputs=[bvh.id, query_start, query_dir, bounds_intersected], device=device
|
|
109
|
-
)
|
|
107
|
+
wp.launch(bvh_query_ray, dim=1, inputs=[bvh.id, query_start, query_dir, bounds_intersected], device=device)
|
|
110
108
|
|
|
111
109
|
device_intersected = bounds_intersected.numpy()
|
|
112
110
|
|
|
@@ -120,48 +118,178 @@ def test_bvh(test, type, device):
|
|
|
120
118
|
|
|
121
119
|
test.assertEqual(host_intersected, device_intersected[i])
|
|
122
120
|
|
|
123
|
-
if test_case == 0:
|
|
121
|
+
if test_case == 0 or test_case == 1:
|
|
124
122
|
lowers = rng.random(size=(num_bounds, 3)) * 5.0
|
|
125
123
|
uppers = lowers + rng.random(size=(num_bounds, 3)) * 5.0
|
|
126
124
|
wp.copy(device_lowers, wp.array(lowers, dtype=wp.vec3, device=device))
|
|
127
125
|
wp.copy(device_uppers, wp.array(uppers, dtype=wp.vec3, device=device))
|
|
128
|
-
bvh.refit()
|
|
129
126
|
bounds_intersected.zero_()
|
|
130
127
|
|
|
128
|
+
if test_case == 0:
|
|
129
|
+
bvh.refit()
|
|
130
|
+
else:
|
|
131
|
+
bvh.rebuild()
|
|
132
|
+
|
|
131
133
|
|
|
132
134
|
def test_bvh_query_aabb(test, device):
|
|
133
|
-
|
|
135
|
+
for leaf_size in [1, 2, 4]:
|
|
136
|
+
test_bvh(test, "AABB", device, leaf_size)
|
|
134
137
|
|
|
135
138
|
|
|
136
139
|
def test_bvh_query_ray(test, device):
|
|
137
|
-
|
|
140
|
+
for leaf_size in [1, 2, 4]:
|
|
141
|
+
test_bvh(test, "ray", device, leaf_size)
|
|
138
142
|
|
|
139
143
|
|
|
140
|
-
def
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
def test_bvh_ray_query_inside_and_outside_bounds(test, device):
|
|
145
|
+
"""Regression test for issue #288: BVH ray queries should detect intersections
|
|
146
|
+
regardless of whether the ray origin is inside or outside the bounding volumes.
|
|
147
|
+
|
|
148
|
+
Previously, rays starting outside the bounds would fail to detect intersections.
|
|
149
|
+
"""
|
|
150
|
+
# Create a single AABB spanning x=[0.5, 1.0], extending across y and z axes
|
|
151
|
+
lowers = ((0.5, -1.0, -1.0),)
|
|
152
|
+
uppers = ((1.0, 1.0, 1.0),)
|
|
144
153
|
|
|
145
154
|
device_lowers = wp.array(lowers, dtype=wp.vec3f, device=device)
|
|
146
155
|
device_uppers = wp.array(uppers, dtype=wp.vec3f, device=device)
|
|
147
156
|
|
|
148
157
|
bvh = wp.Bvh(device_lowers, device_uppers)
|
|
149
158
|
|
|
150
|
-
bounds_intersected = wp.zeros(shape=
|
|
159
|
+
bounds_intersected = wp.zeros(shape=1, dtype=int, device=device)
|
|
151
160
|
|
|
161
|
+
# Test both ray origins: outside (x=0.0) and inside (x=0.75) the AABB
|
|
152
162
|
for x in (0.0, 0.75):
|
|
153
163
|
query_start = wp.vec3(x, 0.0, 0.0)
|
|
154
|
-
query_dir = wp.vec3(1.0, 0.0, 0.0)
|
|
164
|
+
query_dir = wp.vec3(1.0, 0.0, 0.0) # Ray pointing in +x direction
|
|
155
165
|
|
|
156
|
-
wp.launch(
|
|
157
|
-
kernel=bvh_query_ray, dim=1, inputs=[bvh.id, query_start, query_dir, bounds_intersected], device=device
|
|
158
|
-
)
|
|
166
|
+
wp.launch(bvh_query_ray, dim=1, inputs=[bvh.id, query_start, query_dir, bounds_intersected], device=device)
|
|
159
167
|
|
|
160
168
|
device_intersected = bounds_intersected.numpy()
|
|
161
|
-
|
|
169
|
+
# Both cases should detect the single intersection
|
|
170
|
+
test.assertEqual(device_intersected.sum(), 1)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def get_random_aabbs(n, center, relative_shift, relative_size, rng):
|
|
174
|
+
centers = rng.uniform(-0.5, 0.5, size=n * 3).reshape(n, 3) * relative_shift + center
|
|
175
|
+
diffs = 0.5 * rng.random(n * 3).reshape(n, 3) * relative_size
|
|
176
|
+
|
|
177
|
+
lowers = centers - diffs
|
|
178
|
+
uppers = centers + diffs
|
|
179
|
+
|
|
180
|
+
return lowers, uppers
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@wp.kernel
|
|
184
|
+
def compute_num_contact_with_checksums(
|
|
185
|
+
lowers: wp.array(dtype=wp.vec3),
|
|
186
|
+
uppers: wp.array(dtype=wp.vec3),
|
|
187
|
+
bvh_id: wp.uint64,
|
|
188
|
+
counts: wp.array(dtype=int),
|
|
189
|
+
check_sums: wp.array(dtype=int),
|
|
190
|
+
):
|
|
191
|
+
tid = wp.tid()
|
|
192
|
+
|
|
193
|
+
upper = uppers[tid]
|
|
194
|
+
lower = lowers[tid]
|
|
195
|
+
|
|
196
|
+
query = wp.bvh_query_aabb(bvh_id, lower, upper)
|
|
197
|
+
count = int(0)
|
|
198
|
+
|
|
199
|
+
check_sum = int(0)
|
|
200
|
+
index = int(0)
|
|
201
|
+
while wp.bvh_query_next(query, index):
|
|
202
|
+
check_sum = check_sum ^ index
|
|
203
|
+
count += 1
|
|
204
|
+
|
|
205
|
+
counts[tid] = count
|
|
206
|
+
check_sums[tid] = check_sum
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def test_capture_bvh_rebuild(test, device):
|
|
210
|
+
with wp.ScopedDevice(device):
|
|
211
|
+
rng = np.random.default_rng(123)
|
|
212
|
+
|
|
213
|
+
num_item_bounds = 100000
|
|
214
|
+
item_bound_size = 0.01
|
|
215
|
+
|
|
216
|
+
relative_shift = 2
|
|
217
|
+
|
|
218
|
+
num_test_bounds = 10000
|
|
219
|
+
test_bound_relative_size = 0.05
|
|
220
|
+
|
|
221
|
+
center = np.array([0.0, 0.0, 0.0])
|
|
222
|
+
|
|
223
|
+
item_lowers_np, item_uppers_np = get_random_aabbs(num_item_bounds, center, relative_shift, item_bound_size, rng)
|
|
224
|
+
item_lowers = wp.array(item_lowers_np, dtype=wp.vec3)
|
|
225
|
+
item_uppers = wp.array(item_uppers_np, dtype=wp.vec3)
|
|
226
|
+
bvh_1 = wp.Bvh(item_lowers, item_uppers)
|
|
227
|
+
item_lowers_2 = wp.zeros_like(item_lowers)
|
|
228
|
+
item_uppers_2 = wp.zeros_like(item_lowers)
|
|
229
|
+
|
|
230
|
+
test_lowers_np, test_uppers_np = get_random_aabbs(
|
|
231
|
+
num_test_bounds, center, relative_shift, test_bound_relative_size, rng
|
|
232
|
+
)
|
|
233
|
+
test_lowers = wp.array(test_lowers_np, dtype=wp.vec3)
|
|
234
|
+
test_uppers = wp.array(test_uppers_np, dtype=wp.vec3)
|
|
235
|
+
|
|
236
|
+
item_lowers_2_np, item_uppers_2_np = get_random_aabbs(
|
|
237
|
+
num_item_bounds,
|
|
238
|
+
center,
|
|
239
|
+
relative_shift,
|
|
240
|
+
item_bound_size,
|
|
241
|
+
rng,
|
|
242
|
+
)
|
|
243
|
+
item_lowers_2.assign(item_lowers_2_np)
|
|
244
|
+
item_uppers_2.assign(item_uppers_2_np)
|
|
245
|
+
|
|
246
|
+
counts_1 = wp.empty(n=num_test_bounds, dtype=int)
|
|
247
|
+
checksums_1 = wp.empty(n=num_test_bounds, dtype=int)
|
|
248
|
+
counts_2 = wp.empty(n=num_test_bounds, dtype=int)
|
|
249
|
+
checksums_2 = wp.empty(n=num_test_bounds, dtype=int)
|
|
250
|
+
|
|
251
|
+
wp.load_module(device=device)
|
|
252
|
+
with wp.ScopedCapture(force_module_load=False) as capture:
|
|
253
|
+
wp.copy(item_lowers, item_lowers_2)
|
|
254
|
+
wp.copy(item_uppers, item_uppers_2)
|
|
255
|
+
bvh_1.rebuild()
|
|
256
|
+
wp.launch(
|
|
257
|
+
compute_num_contact_with_checksums,
|
|
258
|
+
dim=num_test_bounds,
|
|
259
|
+
inputs=[test_lowers, test_uppers, bvh_1.id],
|
|
260
|
+
outputs=[counts_1, checksums_1],
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
cuda_graph = capture.graph
|
|
264
|
+
|
|
265
|
+
for _ in range(10):
|
|
266
|
+
item_lowers_2_np, item_uppers_2_np = get_random_aabbs(
|
|
267
|
+
num_item_bounds,
|
|
268
|
+
center,
|
|
269
|
+
relative_shift,
|
|
270
|
+
item_bound_size,
|
|
271
|
+
rng,
|
|
272
|
+
)
|
|
273
|
+
item_lowers_2.assign(item_lowers_2_np)
|
|
274
|
+
item_uppers_2.assign(item_uppers_2_np)
|
|
275
|
+
|
|
276
|
+
wp.capture_launch(cuda_graph)
|
|
277
|
+
|
|
278
|
+
bvh_2 = wp.Bvh(item_lowers_2, item_uppers_2)
|
|
279
|
+
wp.launch(
|
|
280
|
+
compute_num_contact_with_checksums,
|
|
281
|
+
dim=num_test_bounds,
|
|
282
|
+
inputs=[test_lowers, test_uppers, bvh_2.id],
|
|
283
|
+
outputs=[counts_2, checksums_2],
|
|
284
|
+
device=device,
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
assert_array_equal(counts_1, counts_2)
|
|
288
|
+
assert_array_equal(checksums_1, checksums_2)
|
|
162
289
|
|
|
163
290
|
|
|
164
291
|
devices = get_test_devices()
|
|
292
|
+
cuda_devices = get_cuda_test_devices()
|
|
165
293
|
|
|
166
294
|
|
|
167
295
|
class TestBvh(unittest.TestCase):
|
|
@@ -193,7 +321,14 @@ class TestBvh(unittest.TestCase):
|
|
|
193
321
|
|
|
194
322
|
add_function_test(TestBvh, "test_bvh_aabb", test_bvh_query_aabb, devices=devices)
|
|
195
323
|
add_function_test(TestBvh, "test_bvh_ray", test_bvh_query_ray, devices=devices)
|
|
196
|
-
add_function_test(
|
|
324
|
+
add_function_test(
|
|
325
|
+
TestBvh,
|
|
326
|
+
"test_bvh_ray_query_inside_and_outside_bounds",
|
|
327
|
+
test_bvh_ray_query_inside_and_outside_bounds,
|
|
328
|
+
devices=devices,
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
add_function_test(TestBvh, "test_capture_bvh_rebuild", test_capture_bvh_rebuild, devices=cuda_devices)
|
|
197
332
|
|
|
198
333
|
if __name__ == "__main__":
|
|
199
334
|
wp.clear_kernel_cache()
|
warp/tests/geometry/test_mesh.py
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
-
|
|
15
|
+
import itertools
|
|
16
16
|
import unittest
|
|
17
17
|
|
|
18
18
|
import numpy as np
|
|
@@ -204,11 +204,13 @@ def test_mesh_query_ray(test, device):
|
|
|
204
204
|
else:
|
|
205
205
|
constructors = ["sah", "median", "lbvh"]
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
leaf_sizes = [1, 2, 4]
|
|
208
|
+
|
|
209
|
+
for leaf_size, constructor in itertools.product(leaf_sizes, constructors):
|
|
208
210
|
points = wp.array(POINT_POSITIONS, dtype=wp.vec3, device=device)
|
|
209
211
|
|
|
210
212
|
indices = wp.array(RIGHT_HANDED_FACE_VERTEX_INDICES, dtype=int, device=device)
|
|
211
|
-
mesh = wp.Mesh(points=points, indices=indices, bvh_constructor=constructor)
|
|
213
|
+
mesh = wp.Mesh(points=points, indices=indices, bvh_constructor=constructor, bvh_leaf_size=leaf_size)
|
|
212
214
|
expected_sign = -1.0
|
|
213
215
|
wp.launch(
|
|
214
216
|
query_ray_kernel,
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
import itertools
|
|
16
17
|
import os
|
|
17
18
|
import unittest
|
|
18
19
|
|
|
@@ -60,11 +61,6 @@ def compute_bounds(
|
|
|
60
61
|
def compute_num_contacts(
|
|
61
62
|
lowers: wp.array(dtype=wp.vec3), uppers: wp.array(dtype=wp.vec3), mesh_id: wp.uint64, counts: wp.array(dtype=int)
|
|
62
63
|
):
|
|
63
|
-
face_index = int(0)
|
|
64
|
-
face_u = float(0.0)
|
|
65
|
-
face_v = float(0.0)
|
|
66
|
-
sign = float(0.0)
|
|
67
|
-
|
|
68
64
|
tid = wp.tid()
|
|
69
65
|
|
|
70
66
|
upper = uppers[tid]
|
|
@@ -210,11 +206,6 @@ def compute_num_contact_with_checksums(
|
|
|
210
206
|
counts: wp.array(dtype=int),
|
|
211
207
|
check_sums: wp.array(dtype=int),
|
|
212
208
|
):
|
|
213
|
-
face_index = int(0)
|
|
214
|
-
face_u = float(0.0)
|
|
215
|
-
face_v = float(0.0)
|
|
216
|
-
sign = float(0.0)
|
|
217
|
-
|
|
218
209
|
tid = wp.tid()
|
|
219
210
|
|
|
220
211
|
upper = uppers[tid]
|
|
@@ -304,12 +295,14 @@ def test_mesh_query_aabb_count_overlap_with_checksum(test, device):
|
|
|
304
295
|
else:
|
|
305
296
|
constructors = ["sah", "median", "lbvh"]
|
|
306
297
|
|
|
298
|
+
leaf_sizes = [1, 2, 4]
|
|
299
|
+
|
|
307
300
|
points, indices = load_mesh()
|
|
308
301
|
points_wp = wp.array(points, dtype=wp.vec3, device=device)
|
|
309
302
|
indices_wp = wp.array(indices, dtype=int, device=device)
|
|
310
303
|
|
|
311
|
-
for constructor in constructors:
|
|
312
|
-
m = wp.Mesh(points=points_wp, indices=indices_wp, bvh_constructor=constructor)
|
|
304
|
+
for leaf_size, constructor in itertools.product(leaf_sizes, constructors):
|
|
305
|
+
m = wp.Mesh(points=points_wp, indices=indices_wp, bvh_constructor=constructor, bvh_leaf_size=leaf_size)
|
|
313
306
|
|
|
314
307
|
num_test_bounds = 10000
|
|
315
308
|
test_bound_relative_size = 0.01
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
import itertools
|
|
16
17
|
import math
|
|
17
18
|
import unittest
|
|
18
19
|
|
|
@@ -314,7 +315,9 @@ def test_mesh_query_point(test, device):
|
|
|
314
315
|
else:
|
|
315
316
|
constructors = ["sah", "median", "lbvh"]
|
|
316
317
|
|
|
317
|
-
|
|
318
|
+
leaf_sizes = [1, 2, 4]
|
|
319
|
+
|
|
320
|
+
for leaf_size, constructor in itertools.product(leaf_sizes, constructors):
|
|
318
321
|
# create mesh
|
|
319
322
|
mesh = wp.Mesh(
|
|
320
323
|
points=mesh_points,
|
|
@@ -322,6 +325,7 @@ def test_mesh_query_point(test, device):
|
|
|
322
325
|
indices=mesh_indices,
|
|
323
326
|
support_winding_number=True,
|
|
324
327
|
bvh_constructor=constructor,
|
|
328
|
+
bvh_leaf_size=leaf_size,
|
|
325
329
|
)
|
|
326
330
|
|
|
327
331
|
p = particle_grid(32, 32, 32, np.array([-1.1, -1.1, -1.1]), 0.05, 0.0)
|
|
@@ -791,7 +795,6 @@ def point_query_aabb_and_closest(
|
|
|
791
795
|
|
|
792
796
|
tri_index = wp.int32(0)
|
|
793
797
|
num_collisions = wp.int32(0)
|
|
794
|
-
min_dis_to_tris = query_radius
|
|
795
798
|
while wp.mesh_query_aabb_next(query, tri_index):
|
|
796
799
|
t1 = tri_indices[tri_index, 0]
|
|
797
800
|
t2 = tri_indices[tri_index, 1]
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
import itertools
|
|
16
17
|
import unittest
|
|
17
18
|
|
|
18
19
|
import numpy as np
|
|
@@ -104,12 +105,20 @@ def test_mesh_query_ray_grad(test, device):
|
|
|
104
105
|
else:
|
|
105
106
|
constructors = ["sah", "median", "lbvh"]
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
leaf_sizes = [1, 2, 4]
|
|
109
|
+
|
|
110
|
+
for leaf_size, constructor in itertools.product(leaf_sizes, constructors):
|
|
108
111
|
p = wp.vec3(50.0, 50.0, 0.0)
|
|
109
112
|
D = wp.vec3(0.0, -1.0, 0.0)
|
|
110
113
|
|
|
111
114
|
# create mesh
|
|
112
|
-
mesh = wp.Mesh(
|
|
115
|
+
mesh = wp.Mesh(
|
|
116
|
+
points=mesh_points,
|
|
117
|
+
velocities=None,
|
|
118
|
+
indices=mesh_indices,
|
|
119
|
+
bvh_constructor=constructor,
|
|
120
|
+
bvh_leaf_size=leaf_size,
|
|
121
|
+
)
|
|
113
122
|
|
|
114
123
|
tape = wp.Tape()
|
|
115
124
|
|
|
@@ -248,6 +257,8 @@ def test_mesh_query_ray_edge(test, device):
|
|
|
248
257
|
else:
|
|
249
258
|
constructors = ["sah", "median", "lbvh"]
|
|
250
259
|
|
|
260
|
+
leaf_sizes = [1, 2, 4]
|
|
261
|
+
|
|
251
262
|
# Create raycast starts and directions
|
|
252
263
|
xx, yy = np.meshgrid(np.arange(0.1, 0.4, 0.01), np.arange(0.1, 0.4, 0.01))
|
|
253
264
|
xx = xx.flatten().reshape(-1, 1)
|
|
@@ -268,11 +279,12 @@ def test_mesh_query_ray_edge(test, device):
|
|
|
268
279
|
|
|
269
280
|
triangles = np.array([[1, 0, 2], [1, 2, 3]], dtype=np.int32)
|
|
270
281
|
|
|
271
|
-
for constructor in constructors:
|
|
282
|
+
for leaf_size, constructor in itertools.product(leaf_sizes, constructors):
|
|
272
283
|
mesh = wp.Mesh(
|
|
273
284
|
points=wp.array(vertices, dtype=wp.vec3, device=device),
|
|
274
285
|
indices=wp.array(triangles.flatten(), dtype=int, device=device),
|
|
275
286
|
bvh_constructor=constructor,
|
|
287
|
+
bvh_leaf_size=leaf_size,
|
|
276
288
|
)
|
|
277
289
|
|
|
278
290
|
counts = wp.zeros(1, dtype=int, device=device)
|
|
@@ -172,8 +172,8 @@ def test_volume_allocation(test, device):
|
|
|
172
172
|
device=device,
|
|
173
173
|
)
|
|
174
174
|
|
|
175
|
-
assert wp.types.types_equal(volume_a.dtype, wp.float32)
|
|
176
|
-
assert wp.types.types_equal(volume_b.dtype, wp.float32)
|
|
175
|
+
assert wp._src.types.types_equal(volume_a.dtype, wp.float32)
|
|
176
|
+
assert wp._src.types.types_equal(volume_b.dtype, wp.float32)
|
|
177
177
|
|
|
178
178
|
points = wp.array(points_ref, dtype=wp.vec3, device=device)
|
|
179
179
|
values_a = wp.empty(num_points, dtype=wp.float32, device=device)
|
|
@@ -211,8 +211,8 @@ def test_volume_allocate_by_tiles_f(test, device):
|
|
|
211
211
|
volume_a = wp.Volume.allocate_by_tiles(points_is_d, voxel_size, background_value, translation, device=device)
|
|
212
212
|
volume_b = wp.Volume.allocate_by_tiles(points_ws_d, voxel_size, background_value, translation, device=device)
|
|
213
213
|
|
|
214
|
-
assert wp.types.types_equal(volume_a.dtype, wp.float32)
|
|
215
|
-
assert wp.types.types_equal(volume_b.dtype, wp.float32)
|
|
214
|
+
assert wp._src.types.types_equal(volume_a.dtype, wp.float32)
|
|
215
|
+
assert wp._src.types.types_equal(volume_b.dtype, wp.float32)
|
|
216
216
|
|
|
217
217
|
values_a = wp.empty(num_tiles * 512, dtype=wp.float32, device=device)
|
|
218
218
|
values_b = wp.empty(num_tiles * 512, dtype=wp.float32, device=device)
|
|
@@ -243,7 +243,7 @@ def test_volume_allocate_by_tiles_v(test, device):
|
|
|
243
243
|
points_d = wp.array(points_is, dtype=wp.int32, device=device)
|
|
244
244
|
volume = wp.Volume.allocate_by_tiles(points_d, 0.1, wp.vec3(1, 2, 3), device=device)
|
|
245
245
|
|
|
246
|
-
assert wp.types.types_equal(volume.dtype, wp.vec3)
|
|
246
|
+
assert wp._src.types.types_equal(volume.dtype, wp.vec3)
|
|
247
247
|
|
|
248
248
|
values = wp.empty(len(points_d) * 512, dtype=wp.vec3, device=device)
|
|
249
249
|
|