warp-lang 1.6.2__py3-none-macosx_10_13_universal2.whl → 1.7.1__py3-none-macosx_10_13_universal2.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 +7 -1
- warp/autograd.py +12 -2
- warp/bin/libwarp-clang.dylib +0 -0
- warp/bin/libwarp.dylib +0 -0
- warp/build.py +410 -0
- warp/build_dll.py +6 -14
- warp/builtins.py +463 -372
- warp/codegen.py +196 -124
- warp/config.py +42 -6
- warp/context.py +496 -271
- warp/dlpack.py +8 -6
- warp/examples/assets/nonuniform.usd +0 -0
- warp/examples/assets/nvidia_logo.png +0 -0
- warp/examples/benchmarks/benchmark_cloth.py +1 -1
- warp/examples/benchmarks/benchmark_tile_load_store.py +103 -0
- warp/examples/core/example_sample_mesh.py +300 -0
- warp/examples/distributed/example_jacobi_mpi.py +507 -0
- warp/examples/fem/example_apic_fluid.py +1 -1
- warp/examples/fem/example_burgers.py +2 -2
- warp/examples/fem/example_deformed_geometry.py +1 -1
- warp/examples/fem/example_distortion_energy.py +1 -1
- warp/examples/fem/example_magnetostatics.py +6 -6
- warp/examples/fem/utils.py +9 -3
- warp/examples/interop/example_jax_callable.py +116 -0
- warp/examples/interop/example_jax_ffi_callback.py +132 -0
- warp/examples/interop/example_jax_kernel.py +205 -0
- warp/examples/optim/example_fluid_checkpoint.py +497 -0
- warp/examples/tile/example_tile_matmul.py +2 -4
- warp/fem/__init__.py +11 -1
- warp/fem/adaptivity.py +4 -4
- warp/fem/field/field.py +11 -1
- warp/fem/field/nodal_field.py +56 -88
- warp/fem/field/virtual.py +62 -23
- warp/fem/geometry/adaptive_nanogrid.py +16 -13
- warp/fem/geometry/closest_point.py +1 -1
- warp/fem/geometry/deformed_geometry.py +5 -2
- warp/fem/geometry/geometry.py +5 -0
- warp/fem/geometry/grid_2d.py +12 -12
- warp/fem/geometry/grid_3d.py +12 -15
- warp/fem/geometry/hexmesh.py +5 -7
- warp/fem/geometry/nanogrid.py +9 -11
- warp/fem/geometry/quadmesh.py +13 -13
- warp/fem/geometry/tetmesh.py +3 -4
- warp/fem/geometry/trimesh.py +7 -20
- warp/fem/integrate.py +262 -93
- warp/fem/linalg.py +5 -5
- warp/fem/quadrature/pic_quadrature.py +37 -22
- warp/fem/quadrature/quadrature.py +194 -25
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/basis_function_space.py +4 -2
- warp/fem/space/basis_space.py +25 -18
- warp/fem/space/hexmesh_function_space.py +2 -2
- warp/fem/space/partition.py +6 -2
- warp/fem/space/quadmesh_function_space.py +8 -8
- warp/fem/space/shape/cube_shape_function.py +23 -23
- warp/fem/space/shape/square_shape_function.py +12 -12
- warp/fem/space/shape/triangle_shape_function.py +1 -1
- warp/fem/space/tetmesh_function_space.py +3 -3
- warp/fem/space/trimesh_function_space.py +2 -2
- warp/fem/utils.py +12 -6
- warp/jax.py +14 -1
- warp/jax_experimental/__init__.py +16 -0
- warp/{jax_experimental.py → jax_experimental/custom_call.py} +28 -29
- warp/jax_experimental/ffi.py +702 -0
- warp/jax_experimental/xla_ffi.py +602 -0
- warp/math.py +89 -0
- warp/native/array.h +13 -0
- warp/native/builtin.h +29 -3
- warp/native/bvh.cpp +3 -1
- warp/native/bvh.cu +42 -14
- warp/native/bvh.h +2 -1
- warp/native/clang/clang.cpp +30 -3
- warp/native/cuda_util.cpp +14 -0
- warp/native/cuda_util.h +2 -0
- warp/native/exports.h +68 -63
- warp/native/intersect.h +26 -26
- warp/native/intersect_adj.h +33 -33
- warp/native/marching.cu +1 -1
- warp/native/mat.h +513 -9
- warp/native/mesh.h +10 -10
- warp/native/quat.h +99 -11
- warp/native/rand.h +6 -0
- warp/native/sort.cpp +122 -59
- warp/native/sort.cu +152 -15
- warp/native/sort.h +8 -1
- warp/native/sparse.cpp +43 -22
- warp/native/sparse.cu +52 -17
- warp/native/svd.h +116 -0
- warp/native/tile.h +312 -116
- warp/native/tile_reduce.h +46 -3
- warp/native/vec.h +68 -7
- warp/native/volume.cpp +85 -113
- warp/native/volume_builder.cu +25 -10
- warp/native/volume_builder.h +6 -0
- warp/native/warp.cpp +5 -6
- warp/native/warp.cu +100 -11
- warp/native/warp.h +19 -10
- warp/optim/linear.py +10 -10
- warp/render/render_opengl.py +19 -17
- warp/render/render_usd.py +93 -3
- warp/sim/articulation.py +4 -4
- warp/sim/collide.py +32 -19
- warp/sim/import_mjcf.py +449 -155
- warp/sim/import_urdf.py +32 -12
- warp/sim/inertia.py +189 -156
- warp/sim/integrator_euler.py +8 -5
- warp/sim/integrator_featherstone.py +3 -10
- warp/sim/integrator_vbd.py +207 -2
- warp/sim/integrator_xpbd.py +8 -5
- warp/sim/model.py +71 -25
- warp/sim/render.py +4 -0
- warp/sim/utils.py +2 -2
- warp/sparse.py +642 -555
- warp/stubs.py +217 -20
- warp/tests/__main__.py +0 -15
- warp/tests/assets/torus.usda +1 -1
- warp/tests/cuda/__init__.py +0 -0
- warp/tests/{test_mempool.py → cuda/test_mempool.py} +39 -0
- warp/tests/{test_streams.py → cuda/test_streams.py} +71 -0
- warp/tests/geometry/__init__.py +0 -0
- warp/tests/{test_mesh_query_point.py → geometry/test_mesh_query_point.py} +66 -63
- warp/tests/{test_mesh_query_ray.py → geometry/test_mesh_query_ray.py} +1 -1
- warp/tests/{test_volume.py → geometry/test_volume.py} +41 -6
- warp/tests/interop/__init__.py +0 -0
- warp/tests/{test_dlpack.py → interop/test_dlpack.py} +28 -5
- warp/tests/sim/__init__.py +0 -0
- warp/tests/{disabled_kinematics.py → sim/disabled_kinematics.py} +9 -10
- warp/tests/{test_collision.py → sim/test_collision.py} +236 -205
- warp/tests/sim/test_inertia.py +161 -0
- warp/tests/{test_model.py → sim/test_model.py} +40 -0
- warp/tests/{flaky_test_sim_grad.py → sim/test_sim_grad.py} +4 -0
- warp/tests/{test_sim_kinematics.py → sim/test_sim_kinematics.py} +2 -1
- warp/tests/sim/test_vbd.py +597 -0
- warp/tests/sim/test_xpbd.py +399 -0
- warp/tests/test_bool.py +1 -1
- warp/tests/test_codegen.py +24 -3
- warp/tests/test_examples.py +40 -38
- warp/tests/test_fem.py +98 -14
- warp/tests/test_linear_solvers.py +0 -11
- warp/tests/test_mat.py +577 -156
- warp/tests/test_mat_scalar_ops.py +4 -4
- warp/tests/test_overwrite.py +0 -60
- warp/tests/test_quat.py +356 -151
- warp/tests/test_rand.py +44 -37
- warp/tests/test_sparse.py +47 -6
- warp/tests/test_spatial.py +75 -0
- warp/tests/test_static.py +1 -1
- warp/tests/test_utils.py +84 -4
- warp/tests/test_vec.py +336 -178
- warp/tests/tile/__init__.py +0 -0
- warp/tests/{test_tile.py → tile/test_tile.py} +136 -51
- warp/tests/{test_tile_load.py → tile/test_tile_load.py} +98 -1
- warp/tests/{test_tile_mathdx.py → tile/test_tile_mathdx.py} +9 -6
- warp/tests/{test_tile_mlp.py → tile/test_tile_mlp.py} +25 -14
- warp/tests/{test_tile_reduce.py → tile/test_tile_reduce.py} +60 -1
- warp/tests/{test_tile_view.py → tile/test_tile_view.py} +1 -1
- warp/tests/unittest_serial.py +1 -0
- warp/tests/unittest_suites.py +45 -62
- warp/tests/unittest_utils.py +2 -1
- warp/thirdparty/unittest_parallel.py +3 -1
- warp/types.py +175 -666
- warp/utils.py +137 -72
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/METADATA +46 -12
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/RECORD +184 -171
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/WHEEL +1 -1
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info/licenses}/LICENSE.md +0 -26
- warp/examples/optim/example_walker.py +0 -317
- warp/native/cutlass_gemm.cpp +0 -43
- warp/native/cutlass_gemm.cu +0 -382
- warp/tests/test_matmul.py +0 -511
- warp/tests/test_matmul_lite.py +0 -411
- warp/tests/test_vbd.py +0 -386
- warp/tests/unused_test_misc.py +0 -77
- /warp/tests/{test_async.py → cuda/test_async.py} +0 -0
- /warp/tests/{test_ipc.py → cuda/test_ipc.py} +0 -0
- /warp/tests/{test_multigpu.py → cuda/test_multigpu.py} +0 -0
- /warp/tests/{test_peer.py → cuda/test_peer.py} +0 -0
- /warp/tests/{test_pinned.py → cuda/test_pinned.py} +0 -0
- /warp/tests/{test_bvh.py → geometry/test_bvh.py} +0 -0
- /warp/tests/{test_hash_grid.py → geometry/test_hash_grid.py} +0 -0
- /warp/tests/{test_marching_cubes.py → geometry/test_marching_cubes.py} +0 -0
- /warp/tests/{test_mesh.py → geometry/test_mesh.py} +0 -0
- /warp/tests/{test_mesh_query_aabb.py → geometry/test_mesh_query_aabb.py} +0 -0
- /warp/tests/{test_volume_write.py → geometry/test_volume_write.py} +0 -0
- /warp/tests/{test_jax.py → interop/test_jax.py} +0 -0
- /warp/tests/{test_paddle.py → interop/test_paddle.py} +0 -0
- /warp/tests/{test_torch.py → interop/test_torch.py} +0 -0
- /warp/tests/{test_coloring.py → sim/test_coloring.py} +0 -0
- /warp/tests/{test_sim_grad_bounce_linear.py → sim/test_sim_grad_bounce_linear.py} +0 -0
- /warp/tests/{test_tile_shared_memory.py → tile/test_tile_shared_memory.py} +0 -0
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
from warp.sim.model import PARTICLE_FLAG_ACTIVE
|
|
17
|
+
from warp.tests.unittest_utils import *
|
|
18
|
+
|
|
19
|
+
# fmt: off
|
|
20
|
+
CLOTH_POINTS = [
|
|
21
|
+
(-50.0000000, 0.0000000, -50.0000000),
|
|
22
|
+
(-38.8888893, 11.1111107, -50.0000000),
|
|
23
|
+
(-27.7777786, 22.2222214, -50.0000000),
|
|
24
|
+
(-16.6666679, 33.3333321, -50.0000000),
|
|
25
|
+
(-5.5555558, 44.4444427, -50.0000000),
|
|
26
|
+
(5.5555558, 55.5555573, -50.0000000),
|
|
27
|
+
(16.6666679, 66.6666641, -50.0000000),
|
|
28
|
+
(27.7777786, 77.7777786, -50.0000000),
|
|
29
|
+
(38.8888893, 88.8888855, -50.0000000),
|
|
30
|
+
(50.0000000, 100.0000000, -50.0000000),
|
|
31
|
+
(-50.0000000, 0.0000000, -38.8888893),
|
|
32
|
+
(-38.8888893, 11.1111107, -38.8888893),
|
|
33
|
+
(-27.7777786, 22.2222214, -38.8888893),
|
|
34
|
+
(-16.6666679, 33.3333321, -38.8888893),
|
|
35
|
+
(-5.5555558, 44.4444427, -38.8888893),
|
|
36
|
+
(5.5555558, 55.5555573, -38.8888893),
|
|
37
|
+
(16.6666679, 66.6666641, -38.8888893),
|
|
38
|
+
(27.7777786, 77.7777786, -38.8888893),
|
|
39
|
+
(38.8888893, 88.8888855, -38.8888893),
|
|
40
|
+
(50.0000000, 100.0000000, -38.8888893),
|
|
41
|
+
(-50.0000000, 0.0000000, -27.7777786),
|
|
42
|
+
(-38.8888893, 11.1111107, -27.7777786),
|
|
43
|
+
(-27.7777786, 22.2222214, -27.7777786),
|
|
44
|
+
(-16.6666679, 33.3333321, -27.7777786),
|
|
45
|
+
(-5.5555558, 44.4444427, -27.7777786),
|
|
46
|
+
(5.5555558, 55.5555573, -27.7777786),
|
|
47
|
+
(16.6666679, 66.6666641, -27.7777786),
|
|
48
|
+
(27.7777786, 77.7777786, -27.7777786),
|
|
49
|
+
(38.8888893, 88.8888855, -27.7777786),
|
|
50
|
+
(50.0000000, 100.0000000, -27.7777786),
|
|
51
|
+
(-50.0000000, 0.0000000, -16.6666679),
|
|
52
|
+
(-38.8888893, 11.1111107, -16.6666679),
|
|
53
|
+
(-27.7777786, 22.2222214, -16.6666679),
|
|
54
|
+
(-16.6666679, 33.3333321, -16.6666679),
|
|
55
|
+
(-5.5555558, 44.4444427, -16.6666679),
|
|
56
|
+
(5.5555558, 55.5555573, -16.6666679),
|
|
57
|
+
(16.6666679, 66.6666641, -16.6666679),
|
|
58
|
+
(27.7777786, 77.7777786, -16.6666679),
|
|
59
|
+
(38.8888893, 88.8888855, -16.6666679),
|
|
60
|
+
(50.0000000, 100.0000000, -16.6666679),
|
|
61
|
+
(-50.0000000, 0.0000000, -5.5555558),
|
|
62
|
+
(-38.8888893, 11.1111107, -5.5555558),
|
|
63
|
+
(-27.7777786, 22.2222214, -5.5555558),
|
|
64
|
+
(-16.6666679, 33.3333321, -5.5555558),
|
|
65
|
+
(-5.5555558, 44.4444427, -5.5555558),
|
|
66
|
+
(5.5555558, 55.5555573, -5.5555558),
|
|
67
|
+
(16.6666679, 66.6666641, -5.5555558),
|
|
68
|
+
(27.7777786, 77.7777786, -5.5555558),
|
|
69
|
+
(38.8888893, 88.8888855, -5.5555558),
|
|
70
|
+
(50.0000000, 100.0000000, -5.5555558),
|
|
71
|
+
(-50.0000000, 0.0000000, 5.5555558),
|
|
72
|
+
(-38.8888893, 11.1111107, 5.5555558),
|
|
73
|
+
(-27.7777786, 22.2222214, 5.5555558),
|
|
74
|
+
(-16.6666679, 33.3333321, 5.5555558),
|
|
75
|
+
(-5.5555558, 44.4444427, 5.5555558),
|
|
76
|
+
(5.5555558, 55.5555573, 5.5555558),
|
|
77
|
+
(16.6666679, 66.6666641, 5.5555558),
|
|
78
|
+
(27.7777786, 77.7777786, 5.5555558),
|
|
79
|
+
(38.8888893, 88.8888855, 5.5555558),
|
|
80
|
+
(50.0000000, 100.0000000, 5.5555558),
|
|
81
|
+
(-50.0000000, 0.0000000, 16.6666679),
|
|
82
|
+
(-38.8888893, 11.1111107, 16.6666679),
|
|
83
|
+
(-27.7777786, 22.2222214, 16.6666679),
|
|
84
|
+
(-16.6666679, 33.3333321, 16.6666679),
|
|
85
|
+
(-5.5555558, 44.4444427, 16.6666679),
|
|
86
|
+
(5.5555558, 55.5555573, 16.6666679),
|
|
87
|
+
(16.6666679, 66.6666641, 16.6666679),
|
|
88
|
+
(27.7777786, 77.7777786, 16.6666679),
|
|
89
|
+
(38.8888893, 88.8888855, 16.6666679),
|
|
90
|
+
(50.0000000, 100.0000000, 16.6666679),
|
|
91
|
+
(-50.0000000, 0.0000000, 27.7777786),
|
|
92
|
+
(-38.8888893, 11.1111107, 27.7777786),
|
|
93
|
+
(-27.7777786, 22.2222214, 27.7777786),
|
|
94
|
+
(-16.6666679, 33.3333321, 27.7777786),
|
|
95
|
+
(-5.5555558, 44.4444427, 27.7777786),
|
|
96
|
+
(5.5555558, 55.5555573, 27.7777786),
|
|
97
|
+
(16.6666679, 66.6666641, 27.7777786),
|
|
98
|
+
(27.7777786, 77.7777786, 27.7777786),
|
|
99
|
+
(38.8888893, 88.8888855, 27.7777786),
|
|
100
|
+
(50.0000000, 100.0000000, 27.7777786),
|
|
101
|
+
(-50.0000000, 0.0000000, 38.8888893),
|
|
102
|
+
(-38.8888893, 11.1111107, 38.8888893),
|
|
103
|
+
(-27.7777786, 22.2222214, 38.8888893),
|
|
104
|
+
(-16.6666679, 33.3333321, 38.8888893),
|
|
105
|
+
(-5.5555558, 44.4444427, 38.8888893),
|
|
106
|
+
(5.5555558, 55.5555573, 38.8888893),
|
|
107
|
+
(16.6666679, 66.6666641, 38.8888893),
|
|
108
|
+
(27.7777786, 77.7777786, 38.8888893),
|
|
109
|
+
(38.8888893, 88.8888855, 38.8888893),
|
|
110
|
+
(50.0000000, 100.0000000, 38.8888893),
|
|
111
|
+
(-50.0000000, 0.0000000, 50.0000000),
|
|
112
|
+
(-38.8888893, 11.1111107, 50.0000000),
|
|
113
|
+
(-27.7777786, 22.2222214, 50.0000000),
|
|
114
|
+
(-16.6666679, 33.3333321, 50.0000000),
|
|
115
|
+
(-5.5555558, 44.4444427, 50.0000000),
|
|
116
|
+
(5.5555558, 55.5555573, 50.0000000),
|
|
117
|
+
(16.6666679, 66.6666641, 50.0000000),
|
|
118
|
+
(27.7777786, 77.7777786, 50.0000000),
|
|
119
|
+
(38.8888893, 88.8888855, 50.0000000),
|
|
120
|
+
(50.0000000, 100.0000000, 50.0000000),
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
CLOTH_FACES = [
|
|
124
|
+
1, 12, 2,
|
|
125
|
+
1, 11, 12,
|
|
126
|
+
2, 12, 3,
|
|
127
|
+
12, 13, 3,
|
|
128
|
+
3, 14, 4,
|
|
129
|
+
3, 13, 14,
|
|
130
|
+
4, 14, 5,
|
|
131
|
+
14, 15, 5,
|
|
132
|
+
5, 16, 6,
|
|
133
|
+
5, 15, 16,
|
|
134
|
+
6, 16, 7,
|
|
135
|
+
16, 17, 7,
|
|
136
|
+
7, 18, 8,
|
|
137
|
+
7, 17, 18,
|
|
138
|
+
8, 18, 9,
|
|
139
|
+
18, 19, 9,
|
|
140
|
+
9, 20, 10,
|
|
141
|
+
9, 19, 20,
|
|
142
|
+
11, 21, 12,
|
|
143
|
+
21, 22, 12,
|
|
144
|
+
12, 23, 13,
|
|
145
|
+
12, 22, 23,
|
|
146
|
+
13, 23, 14,
|
|
147
|
+
23, 24, 14,
|
|
148
|
+
14, 25, 15,
|
|
149
|
+
14, 24, 25,
|
|
150
|
+
15, 25, 16,
|
|
151
|
+
25, 26, 16,
|
|
152
|
+
16, 27, 17,
|
|
153
|
+
16, 26, 27,
|
|
154
|
+
17, 27, 18,
|
|
155
|
+
27, 28, 18,
|
|
156
|
+
18, 29, 19,
|
|
157
|
+
18, 28, 29,
|
|
158
|
+
19, 29, 20,
|
|
159
|
+
29, 30, 20,
|
|
160
|
+
21, 32, 22,
|
|
161
|
+
21, 31, 32,
|
|
162
|
+
22, 32, 23,
|
|
163
|
+
32, 33, 23,
|
|
164
|
+
23, 34, 24,
|
|
165
|
+
23, 33, 34,
|
|
166
|
+
24, 34, 25,
|
|
167
|
+
34, 35, 25,
|
|
168
|
+
25, 36, 26,
|
|
169
|
+
25, 35, 36,
|
|
170
|
+
26, 36, 27,
|
|
171
|
+
36, 37, 27,
|
|
172
|
+
27, 38, 28,
|
|
173
|
+
27, 37, 38,
|
|
174
|
+
28, 38, 29,
|
|
175
|
+
38, 39, 29,
|
|
176
|
+
29, 40, 30,
|
|
177
|
+
29, 39, 40,
|
|
178
|
+
31, 41, 32,
|
|
179
|
+
41, 42, 32,
|
|
180
|
+
32, 43, 33,
|
|
181
|
+
32, 42, 43,
|
|
182
|
+
33, 43, 34,
|
|
183
|
+
43, 44, 34,
|
|
184
|
+
34, 45, 35,
|
|
185
|
+
34, 44, 45,
|
|
186
|
+
35, 45, 36,
|
|
187
|
+
45, 46, 36,
|
|
188
|
+
36, 47, 37,
|
|
189
|
+
36, 46, 47,
|
|
190
|
+
37, 47, 38,
|
|
191
|
+
47, 48, 38,
|
|
192
|
+
38, 49, 39,
|
|
193
|
+
38, 48, 49,
|
|
194
|
+
39, 49, 40,
|
|
195
|
+
49, 50, 40,
|
|
196
|
+
41, 52, 42,
|
|
197
|
+
41, 51, 52,
|
|
198
|
+
42, 52, 43,
|
|
199
|
+
52, 53, 43,
|
|
200
|
+
43, 54, 44,
|
|
201
|
+
43, 53, 54,
|
|
202
|
+
44, 54, 45,
|
|
203
|
+
54, 55, 45,
|
|
204
|
+
45, 56, 46,
|
|
205
|
+
45, 55, 56,
|
|
206
|
+
46, 56, 47,
|
|
207
|
+
56, 57, 47,
|
|
208
|
+
47, 58, 48,
|
|
209
|
+
47, 57, 58,
|
|
210
|
+
48, 58, 49,
|
|
211
|
+
58, 59, 49,
|
|
212
|
+
49, 60, 50,
|
|
213
|
+
49, 59, 60,
|
|
214
|
+
51, 61, 52,
|
|
215
|
+
61, 62, 52,
|
|
216
|
+
52, 63, 53,
|
|
217
|
+
52, 62, 63,
|
|
218
|
+
53, 63, 54,
|
|
219
|
+
63, 64, 54,
|
|
220
|
+
54, 65, 55,
|
|
221
|
+
54, 64, 65,
|
|
222
|
+
55, 65, 56,
|
|
223
|
+
65, 66, 56,
|
|
224
|
+
56, 67, 57,
|
|
225
|
+
56, 66, 67,
|
|
226
|
+
57, 67, 58,
|
|
227
|
+
67, 68, 58,
|
|
228
|
+
58, 69, 59,
|
|
229
|
+
58, 68, 69,
|
|
230
|
+
59, 69, 60,
|
|
231
|
+
69, 70, 60,
|
|
232
|
+
61, 72, 62,
|
|
233
|
+
61, 71, 72,
|
|
234
|
+
62, 72, 63,
|
|
235
|
+
72, 73, 63,
|
|
236
|
+
63, 74, 64,
|
|
237
|
+
63, 73, 74,
|
|
238
|
+
64, 74, 65,
|
|
239
|
+
74, 75, 65,
|
|
240
|
+
65, 76, 66,
|
|
241
|
+
65, 75, 76,
|
|
242
|
+
66, 76, 67,
|
|
243
|
+
76, 77, 67,
|
|
244
|
+
67, 78, 68,
|
|
245
|
+
67, 77, 78,
|
|
246
|
+
68, 78, 69,
|
|
247
|
+
78, 79, 69,
|
|
248
|
+
69, 80, 70,
|
|
249
|
+
69, 79, 80,
|
|
250
|
+
71, 81, 72,
|
|
251
|
+
81, 82, 72,
|
|
252
|
+
72, 83, 73,
|
|
253
|
+
72, 82, 83,
|
|
254
|
+
73, 83, 74,
|
|
255
|
+
83, 84, 74,
|
|
256
|
+
74, 85, 75,
|
|
257
|
+
74, 84, 85,
|
|
258
|
+
75, 85, 76,
|
|
259
|
+
85, 86, 76,
|
|
260
|
+
76, 87, 77,
|
|
261
|
+
76, 86, 87,
|
|
262
|
+
77, 87, 78,
|
|
263
|
+
87, 88, 78,
|
|
264
|
+
78, 89, 79,
|
|
265
|
+
78, 88, 89,
|
|
266
|
+
79, 89, 80,
|
|
267
|
+
89, 90, 80,
|
|
268
|
+
81, 92, 82,
|
|
269
|
+
81, 91, 92,
|
|
270
|
+
82, 92, 83,
|
|
271
|
+
92, 93, 83,
|
|
272
|
+
83, 94, 84,
|
|
273
|
+
83, 93, 94,
|
|
274
|
+
84, 94, 85,
|
|
275
|
+
94, 95, 85,
|
|
276
|
+
85, 96, 86,
|
|
277
|
+
85, 95, 96,
|
|
278
|
+
86, 96, 87,
|
|
279
|
+
96, 97, 87,
|
|
280
|
+
87, 98, 88,
|
|
281
|
+
87, 97, 98,
|
|
282
|
+
88, 98, 89,
|
|
283
|
+
98, 99, 89,
|
|
284
|
+
89, 100, 90,
|
|
285
|
+
89, 99, 100
|
|
286
|
+
]
|
|
287
|
+
|
|
288
|
+
# fmt: on
|
|
289
|
+
class XPBDClothSim:
|
|
290
|
+
def __init__(self, device, use_cuda_graph=False):
|
|
291
|
+
self.frame_dt = 1 / 60
|
|
292
|
+
self.num_test_frames = 100
|
|
293
|
+
self.num_substeps = 20
|
|
294
|
+
self.iterations = 2
|
|
295
|
+
self.dt = self.frame_dt / self.num_substeps
|
|
296
|
+
self.device = device
|
|
297
|
+
self.use_cuda_graph = self.device.is_cuda and use_cuda_graph
|
|
298
|
+
self.builder = wp.sim.ModelBuilder()
|
|
299
|
+
|
|
300
|
+
def set_free_falling_experiment(self):
|
|
301
|
+
self.input_scale_factor = 1.0
|
|
302
|
+
self.renderer_scale_factor = 0.01
|
|
303
|
+
vertices = [wp.vec3(v) * self.input_scale_factor for v in CLOTH_POINTS]
|
|
304
|
+
faces_flatten = [fv - 1 for fv in CLOTH_FACES]
|
|
305
|
+
|
|
306
|
+
self.builder.add_cloth_mesh(
|
|
307
|
+
vertices=vertices,
|
|
308
|
+
indices=faces_flatten,
|
|
309
|
+
scale=0.05,
|
|
310
|
+
density=10,
|
|
311
|
+
pos=wp.vec3(0.0, 4.0, 0.0),
|
|
312
|
+
rot=wp.quat_identity(),
|
|
313
|
+
vel=wp.vec3(0.0, 0.0, 0.0),
|
|
314
|
+
edge_ke=1.0e2,
|
|
315
|
+
add_springs=True,
|
|
316
|
+
spring_ke=1.0e3,
|
|
317
|
+
spring_kd=0.0,
|
|
318
|
+
)
|
|
319
|
+
self.fixed_particles = []
|
|
320
|
+
self.num_test_frames = 30
|
|
321
|
+
|
|
322
|
+
def finalize(self, ground=True):
|
|
323
|
+
self.model = self.builder.finalize(device=self.device)
|
|
324
|
+
self.model.ground = ground
|
|
325
|
+
self.model.gravity = wp.vec3(0, -10.0, 0)
|
|
326
|
+
self.model.soft_contact_ke = 1.0e4
|
|
327
|
+
self.model.soft_contact_kd = 1.0e2
|
|
328
|
+
|
|
329
|
+
self.set_points_fixed(self.model, self.fixed_particles)
|
|
330
|
+
|
|
331
|
+
self.integrator = wp.sim.XPBDIntegrator(self.iterations)
|
|
332
|
+
self.state0 = self.model.state()
|
|
333
|
+
self.state1 = self.model.state()
|
|
334
|
+
|
|
335
|
+
self.init_pos = np.array(self.state0.particle_q.numpy(), copy=True)
|
|
336
|
+
|
|
337
|
+
self.graph = None
|
|
338
|
+
if self.use_cuda_graph:
|
|
339
|
+
with wp.ScopedCapture(device=self.device, force_module_load=False) as capture:
|
|
340
|
+
self.simulate()
|
|
341
|
+
self.graph = capture.graph
|
|
342
|
+
|
|
343
|
+
def simulate(self):
|
|
344
|
+
for _step in range(self.num_substeps * self.num_test_frames):
|
|
345
|
+
self.integrator.simulate(self.model, self.state0, self.state1, self.dt, None)
|
|
346
|
+
(self.state0, self.state1) = (self.state1, self.state0)
|
|
347
|
+
|
|
348
|
+
def run(self):
|
|
349
|
+
if self.graph:
|
|
350
|
+
wp.capture_launch(self.graph)
|
|
351
|
+
else:
|
|
352
|
+
self.simulate()
|
|
353
|
+
|
|
354
|
+
def set_points_fixed(self, model, fixed_particles):
|
|
355
|
+
if len(fixed_particles):
|
|
356
|
+
flags = model.particle_flags.numpy()
|
|
357
|
+
for fixed_v_id in fixed_particles:
|
|
358
|
+
flags[fixed_v_id] = wp.uint32(int(flags[fixed_v_id]) & ~int(PARTICLE_FLAG_ACTIVE))
|
|
359
|
+
|
|
360
|
+
model.particle_flags = wp.array(flags, device=model.device)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def test_xpbd_free_falling(test, device):
|
|
364
|
+
example = XPBDClothSim(device)
|
|
365
|
+
example.set_free_falling_experiment()
|
|
366
|
+
example.finalize(ground=False)
|
|
367
|
+
initial_pos = example.state0.particle_q.numpy().copy()
|
|
368
|
+
|
|
369
|
+
example.run()
|
|
370
|
+
|
|
371
|
+
# examine that the simulation does not explode
|
|
372
|
+
final_pos = example.state0.particle_q.numpy()
|
|
373
|
+
test.assertTrue((final_pos < 1e5).all())
|
|
374
|
+
# examine that the simulation have moved
|
|
375
|
+
test.assertTrue((example.init_pos != final_pos).any())
|
|
376
|
+
|
|
377
|
+
gravity = np.array(example.model.gravity)
|
|
378
|
+
diff = final_pos - initial_pos
|
|
379
|
+
vertical_translation_norm = diff @ gravity[..., None] / (np.linalg.norm(gravity) ** 2)
|
|
380
|
+
# ensure it's free-falling
|
|
381
|
+
test.assertTrue((np.abs(vertical_translation_norm - 0.5 * np.linalg.norm(gravity) * (example.dt**2)) < 2e-1).all())
|
|
382
|
+
horizontal_move = diff - (vertical_translation_norm * gravity)
|
|
383
|
+
# ensure its horizontal translation is minimal
|
|
384
|
+
test.assertTrue((np.abs(horizontal_move) < 1e-1).all())
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
devices = get_test_devices(mode="basic")
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
class TestXPBD(unittest.TestCase):
|
|
391
|
+
pass
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
add_function_test(TestXPBD, "test_xpbd_free_falling", test_xpbd_free_falling, devices=devices)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
if __name__ == "__main__":
|
|
398
|
+
wp.clear_kernel_cache()
|
|
399
|
+
unittest.main(verbosity=2)
|
warp/tests/test_bool.py
CHANGED
warp/tests/test_codegen.py
CHANGED
|
@@ -482,7 +482,7 @@ def test_error_unmatched_arguments(test, device):
|
|
|
482
482
|
kernel = wp.Kernel(func=kernel_2_fn)
|
|
483
483
|
with test.assertRaisesRegex(
|
|
484
484
|
RuntimeError,
|
|
485
|
-
r"Input types must be exactly the same, got \[
|
|
485
|
+
r"Input types must be exactly the same, got \['vec2f', 'vector\(length=2, dtype=float16\)'\]",
|
|
486
486
|
):
|
|
487
487
|
wp.launch(kernel, dim=1, device=device)
|
|
488
488
|
|
|
@@ -672,6 +672,27 @@ def test_while_condition_eval():
|
|
|
672
672
|
it.valid = False
|
|
673
673
|
|
|
674
674
|
|
|
675
|
+
@wp.kernel
|
|
676
|
+
def conditional_return_or_sum(result: wp.array(dtype=wp.int32)):
|
|
677
|
+
tid = wp.tid()
|
|
678
|
+
|
|
679
|
+
if tid < 256:
|
|
680
|
+
return
|
|
681
|
+
|
|
682
|
+
wp.atomic_add(result, 0, 1)
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
def test_codegen_return_in_kernel(test, device):
|
|
686
|
+
result = wp.zeros(1, dtype=wp.int32, device=device)
|
|
687
|
+
|
|
688
|
+
grid_size = 1024
|
|
689
|
+
|
|
690
|
+
# On CUDA devices, this becomes a grid-stride loop
|
|
691
|
+
wp.launch(conditional_return_or_sum, dim=grid_size, inputs=[result], block_dim=256, max_blocks=1, device=device)
|
|
692
|
+
|
|
693
|
+
test.assertEqual(result.numpy()[0], grid_size - 256)
|
|
694
|
+
|
|
695
|
+
|
|
675
696
|
class TestCodeGen(unittest.TestCase):
|
|
676
697
|
pass
|
|
677
698
|
|
|
@@ -803,8 +824,8 @@ add_function_test(
|
|
|
803
824
|
add_kernel_test(TestCodeGen, name="test_call_syntax", kernel=test_call_syntax, dim=1, devices=devices)
|
|
804
825
|
add_kernel_test(TestCodeGen, name="test_shadow_builtin", kernel=test_shadow_builtin, dim=1, devices=devices)
|
|
805
826
|
add_kernel_test(TestCodeGen, name="test_while_condition_eval", kernel=test_while_condition_eval, dim=1, devices=devices)
|
|
806
|
-
|
|
827
|
+
add_function_test(TestCodeGen, "test_codegen_return_in_kernel", test_codegen_return_in_kernel, devices=devices)
|
|
807
828
|
|
|
808
829
|
if __name__ == "__main__":
|
|
809
830
|
wp.clear_kernel_cache()
|
|
810
|
-
unittest.main(verbosity=2
|
|
831
|
+
unittest.main(verbosity=2)
|
warp/tests/test_examples.py
CHANGED
|
@@ -25,18 +25,18 @@ Generally the test_options[_cpu,_cuda] dictionaries should be used to prevent
|
|
|
25
25
|
graphical windows from being open by the example {"headless": True} and to
|
|
26
26
|
override example defaults so the example can run in less than ten seconds.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
CUTLASS.
|
|
28
|
+
To skip tests if the optional dependencies are not found, use the following keys:
|
|
29
|
+
- {"usd_required": True} (requires usd-core)
|
|
30
|
+
- {"torch_required": True} (requires torch)
|
|
31
|
+
- {"pillow_required": True} (requires pillow)
|
|
33
32
|
|
|
34
33
|
Use the "num_frames" and "train_iters" keys to control the number of steps.
|
|
35
34
|
|
|
36
|
-
Use "test_timeout" to override the default test timeout threshold of
|
|
35
|
+
Use "test_timeout" to override the default test timeout threshold of 600 seconds.
|
|
37
36
|
"""
|
|
38
37
|
|
|
39
38
|
import os
|
|
39
|
+
import platform
|
|
40
40
|
import subprocess
|
|
41
41
|
import sys
|
|
42
42
|
import unittest
|
|
@@ -52,7 +52,7 @@ from warp.tests.unittest_utils import (
|
|
|
52
52
|
)
|
|
53
53
|
from warp.utils import check_p2p
|
|
54
54
|
|
|
55
|
-
wp.init() # For wp.context.runtime.core.
|
|
55
|
+
wp.init() # For wp.context.runtime.core.is_debug_enabled()
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
def _build_command_line_options(test_options: Dict[str, Any]) -> list:
|
|
@@ -119,9 +119,13 @@ def add_example_test(
|
|
|
119
119
|
if usd_required and not USD_AVAILABLE:
|
|
120
120
|
test.skipTest("Requires usd-core")
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
# Mark the test as skipped if pillow is not installed but required
|
|
123
|
+
pillow_required = options.pop("pillow_required", False)
|
|
124
|
+
if pillow_required:
|
|
125
|
+
try:
|
|
126
|
+
import PIL # noqa: F401
|
|
127
|
+
except ImportError:
|
|
128
|
+
test.skipTest("Requires pillow")
|
|
125
129
|
|
|
126
130
|
# Find the current Warp cache
|
|
127
131
|
warp_cache_path = wp.config.kernel_cache_dir
|
|
@@ -169,7 +173,7 @@ def add_example_test(
|
|
|
169
173
|
command.extend(_build_command_line_options(options))
|
|
170
174
|
|
|
171
175
|
# Set the test timeout in seconds
|
|
172
|
-
test_timeout = options.pop("test_timeout",
|
|
176
|
+
test_timeout = options.pop("test_timeout", 600)
|
|
173
177
|
|
|
174
178
|
# with wp.ScopedTimer(f"{name}_{sanitize_identifier(device)}"):
|
|
175
179
|
# Run the script as a subprocess
|
|
@@ -236,25 +240,38 @@ add_example_test(
|
|
|
236
240
|
devices=test_devices,
|
|
237
241
|
test_options={"usd_required": True, "headless": True},
|
|
238
242
|
)
|
|
243
|
+
if platform.system() == "Windows":
|
|
244
|
+
# Skip GPU testing because of obscure NVRTC bug with illegal memory access
|
|
245
|
+
add_example_test(
|
|
246
|
+
TestCoreExamples,
|
|
247
|
+
name="core.example_raymarch",
|
|
248
|
+
devices=[wp.get_device("cpu")],
|
|
249
|
+
test_options={"height": 512, "width": 1024, "headless": True},
|
|
250
|
+
)
|
|
251
|
+
else:
|
|
252
|
+
add_example_test(
|
|
253
|
+
TestCoreExamples,
|
|
254
|
+
name="core.example_raymarch",
|
|
255
|
+
devices=test_devices,
|
|
256
|
+
test_options={"height": 512, "width": 1024, "headless": True},
|
|
257
|
+
)
|
|
239
258
|
add_example_test(
|
|
240
259
|
TestCoreExamples,
|
|
241
|
-
name="core.
|
|
260
|
+
name="core.example_sample_mesh",
|
|
242
261
|
devices=test_devices,
|
|
243
|
-
|
|
262
|
+
test_options_cpu={"num_frames": 1},
|
|
244
263
|
)
|
|
245
264
|
add_example_test(
|
|
246
265
|
TestCoreExamples,
|
|
247
266
|
name="core.example_sph",
|
|
248
267
|
devices=test_devices,
|
|
249
268
|
test_options_cpu={"num_frames": 1},
|
|
250
|
-
test_options_cuda={"test_timeout": 600},
|
|
251
269
|
)
|
|
252
270
|
add_example_test(
|
|
253
271
|
TestCoreExamples,
|
|
254
272
|
name="core.example_torch",
|
|
255
273
|
devices=test_devices,
|
|
256
274
|
test_options={"headless": True, "num_frames": 1000, "torch_required": True},
|
|
257
|
-
test_options_cpu={"test_timeout": 600},
|
|
258
275
|
)
|
|
259
276
|
add_example_test(TestCoreExamples, name="core.example_wave", devices=test_devices)
|
|
260
277
|
|
|
@@ -268,7 +285,6 @@ add_example_test(
|
|
|
268
285
|
name="optim.example_bounce",
|
|
269
286
|
devices=test_devices,
|
|
270
287
|
test_options_cpu={"train_iters": 3},
|
|
271
|
-
test_options_cuda={"test_timeout": 600},
|
|
272
288
|
)
|
|
273
289
|
add_example_test(
|
|
274
290
|
TestOptimExamples,
|
|
@@ -281,7 +297,6 @@ add_example_test(
|
|
|
281
297
|
TestOptimExamples,
|
|
282
298
|
name="optim.example_cloth_throw",
|
|
283
299
|
devices=test_devices,
|
|
284
|
-
test_options={"test_timeout": 600},
|
|
285
300
|
test_options_cpu={"train_iters": 3},
|
|
286
301
|
)
|
|
287
302
|
add_example_test(
|
|
@@ -291,6 +306,12 @@ add_example_test(
|
|
|
291
306
|
test_options={"usd_required": True, "headless": True},
|
|
292
307
|
test_options_cpu={"train_iters": 2},
|
|
293
308
|
)
|
|
309
|
+
add_example_test(
|
|
310
|
+
TestOptimExamples,
|
|
311
|
+
name="optim.example_fluid_checkpoint",
|
|
312
|
+
devices=cuda_test_devices,
|
|
313
|
+
test_options={"headless": True, "train_iters": 5, "num_frames": 300, "pillow_required": True},
|
|
314
|
+
)
|
|
294
315
|
add_example_test(TestOptimExamples, name="optim.example_inverse_kinematics", devices=test_devices)
|
|
295
316
|
add_example_test(
|
|
296
317
|
TestOptimExamples,
|
|
@@ -305,19 +326,6 @@ add_example_test(
|
|
|
305
326
|
devices=test_devices,
|
|
306
327
|
test_options={"headless": True, "train_iters": 50},
|
|
307
328
|
)
|
|
308
|
-
# NOTE: This example uses CUTLASS and will run orders of magnitude slower when Warp is built in debug mode
|
|
309
|
-
add_example_test(
|
|
310
|
-
TestOptimExamples,
|
|
311
|
-
name="optim.example_walker",
|
|
312
|
-
devices=test_devices,
|
|
313
|
-
test_options={"usd_required": True},
|
|
314
|
-
test_options_cuda={
|
|
315
|
-
"train_iters": 1 if warp.context.runtime.core.is_debug_enabled() else 3,
|
|
316
|
-
"num_frames": 1 if warp.context.runtime.core.is_debug_enabled() else 60,
|
|
317
|
-
"cutlass_required": True,
|
|
318
|
-
},
|
|
319
|
-
test_options_cpu={"train_iters": 1, "num_frames": 30},
|
|
320
|
-
)
|
|
321
329
|
add_example_test(
|
|
322
330
|
TestOptimExamples,
|
|
323
331
|
name="optim.example_softbody_properties",
|
|
@@ -333,15 +341,13 @@ class TestSimExamples(unittest.TestCase):
|
|
|
333
341
|
pass
|
|
334
342
|
|
|
335
343
|
|
|
336
|
-
add_example_test(
|
|
337
|
-
TestSimExamples, name="sim.example_cartpole", devices=test_devices, test_options_cuda={"test_timeout": 600}
|
|
338
|
-
)
|
|
344
|
+
add_example_test(TestSimExamples, name="sim.example_cartpole", devices=test_devices)
|
|
339
345
|
add_example_test(
|
|
340
346
|
TestSimExamples,
|
|
341
347
|
name="sim.example_cloth",
|
|
342
348
|
devices=test_devices,
|
|
343
349
|
test_options={"usd_required": True},
|
|
344
|
-
test_options_cpu={"num_frames": 10
|
|
350
|
+
test_options_cpu={"num_frames": 10},
|
|
345
351
|
)
|
|
346
352
|
add_example_test(
|
|
347
353
|
TestSimExamples, name="sim.example_granular", devices=test_devices, test_options_cpu={"num_frames": 10}
|
|
@@ -421,28 +427,24 @@ add_example_test(
|
|
|
421
427
|
name="fem.example_convection_diffusion",
|
|
422
428
|
devices=test_devices,
|
|
423
429
|
test_options={"resolution": 20, "headless": True},
|
|
424
|
-
test_options_cpu={"test_timeout": 600},
|
|
425
430
|
)
|
|
426
431
|
add_example_test(
|
|
427
432
|
TestFemExamples,
|
|
428
433
|
name="fem.example_burgers",
|
|
429
434
|
devices=test_devices,
|
|
430
435
|
test_options={"resolution": 20, "num_frames": 25, "degree": 1, "headless": True},
|
|
431
|
-
test_options_cpu={"test_timeout": 600},
|
|
432
436
|
)
|
|
433
437
|
add_example_test(
|
|
434
438
|
TestFemExamples,
|
|
435
439
|
name="fem.example_convection_diffusion_dg",
|
|
436
440
|
devices=test_devices,
|
|
437
441
|
test_options={"resolution": 20, "num_frames": 25, "headless": True},
|
|
438
|
-
test_options_cpu={"test_timeout": 600},
|
|
439
442
|
)
|
|
440
443
|
add_example_test(
|
|
441
444
|
TestFemExamples,
|
|
442
445
|
name="fem.example_mixed_elasticity",
|
|
443
446
|
devices=test_devices,
|
|
444
447
|
test_options={"nonconforming_stresses": True, "mesh": "quad", "headless": True},
|
|
445
|
-
test_options_cpu={"test_timeout": 600},
|
|
446
448
|
)
|
|
447
449
|
add_example_test(
|
|
448
450
|
TestFemExamples, name="fem.example_stokes_transfer", devices=test_devices, test_options={"headless": True}
|