warp-lang 1.2.2__py3-none-manylinux2014_x86_64.whl → 1.3.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 -6
- warp/autograd.py +823 -0
- warp/bin/warp.so +0 -0
- warp/build.py +6 -2
- warp/builtins.py +1410 -886
- warp/codegen.py +503 -166
- warp/config.py +48 -18
- warp/context.py +400 -198
- warp/dlpack.py +8 -0
- warp/examples/assets/bunny.usd +0 -0
- warp/examples/benchmarks/benchmark_cloth_warp.py +1 -1
- warp/examples/benchmarks/benchmark_interop_torch.py +158 -0
- warp/examples/benchmarks/benchmark_launches.py +1 -1
- warp/examples/core/example_cupy.py +78 -0
- warp/examples/fem/example_apic_fluid.py +17 -36
- warp/examples/fem/example_burgers.py +9 -18
- warp/examples/fem/example_convection_diffusion.py +7 -17
- warp/examples/fem/example_convection_diffusion_dg.py +27 -47
- warp/examples/fem/example_deformed_geometry.py +11 -22
- warp/examples/fem/example_diffusion.py +7 -18
- warp/examples/fem/example_diffusion_3d.py +24 -28
- warp/examples/fem/example_diffusion_mgpu.py +7 -14
- warp/examples/fem/example_magnetostatics.py +190 -0
- warp/examples/fem/example_mixed_elasticity.py +111 -80
- warp/examples/fem/example_navier_stokes.py +30 -34
- warp/examples/fem/example_nonconforming_contact.py +290 -0
- warp/examples/fem/example_stokes.py +17 -32
- warp/examples/fem/example_stokes_transfer.py +12 -21
- warp/examples/fem/example_streamlines.py +350 -0
- warp/examples/fem/utils.py +936 -0
- warp/fabric.py +5 -2
- warp/fem/__init__.py +13 -3
- warp/fem/cache.py +161 -11
- warp/fem/dirichlet.py +37 -28
- warp/fem/domain.py +105 -14
- warp/fem/field/__init__.py +14 -3
- warp/fem/field/field.py +454 -11
- warp/fem/field/nodal_field.py +33 -18
- warp/fem/geometry/deformed_geometry.py +50 -15
- warp/fem/geometry/hexmesh.py +12 -24
- warp/fem/geometry/nanogrid.py +106 -31
- warp/fem/geometry/quadmesh_2d.py +6 -11
- warp/fem/geometry/tetmesh.py +103 -61
- warp/fem/geometry/trimesh_2d.py +98 -47
- warp/fem/integrate.py +231 -186
- warp/fem/operator.py +14 -9
- warp/fem/quadrature/pic_quadrature.py +35 -9
- warp/fem/quadrature/quadrature.py +119 -32
- warp/fem/space/basis_space.py +98 -22
- warp/fem/space/collocated_function_space.py +3 -1
- warp/fem/space/function_space.py +7 -2
- warp/fem/space/grid_2d_function_space.py +3 -3
- warp/fem/space/grid_3d_function_space.py +4 -4
- warp/fem/space/hexmesh_function_space.py +3 -2
- warp/fem/space/nanogrid_function_space.py +12 -14
- warp/fem/space/partition.py +45 -47
- warp/fem/space/restriction.py +19 -16
- warp/fem/space/shape/cube_shape_function.py +91 -3
- warp/fem/space/shape/shape_function.py +7 -0
- warp/fem/space/shape/square_shape_function.py +32 -0
- warp/fem/space/shape/tet_shape_function.py +11 -7
- warp/fem/space/shape/triangle_shape_function.py +10 -1
- warp/fem/space/topology.py +116 -42
- warp/fem/types.py +8 -1
- warp/fem/utils.py +301 -83
- warp/native/array.h +16 -0
- warp/native/builtin.h +0 -15
- warp/native/cuda_util.cpp +14 -6
- warp/native/exports.h +1348 -1308
- warp/native/quat.h +79 -0
- warp/native/rand.h +27 -4
- warp/native/sparse.cpp +83 -81
- warp/native/sparse.cu +381 -453
- warp/native/vec.h +64 -0
- warp/native/volume.cpp +40 -49
- warp/native/volume_builder.cu +2 -3
- warp/native/volume_builder.h +12 -17
- warp/native/warp.cu +3 -3
- warp/native/warp.h +69 -59
- warp/render/render_opengl.py +17 -9
- warp/sim/articulation.py +117 -17
- warp/sim/collide.py +35 -29
- warp/sim/model.py +123 -18
- warp/sim/render.py +3 -1
- warp/sparse.py +867 -203
- warp/stubs.py +312 -541
- warp/tape.py +29 -1
- warp/tests/disabled_kinematics.py +1 -1
- warp/tests/test_adam.py +1 -1
- warp/tests/test_arithmetic.py +1 -1
- warp/tests/test_array.py +58 -1
- warp/tests/test_array_reduce.py +1 -1
- warp/tests/test_async.py +1 -1
- warp/tests/test_atomic.py +1 -1
- warp/tests/test_bool.py +1 -1
- warp/tests/test_builtins_resolution.py +1 -1
- warp/tests/test_bvh.py +6 -1
- warp/tests/test_closest_point_edge_edge.py +1 -1
- warp/tests/test_codegen.py +66 -1
- warp/tests/test_compile_consts.py +1 -1
- warp/tests/test_conditional.py +1 -1
- warp/tests/test_copy.py +1 -1
- warp/tests/test_ctypes.py +1 -1
- warp/tests/test_dense.py +1 -1
- warp/tests/test_devices.py +1 -1
- warp/tests/test_dlpack.py +1 -1
- warp/tests/test_examples.py +33 -4
- warp/tests/test_fabricarray.py +5 -2
- warp/tests/test_fast_math.py +1 -1
- warp/tests/test_fem.py +213 -6
- warp/tests/test_fp16.py +1 -1
- warp/tests/test_func.py +1 -1
- warp/tests/test_future_annotations.py +90 -0
- warp/tests/test_generics.py +1 -1
- warp/tests/test_grad.py +1 -1
- warp/tests/test_grad_customs.py +1 -1
- warp/tests/test_grad_debug.py +247 -0
- warp/tests/test_hash_grid.py +6 -1
- warp/tests/test_implicit_init.py +354 -0
- warp/tests/test_import.py +1 -1
- warp/tests/test_indexedarray.py +1 -1
- warp/tests/test_intersect.py +1 -1
- warp/tests/test_jax.py +1 -1
- warp/tests/test_large.py +1 -1
- warp/tests/test_launch.py +1 -1
- warp/tests/test_lerp.py +1 -1
- warp/tests/test_linear_solvers.py +1 -1
- warp/tests/test_lvalue.py +1 -1
- warp/tests/test_marching_cubes.py +5 -2
- warp/tests/test_mat.py +34 -35
- warp/tests/test_mat_lite.py +2 -1
- warp/tests/test_mat_scalar_ops.py +1 -1
- warp/tests/test_math.py +1 -1
- warp/tests/test_matmul.py +20 -16
- warp/tests/test_matmul_lite.py +1 -1
- warp/tests/test_mempool.py +1 -1
- warp/tests/test_mesh.py +5 -2
- warp/tests/test_mesh_query_aabb.py +1 -1
- warp/tests/test_mesh_query_point.py +1 -1
- warp/tests/test_mesh_query_ray.py +1 -1
- warp/tests/test_mlp.py +1 -1
- warp/tests/test_model.py +1 -1
- warp/tests/test_module_hashing.py +77 -1
- warp/tests/test_modules_lite.py +1 -1
- warp/tests/test_multigpu.py +1 -1
- warp/tests/test_noise.py +1 -1
- warp/tests/test_operators.py +1 -1
- warp/tests/test_options.py +1 -1
- warp/tests/test_overwrite.py +542 -0
- warp/tests/test_peer.py +1 -1
- warp/tests/test_pinned.py +1 -1
- warp/tests/test_print.py +1 -1
- warp/tests/test_quat.py +15 -1
- warp/tests/test_rand.py +1 -1
- warp/tests/test_reload.py +1 -1
- warp/tests/test_rounding.py +1 -1
- warp/tests/test_runlength_encode.py +1 -1
- warp/tests/test_scalar_ops.py +95 -0
- warp/tests/test_sim_grad.py +1 -1
- warp/tests/test_sim_kinematics.py +1 -1
- warp/tests/test_smoothstep.py +1 -1
- warp/tests/test_sparse.py +82 -15
- warp/tests/test_spatial.py +1 -1
- warp/tests/test_special_values.py +2 -11
- warp/tests/test_streams.py +11 -1
- warp/tests/test_struct.py +1 -1
- warp/tests/test_tape.py +1 -1
- warp/tests/test_torch.py +194 -1
- warp/tests/test_transient_module.py +1 -1
- warp/tests/test_types.py +1 -1
- warp/tests/test_utils.py +1 -1
- warp/tests/test_vec.py +15 -63
- warp/tests/test_vec_lite.py +2 -1
- warp/tests/test_vec_scalar_ops.py +65 -1
- warp/tests/test_verify_fp.py +1 -1
- warp/tests/test_volume.py +28 -2
- warp/tests/test_volume_write.py +1 -1
- warp/tests/unittest_serial.py +1 -1
- warp/tests/unittest_suites.py +9 -1
- warp/tests/walkthrough_debug.py +1 -1
- warp/thirdparty/unittest_parallel.py +2 -5
- warp/torch.py +103 -41
- warp/types.py +341 -224
- warp/utils.py +11 -2
- {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/METADATA +99 -46
- warp_lang-1.3.0.dist-info/RECORD +368 -0
- warp/examples/fem/bsr_utils.py +0 -378
- warp/examples/fem/mesh_utils.py +0 -133
- warp/examples/fem/plot_utils.py +0 -292
- warp_lang-1.2.2.dist-info/RECORD +0 -359
- {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/WHEEL +0 -0
- {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/top_level.txt +0 -0
warp/tape.py
CHANGED
|
@@ -165,7 +165,7 @@ class Tape:
|
|
|
165
165
|
|
|
166
166
|
Args:
|
|
167
167
|
backward (Callable): A callable Python object (can be any function) that will be executed in the backward pass.
|
|
168
|
-
arrays (list): A list of arrays that are used by the function
|
|
168
|
+
arrays (list): A list of arrays that are used by the backward function. The tape keeps track of these to be able to zero their gradients in Tape.zero()
|
|
169
169
|
"""
|
|
170
170
|
self.launches.append(backward)
|
|
171
171
|
|
|
@@ -197,6 +197,24 @@ class Tape:
|
|
|
197
197
|
else:
|
|
198
198
|
self.scopes.append((len(self.launches), None, None))
|
|
199
199
|
|
|
200
|
+
def check_kernel_array_access(self, kernel, args):
|
|
201
|
+
"""Detect illegal inter-kernel write after read access patterns during launch capture"""
|
|
202
|
+
adj = kernel.adj
|
|
203
|
+
kernel_name = adj.fun_name
|
|
204
|
+
filename = adj.filename
|
|
205
|
+
lineno = adj.fun_lineno
|
|
206
|
+
|
|
207
|
+
for i, arg in enumerate(args):
|
|
208
|
+
if isinstance(arg, wp.array):
|
|
209
|
+
arg_name = adj.args[i].label
|
|
210
|
+
|
|
211
|
+
# we check write condition first because we allow (write --> read) within the same kernel
|
|
212
|
+
if adj.args[i].is_write:
|
|
213
|
+
arg.mark_write(arg_name=arg_name, kernel_name=kernel_name, filename=filename, lineno=lineno)
|
|
214
|
+
|
|
215
|
+
if adj.args[i].is_read:
|
|
216
|
+
arg.mark_read()
|
|
217
|
+
|
|
200
218
|
# returns the adjoint of a kernel parameter
|
|
201
219
|
def get_adjoint(self, a):
|
|
202
220
|
if not wp.types.is_array(a) and not isinstance(a, wp.codegen.StructInstance):
|
|
@@ -237,6 +255,8 @@ class Tape:
|
|
|
237
255
|
self.launches = []
|
|
238
256
|
self.scopes = []
|
|
239
257
|
self.zero()
|
|
258
|
+
if wp.config.verify_autograd_array_access:
|
|
259
|
+
self.reset_array_read_flags()
|
|
240
260
|
|
|
241
261
|
def zero(self):
|
|
242
262
|
"""
|
|
@@ -251,6 +271,14 @@ class Tape:
|
|
|
251
271
|
else:
|
|
252
272
|
g.zero_()
|
|
253
273
|
|
|
274
|
+
def reset_array_read_flags(self):
|
|
275
|
+
"""
|
|
276
|
+
Reset all recorded array read flags to False
|
|
277
|
+
"""
|
|
278
|
+
for a in self.gradients:
|
|
279
|
+
if isinstance(a, wp.array):
|
|
280
|
+
a.mark_init()
|
|
281
|
+
|
|
254
282
|
def visualize(
|
|
255
283
|
self,
|
|
256
284
|
filename: str = None,
|
warp/tests/test_adam.py
CHANGED
warp/tests/test_arithmetic.py
CHANGED
warp/tests/test_array.py
CHANGED
|
@@ -2328,6 +2328,60 @@ def test_array_from_cai(test, device):
|
|
|
2328
2328
|
assert_np_equal(arr_warp.numpy(), np.array([[2, 1, 1], [1, 0, 0], [1, 0, 0]]))
|
|
2329
2329
|
|
|
2330
2330
|
|
|
2331
|
+
@wp.kernel
|
|
2332
|
+
def inc_scalar(a: wp.array(dtype=float)):
|
|
2333
|
+
tid = wp.tid()
|
|
2334
|
+
a[tid] = a[tid] + 1.0
|
|
2335
|
+
|
|
2336
|
+
|
|
2337
|
+
@wp.kernel
|
|
2338
|
+
def inc_vector(a: wp.array(dtype=wp.vec3f)):
|
|
2339
|
+
tid = wp.tid()
|
|
2340
|
+
a[tid] = a[tid] + wp.vec3f(1.0)
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
@wp.kernel
|
|
2344
|
+
def inc_matrix(a: wp.array(dtype=wp.mat22f)):
|
|
2345
|
+
tid = wp.tid()
|
|
2346
|
+
a[tid] = a[tid] + wp.mat22f(1.0)
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
def test_direct_from_numpy(test, device):
|
|
2350
|
+
"""Pass NumPy arrays to Warp kernels directly"""
|
|
2351
|
+
|
|
2352
|
+
n = 12
|
|
2353
|
+
|
|
2354
|
+
s = np.arange(n, dtype=np.float32)
|
|
2355
|
+
v = np.arange(n, dtype=np.float32).reshape((n // 3, 3))
|
|
2356
|
+
m = np.arange(n, dtype=np.float32).reshape((n // 4, 2, 2))
|
|
2357
|
+
|
|
2358
|
+
wp.launch(inc_scalar, dim=n, inputs=[s], device=device)
|
|
2359
|
+
wp.launch(inc_vector, dim=n // 3, inputs=[v], device=device)
|
|
2360
|
+
wp.launch(inc_matrix, dim=n // 4, inputs=[m], device=device)
|
|
2361
|
+
|
|
2362
|
+
expected = np.arange(1, n + 1, dtype=np.float32)
|
|
2363
|
+
|
|
2364
|
+
assert_np_equal(s, expected)
|
|
2365
|
+
assert_np_equal(v.reshape(n), expected)
|
|
2366
|
+
assert_np_equal(m.reshape(n), expected)
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
@wp.kernel
|
|
2370
|
+
def kernel_array_from_ptr(
|
|
2371
|
+
ptr: wp.uint64,
|
|
2372
|
+
):
|
|
2373
|
+
arr = wp.array(ptr=ptr, shape=(2, 3), dtype=wp.float32)
|
|
2374
|
+
arr[0, 0] = 1.0
|
|
2375
|
+
arr[0, 1] = 2.0
|
|
2376
|
+
arr[0, 2] = 3.0
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
def test_kernel_array_from_ptr(test, device):
|
|
2380
|
+
arr = wp.zeros(shape=(2, 3), dtype=wp.float32, device=device)
|
|
2381
|
+
wp.launch(kernel_array_from_ptr, dim=(1,), inputs=(arr.ptr,), device=device)
|
|
2382
|
+
assert_np_equal(arr.numpy(), np.array(((1.0, 2.0, 3.0), (0.0, 0.0, 0.0))))
|
|
2383
|
+
|
|
2384
|
+
|
|
2331
2385
|
devices = get_test_devices()
|
|
2332
2386
|
|
|
2333
2387
|
|
|
@@ -2386,6 +2440,9 @@ add_function_test(TestArray, "test_array_of_structs_from_numpy", test_array_of_s
|
|
|
2386
2440
|
add_function_test(TestArray, "test_array_of_structs_roundtrip", test_array_of_structs_roundtrip, devices=devices)
|
|
2387
2441
|
add_function_test(TestArray, "test_array_from_numpy", test_array_from_numpy, devices=devices)
|
|
2388
2442
|
|
|
2443
|
+
add_function_test(TestArray, "test_direct_from_numpy", test_direct_from_numpy, devices=["cpu"])
|
|
2444
|
+
add_function_test(TestArray, "test_kernel_array_from_ptr", test_kernel_array_from_ptr, devices=devices)
|
|
2445
|
+
|
|
2389
2446
|
try:
|
|
2390
2447
|
import torch
|
|
2391
2448
|
|
|
@@ -2411,5 +2468,5 @@ except Exception as e:
|
|
|
2411
2468
|
|
|
2412
2469
|
|
|
2413
2470
|
if __name__ == "__main__":
|
|
2414
|
-
wp.
|
|
2471
|
+
wp.clear_kernel_cache()
|
|
2415
2472
|
unittest.main(verbosity=2)
|
warp/tests/test_array_reduce.py
CHANGED
warp/tests/test_async.py
CHANGED
warp/tests/test_atomic.py
CHANGED
warp/tests/test_bool.py
CHANGED
warp/tests/test_bvh.py
CHANGED
|
@@ -153,10 +153,15 @@ class TestBvh(unittest.TestCase):
|
|
|
153
153
|
|
|
154
154
|
wp.Kernel(func=kernel_fn)
|
|
155
155
|
|
|
156
|
+
def test_bvh_new_del(self):
|
|
157
|
+
# test the scenario in which a bvh is created but not initialized before gc
|
|
158
|
+
instance = wp.Bvh.__new__(wp.Bvh)
|
|
159
|
+
instance.__del__()
|
|
160
|
+
|
|
156
161
|
|
|
157
162
|
add_function_test(TestBvh, "test_bvh_aabb", test_bvh_query_aabb, devices=devices)
|
|
158
163
|
add_function_test(TestBvh, "test_bvh_ray", test_bvh_query_ray, devices=devices)
|
|
159
164
|
|
|
160
165
|
if __name__ == "__main__":
|
|
161
|
-
wp.
|
|
166
|
+
wp.clear_kernel_cache()
|
|
162
167
|
unittest.main(verbosity=2)
|
warp/tests/test_codegen.py
CHANGED
|
@@ -425,6 +425,66 @@ def test_error_global_var(test, device):
|
|
|
425
425
|
wp.launch(kernel, dim=out.shape, inputs=(), outputs=(out,))
|
|
426
426
|
|
|
427
427
|
|
|
428
|
+
def test_error_collection_construct(test, device):
|
|
429
|
+
def kernel_1_fn():
|
|
430
|
+
x = [1.0, 2.0, 3.0]
|
|
431
|
+
|
|
432
|
+
def kernel_2_fn():
|
|
433
|
+
x = (1.0, 2.0, 3.0)
|
|
434
|
+
|
|
435
|
+
def kernel_3_fn():
|
|
436
|
+
x = {"a": 1.0, "b": 2.0, "c": 3.0}
|
|
437
|
+
|
|
438
|
+
def kernel_4_fn():
|
|
439
|
+
wp.length((1.0, 2.0, 3.0))
|
|
440
|
+
|
|
441
|
+
kernel = wp.Kernel(func=kernel_1_fn)
|
|
442
|
+
with test.assertRaisesRegex(
|
|
443
|
+
RuntimeError,
|
|
444
|
+
r"List constructs are not supported in kernels. Use vectors like `wp.vec3\(\)` for small collections instead.",
|
|
445
|
+
):
|
|
446
|
+
wp.launch(kernel, dim=1)
|
|
447
|
+
|
|
448
|
+
kernel = wp.Kernel(func=kernel_2_fn)
|
|
449
|
+
with test.assertRaisesRegex(
|
|
450
|
+
RuntimeError,
|
|
451
|
+
r"Tuple constructs are not supported in kernels. Use vectors like `wp.vec3\(\)` for small collections instead.",
|
|
452
|
+
):
|
|
453
|
+
wp.launch(kernel, dim=1)
|
|
454
|
+
|
|
455
|
+
kernel = wp.Kernel(func=kernel_3_fn)
|
|
456
|
+
with test.assertRaisesRegex(
|
|
457
|
+
RuntimeError,
|
|
458
|
+
r"Construct `ast.Dict` not supported in kernels.",
|
|
459
|
+
):
|
|
460
|
+
wp.launch(kernel, dim=1)
|
|
461
|
+
|
|
462
|
+
kernel = wp.Kernel(func=kernel_4_fn)
|
|
463
|
+
with test.assertRaisesRegex(
|
|
464
|
+
RuntimeError,
|
|
465
|
+
r"Tuple constructs are not supported in kernels. Use vectors like `wp.vec3\(\)` instead.",
|
|
466
|
+
):
|
|
467
|
+
wp.launch(kernel, dim=1)
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
@wp.kernel
|
|
471
|
+
def test_call_syntax():
|
|
472
|
+
expected_pow = 16.0
|
|
473
|
+
wp.expect_eq(wp.pow(2.0, 4.0), expected_pow)
|
|
474
|
+
wp.expect_eq(wp.pow(x=2.0, y=4.0), expected_pow)
|
|
475
|
+
wp.expect_eq(wp.pow(2.0, y=4.0), expected_pow)
|
|
476
|
+
wp.expect_eq(wp.pow(y=4.0, x=2.0), expected_pow)
|
|
477
|
+
|
|
478
|
+
expected_matrix = wp.mat44(2.0, 0.0, 0.0, 1.0, 0.0, 3.0, 0.0, 2.0, 0.0, 0.0, 4.0, 3.0, 0.0, 0.0, 0.0, 1.0)
|
|
479
|
+
pos = wp.vec3(1.0, 2.0, 3.0)
|
|
480
|
+
rot = wp.quat(0.0, 0.0, 0.0, 1.0)
|
|
481
|
+
scale = wp.vec3(2.0, 3.0, 4.0)
|
|
482
|
+
wp.expect_eq(wp.matrix(pos, rot, scale, wp.float32), expected_matrix)
|
|
483
|
+
wp.expect_eq(wp.matrix(pos=pos, rot=rot, scale=scale, dtype=wp.float32), expected_matrix)
|
|
484
|
+
wp.expect_eq(wp.matrix(pos, rot, scale, dtype=wp.float32), expected_matrix)
|
|
485
|
+
wp.expect_eq(wp.matrix(rot=rot, pos=pos, dtype=wp.float32, scale=scale), expected_matrix)
|
|
486
|
+
|
|
487
|
+
|
|
428
488
|
class TestCodeGen(unittest.TestCase):
|
|
429
489
|
pass
|
|
430
490
|
|
|
@@ -555,8 +615,13 @@ add_kernel_test(TestCodeGen, name="test_continue_unroll", kernel=test_continue_u
|
|
|
555
615
|
add_function_test(TestCodeGen, func=test_unresolved_func, name="test_unresolved_func", devices=devices)
|
|
556
616
|
add_function_test(TestCodeGen, func=test_unresolved_symbol, name="test_unresolved_symbol", devices=devices)
|
|
557
617
|
add_function_test(TestCodeGen, func=test_error_global_var, name="test_error_global_var", devices=devices)
|
|
618
|
+
add_function_test(
|
|
619
|
+
TestCodeGen, func=test_error_collection_construct, name="test_error_collection_construct", devices=devices
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
add_kernel_test(TestCodeGen, name="test_call_syntax", kernel=test_call_syntax, dim=1, devices=devices)
|
|
558
623
|
|
|
559
624
|
|
|
560
625
|
if __name__ == "__main__":
|
|
561
|
-
wp.
|
|
626
|
+
wp.clear_kernel_cache()
|
|
562
627
|
unittest.main(verbosity=2, failfast=True)
|
warp/tests/test_conditional.py
CHANGED
warp/tests/test_copy.py
CHANGED
warp/tests/test_ctypes.py
CHANGED
warp/tests/test_dense.py
CHANGED
warp/tests/test_devices.py
CHANGED
warp/tests/test_dlpack.py
CHANGED
warp/tests/test_examples.py
CHANGED
|
@@ -148,9 +148,12 @@ def add_example_test(
|
|
|
148
148
|
|
|
149
149
|
command.extend(_build_command_line_options(options))
|
|
150
150
|
|
|
151
|
+
# Set the test timeout in seconds
|
|
152
|
+
test_timeout = options.pop("test_timeout", 300)
|
|
153
|
+
|
|
151
154
|
# with wp.ScopedTimer(f"{name}_{sanitize_identifier(device)}"):
|
|
152
155
|
# Run the script as a subprocess
|
|
153
|
-
result = subprocess.run(command, capture_output=True, text=True, env=env_vars)
|
|
156
|
+
result = subprocess.run(command, capture_output=True, text=True, env=env_vars, timeout=test_timeout)
|
|
154
157
|
|
|
155
158
|
# Check the return code (0 is standard for success)
|
|
156
159
|
test.assertEqual(
|
|
@@ -223,6 +226,7 @@ add_example_test(
|
|
|
223
226
|
name="core.example_torch",
|
|
224
227
|
devices=test_devices,
|
|
225
228
|
test_options={"headless": True, "num_frames": 1000, "torch_required": True},
|
|
229
|
+
test_options_cpu={"test_timeout": 600},
|
|
226
230
|
)
|
|
227
231
|
add_example_test(TestCoreExamples, name="core.example_wave", devices=test_devices)
|
|
228
232
|
|
|
@@ -232,7 +236,11 @@ class TestOptimExamples(unittest.TestCase):
|
|
|
232
236
|
|
|
233
237
|
|
|
234
238
|
add_example_test(
|
|
235
|
-
TestOptimExamples,
|
|
239
|
+
TestOptimExamples,
|
|
240
|
+
name="optim.example_bounce",
|
|
241
|
+
devices=test_devices,
|
|
242
|
+
test_options_cpu={"train_iters": 3},
|
|
243
|
+
test_options_cuda={"test_timeout": 600},
|
|
236
244
|
)
|
|
237
245
|
add_example_test(
|
|
238
246
|
TestOptimExamples,
|
|
@@ -283,7 +291,9 @@ class TestSimExamples(unittest.TestCase):
|
|
|
283
291
|
pass
|
|
284
292
|
|
|
285
293
|
|
|
286
|
-
add_example_test(
|
|
294
|
+
add_example_test(
|
|
295
|
+
TestSimExamples, name="sim.example_cartpole", devices=test_devices, test_options_cuda={"test_timeout": 600}
|
|
296
|
+
)
|
|
287
297
|
add_example_test(
|
|
288
298
|
TestSimExamples,
|
|
289
299
|
name="sim.example_cloth",
|
|
@@ -373,6 +383,7 @@ add_example_test(
|
|
|
373
383
|
name="fem.example_convection_diffusion_dg",
|
|
374
384
|
devices=test_devices,
|
|
375
385
|
test_options={"resolution": 20, "num_frames": 25, "mesh": "quad", "headless": True},
|
|
386
|
+
test_options_cpu={"test_timeout": 600},
|
|
376
387
|
)
|
|
377
388
|
add_example_test(
|
|
378
389
|
TestFemExamples,
|
|
@@ -395,9 +406,27 @@ add_example_test(
|
|
|
395
406
|
devices=test_devices,
|
|
396
407
|
test_options={"num_frames": 101, "resolution": 10, "tri_mesh": True, "headless": True},
|
|
397
408
|
)
|
|
409
|
+
add_example_test(
|
|
410
|
+
TestFemExamples,
|
|
411
|
+
name="fem.example_streamlines",
|
|
412
|
+
devices=test_devices,
|
|
413
|
+
test_options={"headless": True},
|
|
414
|
+
)
|
|
415
|
+
add_example_test(
|
|
416
|
+
TestFemExamples,
|
|
417
|
+
name="fem.example_magnetostatics",
|
|
418
|
+
devices=test_devices,
|
|
419
|
+
test_options={"headless": True, "resolution": 16},
|
|
420
|
+
)
|
|
421
|
+
add_example_test(
|
|
422
|
+
TestFemExamples,
|
|
423
|
+
name="fem.example_nonconforming_contact",
|
|
424
|
+
devices=test_devices,
|
|
425
|
+
test_options={"headless": True, "resolution": 16, "num_steps": 2},
|
|
426
|
+
)
|
|
398
427
|
|
|
399
428
|
if __name__ == "__main__":
|
|
400
429
|
# force rebuild of all kernels
|
|
401
|
-
wp.
|
|
430
|
+
wp.clear_kernel_cache()
|
|
402
431
|
|
|
403
432
|
unittest.main(verbosity=2, failfast=True)
|
warp/tests/test_fabricarray.py
CHANGED
|
@@ -931,7 +931,10 @@ devices = get_test_devices()
|
|
|
931
931
|
|
|
932
932
|
|
|
933
933
|
class TestFabricArray(unittest.TestCase):
|
|
934
|
-
|
|
934
|
+
def test_fabricarray_new_del(self):
|
|
935
|
+
# test the scenario in which a fabricarray is created but not initialized before gc
|
|
936
|
+
instance = wp.fabricarray.__new__(wp.fabricarray)
|
|
937
|
+
instance.__del__()
|
|
935
938
|
|
|
936
939
|
|
|
937
940
|
# fabric arrays
|
|
@@ -948,5 +951,5 @@ add_function_test(TestFabricArray, "test_fabricarrayarray", test_fabricarrayarra
|
|
|
948
951
|
|
|
949
952
|
|
|
950
953
|
if __name__ == "__main__":
|
|
951
|
-
wp.
|
|
954
|
+
wp.clear_kernel_cache()
|
|
952
955
|
unittest.main(verbosity=2)
|
warp/tests/test_fast_math.py
CHANGED