warp-lang 1.0.0b5__py3-none-manylinux2014_x86_64.whl → 1.0.0b6__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.
- docs/conf.py +3 -4
- examples/env/env_ant.py +1 -1
- examples/env/env_cartpole.py +1 -1
- examples/env/env_humanoid.py +1 -1
- examples/example_dem.py +28 -26
- examples/example_diffray.py +37 -30
- examples/example_fluid.py +7 -3
- examples/example_jacobian_ik.py +1 -1
- examples/example_mesh_intersect.py +10 -7
- examples/example_nvdb.py +3 -3
- examples/example_render_opengl.py +19 -10
- examples/example_sim_cartpole.py +9 -5
- examples/example_sim_cloth.py +29 -25
- examples/example_sim_fk_grad.py +2 -2
- examples/example_sim_fk_grad_torch.py +3 -3
- examples/example_sim_grad_bounce.py +11 -8
- examples/example_sim_grad_cloth.py +12 -9
- examples/example_sim_granular.py +2 -2
- examples/example_sim_granular_collision_sdf.py +13 -13
- examples/example_sim_neo_hookean.py +3 -3
- examples/example_sim_particle_chain.py +2 -2
- examples/example_sim_quadruped.py +8 -5
- examples/example_sim_rigid_chain.py +8 -5
- examples/example_sim_rigid_contact.py +13 -10
- examples/example_sim_rigid_fem.py +2 -2
- examples/example_sim_rigid_gyroscopic.py +2 -2
- examples/example_sim_rigid_kinematics.py +1 -1
- examples/example_sim_trajopt.py +3 -2
- examples/fem/example_apic_fluid.py +5 -7
- examples/fem/example_diffusion_mgpu.py +18 -16
- warp/__init__.py +3 -2
- warp/bin/warp.so +0 -0
- warp/build_dll.py +29 -9
- warp/builtins.py +206 -7
- warp/codegen.py +58 -38
- warp/config.py +3 -1
- warp/context.py +234 -128
- warp/fem/__init__.py +2 -2
- warp/fem/cache.py +2 -1
- warp/fem/field/nodal_field.py +18 -17
- warp/fem/geometry/hexmesh.py +11 -6
- warp/fem/geometry/quadmesh_2d.py +16 -12
- warp/fem/geometry/tetmesh.py +19 -8
- warp/fem/geometry/trimesh_2d.py +18 -7
- warp/fem/integrate.py +341 -196
- warp/fem/quadrature/__init__.py +1 -1
- warp/fem/quadrature/pic_quadrature.py +138 -53
- warp/fem/quadrature/quadrature.py +81 -9
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/basis_space.py +169 -51
- warp/fem/space/grid_2d_function_space.py +2 -2
- warp/fem/space/grid_3d_function_space.py +2 -2
- warp/fem/space/hexmesh_function_space.py +2 -2
- warp/fem/space/partition.py +9 -6
- warp/fem/space/quadmesh_2d_function_space.py +2 -2
- warp/fem/space/shape/cube_shape_function.py +27 -15
- warp/fem/space/shape/square_shape_function.py +29 -18
- warp/fem/space/tetmesh_function_space.py +2 -2
- warp/fem/space/topology.py +10 -0
- warp/fem/space/trimesh_2d_function_space.py +2 -2
- warp/fem/utils.py +10 -5
- warp/native/array.h +49 -8
- warp/native/builtin.h +31 -14
- warp/native/cuda_util.cpp +8 -3
- warp/native/cuda_util.h +1 -0
- warp/native/exports.h +1177 -1108
- warp/native/intersect.h +4 -4
- warp/native/intersect_adj.h +8 -8
- warp/native/mat.h +65 -6
- warp/native/mesh.h +126 -5
- warp/native/quat.h +28 -4
- warp/native/vec.h +76 -14
- warp/native/warp.cu +1 -6
- warp/render/render_opengl.py +261 -109
- warp/sim/import_mjcf.py +13 -7
- warp/sim/import_urdf.py +14 -14
- warp/sim/inertia.py +17 -18
- warp/sim/model.py +67 -67
- warp/sim/render.py +1 -1
- warp/sparse.py +6 -6
- warp/stubs.py +19 -81
- warp/tape.py +1 -1
- warp/tests/__main__.py +3 -6
- warp/tests/{test_class_kernel.py → aux_test_class_kernel.py} +9 -1
- warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -0
- warp/tests/{test_dependent.py → aux_test_dependent.py} +2 -2
- warp/tests/{test_reference.py → aux_test_reference.py} +1 -1
- warp/tests/aux_test_unresolved_func.py +14 -0
- warp/tests/aux_test_unresolved_symbol.py +14 -0
- warp/tests/{test_kinematics.py → disabled_kinematics.py} +10 -12
- warp/tests/run_coverage_serial.py +31 -0
- warp/tests/test_adam.py +102 -106
- warp/tests/test_arithmetic.py +39 -40
- warp/tests/test_array.py +46 -48
- warp/tests/test_array_reduce.py +25 -19
- warp/tests/test_atomic.py +62 -26
- warp/tests/test_bool.py +16 -11
- warp/tests/test_builtins_resolution.py +1292 -0
- warp/tests/test_bvh.py +9 -12
- warp/tests/test_closest_point_edge_edge.py +53 -57
- warp/tests/test_codegen.py +164 -134
- warp/tests/test_compile_consts.py +13 -19
- warp/tests/test_conditional.py +30 -32
- warp/tests/test_copy.py +9 -12
- warp/tests/test_ctypes.py +90 -98
- warp/tests/test_dense.py +20 -14
- warp/tests/test_devices.py +34 -35
- warp/tests/test_dlpack.py +74 -75
- warp/tests/test_examples.py +215 -97
- warp/tests/test_fabricarray.py +15 -21
- warp/tests/test_fast_math.py +14 -11
- warp/tests/test_fem.py +280 -97
- warp/tests/test_fp16.py +19 -15
- warp/tests/test_func.py +177 -194
- warp/tests/test_generics.py +71 -77
- warp/tests/test_grad.py +83 -32
- warp/tests/test_grad_customs.py +7 -9
- warp/tests/test_hash_grid.py +6 -10
- warp/tests/test_import.py +9 -23
- warp/tests/test_indexedarray.py +19 -21
- warp/tests/test_intersect.py +15 -9
- warp/tests/test_large.py +17 -19
- warp/tests/test_launch.py +14 -17
- warp/tests/test_lerp.py +63 -63
- warp/tests/test_lvalue.py +84 -35
- warp/tests/test_marching_cubes.py +9 -13
- warp/tests/test_mat.py +388 -3004
- warp/tests/test_mat_lite.py +9 -12
- warp/tests/test_mat_scalar_ops.py +2889 -0
- warp/tests/test_math.py +10 -11
- warp/tests/test_matmul.py +104 -100
- warp/tests/test_matmul_lite.py +72 -98
- warp/tests/test_mesh.py +35 -32
- warp/tests/test_mesh_query_aabb.py +18 -25
- warp/tests/test_mesh_query_point.py +39 -23
- warp/tests/test_mesh_query_ray.py +9 -21
- warp/tests/test_mlp.py +8 -9
- warp/tests/test_model.py +89 -93
- warp/tests/test_modules_lite.py +15 -25
- warp/tests/test_multigpu.py +87 -114
- warp/tests/test_noise.py +10 -12
- warp/tests/test_operators.py +14 -21
- warp/tests/test_options.py +10 -11
- warp/tests/test_pinned.py +16 -18
- warp/tests/test_print.py +16 -20
- warp/tests/test_quat.py +121 -88
- warp/tests/test_rand.py +12 -13
- warp/tests/test_reload.py +27 -32
- warp/tests/test_rounding.py +7 -10
- warp/tests/test_runlength_encode.py +105 -106
- warp/tests/test_smoothstep.py +8 -9
- warp/tests/test_snippet.py +13 -22
- warp/tests/test_sparse.py +30 -29
- warp/tests/test_spatial.py +179 -174
- warp/tests/test_streams.py +100 -107
- warp/tests/test_struct.py +98 -67
- warp/tests/test_tape.py +11 -17
- warp/tests/test_torch.py +89 -86
- warp/tests/test_transient_module.py +9 -12
- warp/tests/test_types.py +328 -50
- warp/tests/test_utils.py +217 -218
- warp/tests/test_vec.py +133 -2133
- warp/tests/test_vec_lite.py +8 -11
- warp/tests/test_vec_scalar_ops.py +2099 -0
- warp/tests/test_volume.py +391 -382
- warp/tests/test_volume_write.py +122 -135
- warp/tests/unittest_serial.py +35 -0
- warp/tests/unittest_suites.py +291 -0
- warp/tests/{test_base.py → unittest_utils.py} +138 -25
- warp/tests/{test_misc.py → unused_test_misc.py} +13 -5
- warp/tests/{test_debug.py → walkthough_debug.py} +2 -15
- warp/thirdparty/unittest_parallel.py +257 -54
- warp/types.py +119 -98
- warp/utils.py +14 -0
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/METADATA +2 -1
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/RECORD +182 -178
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/WHEEL +1 -1
- warp/tests/test_all.py +0 -239
- warp/tests/test_conditional_unequal_types_kernels.py +0 -14
- warp/tests/test_coverage.py +0 -38
- warp/tests/test_unresolved_func.py +0 -7
- warp/tests/test_unresolved_symbol.py +0 -7
- /warp/tests/{test_compile_consts_dummy.py → aux_test_compile_consts_dummy.py} +0 -0
- /warp/tests/{test_reference_reference.py → aux_test_reference_reference.py} +0 -0
- /warp/tests/{test_square.py → aux_test_square.py} +0 -0
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/top_level.txt +0 -0
warp/tests/test_examples.py
CHANGED
|
@@ -1,119 +1,237 @@
|
|
|
1
|
+
# Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
|
|
2
|
+
# NVIDIA CORPORATION and its licensors retain all intellectual property
|
|
3
|
+
# and proprietary rights in and to this software, related documentation
|
|
4
|
+
# and any modifications thereto. Any use, reproduction, disclosure or
|
|
5
|
+
# distribution of this software and related documentation without an express
|
|
6
|
+
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
7
|
+
|
|
1
8
|
import importlib
|
|
2
9
|
import os
|
|
3
10
|
import unittest
|
|
4
11
|
|
|
5
12
|
import warp as wp
|
|
13
|
+
from warp.tests.unittest_utils import get_unique_cuda_test_devices, sanitize_identifier
|
|
14
|
+
|
|
15
|
+
wp.init()
|
|
6
16
|
|
|
7
17
|
|
|
8
18
|
# registers an example to run as a TestCase
|
|
9
|
-
def add_example_test(cls, name, options):
|
|
19
|
+
def add_example_test(cls, name, devices=None, options={}):
|
|
10
20
|
def run(test, device):
|
|
11
|
-
#
|
|
12
|
-
|
|
21
|
+
# The copy() is needed because pop() is used to avoid passing extra args to Example()
|
|
22
|
+
# Can remove once all examples accept **kwargs and we no longer need to pop()
|
|
23
|
+
test_options = options.copy()
|
|
13
24
|
|
|
14
25
|
try:
|
|
15
26
|
module = importlib.import_module(f"examples.{name}")
|
|
27
|
+
|
|
28
|
+
torch_cuda_required = test_options.setdefault("torch_cuda_required", False)
|
|
29
|
+
test_options.pop("torch_cuda_required", None)
|
|
30
|
+
if torch_cuda_required and wp.get_device(device).is_cuda:
|
|
31
|
+
# Ensure torch has CUDA support
|
|
32
|
+
import torch
|
|
33
|
+
|
|
34
|
+
if not torch.cuda.is_available():
|
|
35
|
+
test.skipTest("Torch not compiled with CUDA support")
|
|
36
|
+
|
|
16
37
|
except Exception as e:
|
|
17
|
-
|
|
18
|
-
return
|
|
38
|
+
test.skipTest(f"{e}")
|
|
19
39
|
|
|
20
40
|
# create default USD stage output path which many examples expect
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if "num_frames" in options:
|
|
26
|
-
num_frames = options["num_frames"]
|
|
27
|
-
del options["num_frames"]
|
|
28
|
-
else:
|
|
29
|
-
num_frames = 10
|
|
30
|
-
|
|
31
|
-
e = module.Example(**options)
|
|
32
|
-
|
|
33
|
-
for _ in range(num_frames):
|
|
34
|
-
e.update()
|
|
35
|
-
e.render()
|
|
36
|
-
|
|
37
|
-
wp.ScopedTimer.enabled = True
|
|
38
|
-
|
|
39
|
-
from warp.tests.test_base import add_function_test
|
|
40
|
-
|
|
41
|
-
add_function_test(cls, f"test_{name}", run, check_output=False)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def register(parent):
|
|
45
|
-
class TestExamples(parent):
|
|
46
|
-
pass
|
|
47
|
-
|
|
48
|
-
# Exclude unless we can run headless somehow
|
|
49
|
-
# add_example_test(TestExamples, name="example_render_opengl", options={})
|
|
50
|
-
|
|
51
|
-
# TODO: Test CPU and GPU versions
|
|
52
|
-
if wp.is_cuda_available():
|
|
53
|
-
add_example_test(TestExamples, name="example_dem", options={})
|
|
54
|
-
add_example_test(TestExamples, name="example_diffray", options={})
|
|
55
|
-
add_example_test(TestExamples, name="example_fluid", options={})
|
|
56
|
-
add_example_test(TestExamples, name="example_jacobian_ik", options={})
|
|
57
|
-
add_example_test(TestExamples, name="example_marching_cubes", options={})
|
|
58
|
-
add_example_test(TestExamples, name="example_mesh", options={})
|
|
59
|
-
add_example_test(TestExamples, name="example_mesh_intersect", options={"num_frames": 1})
|
|
60
|
-
add_example_test(TestExamples, name="example_nvdb", options={})
|
|
61
|
-
add_example_test(TestExamples, name="example_raycast", options={})
|
|
62
|
-
add_example_test(TestExamples, name="example_raymarch", options={})
|
|
63
|
-
add_example_test(TestExamples, name="example_sim_cartpole", options={})
|
|
64
|
-
add_example_test(TestExamples, name="example_sim_cloth", options={})
|
|
65
|
-
add_example_test(TestExamples, name="example_sim_fk_grad", options={})
|
|
66
|
-
# add_example_test(TestExamples, name="example_sim_fk_grad_torch", options={}) # disabling due to failure on TC machines that have torch but not CUDA torch
|
|
67
|
-
add_example_test(TestExamples, name="example_sim_grad_bounce", options={})
|
|
68
|
-
add_example_test(TestExamples, name="example_sim_grad_cloth", options={})
|
|
69
|
-
add_example_test(TestExamples, name="example_sim_granular", options={})
|
|
70
|
-
add_example_test(TestExamples, name="example_sim_granular_collision_sdf", options={})
|
|
71
|
-
add_example_test(TestExamples, name="example_sim_neo_hookean", options={})
|
|
72
|
-
add_example_test(TestExamples, name="example_sim_particle_chain", options={})
|
|
73
|
-
add_example_test(TestExamples, name="example_sim_quadruped", options={})
|
|
74
|
-
add_example_test(TestExamples, name="example_sim_rigid_chain", options={})
|
|
75
|
-
add_example_test(TestExamples, name="example_sim_rigid_contact", options={})
|
|
76
|
-
add_example_test(TestExamples, name="example_sim_rigid_fem", options={})
|
|
77
|
-
add_example_test(TestExamples, name="example_sim_rigid_force", options={})
|
|
78
|
-
add_example_test(TestExamples, name="example_sim_rigid_gyroscopic", options={})
|
|
79
|
-
add_example_test(TestExamples, name="example_sim_rigid_kinematics", options={})
|
|
80
|
-
add_example_test(TestExamples, name="example_sim_trajopt", options={})
|
|
81
|
-
add_example_test(TestExamples, name="example_sph", options={})
|
|
82
|
-
add_example_test(TestExamples, name="example_wave", options={"resx": 256, "resy": 256})
|
|
83
|
-
add_example_test(TestExamples, name="fem.example_diffusion_mgpu", options={"quiet": True, "num_frames": 1})
|
|
84
|
-
|
|
85
|
-
# The following examples do not need cuda
|
|
86
|
-
add_example_test(TestExamples, name="fem.example_apic_fluid", options={"quiet": True, "res": [16, 16, 16]})
|
|
87
|
-
add_example_test(
|
|
88
|
-
TestExamples,
|
|
89
|
-
name="fem.example_diffusion",
|
|
90
|
-
options={"quiet": True, "resolution": 10, "mesh": "tri", "num_frames": 1},
|
|
91
|
-
)
|
|
92
|
-
add_example_test(
|
|
93
|
-
TestExamples, name="fem.example_diffusion_3d", options={"quiet": True, "resolution": 10, "num_frames": 1}
|
|
94
|
-
)
|
|
95
|
-
add_example_test(
|
|
96
|
-
TestExamples,
|
|
97
|
-
name="fem.example_deformed_geometry",
|
|
98
|
-
options={"quiet": True, "resolution": 10, "num_frames": 1, "mesh": "tri"},
|
|
99
|
-
)
|
|
100
|
-
add_example_test(TestExamples, name="fem.example_convection_diffusion", options={"quiet": True, "resolution": 20})
|
|
101
|
-
add_example_test(
|
|
102
|
-
TestExamples,
|
|
103
|
-
name="fem.example_mixed_elasticity",
|
|
104
|
-
options={"quiet": True, "nonconforming_stresses": True, "mesh": "quad", "num_frames": 1},
|
|
105
|
-
)
|
|
106
|
-
add_example_test(TestExamples, name="fem.example_stokes_transfer", options={"quiet": True, "num_frames": 1})
|
|
107
|
-
|
|
108
|
-
return TestExamples
|
|
41
|
+
test_options.setdefault(
|
|
42
|
+
"stage", os.path.join(os.path.dirname(__file__), f"outputs/{name}_{sanitize_identifier(device)}.usd")
|
|
43
|
+
)
|
|
109
44
|
|
|
45
|
+
try:
|
|
46
|
+
os.remove(test_options["stage"])
|
|
47
|
+
except OSError:
|
|
48
|
+
pass
|
|
110
49
|
|
|
111
|
-
|
|
112
|
-
|
|
50
|
+
num_frames = test_options.get("num_frames", 10)
|
|
51
|
+
test_options.pop("num_frames", None)
|
|
52
|
+
|
|
53
|
+
# Don't want to force load all modules by default for serial test runner
|
|
54
|
+
wp.config.graph_capture_module_load_default = False
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
enable_backward = test_options.get("enable_backward", True)
|
|
58
|
+
wp.set_module_options({"enable_backward": enable_backward}, module)
|
|
59
|
+
test_options.pop("enable_backward", None)
|
|
60
|
+
|
|
61
|
+
with wp.ScopedDevice(device):
|
|
62
|
+
wp.load_module(module, device=wp.get_device())
|
|
63
|
+
extra_load_modules = test_options.get("load_modules", [])
|
|
64
|
+
for module_name in extra_load_modules:
|
|
65
|
+
wp.load_module(module_name, device=wp.get_device())
|
|
66
|
+
test_options.pop("load_modules", None)
|
|
67
|
+
|
|
68
|
+
e = module.Example(**test_options)
|
|
113
69
|
|
|
70
|
+
# disable scoped timer to avoid log spam from time steps
|
|
71
|
+
wp.ScopedTimer.enabled = False
|
|
72
|
+
|
|
73
|
+
for _ in range(num_frames):
|
|
74
|
+
e.update()
|
|
75
|
+
e.render()
|
|
76
|
+
except Exception as e:
|
|
77
|
+
test.fail(f"{e}")
|
|
78
|
+
finally:
|
|
79
|
+
wp.ScopedTimer.enabled = True
|
|
80
|
+
wp.config.graph_capture_module_load_default = True
|
|
81
|
+
|
|
82
|
+
from warp.tests.unittest_utils import add_function_test
|
|
83
|
+
|
|
84
|
+
add_function_test(cls, f"test_{name}", run, devices=devices, check_output=False)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# TODO: Make the example classes use the passed in device
|
|
88
|
+
cuda_test_devices = get_unique_cuda_test_devices()
|
|
89
|
+
|
|
90
|
+
# NOTE: To give the parallel test runner more opportunities to parallelize test cases,
|
|
91
|
+
# we break up the tests into multiple TestCase classes that should be non-conflicting
|
|
92
|
+
# w.r.t. kernel compilation
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class TestExamples(unittest.TestCase):
|
|
96
|
+
pass
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# Exclude unless we can run headless somehow
|
|
100
|
+
# add_example_test(TestExamples, name="example_render_opengl", options={})
|
|
101
|
+
|
|
102
|
+
add_example_test(TestExamples, name="example_dem", devices=cuda_test_devices)
|
|
103
|
+
add_example_test(TestExamples, name="example_diffray", devices=cuda_test_devices)
|
|
104
|
+
add_example_test(TestExamples, name="example_fluid", devices=cuda_test_devices)
|
|
105
|
+
add_example_test(TestExamples, name="example_jacobian_ik", devices=cuda_test_devices)
|
|
106
|
+
add_example_test(TestExamples, name="example_marching_cubes", devices=cuda_test_devices)
|
|
107
|
+
add_example_test(TestExamples, name="example_mesh", devices=cuda_test_devices)
|
|
108
|
+
add_example_test(TestExamples, name="example_mesh_intersect", devices=cuda_test_devices, options={"num_frames": 1})
|
|
109
|
+
add_example_test(TestExamples, name="example_nvdb", devices=cuda_test_devices)
|
|
110
|
+
add_example_test(TestExamples, name="example_raycast", devices=cuda_test_devices)
|
|
111
|
+
add_example_test(TestExamples, name="example_raymarch", devices=cuda_test_devices)
|
|
112
|
+
add_example_test(TestExamples, name="example_sph", devices=cuda_test_devices)
|
|
113
|
+
add_example_test(TestExamples, name="example_wave", devices=cuda_test_devices, options={"resx": 256, "resy": 256})
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class TestSimExamples(unittest.TestCase):
|
|
117
|
+
pass
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
add_example_test(
|
|
121
|
+
TestSimExamples,
|
|
122
|
+
name="example_sim_cartpole",
|
|
123
|
+
devices=cuda_test_devices,
|
|
124
|
+
options={"load_modules": ["warp.sim.collide", "warp.sim.integrator_euler", "warp.sim.articulation"]},
|
|
125
|
+
)
|
|
126
|
+
add_example_test(
|
|
127
|
+
TestSimExamples,
|
|
128
|
+
name="example_sim_cloth",
|
|
129
|
+
devices=cuda_test_devices,
|
|
130
|
+
options={"load_modules": ["warp.sim.collide", "warp.sim.integrator_euler", "warp.sim.particles"]},
|
|
131
|
+
)
|
|
132
|
+
add_example_test(TestSimExamples, name="example_sim_fk_grad", devices=cuda_test_devices)
|
|
133
|
+
add_example_test(
|
|
134
|
+
TestSimExamples, name="example_sim_fk_grad_torch", devices=cuda_test_devices, options={"torch_cuda_required": True}
|
|
135
|
+
)
|
|
136
|
+
add_example_test(
|
|
137
|
+
TestSimExamples,
|
|
138
|
+
name="example_sim_grad_bounce",
|
|
139
|
+
devices=cuda_test_devices,
|
|
140
|
+
options={"load_modules": ["warp.sim.integrator_euler", "warp.sim.particles"]},
|
|
141
|
+
)
|
|
142
|
+
add_example_test(
|
|
143
|
+
TestSimExamples,
|
|
144
|
+
name="example_sim_grad_cloth",
|
|
145
|
+
devices=cuda_test_devices,
|
|
146
|
+
options={"load_modules": ["warp.sim.integrator_euler", "warp.sim.particles"]},
|
|
147
|
+
)
|
|
148
|
+
add_example_test(TestSimExamples, name="example_sim_granular", devices=cuda_test_devices)
|
|
149
|
+
add_example_test(TestSimExamples, name="example_sim_granular_collision_sdf", devices=cuda_test_devices)
|
|
150
|
+
add_example_test(TestSimExamples, name="example_sim_neo_hookean", devices=cuda_test_devices)
|
|
151
|
+
add_example_test(TestSimExamples, name="example_sim_particle_chain", devices=cuda_test_devices)
|
|
152
|
+
add_example_test(
|
|
153
|
+
TestSimExamples,
|
|
154
|
+
name="example_sim_quadruped",
|
|
155
|
+
devices=cuda_test_devices,
|
|
156
|
+
options={"load_modules": ["warp.sim.integrator_xpbd", "warp.sim.integrator_euler"]},
|
|
157
|
+
)
|
|
158
|
+
add_example_test(
|
|
159
|
+
TestSimExamples,
|
|
160
|
+
name="example_sim_rigid_chain",
|
|
161
|
+
devices=cuda_test_devices,
|
|
162
|
+
options={"load_modules": ["warp.sim.integrator_xpbd", "warp.sim.integrator_euler"]},
|
|
163
|
+
)
|
|
164
|
+
add_example_test(
|
|
165
|
+
TestSimExamples,
|
|
166
|
+
name="example_sim_rigid_contact",
|
|
167
|
+
devices=cuda_test_devices,
|
|
168
|
+
options={"load_modules": ["warp.sim.integrator_euler"]},
|
|
169
|
+
)
|
|
170
|
+
add_example_test(TestSimExamples, name="example_sim_rigid_fem", devices=cuda_test_devices)
|
|
171
|
+
add_example_test(TestSimExamples, name="example_sim_rigid_force", devices=cuda_test_devices)
|
|
172
|
+
add_example_test(TestSimExamples, name="example_sim_rigid_gyroscopic", devices=cuda_test_devices)
|
|
173
|
+
add_example_test(TestSimExamples, name="example_sim_rigid_kinematics", devices=cuda_test_devices)
|
|
174
|
+
add_example_test(TestSimExamples, name="example_sim_trajopt", devices=cuda_test_devices)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class TestFemExamples(unittest.TestCase):
|
|
178
|
+
pass
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
add_example_test(
|
|
182
|
+
TestFemExamples,
|
|
183
|
+
name="fem.example_diffusion_mgpu",
|
|
184
|
+
devices=cuda_test_devices,
|
|
185
|
+
options={"quiet": True, "num_frames": 1, "enable_backward": False},
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
# The following examples do not need CUDA, but they need USD
|
|
189
|
+
add_example_test(
|
|
190
|
+
TestFemExamples,
|
|
191
|
+
name="fem.example_apic_fluid",
|
|
192
|
+
devices=cuda_test_devices,
|
|
193
|
+
options={"quiet": True, "res": [16, 16, 16], "enable_backward": False},
|
|
194
|
+
)
|
|
195
|
+
add_example_test(
|
|
196
|
+
TestFemExamples,
|
|
197
|
+
name="fem.example_diffusion",
|
|
198
|
+
devices=cuda_test_devices,
|
|
199
|
+
options={"quiet": True, "resolution": 10, "mesh": "tri", "num_frames": 1, "enable_backward": False},
|
|
200
|
+
)
|
|
201
|
+
add_example_test(
|
|
202
|
+
TestFemExamples,
|
|
203
|
+
name="fem.example_diffusion_3d",
|
|
204
|
+
devices=cuda_test_devices,
|
|
205
|
+
options={"quiet": True, "resolution": 10, "num_frames": 1, "enable_backward": False},
|
|
206
|
+
)
|
|
207
|
+
add_example_test(
|
|
208
|
+
TestFemExamples,
|
|
209
|
+
name="fem.example_deformed_geometry",
|
|
210
|
+
devices=cuda_test_devices,
|
|
211
|
+
options={"quiet": True, "resolution": 10, "num_frames": 1, "mesh": "tri", "enable_backward": False},
|
|
212
|
+
)
|
|
213
|
+
add_example_test(
|
|
214
|
+
TestFemExamples,
|
|
215
|
+
name="fem.example_convection_diffusion",
|
|
216
|
+
devices=cuda_test_devices,
|
|
217
|
+
options={"quiet": True, "resolution": 20, "enable_backward": False},
|
|
218
|
+
)
|
|
219
|
+
add_example_test(
|
|
220
|
+
TestFemExamples,
|
|
221
|
+
name="fem.example_mixed_elasticity",
|
|
222
|
+
devices=cuda_test_devices,
|
|
223
|
+
options={"quiet": True, "nonconforming_stresses": True, "mesh": "quad", "num_frames": 1, "enable_backward": False},
|
|
224
|
+
)
|
|
225
|
+
add_example_test(
|
|
226
|
+
TestFemExamples,
|
|
227
|
+
name="fem.example_stokes_transfer",
|
|
228
|
+
devices=cuda_test_devices,
|
|
229
|
+
options={"quiet": True, "num_frames": 1, "enable_backward": False},
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
if __name__ == "__main__":
|
|
114
234
|
# force rebuild of all kernels
|
|
115
235
|
wp.build.clear_kernel_cache()
|
|
116
236
|
|
|
117
|
-
_ = register(unittest.TestCase)
|
|
118
|
-
|
|
119
237
|
unittest.main(verbosity=2, failfast=True)
|
warp/tests/test_fabricarray.py
CHANGED
|
@@ -12,7 +12,7 @@ from typing import Any
|
|
|
12
12
|
import numpy as np
|
|
13
13
|
|
|
14
14
|
import warp as wp
|
|
15
|
-
from warp.tests.
|
|
15
|
+
from warp.tests.unittest_utils import *
|
|
16
16
|
|
|
17
17
|
wp.init()
|
|
18
18
|
|
|
@@ -930,32 +930,26 @@ for T in _fabric_types:
|
|
|
930
930
|
wp.overload(fa_generic_sums_kernel_indexed, [wp.indexedfabricarrayarray(dtype=T), wp.array(dtype=T)])
|
|
931
931
|
|
|
932
932
|
|
|
933
|
-
|
|
934
|
-
devices = get_test_devices()
|
|
933
|
+
devices = get_test_devices()
|
|
935
934
|
|
|
936
|
-
class TestFabricArray(parent):
|
|
937
|
-
pass
|
|
938
935
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
add_function_test(TestFabricArray, "test_fabricarray_empty", test_fabricarray_empty, devices=devices)
|
|
942
|
-
add_function_test(
|
|
943
|
-
TestFabricArray, "test_fabricarray_generic_dtype", test_fabricarray_generic_dtype, devices=devices
|
|
944
|
-
)
|
|
945
|
-
add_function_test(
|
|
946
|
-
TestFabricArray, "test_fabricarray_generic_array", test_fabricarray_generic_array, devices=devices
|
|
947
|
-
)
|
|
948
|
-
add_function_test(TestFabricArray, "test_fabricarray_fill_scalar", test_fabricarray_fill_scalar, devices=devices)
|
|
949
|
-
add_function_test(TestFabricArray, "test_fabricarray_fill_vector", test_fabricarray_fill_vector, devices=devices)
|
|
950
|
-
add_function_test(TestFabricArray, "test_fabricarray_fill_matrix", test_fabricarray_fill_matrix, devices=devices)
|
|
936
|
+
class TestFabricArray(unittest.TestCase):
|
|
937
|
+
pass
|
|
951
938
|
|
|
952
|
-
# fabric arrays of arrays
|
|
953
|
-
add_function_test(TestFabricArray, "test_fabricarrayarray", test_fabricarrayarray, devices=devices)
|
|
954
939
|
|
|
955
|
-
|
|
940
|
+
# fabric arrays
|
|
941
|
+
add_function_test(TestFabricArray, "test_fabricarray_kernel", test_fabricarray_kernel, devices=devices)
|
|
942
|
+
add_function_test(TestFabricArray, "test_fabricarray_empty", test_fabricarray_empty, devices=devices)
|
|
943
|
+
add_function_test(TestFabricArray, "test_fabricarray_generic_dtype", test_fabricarray_generic_dtype, devices=devices)
|
|
944
|
+
add_function_test(TestFabricArray, "test_fabricarray_generic_array", test_fabricarray_generic_array, devices=devices)
|
|
945
|
+
add_function_test(TestFabricArray, "test_fabricarray_fill_scalar", test_fabricarray_fill_scalar, devices=devices)
|
|
946
|
+
add_function_test(TestFabricArray, "test_fabricarray_fill_vector", test_fabricarray_fill_vector, devices=devices)
|
|
947
|
+
add_function_test(TestFabricArray, "test_fabricarray_fill_matrix", test_fabricarray_fill_matrix, devices=devices)
|
|
948
|
+
|
|
949
|
+
# fabric arrays of arrays
|
|
950
|
+
add_function_test(TestFabricArray, "test_fabricarrayarray", test_fabricarrayarray, devices=devices)
|
|
956
951
|
|
|
957
952
|
|
|
958
953
|
if __name__ == "__main__":
|
|
959
954
|
wp.build.clear_kernel_cache()
|
|
960
|
-
_ = register(unittest.TestCase)
|
|
961
955
|
unittest.main(verbosity=2)
|
warp/tests/test_fast_math.py
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
|
|
2
|
+
# NVIDIA CORPORATION and its licensors retain all intellectual property
|
|
3
|
+
# and proprietary rights in and to this software, related documentation
|
|
4
|
+
# and any modifications thereto. Any use, reproduction, disclosure or
|
|
5
|
+
# distribution of this software and related documentation without an express
|
|
6
|
+
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
3
7
|
|
|
4
8
|
import unittest
|
|
5
9
|
|
|
6
10
|
import warp as wp
|
|
7
|
-
from warp.tests.
|
|
8
|
-
|
|
11
|
+
from warp.tests.unittest_utils import *
|
|
9
12
|
|
|
10
13
|
wp.init()
|
|
11
14
|
|
|
@@ -33,19 +36,19 @@ def test_fast_math(test, device):
|
|
|
33
36
|
with CheckOutput():
|
|
34
37
|
wp.launch(test_pow, dim=1, inputs=[-2.0, 2.0, 2.0], device=device)
|
|
35
38
|
|
|
39
|
+
# Turn fast math back off
|
|
40
|
+
wp.set_module_options({"fast_math": False})
|
|
41
|
+
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
pass
|
|
43
|
+
class TestFastMath(unittest.TestCase):
|
|
44
|
+
pass
|
|
40
45
|
|
|
41
|
-
devices = get_test_devices()
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
devices = get_test_devices()
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
add_function_test(TestFastMath, "test_fast_math", test_fast_math, devices=devices)
|
|
46
50
|
|
|
47
51
|
|
|
48
52
|
if __name__ == "__main__":
|
|
49
53
|
wp.build.clear_kernel_cache()
|
|
50
|
-
_ = register(unittest.TestCase)
|
|
51
54
|
unittest.main(verbosity=2)
|