warp-lang 1.5.0__py3-none-manylinux2014_aarch64.whl → 1.6.0__py3-none-manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +5 -0
- warp/autograd.py +414 -191
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +40 -12
- warp/build_dll.py +13 -6
- warp/builtins.py +1124 -497
- warp/codegen.py +261 -136
- warp/config.py +1 -1
- warp/context.py +357 -119
- warp/examples/assets/square_cloth.usd +0 -0
- warp/examples/benchmarks/benchmark_gemm.py +27 -18
- warp/examples/benchmarks/benchmark_interop_paddle.py +3 -3
- warp/examples/benchmarks/benchmark_interop_torch.py +3 -3
- warp/examples/core/example_torch.py +18 -34
- warp/examples/fem/example_apic_fluid.py +1 -0
- warp/examples/fem/example_mixed_elasticity.py +1 -1
- warp/examples/optim/example_bounce.py +1 -1
- warp/examples/optim/example_cloth_throw.py +1 -1
- warp/examples/optim/example_diffray.py +4 -15
- warp/examples/optim/example_drone.py +1 -1
- warp/examples/optim/example_softbody_properties.py +392 -0
- warp/examples/optim/example_trajectory.py +1 -3
- warp/examples/optim/example_walker.py +5 -0
- warp/examples/sim/example_cartpole.py +0 -2
- warp/examples/sim/example_cloth.py +3 -1
- warp/examples/sim/example_cloth_self_contact.py +260 -0
- warp/examples/sim/example_granular_collision_sdf.py +4 -5
- warp/examples/sim/example_jacobian_ik.py +0 -2
- warp/examples/sim/example_quadruped.py +5 -2
- warp/examples/tile/example_tile_cholesky.py +79 -0
- warp/examples/tile/example_tile_convolution.py +2 -2
- warp/examples/tile/example_tile_fft.py +2 -2
- warp/examples/tile/example_tile_filtering.py +3 -3
- warp/examples/tile/example_tile_matmul.py +4 -4
- warp/examples/tile/example_tile_mlp.py +12 -12
- warp/examples/tile/example_tile_nbody.py +180 -0
- warp/examples/tile/example_tile_walker.py +319 -0
- warp/fem/geometry/geometry.py +0 -2
- warp/math.py +147 -0
- warp/native/array.h +12 -0
- warp/native/builtin.h +0 -1
- warp/native/bvh.cpp +149 -70
- warp/native/bvh.cu +287 -68
- warp/native/bvh.h +195 -85
- warp/native/clang/clang.cpp +5 -1
- warp/native/coloring.cpp +5 -1
- warp/native/cuda_util.cpp +91 -53
- warp/native/cuda_util.h +5 -0
- warp/native/exports.h +40 -40
- warp/native/intersect.h +17 -0
- warp/native/mat.h +41 -0
- warp/native/mathdx.cpp +19 -0
- warp/native/mesh.cpp +25 -8
- warp/native/mesh.cu +153 -101
- warp/native/mesh.h +482 -403
- warp/native/quat.h +40 -0
- warp/native/solid_angle.h +7 -0
- warp/native/sort.cpp +85 -0
- warp/native/sort.cu +34 -0
- warp/native/sort.h +3 -1
- warp/native/spatial.h +11 -0
- warp/native/tile.h +1187 -669
- warp/native/tile_reduce.h +8 -6
- warp/native/vec.h +41 -0
- warp/native/warp.cpp +8 -1
- warp/native/warp.cu +263 -40
- warp/native/warp.h +19 -5
- warp/optim/linear.py +22 -4
- warp/render/render_opengl.py +130 -64
- warp/sim/__init__.py +6 -1
- warp/sim/collide.py +270 -26
- warp/sim/import_urdf.py +8 -8
- warp/sim/integrator_euler.py +25 -7
- warp/sim/integrator_featherstone.py +154 -35
- warp/sim/integrator_vbd.py +842 -40
- warp/sim/model.py +134 -72
- warp/sparse.py +1 -1
- warp/stubs.py +265 -132
- warp/tape.py +28 -30
- warp/tests/aux_test_module_unload.py +15 -0
- warp/tests/{test_sim_grad.py → flaky_test_sim_grad.py} +104 -63
- warp/tests/test_array.py +74 -0
- warp/tests/test_assert.py +242 -0
- warp/tests/test_codegen.py +14 -61
- warp/tests/test_collision.py +2 -2
- warp/tests/test_coloring.py +12 -2
- warp/tests/test_examples.py +12 -1
- warp/tests/test_func.py +21 -4
- warp/tests/test_grad_debug.py +87 -2
- warp/tests/test_hash_grid.py +1 -1
- warp/tests/test_ipc.py +116 -0
- warp/tests/test_lerp.py +13 -87
- warp/tests/test_mat.py +138 -167
- warp/tests/test_math.py +47 -1
- warp/tests/test_matmul.py +17 -16
- warp/tests/test_matmul_lite.py +10 -15
- warp/tests/test_mesh.py +84 -60
- warp/tests/test_mesh_query_aabb.py +165 -0
- warp/tests/test_mesh_query_point.py +328 -286
- warp/tests/test_mesh_query_ray.py +134 -121
- warp/tests/test_mlp.py +2 -2
- warp/tests/test_operators.py +43 -0
- warp/tests/test_overwrite.py +47 -2
- warp/tests/test_quat.py +77 -0
- warp/tests/test_reload.py +29 -0
- warp/tests/test_sim_grad_bounce_linear.py +204 -0
- warp/tests/test_smoothstep.py +17 -83
- warp/tests/test_static.py +19 -3
- warp/tests/test_tape.py +25 -0
- warp/tests/test_tile.py +178 -191
- warp/tests/test_tile_load.py +356 -0
- warp/tests/test_tile_mathdx.py +61 -8
- warp/tests/test_tile_mlp.py +17 -17
- warp/tests/test_tile_reduce.py +24 -18
- warp/tests/test_tile_shared_memory.py +66 -17
- warp/tests/test_tile_view.py +165 -0
- warp/tests/test_torch.py +35 -0
- warp/tests/test_utils.py +36 -24
- warp/tests/test_vec.py +110 -0
- warp/tests/unittest_suites.py +29 -4
- warp/tests/unittest_utils.py +30 -13
- warp/thirdparty/unittest_parallel.py +2 -2
- warp/types.py +411 -101
- warp/utils.py +10 -7
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/METADATA +92 -69
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/RECORD +130 -119
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/WHEEL +1 -1
- warp/examples/benchmarks/benchmark_tile.py +0 -179
- warp/native/tile_gemm.h +0 -341
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/top_level.txt +0 -0
warp/tests/test_ipc.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Copyright (c) 2024 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
|
+
|
|
8
|
+
import multiprocessing as mp
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
import warp as wp
|
|
12
|
+
from warp.tests.unittest_utils import *
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_ipc_get_memory_handle(test, device):
|
|
16
|
+
if device.is_ipc_supported is False:
|
|
17
|
+
test.skipTest(f"IPC is not supported on {device}")
|
|
18
|
+
|
|
19
|
+
with wp.ScopedMempool(device, False):
|
|
20
|
+
test_array = wp.full(10, value=42.0, dtype=wp.float32, device=device)
|
|
21
|
+
ipc_handle = test_array.ipc_handle()
|
|
22
|
+
|
|
23
|
+
test.assertNotEqual(ipc_handle, bytes(64), "IPC memory handle appears to be invalid")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_ipc_get_event_handle(test, device):
|
|
27
|
+
if device.is_ipc_supported is False:
|
|
28
|
+
test.skipTest(f"IPC is not supported on {device}")
|
|
29
|
+
|
|
30
|
+
e1 = wp.Event(device, interprocess=True)
|
|
31
|
+
|
|
32
|
+
ipc_handle = e1.ipc_handle()
|
|
33
|
+
|
|
34
|
+
test.assertNotEqual(ipc_handle, bytes(64), "IPC event handle appears to be invalid")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_ipc_event_missing_interprocess_flag(test, device):
|
|
38
|
+
if device.is_ipc_supported is False:
|
|
39
|
+
test.skipTest(f"IPC is not supported on {device}")
|
|
40
|
+
|
|
41
|
+
e1 = wp.Event(device, interprocess=False)
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
capture = StdOutCapture()
|
|
45
|
+
capture.begin()
|
|
46
|
+
ipc_handle = e1.ipc_handle()
|
|
47
|
+
finally:
|
|
48
|
+
output = capture.end()
|
|
49
|
+
|
|
50
|
+
# Older Windows C runtimes have a bug where stdout sometimes does not get properly flushed.
|
|
51
|
+
if sys.platform != "win32":
|
|
52
|
+
test.assertRegex(output, r"Warp UserWarning: IPC event handle appears to be invalid.")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@wp.kernel
|
|
56
|
+
def multiply_by_two(a: wp.array(dtype=wp.float32)):
|
|
57
|
+
i = wp.tid()
|
|
58
|
+
a[i] = 2.0 * a[i]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def child_task(array_handle, dtype, shape, device, event_handle):
|
|
62
|
+
with wp.ScopedDevice(device):
|
|
63
|
+
ipc_array = wp.from_ipc_handle(array_handle, dtype, shape, device=device)
|
|
64
|
+
ipc_event = wp.event_from_ipc_handle(event_handle, device=device)
|
|
65
|
+
stream = wp.get_stream()
|
|
66
|
+
wp.launch(multiply_by_two, ipc_array.shape, inputs=[ipc_array])
|
|
67
|
+
stream.record_event(ipc_event)
|
|
68
|
+
stream.wait_event(ipc_event)
|
|
69
|
+
wp.synchronize_device()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_ipc_multiprocess_write(test, device):
|
|
73
|
+
if device.is_ipc_supported is False:
|
|
74
|
+
test.skipTest(f"IPC is not supported on {device}")
|
|
75
|
+
|
|
76
|
+
stream = wp.get_stream(device)
|
|
77
|
+
e1 = wp.Event(device, interprocess=True)
|
|
78
|
+
|
|
79
|
+
with wp.ScopedMempool(device, False):
|
|
80
|
+
test_array = wp.full(1024, value=42.0, dtype=wp.float32, device=device)
|
|
81
|
+
ipc_handle = test_array.ipc_handle()
|
|
82
|
+
|
|
83
|
+
wp.launch(multiply_by_two, test_array.shape, inputs=[test_array], device=device)
|
|
84
|
+
|
|
85
|
+
ctx = mp.get_context("spawn")
|
|
86
|
+
|
|
87
|
+
process = ctx.Process(
|
|
88
|
+
target=child_task, args=(ipc_handle, test_array.dtype, test_array.shape, str(device), e1.ipc_handle())
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
process.start()
|
|
92
|
+
process.join()
|
|
93
|
+
|
|
94
|
+
assert_np_equal(test_array.numpy(), np.full(test_array.shape, 168.0, dtype=np.float32))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
cuda_devices = get_cuda_test_devices()
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class TestIpc(unittest.TestCase):
|
|
101
|
+
pass
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
add_function_test(TestIpc, "test_ipc_get_memory_handle", test_ipc_get_memory_handle, devices=cuda_devices)
|
|
105
|
+
add_function_test(TestIpc, "test_ipc_get_event_handle", test_ipc_get_event_handle, devices=cuda_devices)
|
|
106
|
+
add_function_test(
|
|
107
|
+
TestIpc, "test_ipc_event_missing_interprocess_flag", test_ipc_event_missing_interprocess_flag, devices=cuda_devices
|
|
108
|
+
)
|
|
109
|
+
add_function_test(
|
|
110
|
+
TestIpc, "test_ipc_multiprocess_write", test_ipc_multiprocess_write, devices=cuda_devices, check_output=False
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
wp.clear_kernel_cache()
|
|
116
|
+
unittest.main(verbosity=2)
|
warp/tests/test_lerp.py
CHANGED
|
@@ -31,66 +31,14 @@ class TestData:
|
|
|
31
31
|
|
|
32
32
|
TEST_DATA = {
|
|
33
33
|
wp.float32: (
|
|
34
|
-
TestData(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
t=0.75,
|
|
38
|
-
expected=4.0,
|
|
39
|
-
expected_adj_a=0.25,
|
|
40
|
-
expected_adj_b=0.75,
|
|
41
|
-
expected_adj_t=4.0,
|
|
42
|
-
),
|
|
43
|
-
TestData(
|
|
44
|
-
a=-2.0,
|
|
45
|
-
b=5.0,
|
|
46
|
-
t=0.25,
|
|
47
|
-
expected=-0.25,
|
|
48
|
-
expected_adj_a=0.75,
|
|
49
|
-
expected_adj_b=0.25,
|
|
50
|
-
expected_adj_t=7.0,
|
|
51
|
-
),
|
|
52
|
-
TestData(
|
|
53
|
-
a=1.23,
|
|
54
|
-
b=2.34,
|
|
55
|
-
t=0.5,
|
|
56
|
-
expected=1.785,
|
|
57
|
-
expected_adj_a=0.5,
|
|
58
|
-
expected_adj_b=0.5,
|
|
59
|
-
expected_adj_t=1.11,
|
|
60
|
-
),
|
|
61
|
-
),
|
|
62
|
-
wp.vec2: (
|
|
63
|
-
TestData(
|
|
64
|
-
a=[1, 2],
|
|
65
|
-
b=[3, 4],
|
|
66
|
-
t=0.5,
|
|
67
|
-
expected=[2, 3],
|
|
68
|
-
),
|
|
69
|
-
),
|
|
70
|
-
wp.vec3: (
|
|
71
|
-
TestData(
|
|
72
|
-
a=[1, 2, 3],
|
|
73
|
-
b=[3, 4, 5],
|
|
74
|
-
t=0.5,
|
|
75
|
-
expected=[2, 3, 4],
|
|
76
|
-
),
|
|
77
|
-
),
|
|
78
|
-
wp.vec4: (
|
|
79
|
-
TestData(
|
|
80
|
-
a=[1, 2, 3, 4],
|
|
81
|
-
b=[3, 4, 5, 6],
|
|
82
|
-
t=0.5,
|
|
83
|
-
expected=[2, 3, 4, 5],
|
|
84
|
-
),
|
|
85
|
-
),
|
|
86
|
-
wp.mat22: (
|
|
87
|
-
TestData(
|
|
88
|
-
a=[[1, 2], [2, 1]],
|
|
89
|
-
b=[[3, 4], [4, 3]],
|
|
90
|
-
t=0.5,
|
|
91
|
-
expected=[[2, 3], [3, 2]],
|
|
92
|
-
),
|
|
34
|
+
TestData(a=1.0, b=5.0, t=0.75, expected=4.0, expected_adj_a=0.25, expected_adj_b=0.75, expected_adj_t=4.0),
|
|
35
|
+
TestData(a=-2.0, b=5.0, t=0.25, expected=-0.25, expected_adj_a=0.75, expected_adj_b=0.25, expected_adj_t=7.0),
|
|
36
|
+
TestData(a=1.23, b=2.34, t=0.5, expected=1.785, expected_adj_a=0.5, expected_adj_b=0.5, expected_adj_t=1.11),
|
|
93
37
|
),
|
|
38
|
+
wp.vec2: (TestData(a=[1, 2], b=[3, 4], t=0.5, expected=[2, 3]),),
|
|
39
|
+
wp.vec3: (TestData(a=[1, 2, 3], b=[3, 4, 5], t=0.5, expected=[2, 3, 4]),),
|
|
40
|
+
wp.vec4: (TestData(a=[1, 2, 3, 4], b=[3, 4, 5, 6], t=0.5, expected=[2, 3, 4, 5]),),
|
|
41
|
+
wp.mat22: (TestData(a=[[1, 2], [2, 1]], b=[[3, 4], [4, 3]], t=0.5, expected=[[2, 3], [3, 2]]),),
|
|
94
42
|
wp.mat33: (
|
|
95
43
|
TestData(
|
|
96
44
|
a=[[1, 2, 3], [3, 1, 2], [2, 3, 1]],
|
|
@@ -107,30 +55,9 @@ TEST_DATA = {
|
|
|
107
55
|
expected=[[2, 3, 4, 5], [5, 2, 3, 4], [4, 5, 2, 3], [3, 4, 5, 2]],
|
|
108
56
|
),
|
|
109
57
|
),
|
|
110
|
-
wp.quat: (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
b=[3, 4, 5, 6],
|
|
114
|
-
t=0.5,
|
|
115
|
-
expected=[2, 3, 4, 5],
|
|
116
|
-
),
|
|
117
|
-
),
|
|
118
|
-
wp.transform: (
|
|
119
|
-
TestData(
|
|
120
|
-
a=[1, 2, 3, 4, 5, 6, 7],
|
|
121
|
-
b=[3, 4, 5, 6, 7, 8, 9],
|
|
122
|
-
t=0.5,
|
|
123
|
-
expected=[2, 3, 4, 5, 6, 7, 8],
|
|
124
|
-
),
|
|
125
|
-
),
|
|
126
|
-
wp.spatial_vector: (
|
|
127
|
-
TestData(
|
|
128
|
-
a=[1, 2, 3, 4, 5, 6],
|
|
129
|
-
b=[3, 4, 5, 6, 7, 8],
|
|
130
|
-
t=0.5,
|
|
131
|
-
expected=[2, 3, 4, 5, 6, 7],
|
|
132
|
-
),
|
|
133
|
-
),
|
|
58
|
+
wp.quat: (TestData(a=[1, 2, 3, 4], b=[3, 4, 5, 6], t=0.5, expected=[2, 3, 4, 5]),),
|
|
59
|
+
wp.transform: (TestData(a=[1, 2, 3, 4, 5, 6, 7], b=[3, 4, 5, 6, 7, 8, 9], t=0.5, expected=[2, 3, 4, 5, 6, 7, 8]),),
|
|
60
|
+
wp.spatial_vector: (TestData(a=[1, 2, 3, 4, 5, 6], b=[3, 4, 5, 6, 7, 8], t=0.5, expected=[2, 3, 4, 5, 6, 7]),),
|
|
134
61
|
wp.spatial_matrix: (
|
|
135
62
|
TestData(
|
|
136
63
|
a=[
|
|
@@ -175,12 +102,12 @@ def test_lerp(test, device):
|
|
|
175
102
|
|
|
176
103
|
return fn
|
|
177
104
|
|
|
178
|
-
for data_type in TEST_DATA:
|
|
105
|
+
for data_type, test_data_set in TEST_DATA.items():
|
|
179
106
|
kernel_fn = make_kernel_fn(data_type)
|
|
180
107
|
kernel = wp.Kernel(func=kernel_fn, key=f"test_lerp_{data_type.__name__}_kernel")
|
|
181
108
|
|
|
182
109
|
with test.subTest(data_type=data_type):
|
|
183
|
-
for test_data in
|
|
110
|
+
for test_data in test_data_set:
|
|
184
111
|
a = wp.array([test_data.a], dtype=data_type, device=device, requires_grad=True)
|
|
185
112
|
b = wp.array([test_data.b], dtype=data_type, device=device, requires_grad=True)
|
|
186
113
|
t = wp.array([test_data.t], dtype=float, device=device, requires_grad=True)
|
|
@@ -188,8 +115,7 @@ def test_lerp(test, device):
|
|
|
188
115
|
[0] * wp.types.type_length(data_type), dtype=data_type, device=device, requires_grad=True
|
|
189
116
|
)
|
|
190
117
|
|
|
191
|
-
|
|
192
|
-
with tape:
|
|
118
|
+
with wp.Tape() as tape:
|
|
193
119
|
wp.launch(kernel, dim=1, inputs=[a, b, t, out], device=device)
|
|
194
120
|
|
|
195
121
|
assert_np_equal(out.numpy(), np.array([test_data.expected]), tol=1e-6)
|