warp-lang 0.11.0__py3-none-manylinux2014_x86_64.whl → 1.0.0__py3-none-manylinux2014_x86_64.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 +8 -0
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +7 -6
- warp/build_dll.py +70 -79
- warp/builtins.py +10 -6
- warp/codegen.py +51 -19
- warp/config.py +7 -8
- warp/constants.py +3 -0
- warp/context.py +948 -245
- warp/dlpack.py +198 -113
- warp/examples/assets/bunny.usd +0 -0
- warp/examples/assets/cartpole.urdf +110 -0
- warp/examples/assets/crazyflie.usd +0 -0
- warp/examples/assets/cube.usda +42 -0
- warp/examples/assets/nv_ant.xml +92 -0
- warp/examples/assets/nv_humanoid.xml +183 -0
- warp/examples/assets/quadruped.urdf +268 -0
- warp/examples/assets/rocks.nvdb +0 -0
- warp/examples/assets/rocks.usd +0 -0
- warp/examples/assets/sphere.usda +56 -0
- warp/examples/assets/torus.usda +105 -0
- warp/examples/benchmarks/benchmark_api.py +383 -0
- warp/examples/benchmarks/benchmark_cloth.py +279 -0
- warp/examples/benchmarks/benchmark_cloth_cupy.py +88 -0
- warp/examples/benchmarks/benchmark_cloth_jax.py +100 -0
- warp/examples/benchmarks/benchmark_cloth_numba.py +142 -0
- warp/examples/benchmarks/benchmark_cloth_numpy.py +77 -0
- warp/examples/benchmarks/benchmark_cloth_pytorch.py +86 -0
- warp/examples/benchmarks/benchmark_cloth_taichi.py +112 -0
- warp/examples/benchmarks/benchmark_cloth_warp.py +146 -0
- warp/examples/benchmarks/benchmark_launches.py +295 -0
- warp/examples/core/example_dem.py +221 -0
- warp/examples/core/example_fluid.py +267 -0
- warp/examples/core/example_graph_capture.py +129 -0
- warp/examples/core/example_marching_cubes.py +177 -0
- warp/examples/core/example_mesh.py +154 -0
- warp/examples/core/example_mesh_intersect.py +193 -0
- warp/examples/core/example_nvdb.py +169 -0
- warp/examples/core/example_raycast.py +89 -0
- warp/examples/core/example_raymarch.py +178 -0
- warp/examples/core/example_render_opengl.py +141 -0
- warp/examples/core/example_sph.py +389 -0
- warp/examples/core/example_torch.py +181 -0
- warp/examples/core/example_wave.py +249 -0
- warp/examples/fem/bsr_utils.py +380 -0
- warp/examples/fem/example_apic_fluid.py +391 -0
- warp/examples/fem/example_convection_diffusion.py +168 -0
- warp/examples/fem/example_convection_diffusion_dg.py +209 -0
- warp/examples/fem/example_convection_diffusion_dg0.py +194 -0
- warp/examples/fem/example_deformed_geometry.py +159 -0
- warp/examples/fem/example_diffusion.py +173 -0
- warp/examples/fem/example_diffusion_3d.py +152 -0
- warp/examples/fem/example_diffusion_mgpu.py +214 -0
- warp/examples/fem/example_mixed_elasticity.py +222 -0
- warp/examples/fem/example_navier_stokes.py +243 -0
- warp/examples/fem/example_stokes.py +192 -0
- warp/examples/fem/example_stokes_transfer.py +249 -0
- warp/examples/fem/mesh_utils.py +109 -0
- warp/examples/fem/plot_utils.py +287 -0
- warp/examples/optim/example_bounce.py +248 -0
- warp/examples/optim/example_cloth_throw.py +210 -0
- warp/examples/optim/example_diffray.py +535 -0
- warp/examples/optim/example_drone.py +850 -0
- warp/examples/optim/example_inverse_kinematics.py +169 -0
- warp/examples/optim/example_inverse_kinematics_torch.py +170 -0
- warp/examples/optim/example_spring_cage.py +234 -0
- warp/examples/optim/example_trajectory.py +201 -0
- warp/examples/sim/example_cartpole.py +128 -0
- warp/examples/sim/example_cloth.py +184 -0
- warp/examples/sim/example_granular.py +113 -0
- warp/examples/sim/example_granular_collision_sdf.py +185 -0
- warp/examples/sim/example_jacobian_ik.py +213 -0
- warp/examples/sim/example_particle_chain.py +106 -0
- warp/examples/sim/example_quadruped.py +179 -0
- warp/examples/sim/example_rigid_chain.py +191 -0
- warp/examples/sim/example_rigid_contact.py +176 -0
- warp/examples/sim/example_rigid_force.py +126 -0
- warp/examples/sim/example_rigid_gyroscopic.py +97 -0
- warp/examples/sim/example_rigid_soft_contact.py +124 -0
- warp/examples/sim/example_soft_body.py +178 -0
- warp/fabric.py +29 -20
- warp/fem/cache.py +0 -1
- warp/fem/dirichlet.py +0 -2
- warp/fem/integrate.py +0 -1
- warp/jax.py +45 -0
- warp/jax_experimental.py +339 -0
- warp/native/builtin.h +12 -0
- warp/native/bvh.cu +18 -18
- warp/native/clang/clang.cpp +8 -3
- warp/native/cuda_util.cpp +94 -5
- warp/native/cuda_util.h +35 -6
- warp/native/cutlass_gemm.cpp +1 -1
- warp/native/cutlass_gemm.cu +4 -1
- warp/native/error.cpp +66 -0
- warp/native/error.h +27 -0
- warp/native/mesh.cu +2 -2
- warp/native/reduce.cu +4 -4
- warp/native/runlength_encode.cu +2 -2
- warp/native/scan.cu +2 -2
- warp/native/sparse.cu +0 -1
- warp/native/temp_buffer.h +2 -2
- warp/native/warp.cpp +95 -60
- warp/native/warp.cu +1053 -218
- warp/native/warp.h +49 -32
- warp/optim/linear.py +33 -16
- warp/render/render_opengl.py +202 -101
- warp/render/render_usd.py +82 -40
- warp/sim/__init__.py +13 -4
- warp/sim/articulation.py +4 -5
- warp/sim/collide.py +320 -175
- warp/sim/import_mjcf.py +25 -30
- warp/sim/import_urdf.py +94 -63
- warp/sim/import_usd.py +51 -36
- warp/sim/inertia.py +3 -2
- warp/sim/integrator.py +233 -0
- warp/sim/integrator_euler.py +447 -469
- warp/sim/integrator_featherstone.py +1991 -0
- warp/sim/integrator_xpbd.py +1420 -640
- warp/sim/model.py +765 -487
- warp/sim/particles.py +2 -1
- warp/sim/render.py +35 -13
- warp/sim/utils.py +222 -11
- warp/stubs.py +8 -0
- warp/tape.py +16 -1
- warp/tests/aux_test_grad_customs.py +23 -0
- warp/tests/test_array.py +190 -1
- warp/tests/test_async.py +656 -0
- warp/tests/test_bool.py +50 -0
- warp/tests/test_dlpack.py +164 -11
- warp/tests/test_examples.py +166 -74
- warp/tests/test_fem.py +8 -1
- warp/tests/test_generics.py +15 -5
- warp/tests/test_grad.py +1 -1
- warp/tests/test_grad_customs.py +172 -12
- warp/tests/test_jax.py +254 -0
- warp/tests/test_large.py +29 -6
- warp/tests/test_launch.py +25 -0
- warp/tests/test_linear_solvers.py +20 -3
- warp/tests/test_matmul.py +61 -16
- warp/tests/test_matmul_lite.py +13 -13
- warp/tests/test_mempool.py +186 -0
- warp/tests/test_multigpu.py +3 -0
- warp/tests/test_options.py +16 -2
- warp/tests/test_peer.py +137 -0
- warp/tests/test_print.py +3 -1
- warp/tests/test_quat.py +23 -0
- warp/tests/test_sim_kinematics.py +97 -0
- warp/tests/test_snippet.py +126 -3
- warp/tests/test_streams.py +108 -79
- warp/tests/test_torch.py +16 -8
- warp/tests/test_utils.py +32 -27
- warp/tests/test_verify_fp.py +65 -0
- warp/tests/test_volume.py +1 -1
- warp/tests/unittest_serial.py +2 -0
- warp/tests/unittest_suites.py +12 -0
- warp/tests/unittest_utils.py +14 -7
- warp/thirdparty/unittest_parallel.py +15 -3
- warp/torch.py +10 -8
- warp/types.py +363 -246
- warp/utils.py +143 -19
- warp_lang-1.0.0.dist-info/LICENSE.md +126 -0
- warp_lang-1.0.0.dist-info/METADATA +394 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/RECORD +167 -86
- warp/sim/optimizer.py +0 -138
- warp_lang-0.11.0.dist-info/LICENSE.md +0 -36
- warp_lang-0.11.0.dist-info/METADATA +0 -238
- /warp/tests/{walkthough_debug.py → walkthrough_debug.py} +0 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/WHEEL +0 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/top_level.txt +0 -0
warp/tests/test_examples.py
CHANGED
|
@@ -28,7 +28,7 @@ def add_example_test(cls, name, devices=None, options={}):
|
|
|
28
28
|
test_options = options.copy()
|
|
29
29
|
|
|
30
30
|
try:
|
|
31
|
-
module = importlib.import_module(f"examples.{name}")
|
|
31
|
+
module = importlib.import_module(f"warp.examples.{name}")
|
|
32
32
|
|
|
33
33
|
torch_cuda_required = test_options.setdefault("torch_cuda_required", False)
|
|
34
34
|
test_options.pop("torch_cuda_required", None)
|
|
@@ -45,9 +45,11 @@ def add_example_test(cls, name, devices=None, options={}):
|
|
|
45
45
|
# create default USD stage output path which many examples expect
|
|
46
46
|
test_options.setdefault(
|
|
47
47
|
"stage",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
(
|
|
49
|
+
os.path.join(os.path.dirname(__file__), f"outputs/{name}_{sanitize_identifier(device)}.usd")
|
|
50
|
+
if USD_AVAILABLE
|
|
51
|
+
else None
|
|
52
|
+
),
|
|
51
53
|
)
|
|
52
54
|
|
|
53
55
|
if test_options["stage"]:
|
|
@@ -60,33 +62,34 @@ def add_example_test(cls, name, devices=None, options={}):
|
|
|
60
62
|
test_options.pop("num_frames", None)
|
|
61
63
|
|
|
62
64
|
# Don't want to force load all modules by default for serial test runner
|
|
63
|
-
wp.config.
|
|
65
|
+
wp.config.enable_graph_capture_module_load_by_default = False
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
wp.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
67
|
+
with wp.ScopedTimer(f"{name}_{sanitize_identifier(device)}"):
|
|
68
|
+
try:
|
|
69
|
+
enable_backward = test_options.get("enable_backward", True)
|
|
70
|
+
wp.set_module_options({"enable_backward": enable_backward}, module)
|
|
71
|
+
test_options.pop("enable_backward", None)
|
|
72
|
+
|
|
73
|
+
with wp.ScopedDevice(device):
|
|
74
|
+
wp.load_module(module, device=wp.get_device())
|
|
75
|
+
extra_load_modules = test_options.get("load_modules", [])
|
|
76
|
+
for module_name in extra_load_modules:
|
|
77
|
+
wp.load_module(module_name, device=wp.get_device())
|
|
78
|
+
test_options.pop("load_modules", None)
|
|
79
|
+
|
|
80
|
+
e = module.Example(**test_options)
|
|
81
|
+
|
|
82
|
+
# disable scoped timer to avoid log spam from time steps
|
|
83
|
+
wp.ScopedTimer.enabled = False
|
|
84
|
+
|
|
85
|
+
for _ in range(num_frames):
|
|
86
|
+
e.step()
|
|
87
|
+
e.render()
|
|
88
|
+
except Exception as e:
|
|
89
|
+
test.fail(f"{e}")
|
|
90
|
+
finally:
|
|
91
|
+
wp.ScopedTimer.enabled = True
|
|
92
|
+
wp.config.enable_graph_capture_module_load_by_default = True
|
|
90
93
|
|
|
91
94
|
from warp.tests.unittest_utils import add_function_test
|
|
92
95
|
|
|
@@ -109,87 +112,176 @@ class TestExamples(unittest.TestCase):
|
|
|
109
112
|
# Exclude unless we can run headless somehow
|
|
110
113
|
# add_example_test(TestExamples, name="example_render_opengl", options={})
|
|
111
114
|
|
|
112
|
-
add_example_test(TestExamples, name="example_dem", devices=cuda_test_devices)
|
|
113
|
-
add_example_test(TestExamples, name="
|
|
114
|
-
add_example_test(TestExamples, name="
|
|
115
|
-
add_example_test(TestExamples, name="
|
|
116
|
-
add_example_test(TestExamples, name="
|
|
117
|
-
add_example_test(TestExamples, name="
|
|
118
|
-
add_example_test(TestExamples, name="
|
|
119
|
-
add_example_test(TestExamples, name="
|
|
120
|
-
add_example_test(TestExamples, name="
|
|
121
|
-
add_example_test(TestExamples, name="
|
|
122
|
-
add_example_test(TestExamples, name="example_sph", devices=cuda_test_devices)
|
|
123
|
-
add_example_test(TestExamples, name="example_wave", devices=cuda_test_devices, options={"resx": 256, "resy": 256})
|
|
115
|
+
add_example_test(TestExamples, name="core.example_dem", devices=cuda_test_devices)
|
|
116
|
+
add_example_test(TestExamples, name="core.example_fluid", devices=cuda_test_devices)
|
|
117
|
+
add_example_test(TestExamples, name="core.example_marching_cubes", devices=cuda_test_devices)
|
|
118
|
+
add_example_test(TestExamples, name="core.example_mesh", devices=cuda_test_devices)
|
|
119
|
+
add_example_test(TestExamples, name="core.example_mesh_intersect", devices=cuda_test_devices, options={"num_frames": 1})
|
|
120
|
+
add_example_test(TestExamples, name="core.example_nvdb", devices=cuda_test_devices)
|
|
121
|
+
add_example_test(TestExamples, name="core.example_raycast", devices=cuda_test_devices)
|
|
122
|
+
add_example_test(TestExamples, name="core.example_raymarch", devices=cuda_test_devices)
|
|
123
|
+
add_example_test(TestExamples, name="core.example_sph", devices=cuda_test_devices)
|
|
124
|
+
add_example_test(TestExamples, name="core.example_wave", devices=cuda_test_devices)
|
|
124
125
|
|
|
125
126
|
|
|
126
127
|
class TestSimExamples(unittest.TestCase):
|
|
127
128
|
pass
|
|
128
129
|
|
|
129
130
|
|
|
131
|
+
warp_sim_modules = [
|
|
132
|
+
"warp.sim.integrator",
|
|
133
|
+
"warp.sim.integrator_euler",
|
|
134
|
+
"warp.sim.particles",
|
|
135
|
+
"warp.sim.collide",
|
|
136
|
+
"warp.sim.articulation",
|
|
137
|
+
"warp.sim.integrator_xpbd",
|
|
138
|
+
"warp.sim.integrator_featherstone",
|
|
139
|
+
"warp.sim.integrator_euler",
|
|
140
|
+
"warp.sim.integrator",
|
|
141
|
+
"warp.sim.utils",
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
add_example_test(
|
|
145
|
+
TestSimExamples,
|
|
146
|
+
name="optim.example_bounce",
|
|
147
|
+
devices=cuda_test_devices,
|
|
148
|
+
options={"load_modules": warp_sim_modules},
|
|
149
|
+
)
|
|
150
|
+
add_example_test(
|
|
151
|
+
TestSimExamples,
|
|
152
|
+
name="sim.example_cartpole",
|
|
153
|
+
devices=cuda_test_devices,
|
|
154
|
+
options={"load_modules": warp_sim_modules},
|
|
155
|
+
)
|
|
156
|
+
add_example_test(
|
|
157
|
+
TestSimExamples,
|
|
158
|
+
name="sim.example_cloth",
|
|
159
|
+
devices=cuda_test_devices,
|
|
160
|
+
options={"load_modules": warp_sim_modules},
|
|
161
|
+
)
|
|
130
162
|
add_example_test(
|
|
131
163
|
TestSimExamples,
|
|
132
|
-
name="
|
|
164
|
+
name="optim.example_cloth_throw",
|
|
133
165
|
devices=cuda_test_devices,
|
|
134
|
-
options={"load_modules":
|
|
166
|
+
options={"load_modules": warp_sim_modules},
|
|
135
167
|
)
|
|
168
|
+
add_example_test(TestSimExamples, name="optim.example_diffray", devices=cuda_test_devices)
|
|
136
169
|
add_example_test(
|
|
137
170
|
TestSimExamples,
|
|
138
|
-
name="
|
|
171
|
+
name="optim.example_drone",
|
|
139
172
|
devices=cuda_test_devices,
|
|
140
|
-
options={
|
|
173
|
+
options={
|
|
174
|
+
"load_modules": warp_sim_modules + ["warp.optim.sgd"],
|
|
175
|
+
"num_frames": 1,
|
|
176
|
+
"drone_path": os.path.join(os.path.dirname(__file__), "..", "examples", "assets", "crazyflie.usd"),
|
|
177
|
+
},
|
|
141
178
|
)
|
|
142
|
-
add_example_test(TestSimExamples, name="example_sim_fk_grad", devices=cuda_test_devices)
|
|
143
179
|
add_example_test(
|
|
144
|
-
TestSimExamples,
|
|
180
|
+
TestSimExamples,
|
|
181
|
+
name="sim.example_granular",
|
|
182
|
+
devices=cuda_test_devices,
|
|
183
|
+
options={
|
|
184
|
+
"load_modules": warp_sim_modules,
|
|
185
|
+
},
|
|
145
186
|
)
|
|
146
187
|
add_example_test(
|
|
147
188
|
TestSimExamples,
|
|
148
|
-
name="
|
|
189
|
+
name="sim.example_granular_collision_sdf",
|
|
149
190
|
devices=cuda_test_devices,
|
|
150
|
-
options={
|
|
191
|
+
options={
|
|
192
|
+
"load_modules": warp_sim_modules,
|
|
193
|
+
},
|
|
151
194
|
)
|
|
152
195
|
add_example_test(
|
|
153
196
|
TestSimExamples,
|
|
154
|
-
name="
|
|
197
|
+
name="optim.example_inverse_kinematics",
|
|
155
198
|
devices=cuda_test_devices,
|
|
156
|
-
options={
|
|
199
|
+
options={
|
|
200
|
+
"load_modules": warp_sim_modules,
|
|
201
|
+
},
|
|
157
202
|
)
|
|
158
|
-
add_example_test(TestSimExamples, name="example_sim_granular", devices=cuda_test_devices)
|
|
159
|
-
add_example_test(TestSimExamples, name="example_sim_granular_collision_sdf", devices=cuda_test_devices)
|
|
160
|
-
add_example_test(TestSimExamples, name="example_sim_neo_hookean", devices=cuda_test_devices)
|
|
161
|
-
add_example_test(TestSimExamples, name="example_sim_particle_chain", devices=cuda_test_devices)
|
|
162
203
|
add_example_test(
|
|
163
204
|
TestSimExamples,
|
|
164
|
-
name="
|
|
205
|
+
name="optim.example_inverse_kinematics_torch",
|
|
165
206
|
devices=cuda_test_devices,
|
|
166
|
-
options={
|
|
207
|
+
options={
|
|
208
|
+
"torch_cuda_required": True,
|
|
209
|
+
"load_modules": warp_sim_modules,
|
|
210
|
+
},
|
|
167
211
|
)
|
|
212
|
+
add_example_test(TestExamples, name="sim.example_jacobian_ik", devices=cuda_test_devices)
|
|
168
213
|
add_example_test(
|
|
169
214
|
TestSimExamples,
|
|
170
|
-
name="
|
|
215
|
+
name="sim.example_particle_chain",
|
|
171
216
|
devices=cuda_test_devices,
|
|
172
|
-
options={"load_modules":
|
|
217
|
+
options={"load_modules": warp_sim_modules},
|
|
173
218
|
)
|
|
174
219
|
add_example_test(
|
|
175
220
|
TestSimExamples,
|
|
176
|
-
name="
|
|
221
|
+
name="sim.example_quadruped",
|
|
177
222
|
devices=cuda_test_devices,
|
|
178
|
-
options={"load_modules":
|
|
223
|
+
options={"load_modules": warp_sim_modules},
|
|
224
|
+
)
|
|
225
|
+
add_example_test(
|
|
226
|
+
TestSimExamples,
|
|
227
|
+
name="sim.example_rigid_chain",
|
|
228
|
+
devices=cuda_test_devices,
|
|
229
|
+
options={"load_modules": warp_sim_modules},
|
|
230
|
+
)
|
|
231
|
+
add_example_test(
|
|
232
|
+
TestSimExamples,
|
|
233
|
+
name="sim.example_rigid_contact",
|
|
234
|
+
devices=cuda_test_devices,
|
|
235
|
+
options={"load_modules": warp_sim_modules},
|
|
236
|
+
)
|
|
237
|
+
add_example_test(
|
|
238
|
+
TestSimExamples,
|
|
239
|
+
name="sim.example_rigid_soft_contact",
|
|
240
|
+
devices=cuda_test_devices,
|
|
241
|
+
options={"load_modules": warp_sim_modules},
|
|
242
|
+
)
|
|
243
|
+
add_example_test(
|
|
244
|
+
TestSimExamples,
|
|
245
|
+
name="sim.example_rigid_force",
|
|
246
|
+
devices=cuda_test_devices,
|
|
247
|
+
options={"load_modules": warp_sim_modules},
|
|
248
|
+
)
|
|
249
|
+
add_example_test(
|
|
250
|
+
TestSimExamples,
|
|
251
|
+
name="sim.example_rigid_gyroscopic",
|
|
252
|
+
devices=cuda_test_devices,
|
|
253
|
+
options={"load_modules": warp_sim_modules},
|
|
254
|
+
)
|
|
255
|
+
add_example_test(
|
|
256
|
+
TestSimExamples,
|
|
257
|
+
name="sim.example_soft_body",
|
|
258
|
+
devices=cuda_test_devices,
|
|
259
|
+
options={"load_modules": warp_sim_modules},
|
|
260
|
+
)
|
|
261
|
+
add_example_test(
|
|
262
|
+
TestSimExamples,
|
|
263
|
+
name="optim.example_spring_cage",
|
|
264
|
+
devices=cuda_test_devices,
|
|
265
|
+
options={"load_modules": warp_sim_modules},
|
|
266
|
+
)
|
|
267
|
+
add_example_test(
|
|
268
|
+
TestSimExamples,
|
|
269
|
+
name="optim.example_trajectory",
|
|
270
|
+
devices=cuda_test_devices,
|
|
271
|
+
options={"load_modules": warp_sim_modules},
|
|
179
272
|
)
|
|
180
|
-
add_example_test(TestSimExamples, name="example_sim_rigid_fem", devices=cuda_test_devices)
|
|
181
|
-
add_example_test(TestSimExamples, name="example_sim_rigid_force", devices=cuda_test_devices)
|
|
182
|
-
add_example_test(TestSimExamples, name="example_sim_rigid_gyroscopic", devices=cuda_test_devices)
|
|
183
|
-
add_example_test(TestSimExamples, name="example_sim_rigid_kinematics", devices=cuda_test_devices)
|
|
184
|
-
add_example_test(TestSimExamples, name="example_sim_trajopt", devices=cuda_test_devices)
|
|
185
273
|
|
|
186
274
|
|
|
187
275
|
class TestFemExamples(unittest.TestCase):
|
|
188
276
|
pass
|
|
189
277
|
|
|
190
278
|
|
|
279
|
+
class TestFemDiffusionExamples(unittest.TestCase):
|
|
280
|
+
pass
|
|
281
|
+
|
|
282
|
+
|
|
191
283
|
add_example_test(
|
|
192
|
-
|
|
284
|
+
TestFemDiffusionExamples,
|
|
193
285
|
name="fem.example_diffusion_mgpu",
|
|
194
286
|
devices=cuda_test_devices,
|
|
195
287
|
options={"quiet": True, "num_frames": 1, "enable_backward": False},
|
|
@@ -203,13 +295,13 @@ add_example_test(
|
|
|
203
295
|
options={"quiet": True, "res": [16, 16, 16], "enable_backward": False},
|
|
204
296
|
)
|
|
205
297
|
add_example_test(
|
|
206
|
-
|
|
298
|
+
TestFemDiffusionExamples,
|
|
207
299
|
name="fem.example_diffusion",
|
|
208
300
|
devices=test_devices,
|
|
209
301
|
options={"quiet": True, "resolution": 10, "mesh": "tri", "num_frames": 1, "enable_backward": False},
|
|
210
302
|
)
|
|
211
303
|
add_example_test(
|
|
212
|
-
|
|
304
|
+
TestFemDiffusionExamples,
|
|
213
305
|
name="fem.example_diffusion_3d",
|
|
214
306
|
devices=test_devices,
|
|
215
307
|
options={"quiet": True, "resolution": 10, "num_frames": 1, "enable_backward": False},
|
|
@@ -227,13 +319,13 @@ add_example_test(
|
|
|
227
319
|
options={"quiet": True, "resolution": 20, "enable_backward": False},
|
|
228
320
|
)
|
|
229
321
|
add_example_test(
|
|
230
|
-
|
|
322
|
+
TestFemExamples,
|
|
231
323
|
name="fem.example_convection_diffusion_dg0",
|
|
232
324
|
devices=test_devices,
|
|
233
325
|
options={"quiet": True, "resolution": 20, "num_frames": 25, "mesh": "quad", "enable_backward": False},
|
|
234
326
|
)
|
|
235
327
|
add_example_test(
|
|
236
|
-
|
|
328
|
+
TestFemExamples,
|
|
237
329
|
name="fem.example_convection_diffusion_dg",
|
|
238
330
|
devices=test_devices,
|
|
239
331
|
options={"quiet": True, "resolution": 20, "num_frames": 25, "mesh": "tri", "enable_backward": False},
|
|
@@ -251,7 +343,7 @@ add_example_test(
|
|
|
251
343
|
options={"quiet": True, "num_frames": 1, "enable_backward": False},
|
|
252
344
|
)
|
|
253
345
|
add_example_test(
|
|
254
|
-
|
|
346
|
+
TestFemExamples,
|
|
255
347
|
name="fem.example_stokes",
|
|
256
348
|
devices=test_devices,
|
|
257
349
|
options={
|
|
@@ -263,7 +355,7 @@ add_example_test(
|
|
|
263
355
|
},
|
|
264
356
|
)
|
|
265
357
|
add_example_test(
|
|
266
|
-
|
|
358
|
+
TestFemExamples,
|
|
267
359
|
name="fem.example_navier_stokes",
|
|
268
360
|
devices=test_devices,
|
|
269
361
|
options={"quiet": True, "num_frames": 100, "resolution": 10, "tri_mesh": True, "enable_backward": False},
|
warp/tests/test_fem.py
CHANGED
|
@@ -101,9 +101,15 @@ def test_interpolate_gradient(test_case, device):
|
|
|
101
101
|
# Interpolate gradient at center point
|
|
102
102
|
vector_field = vector_space.make_field()
|
|
103
103
|
vector_field.dof_values.requires_grad = True
|
|
104
|
+
vector_field_restriction = fem.make_restriction(vector_field)
|
|
104
105
|
tape = wp.Tape()
|
|
105
106
|
with tape:
|
|
106
|
-
fem.interpolate(
|
|
107
|
+
fem.interpolate(
|
|
108
|
+
grad_field,
|
|
109
|
+
dest=vector_field_restriction,
|
|
110
|
+
fields={"p": scalar_field},
|
|
111
|
+
kernel_options={"enable_backward": True},
|
|
112
|
+
)
|
|
107
113
|
|
|
108
114
|
assert_np_equal(vector_field.dof_values.numpy(), np.array([[1.0, 1.0]]))
|
|
109
115
|
|
|
@@ -146,6 +152,7 @@ def test_interpolate_gradient(test_case, device):
|
|
|
146
152
|
)
|
|
147
153
|
assert_np_equal(point_coords.grad.numpy(), np.array([[[2.0, 0.0, 0.0]]]))
|
|
148
154
|
|
|
155
|
+
|
|
149
156
|
@integrand
|
|
150
157
|
def vector_divergence_form(s: Sample, u: Field, q: Field):
|
|
151
158
|
return div(u, s) * q(s)
|
warp/tests/test_generics.py
CHANGED
|
@@ -164,6 +164,7 @@ def generic_accumulator_kernel(a: wp.array(dtype=wp.float64), value: Any):
|
|
|
164
164
|
wp.overload(generic_accumulator_kernel, {"value": int})
|
|
165
165
|
wp.overload(generic_accumulator_kernel, {"value": float})
|
|
166
166
|
wp.overload(generic_accumulator_kernel, {"value": wp.float64})
|
|
167
|
+
wp.overload(generic_accumulator_kernel, {"value": wp.bool})
|
|
167
168
|
|
|
168
169
|
|
|
169
170
|
def test_generic_accumulator_kernel(test, device):
|
|
@@ -174,8 +175,9 @@ def test_generic_accumulator_kernel(test, device):
|
|
|
174
175
|
wp.launch(generic_accumulator_kernel, dim=a.size, inputs=[a, 25])
|
|
175
176
|
wp.launch(generic_accumulator_kernel, dim=a.size, inputs=[a, 17.0])
|
|
176
177
|
wp.launch(generic_accumulator_kernel, dim=a.size, inputs=[a, wp.float64(8.0)])
|
|
178
|
+
wp.launch(generic_accumulator_kernel, dim=a.size, inputs=[a, wp.bool(True)])
|
|
177
179
|
|
|
178
|
-
assert_np_equal(a.numpy(), np.full((n,),
|
|
180
|
+
assert_np_equal(a.numpy(), np.full((n,), 51.0, dtype=np.float64))
|
|
179
181
|
|
|
180
182
|
|
|
181
183
|
# generic kernel used to automatically generate overloads from launch args
|
|
@@ -191,14 +193,17 @@ def test_generic_fill(test, device):
|
|
|
191
193
|
ai = wp.zeros(n, dtype=int)
|
|
192
194
|
af = wp.zeros(n, dtype=float)
|
|
193
195
|
a3 = wp.zeros(n, dtype=wp.vec3)
|
|
196
|
+
ab = wp.zeros(n, dtype=wp.bool)
|
|
194
197
|
|
|
195
198
|
wp.launch(generic_fill, dim=ai.size, inputs=[ai, 42])
|
|
196
199
|
wp.launch(generic_fill, dim=af.size, inputs=[af, 17.0])
|
|
197
200
|
wp.launch(generic_fill, dim=a3.size, inputs=[a3, wp.vec3(5.0, 5.0, 5.0)])
|
|
201
|
+
wp.launch(generic_fill, dim=ab.size, inputs=[ab, wp.bool(True)])
|
|
198
202
|
|
|
199
203
|
assert_np_equal(ai.numpy(), np.full((n,), 42, dtype=np.int32))
|
|
200
204
|
assert_np_equal(af.numpy(), np.full((n,), 17.0, dtype=np.float32))
|
|
201
205
|
assert_np_equal(a3.numpy(), np.full((n, 3), 5.0, dtype=np.float32))
|
|
206
|
+
assert_np_equal(ab.numpy(), np.full((n,), True, dtype=np.bool_))
|
|
202
207
|
|
|
203
208
|
|
|
204
209
|
# generic kernel used to create and launch explicit overloads
|
|
@@ -208,10 +213,12 @@ def generic_fill_v2(a: wp.array(dtype=Any), value: Any):
|
|
|
208
213
|
a[tid] = value
|
|
209
214
|
|
|
210
215
|
|
|
216
|
+
vec3b_type = wp.vec(3, wp.bool)
|
|
211
217
|
# create explicit overloads to be launched directly
|
|
212
218
|
fill_int = wp.overload(generic_fill_v2, [wp.array(dtype=int), int])
|
|
213
219
|
fill_float = wp.overload(generic_fill_v2, [wp.array(dtype=float), float])
|
|
214
220
|
fill_vec3 = wp.overload(generic_fill_v2, [wp.array(dtype=wp.vec3), wp.vec3])
|
|
221
|
+
fill_vec3b = wp.overload(generic_fill_v2, [wp.array(dtype=vec3b_type), vec3b_type])
|
|
215
222
|
|
|
216
223
|
|
|
217
224
|
def test_generic_fill_overloads(test, device):
|
|
@@ -220,19 +227,22 @@ def test_generic_fill_overloads(test, device):
|
|
|
220
227
|
ai = wp.zeros(n, dtype=int)
|
|
221
228
|
af = wp.zeros(n, dtype=float)
|
|
222
229
|
a3 = wp.zeros(n, dtype=wp.vec3)
|
|
230
|
+
a3b = wp.zeros(n, dtype=vec3b_type)
|
|
223
231
|
|
|
224
232
|
wp.launch(fill_int, dim=ai.size, inputs=[ai, 42])
|
|
225
233
|
wp.launch(fill_float, dim=af.size, inputs=[af, 17.0])
|
|
226
234
|
wp.launch(fill_vec3, dim=a3.size, inputs=[a3, wp.vec3(5.0, 5.0, 5.0)])
|
|
235
|
+
wp.launch(fill_vec3b, dim=a3b.size, inputs=[a3b, vec3b_type([True, True, True])])
|
|
227
236
|
|
|
228
237
|
assert_np_equal(ai.numpy(), np.full((n,), 42, dtype=np.int32))
|
|
229
238
|
assert_np_equal(af.numpy(), np.full((n,), 17.0, dtype=np.float32))
|
|
230
239
|
assert_np_equal(a3.numpy(), np.full((n, 3), 5.0, dtype=np.float32))
|
|
240
|
+
assert_np_equal(a3b.numpy(), np.full((n, 3), True, dtype=np.bool_))
|
|
231
241
|
|
|
232
242
|
|
|
233
243
|
# custom vector/matrix types
|
|
234
|
-
my_vec5 = wp.
|
|
235
|
-
my_mat55 = wp.
|
|
244
|
+
my_vec5 = wp.vec(length=5, dtype=wp.float32)
|
|
245
|
+
my_mat55 = wp.mat(shape=(5, 5), dtype=wp.float32)
|
|
236
246
|
|
|
237
247
|
|
|
238
248
|
@wp.kernel
|
|
@@ -458,7 +468,7 @@ def test_generic_type_as_argument(test, device):
|
|
|
458
468
|
wp.synchronize()
|
|
459
469
|
|
|
460
470
|
|
|
461
|
-
def
|
|
471
|
+
def test_type_operator_misspell(test, device):
|
|
462
472
|
@wp.kernel
|
|
463
473
|
def kernel():
|
|
464
474
|
i = wp.tid()
|
|
@@ -553,7 +563,7 @@ add_kernel_test(
|
|
|
553
563
|
inputs=[bar],
|
|
554
564
|
devices=devices,
|
|
555
565
|
)
|
|
556
|
-
add_function_test(TestGenerics, "
|
|
566
|
+
add_function_test(TestGenerics, "test_type_operator_misspell", test_type_operator_misspell, devices=devices)
|
|
557
567
|
add_function_test(TestGenerics, "test_type_attribute_error", test_type_attribute_error, devices=devices)
|
|
558
568
|
|
|
559
569
|
if __name__ == "__main__":
|
warp/tests/test_grad.py
CHANGED
|
@@ -428,7 +428,7 @@ def test_multi_valued_function_grad(test, device):
|
|
|
428
428
|
|
|
429
429
|
@wp.func
|
|
430
430
|
def multi_valued(x: float, y: float, z: float):
|
|
431
|
-
return wp.sin(x), wp.cos(y) * z, wp.sqrt(z) / wp.abs(x)
|
|
431
|
+
return wp.sin(x), wp.cos(y) * z, wp.sqrt(wp.abs(z)) / wp.abs(x)
|
|
432
432
|
|
|
433
433
|
# test multi-valued functions
|
|
434
434
|
def check_multi_valued(vs: wp.array(dtype=wp.vec3), out: wp.array(dtype=float)):
|