warp-lang 1.8.1__py3-none-manylinux_2_34_aarch64.whl → 1.9.0__py3-none-manylinux_2_34_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 +282 -103
- warp/__init__.pyi +482 -110
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +93 -30
- warp/build_dll.py +47 -67
- warp/builtins.py +955 -137
- warp/codegen.py +312 -206
- warp/config.py +1 -1
- warp/context.py +1249 -784
- warp/examples/core/example_marching_cubes.py +1 -0
- warp/examples/core/example_render_opengl.py +100 -3
- warp/examples/fem/example_apic_fluid.py +98 -52
- warp/examples/fem/example_convection_diffusion_dg.py +25 -4
- warp/examples/fem/example_diffusion_mgpu.py +8 -3
- warp/examples/fem/utils.py +68 -22
- warp/fabric.py +1 -1
- warp/fem/cache.py +27 -19
- warp/fem/domain.py +2 -2
- warp/fem/field/nodal_field.py +2 -2
- warp/fem/field/virtual.py +264 -166
- warp/fem/geometry/geometry.py +5 -5
- warp/fem/integrate.py +129 -51
- warp/fem/space/restriction.py +4 -0
- warp/fem/space/shape/tet_shape_function.py +3 -10
- warp/jax_experimental/custom_call.py +1 -1
- warp/jax_experimental/ffi.py +2 -1
- warp/marching_cubes.py +708 -0
- warp/native/array.h +99 -4
- warp/native/builtin.h +82 -5
- warp/native/bvh.cpp +64 -28
- warp/native/bvh.cu +58 -58
- warp/native/bvh.h +2 -2
- warp/native/clang/clang.cpp +7 -7
- warp/native/coloring.cpp +8 -2
- warp/native/crt.cpp +2 -2
- warp/native/crt.h +3 -5
- warp/native/cuda_util.cpp +41 -10
- warp/native/cuda_util.h +10 -4
- warp/native/exports.h +1842 -1908
- warp/native/fabric.h +2 -1
- warp/native/hashgrid.cpp +37 -37
- warp/native/hashgrid.cu +2 -2
- warp/native/initializer_array.h +1 -1
- warp/native/intersect.h +2 -2
- warp/native/mat.h +1910 -116
- warp/native/mathdx.cpp +43 -43
- warp/native/mesh.cpp +24 -24
- warp/native/mesh.cu +26 -26
- warp/native/mesh.h +4 -2
- warp/native/nanovdb/GridHandle.h +179 -12
- warp/native/nanovdb/HostBuffer.h +8 -7
- warp/native/nanovdb/NanoVDB.h +517 -895
- warp/native/nanovdb/NodeManager.h +323 -0
- warp/native/nanovdb/PNanoVDB.h +2 -2
- warp/native/quat.h +331 -14
- warp/native/range.h +7 -1
- warp/native/reduce.cpp +10 -10
- warp/native/reduce.cu +13 -14
- warp/native/runlength_encode.cpp +2 -2
- warp/native/runlength_encode.cu +5 -5
- warp/native/scan.cpp +3 -3
- warp/native/scan.cu +4 -4
- warp/native/sort.cpp +10 -10
- warp/native/sort.cu +22 -22
- warp/native/sparse.cpp +8 -8
- warp/native/sparse.cu +13 -13
- warp/native/spatial.h +366 -17
- warp/native/temp_buffer.h +2 -2
- warp/native/tile.h +283 -69
- warp/native/vec.h +381 -14
- warp/native/volume.cpp +54 -54
- warp/native/volume.cu +1 -1
- warp/native/volume.h +2 -1
- warp/native/volume_builder.cu +30 -37
- warp/native/warp.cpp +150 -149
- warp/native/warp.cu +323 -192
- warp/native/warp.h +227 -226
- warp/optim/linear.py +736 -271
- warp/render/imgui_manager.py +289 -0
- warp/render/render_opengl.py +85 -6
- warp/sim/graph_coloring.py +2 -2
- warp/sparse.py +558 -175
- warp/tests/aux_test_module_aot.py +7 -0
- warp/tests/cuda/test_async.py +3 -3
- warp/tests/cuda/test_conditional_captures.py +101 -0
- warp/tests/geometry/test_marching_cubes.py +233 -12
- warp/tests/sim/test_coloring.py +6 -6
- warp/tests/test_array.py +56 -5
- warp/tests/test_codegen.py +3 -2
- warp/tests/test_context.py +8 -15
- warp/tests/test_enum.py +136 -0
- warp/tests/test_examples.py +2 -2
- warp/tests/test_fem.py +45 -2
- warp/tests/test_fixedarray.py +229 -0
- warp/tests/test_func.py +18 -15
- warp/tests/test_future_annotations.py +7 -5
- warp/tests/test_linear_solvers.py +30 -0
- warp/tests/test_map.py +1 -1
- warp/tests/test_mat.py +1518 -378
- warp/tests/test_mat_assign_copy.py +178 -0
- warp/tests/test_mat_constructors.py +574 -0
- warp/tests/test_module_aot.py +287 -0
- warp/tests/test_print.py +69 -0
- warp/tests/test_quat.py +140 -34
- warp/tests/test_quat_assign_copy.py +145 -0
- warp/tests/test_reload.py +2 -1
- warp/tests/test_sparse.py +71 -0
- warp/tests/test_spatial.py +140 -34
- warp/tests/test_spatial_assign_copy.py +160 -0
- warp/tests/test_struct.py +43 -3
- warp/tests/test_types.py +0 -20
- warp/tests/test_vec.py +179 -34
- warp/tests/test_vec_assign_copy.py +143 -0
- warp/tests/tile/test_tile.py +184 -18
- warp/tests/tile/test_tile_cholesky.py +605 -0
- warp/tests/tile/test_tile_load.py +169 -0
- warp/tests/tile/test_tile_mathdx.py +2 -558
- warp/tests/tile/test_tile_matmul.py +1 -1
- warp/tests/tile/test_tile_mlp.py +1 -1
- warp/tests/tile/test_tile_shared_memory.py +5 -5
- warp/tests/unittest_suites.py +6 -0
- warp/tests/walkthrough_debug.py +1 -1
- warp/thirdparty/unittest_parallel.py +108 -9
- warp/types.py +554 -264
- warp/utils.py +68 -86
- {warp_lang-1.8.1.dist-info → warp_lang-1.9.0.dist-info}/METADATA +28 -65
- {warp_lang-1.8.1.dist-info → warp_lang-1.9.0.dist-info}/RECORD +131 -121
- warp/native/marching.cpp +0 -19
- warp/native/marching.cu +0 -514
- warp/native/marching.h +0 -19
- {warp_lang-1.8.1.dist-info → warp_lang-1.9.0.dist-info}/WHEEL +0 -0
- {warp_lang-1.8.1.dist-info → warp_lang-1.9.0.dist-info}/licenses/LICENSE.md +0 -0
- {warp_lang-1.8.1.dist-info → warp_lang-1.9.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import unittest
|
|
17
|
+
|
|
18
|
+
import numpy as np
|
|
19
|
+
|
|
20
|
+
import warp as wp
|
|
21
|
+
from warp.tests.unittest_utils import *
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def setUpModule():
|
|
25
|
+
wp.config.enable_vector_component_overwrites = True
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def tearDownModule():
|
|
29
|
+
wp.config.enable_vector_component_overwrites = False
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@wp.kernel
|
|
33
|
+
def mat_assign_element(x: wp.array(dtype=float), y: wp.array(dtype=wp.mat22)):
|
|
34
|
+
i = wp.tid()
|
|
35
|
+
|
|
36
|
+
a = wp.mat22()
|
|
37
|
+
a[0, 0] = 1.0 * x[i]
|
|
38
|
+
a[0, 1] = 2.0 * x[i]
|
|
39
|
+
a[1, 0] = 3.0 * x[i]
|
|
40
|
+
a[1, 1] = 4.0 * x[i]
|
|
41
|
+
|
|
42
|
+
y[i] = a
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@wp.kernel
|
|
46
|
+
def mat_assign_row(x: wp.array(dtype=wp.vec2), y: wp.array(dtype=wp.mat22)):
|
|
47
|
+
i = wp.tid()
|
|
48
|
+
|
|
49
|
+
a = wp.mat22()
|
|
50
|
+
a[0] = 1.0 * x[i]
|
|
51
|
+
a[1] = 2.0 * x[i]
|
|
52
|
+
|
|
53
|
+
y[i] = a
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_mat_assign(test, device):
|
|
57
|
+
# matrix element
|
|
58
|
+
x = wp.ones(1, dtype=float, requires_grad=True, device=device)
|
|
59
|
+
y = wp.zeros(1, dtype=wp.mat22, requires_grad=True, device=device)
|
|
60
|
+
|
|
61
|
+
tape = wp.Tape()
|
|
62
|
+
with tape:
|
|
63
|
+
wp.launch(mat_assign_element, 1, inputs=[x], outputs=[y], device=device)
|
|
64
|
+
|
|
65
|
+
y.grad = wp.ones_like(y)
|
|
66
|
+
tape.backward()
|
|
67
|
+
|
|
68
|
+
assert_np_equal(y.numpy(), np.array([[[1.0, 2.0], [3.0, 4.0]]], dtype=float))
|
|
69
|
+
assert_np_equal(x.grad.numpy(), np.array([10.0], dtype=float))
|
|
70
|
+
|
|
71
|
+
# matrix row
|
|
72
|
+
x = wp.ones(1, dtype=wp.vec2, requires_grad=True, device=device)
|
|
73
|
+
y = wp.zeros(1, dtype=wp.mat22, requires_grad=True, device=device)
|
|
74
|
+
|
|
75
|
+
tape = wp.Tape()
|
|
76
|
+
with tape:
|
|
77
|
+
wp.launch(mat_assign_row, 1, inputs=[x], outputs=[y], device=device)
|
|
78
|
+
|
|
79
|
+
y.grad = wp.ones_like(y)
|
|
80
|
+
tape.backward()
|
|
81
|
+
|
|
82
|
+
assert_np_equal(y.numpy(), np.array([[[1.0, 1.0], [2.0, 2.0]]], dtype=float))
|
|
83
|
+
assert_np_equal(x.grad.numpy(), np.array([[3.0, 3.0]], dtype=float))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_matrix_assign_copy(test, device):
|
|
87
|
+
@wp.kernel(module="unique")
|
|
88
|
+
def mat_in_register_overwrite(x: wp.array2d(dtype=wp.mat22), y: wp.array(dtype=wp.vec2)):
|
|
89
|
+
i, j = wp.tid()
|
|
90
|
+
|
|
91
|
+
a = wp.mat22()
|
|
92
|
+
a[0] = y[i]
|
|
93
|
+
a[0, 1] = 3.0
|
|
94
|
+
x[i, j] = a
|
|
95
|
+
|
|
96
|
+
x = wp.zeros((1, 1), dtype=wp.mat22, device=device, requires_grad=True)
|
|
97
|
+
y = wp.ones(1, dtype=wp.vec2, device=device, requires_grad=True)
|
|
98
|
+
|
|
99
|
+
tape = wp.Tape()
|
|
100
|
+
with tape:
|
|
101
|
+
wp.launch(mat_in_register_overwrite, dim=(1, 1), inputs=[x, y], device=device)
|
|
102
|
+
|
|
103
|
+
tape.backward(grads={x: wp.ones_like(x, requires_grad=False)})
|
|
104
|
+
|
|
105
|
+
assert_np_equal(x.numpy(), np.array([[[[1.0, 3.0], [0.0, 0.0]]]], dtype=float))
|
|
106
|
+
assert_np_equal(y.grad.numpy(), np.array([[1.0, 0.0]], dtype=float))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_mat_slicing_assign_backward(test, device):
|
|
110
|
+
mat23 = wp.mat((2, 3), float)
|
|
111
|
+
|
|
112
|
+
@wp.kernel(module="unique")
|
|
113
|
+
def kernel(
|
|
114
|
+
arr_x: wp.array(dtype=wp.vec2),
|
|
115
|
+
arr_y: wp.array(dtype=mat23),
|
|
116
|
+
arr_z: wp.array(dtype=wp.mat44),
|
|
117
|
+
):
|
|
118
|
+
i = wp.tid()
|
|
119
|
+
|
|
120
|
+
z = arr_z[i]
|
|
121
|
+
|
|
122
|
+
z[0, :2] = arr_x[i]
|
|
123
|
+
z[:2, 1:] = arr_y[i]
|
|
124
|
+
|
|
125
|
+
z[:2, 3] += arr_x[i][:2]
|
|
126
|
+
z[1:-1, :2] += arr_y[i][::-1, :-1]
|
|
127
|
+
|
|
128
|
+
z[2:, 3] -= arr_x[i][0:]
|
|
129
|
+
z[3:, -1:] -= arr_y[i][:1, :1]
|
|
130
|
+
|
|
131
|
+
arr_z[i] = z
|
|
132
|
+
|
|
133
|
+
x = wp.ones(1, dtype=wp.vec2, requires_grad=True, device=device)
|
|
134
|
+
y = wp.ones(1, dtype=mat23, requires_grad=True, device=device)
|
|
135
|
+
z = wp.zeros(1, dtype=wp.mat44, requires_grad=True, device=device)
|
|
136
|
+
|
|
137
|
+
tape = wp.Tape()
|
|
138
|
+
with tape:
|
|
139
|
+
wp.launch(kernel, 1, inputs=(x, y), outputs=(z,), device=device)
|
|
140
|
+
|
|
141
|
+
z.grad = wp.ones_like(z)
|
|
142
|
+
tape.backward()
|
|
143
|
+
|
|
144
|
+
assert_np_equal(
|
|
145
|
+
z.numpy(),
|
|
146
|
+
np.array(
|
|
147
|
+
(
|
|
148
|
+
(
|
|
149
|
+
(1.0, 1.0, 1.0, 2.0),
|
|
150
|
+
(1.0, 2.0, 1.0, 2.0),
|
|
151
|
+
(1.0, 1.0, 0.0, -1.0),
|
|
152
|
+
(0.0, 0.0, 0.0, -2.0),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
dtype=float,
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
assert_np_equal(x.grad.numpy(), np.array(((1.0, 0.0),), dtype=float))
|
|
159
|
+
assert_np_equal(y.grad.numpy(), np.array((((1.0, 2.0, 1.0), (2.0, 2.0, 1.0)),), dtype=float))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
devices = get_test_devices()
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class TestMatAssignCopy(unittest.TestCase):
|
|
166
|
+
pass
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
add_function_test(TestMatAssignCopy, "test_mat_assign", test_mat_assign, devices=devices)
|
|
170
|
+
add_function_test(TestMatAssignCopy, "test_matrix_assign_copy", test_matrix_assign_copy, devices=devices)
|
|
171
|
+
add_function_test(
|
|
172
|
+
TestMatAssignCopy, "test_mat_slicing_assign_backward", test_mat_slicing_assign_backward, devices=devices
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
if __name__ == "__main__":
|
|
177
|
+
wp.clear_kernel_cache()
|
|
178
|
+
unittest.main(verbosity=2, failfast=True)
|