warp-lang 1.4.1__py3-none-manylinux2014_aarch64.whl → 1.5.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 +4 -0
- warp/autograd.py +43 -8
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +21 -2
- warp/build_dll.py +23 -6
- warp/builtins.py +1920 -111
- warp/codegen.py +186 -62
- warp/config.py +2 -2
- warp/context.py +322 -73
- warp/examples/assets/pixel.jpg +0 -0
- warp/examples/benchmarks/benchmark_cloth_paddle.py +86 -0
- warp/examples/benchmarks/benchmark_gemm.py +121 -0
- warp/examples/benchmarks/benchmark_interop_paddle.py +158 -0
- warp/examples/benchmarks/benchmark_tile.py +179 -0
- warp/examples/core/example_dem.py +2 -1
- warp/examples/core/example_mesh_intersect.py +3 -3
- warp/examples/fem/example_adaptive_grid.py +37 -10
- warp/examples/fem/example_apic_fluid.py +3 -2
- warp/examples/fem/example_convection_diffusion_dg.py +4 -5
- warp/examples/fem/example_deformed_geometry.py +1 -1
- warp/examples/fem/example_diffusion_3d.py +47 -4
- warp/examples/fem/example_distortion_energy.py +220 -0
- warp/examples/fem/example_magnetostatics.py +127 -85
- warp/examples/fem/example_nonconforming_contact.py +5 -5
- warp/examples/fem/example_stokes.py +3 -1
- warp/examples/fem/example_streamlines.py +12 -19
- warp/examples/fem/utils.py +38 -15
- warp/examples/optim/example_walker.py +2 -2
- warp/examples/sim/example_cloth.py +2 -25
- warp/examples/sim/example_jacobian_ik.py +6 -2
- warp/examples/sim/example_quadruped.py +2 -1
- warp/examples/tile/example_tile_convolution.py +58 -0
- warp/examples/tile/example_tile_fft.py +47 -0
- warp/examples/tile/example_tile_filtering.py +105 -0
- warp/examples/tile/example_tile_matmul.py +79 -0
- warp/examples/tile/example_tile_mlp.py +375 -0
- warp/fem/__init__.py +8 -0
- warp/fem/cache.py +16 -12
- warp/fem/dirichlet.py +1 -1
- warp/fem/domain.py +44 -1
- warp/fem/field/__init__.py +1 -2
- warp/fem/field/field.py +31 -19
- warp/fem/field/nodal_field.py +101 -49
- warp/fem/field/virtual.py +794 -0
- warp/fem/geometry/__init__.py +2 -2
- warp/fem/geometry/deformed_geometry.py +3 -105
- warp/fem/geometry/element.py +13 -0
- warp/fem/geometry/geometry.py +165 -5
- warp/fem/geometry/grid_2d.py +3 -6
- warp/fem/geometry/grid_3d.py +31 -28
- warp/fem/geometry/hexmesh.py +3 -46
- warp/fem/geometry/nanogrid.py +3 -2
- warp/fem/geometry/{quadmesh_2d.py → quadmesh.py} +280 -159
- warp/fem/geometry/tetmesh.py +2 -43
- warp/fem/geometry/{trimesh_2d.py → trimesh.py} +354 -186
- warp/fem/integrate.py +683 -261
- warp/fem/linalg.py +404 -0
- warp/fem/operator.py +101 -18
- warp/fem/polynomial.py +5 -5
- warp/fem/quadrature/quadrature.py +45 -21
- warp/fem/space/__init__.py +45 -11
- warp/fem/space/basis_function_space.py +451 -0
- warp/fem/space/basis_space.py +58 -11
- warp/fem/space/function_space.py +146 -5
- warp/fem/space/grid_2d_function_space.py +80 -66
- warp/fem/space/grid_3d_function_space.py +113 -68
- warp/fem/space/hexmesh_function_space.py +96 -108
- warp/fem/space/nanogrid_function_space.py +62 -110
- warp/fem/space/quadmesh_function_space.py +208 -0
- warp/fem/space/shape/__init__.py +45 -7
- warp/fem/space/shape/cube_shape_function.py +328 -54
- warp/fem/space/shape/shape_function.py +10 -1
- warp/fem/space/shape/square_shape_function.py +328 -60
- warp/fem/space/shape/tet_shape_function.py +269 -19
- warp/fem/space/shape/triangle_shape_function.py +238 -19
- warp/fem/space/tetmesh_function_space.py +69 -37
- warp/fem/space/topology.py +38 -0
- warp/fem/space/trimesh_function_space.py +179 -0
- warp/fem/utils.py +6 -331
- warp/jax_experimental.py +3 -1
- warp/native/array.h +55 -40
- warp/native/builtin.h +124 -43
- warp/native/bvh.h +4 -0
- warp/native/coloring.cpp +600 -0
- warp/native/cuda_util.cpp +14 -0
- warp/native/cuda_util.h +2 -1
- warp/native/fabric.h +8 -0
- warp/native/hashgrid.h +4 -0
- warp/native/marching.cu +8 -0
- warp/native/mat.h +14 -3
- warp/native/mathdx.cpp +59 -0
- warp/native/mesh.h +4 -0
- warp/native/range.h +13 -1
- warp/native/reduce.cpp +9 -1
- warp/native/reduce.cu +7 -0
- warp/native/runlength_encode.cpp +9 -1
- warp/native/runlength_encode.cu +7 -1
- warp/native/scan.cpp +8 -0
- warp/native/scan.cu +8 -0
- warp/native/scan.h +8 -1
- warp/native/sparse.cpp +8 -0
- warp/native/sparse.cu +8 -0
- warp/native/temp_buffer.h +7 -0
- warp/native/tile.h +1857 -0
- warp/native/tile_gemm.h +341 -0
- warp/native/tile_reduce.h +210 -0
- warp/native/volume_builder.cu +8 -0
- warp/native/volume_builder.h +8 -0
- warp/native/warp.cpp +10 -2
- warp/native/warp.cu +369 -15
- warp/native/warp.h +12 -2
- warp/optim/adam.py +39 -4
- warp/paddle.py +29 -12
- warp/render/render_opengl.py +137 -65
- warp/sim/graph_coloring.py +292 -0
- warp/sim/integrator_euler.py +4 -2
- warp/sim/integrator_featherstone.py +115 -44
- warp/sim/integrator_vbd.py +6 -0
- warp/sim/model.py +90 -17
- warp/stubs.py +651 -85
- warp/tape.py +12 -7
- warp/tests/assets/pixel.npy +0 -0
- warp/tests/aux_test_instancing_gc.py +18 -0
- warp/tests/test_array.py +207 -48
- warp/tests/test_closest_point_edge_edge.py +8 -8
- warp/tests/test_codegen.py +120 -1
- warp/tests/test_codegen_instancing.py +30 -0
- warp/tests/test_collision.py +110 -0
- warp/tests/test_coloring.py +241 -0
- warp/tests/test_context.py +34 -0
- warp/tests/test_examples.py +18 -4
- warp/tests/test_fabricarray.py +33 -0
- warp/tests/test_fem.py +453 -113
- warp/tests/test_func.py +48 -1
- warp/tests/test_generics.py +52 -0
- warp/tests/test_iter.py +68 -0
- warp/tests/test_mat_scalar_ops.py +1 -1
- warp/tests/test_mesh_query_point.py +5 -4
- warp/tests/test_module_hashing.py +23 -0
- warp/tests/test_paddle.py +27 -87
- warp/tests/test_print.py +191 -1
- warp/tests/test_spatial.py +1 -1
- warp/tests/test_tile.py +700 -0
- warp/tests/test_tile_mathdx.py +144 -0
- warp/tests/test_tile_mlp.py +383 -0
- warp/tests/test_tile_reduce.py +374 -0
- warp/tests/test_tile_shared_memory.py +190 -0
- warp/tests/test_vbd.py +12 -20
- warp/tests/test_volume.py +43 -0
- warp/tests/unittest_suites.py +23 -2
- warp/tests/unittest_utils.py +4 -0
- warp/types.py +339 -73
- warp/utils.py +22 -1
- {warp_lang-1.4.1.dist-info → warp_lang-1.5.0.dist-info}/METADATA +33 -7
- {warp_lang-1.4.1.dist-info → warp_lang-1.5.0.dist-info}/RECORD +159 -132
- {warp_lang-1.4.1.dist-info → warp_lang-1.5.0.dist-info}/WHEEL +1 -1
- warp/fem/field/test.py +0 -180
- warp/fem/field/trial.py +0 -183
- warp/fem/space/collocated_function_space.py +0 -102
- warp/fem/space/quadmesh_2d_function_space.py +0 -261
- warp/fem/space/trimesh_2d_function_space.py +0 -153
- {warp_lang-1.4.1.dist-info → warp_lang-1.5.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.4.1.dist-info → warp_lang-1.5.0.dist-info}/top_level.txt +0 -0
warp/tests/test_print.py
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import sys
|
|
9
9
|
import unittest
|
|
10
|
+
from typing import Any
|
|
10
11
|
|
|
11
12
|
import warp as wp
|
|
12
13
|
from warp.tests.unittest_utils import *
|
|
@@ -16,8 +17,22 @@ from warp.tests.unittest_utils import *
|
|
|
16
17
|
def test_print_kernel():
|
|
17
18
|
wp.print(1.0)
|
|
18
19
|
wp.print("this is a string")
|
|
20
|
+
wp.printf("this is another string\n")
|
|
19
21
|
wp.printf("this is a float %f\n", 457.5)
|
|
20
22
|
wp.printf("this is an int %d\n", 123)
|
|
23
|
+
# fmt: off
|
|
24
|
+
wp.printf(
|
|
25
|
+
"0=%d, 1=%d, 2=%d, 3=%d, 4=%d, 5=%d, 6=%d, 7=%d, "
|
|
26
|
+
"8=%d, 9=%d, 10=%d, 11=%d, 12=%d, 13=%d, 14=%d, 15=%d, "
|
|
27
|
+
"16=%d, 17=%d, 18=%d, 19=%d, 20=%d, 21=%d, 22=%d, 23=%d, "
|
|
28
|
+
"24=%d, 25=%d, 26=%d, 27=%d, 28=%d, 29=%d, 30=%d, 31=%d"
|
|
29
|
+
"\n",
|
|
30
|
+
0, 1, 2, 3, 4, 5, 6, 7,
|
|
31
|
+
8, 9, 10, 11, 12, 13, 14, 15,
|
|
32
|
+
16, 17, 18, 19, 20, 21, 22, 23,
|
|
33
|
+
24, 25, 26, 27, 28, 29, 30, 31,
|
|
34
|
+
)
|
|
35
|
+
# fmt: on
|
|
21
36
|
|
|
22
37
|
|
|
23
38
|
@wp.kernel
|
|
@@ -58,8 +73,13 @@ def test_print(test, device):
|
|
|
58
73
|
s,
|
|
59
74
|
rf"1{os.linesep}"
|
|
60
75
|
rf"this is a string{os.linesep}"
|
|
76
|
+
rf"this is another string{os.linesep}"
|
|
61
77
|
rf"this is a float 457\.500000{os.linesep}"
|
|
62
|
-
rf"this is an int 123"
|
|
78
|
+
rf"this is an int 123{os.linesep}"
|
|
79
|
+
rf"0=0, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, "
|
|
80
|
+
rf"8=8, 9=9, 10=10, 11=11, 12=12, 13=13, 14=14, 15=15, "
|
|
81
|
+
rf"16=16, 17=17, 18=18, 19=19, 20=20, 21=21, 22=22, 23=23, "
|
|
82
|
+
rf"24=24, 25=25, 26=26, 27=27, 28=28, 29=29, 30=30, 31=31{os.linesep}",
|
|
63
83
|
)
|
|
64
84
|
|
|
65
85
|
|
|
@@ -126,6 +146,168 @@ def test_print_boolean(test, device):
|
|
|
126
146
|
test.assertRegex(s, rf"True{os.linesep}False{os.linesep}")
|
|
127
147
|
|
|
128
148
|
|
|
149
|
+
@wp.kernel
|
|
150
|
+
def generic_print_kernel(x: Any):
|
|
151
|
+
print(x)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@wp.struct
|
|
155
|
+
class SimpleStruct:
|
|
156
|
+
x: float
|
|
157
|
+
y: float
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
generic_print_types = [*wp.types.scalar_types]
|
|
161
|
+
for scalar_type in wp.types.scalar_types:
|
|
162
|
+
generic_print_types.append(wp.types.vector(2, scalar_type))
|
|
163
|
+
generic_print_types.append(wp.types.vector(3, scalar_type))
|
|
164
|
+
generic_print_types.append(wp.types.vector(4, scalar_type))
|
|
165
|
+
generic_print_types.append(wp.types.matrix((2, 2), scalar_type))
|
|
166
|
+
generic_print_types.append(wp.types.matrix((3, 3), scalar_type))
|
|
167
|
+
generic_print_types.append(wp.types.matrix((4, 4), scalar_type))
|
|
168
|
+
generic_print_types.append(wp.bool)
|
|
169
|
+
generic_print_types.append(SimpleStruct)
|
|
170
|
+
generic_print_types.append(wp.array(dtype=float))
|
|
171
|
+
|
|
172
|
+
for T in generic_print_types:
|
|
173
|
+
wp.overload(generic_print_kernel, [T])
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def test_print_adjoint(test, device):
|
|
177
|
+
for scalar_type in wp.types.scalar_types:
|
|
178
|
+
# scalar
|
|
179
|
+
capture = StdOutCapture()
|
|
180
|
+
capture.begin()
|
|
181
|
+
wp.launch(
|
|
182
|
+
generic_print_kernel,
|
|
183
|
+
dim=1,
|
|
184
|
+
inputs=[scalar_type(17)],
|
|
185
|
+
adj_inputs=[scalar_type(42)],
|
|
186
|
+
adjoint=True,
|
|
187
|
+
device=device,
|
|
188
|
+
)
|
|
189
|
+
wp.synchronize_device(device)
|
|
190
|
+
s = capture.end()
|
|
191
|
+
|
|
192
|
+
# We skip the win32 comparison for now since the capture sometimes is an empty string
|
|
193
|
+
if sys.platform != "win32":
|
|
194
|
+
test.assertRegex(s, rf"17{os.linesep}adj: 42{os.linesep}")
|
|
195
|
+
|
|
196
|
+
for dim in (2, 3, 4):
|
|
197
|
+
# vector
|
|
198
|
+
vec_type = wp.types.vector(dim, scalar_type)
|
|
199
|
+
vec_data = np.arange(vec_type._length_, dtype=wp.dtype_to_numpy(scalar_type))
|
|
200
|
+
v = vec_type(vec_data)
|
|
201
|
+
adj_v = vec_type(vec_data[::-1])
|
|
202
|
+
|
|
203
|
+
capture = StdOutCapture()
|
|
204
|
+
capture.begin()
|
|
205
|
+
wp.launch(generic_print_kernel, dim=1, inputs=[v], adj_inputs=[adj_v], adjoint=True, device=device)
|
|
206
|
+
wp.synchronize_device(device)
|
|
207
|
+
s = capture.end()
|
|
208
|
+
|
|
209
|
+
# We skip the win32 comparison for now since the capture sometimes is an empty string
|
|
210
|
+
if sys.platform != "win32":
|
|
211
|
+
expected_forward = " ".join(str(int(x)) for x in v) + " "
|
|
212
|
+
expected_adjoint = " ".join(str(int(x)) for x in adj_v)
|
|
213
|
+
test.assertRegex(s, rf"{expected_forward}{os.linesep}adj: {expected_adjoint}{os.linesep}")
|
|
214
|
+
|
|
215
|
+
# matrix
|
|
216
|
+
mat_type = wp.types.matrix((dim, dim), scalar_type)
|
|
217
|
+
mat_data = np.arange(mat_type._length_, dtype=wp.dtype_to_numpy(scalar_type))
|
|
218
|
+
m = mat_type(mat_data)
|
|
219
|
+
adj_m = mat_type(mat_data[::-1])
|
|
220
|
+
|
|
221
|
+
capture = StdOutCapture()
|
|
222
|
+
capture.begin()
|
|
223
|
+
wp.launch(generic_print_kernel, dim=1, inputs=[m], adj_inputs=[adj_m], adjoint=True, device=device)
|
|
224
|
+
wp.synchronize_device(device)
|
|
225
|
+
s = capture.end()
|
|
226
|
+
|
|
227
|
+
# We skip the win32 comparison for now since the capture sometimes is an empty string
|
|
228
|
+
if sys.platform != "win32":
|
|
229
|
+
expected_forward = ""
|
|
230
|
+
expected_adjoint = ""
|
|
231
|
+
for row in range(dim):
|
|
232
|
+
if row == 0:
|
|
233
|
+
adj_prefix = "adj: "
|
|
234
|
+
else:
|
|
235
|
+
adj_prefix = " "
|
|
236
|
+
expected_forward += " ".join(str(int(x)) for x in m[row]) + f" {os.linesep}"
|
|
237
|
+
expected_adjoint += adj_prefix + " ".join(str(int(x)) for x in adj_m[row]) + f"{os.linesep}"
|
|
238
|
+
test.assertRegex(s, rf"{expected_forward}{expected_adjoint}")
|
|
239
|
+
|
|
240
|
+
# Booleans
|
|
241
|
+
capture = StdOutCapture()
|
|
242
|
+
capture.begin()
|
|
243
|
+
wp.launch(generic_print_kernel, dim=1, inputs=[True], adj_inputs=[False], adjoint=True, device=device)
|
|
244
|
+
wp.synchronize_device(device)
|
|
245
|
+
s = capture.end()
|
|
246
|
+
|
|
247
|
+
# We skip the win32 comparison for now since the capture sometimes is an empty string
|
|
248
|
+
if sys.platform != "win32":
|
|
249
|
+
test.assertRegex(s, rf"True{os.linesep}adj: False{os.linesep}")
|
|
250
|
+
|
|
251
|
+
# structs, not printable yet
|
|
252
|
+
capture = StdOutCapture()
|
|
253
|
+
capture.begin()
|
|
254
|
+
wp.launch(
|
|
255
|
+
generic_print_kernel, dim=1, inputs=[SimpleStruct()], adj_inputs=[SimpleStruct()], adjoint=True, device=device
|
|
256
|
+
)
|
|
257
|
+
wp.synchronize_device(device)
|
|
258
|
+
s = capture.end()
|
|
259
|
+
|
|
260
|
+
# We skip the win32 comparison for now since the capture sometimes is an empty string
|
|
261
|
+
if sys.platform != "win32":
|
|
262
|
+
test.assertRegex(
|
|
263
|
+
s, rf"<type without print implementation>{os.linesep}adj: <type without print implementation>{os.linesep}"
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
# arrays, not printable
|
|
267
|
+
capture = StdOutCapture()
|
|
268
|
+
capture.begin()
|
|
269
|
+
a = wp.ones(10, dtype=float, device=device)
|
|
270
|
+
adj_a = wp.zeros(10, dtype=float, device=device)
|
|
271
|
+
wp.launch(generic_print_kernel, dim=1, inputs=[a], adj_inputs=[adj_a], adjoint=True, device=device)
|
|
272
|
+
wp.synchronize_device(device)
|
|
273
|
+
s = capture.end()
|
|
274
|
+
|
|
275
|
+
# We skip the win32 comparison for now since the capture sometimes is an empty string
|
|
276
|
+
if sys.platform != "win32":
|
|
277
|
+
test.assertRegex(
|
|
278
|
+
s, rf"<type without print implementation>{os.linesep}adj: <type without print implementation>{os.linesep}"
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def test_print_error_variadic_arg_count(test, device):
|
|
283
|
+
@wp.kernel
|
|
284
|
+
def kernel():
|
|
285
|
+
# fmt: off
|
|
286
|
+
wp.printf(
|
|
287
|
+
"0=%d, 1=%d, 2=%d, 3=%d, 4=%d, 5=%d, 6=%d, 7=%d, "
|
|
288
|
+
"8=%d, 9=%d, 10=%d, 11=%d, 12=%d, 13=%d, 14=%d, 15=%d, "
|
|
289
|
+
"16=%d, 17=%d, 18=%d, 19=%d, 20=%d, 21=%d, 22=%d, 23=%d, "
|
|
290
|
+
"24=%d, 25=%d, 26=%d, 27=%d, 28=%d, 29=%d, 30=%d, 31=%d, "
|
|
291
|
+
"32=%d\n",
|
|
292
|
+
0, 1, 2, 3, 4, 5, 6, 7,
|
|
293
|
+
8, 9, 10, 11, 12, 13, 14, 15,
|
|
294
|
+
16, 17, 18, 19, 20, 21, 22, 23,
|
|
295
|
+
24, 25, 26, 27, 28, 29, 30, 31,
|
|
296
|
+
32,
|
|
297
|
+
)
|
|
298
|
+
# fmt: on
|
|
299
|
+
|
|
300
|
+
with test.assertRaisesRegex(
|
|
301
|
+
RuntimeError,
|
|
302
|
+
r"the maximum number of variadic arguments that can be passed to `printf` is 32$",
|
|
303
|
+
):
|
|
304
|
+
wp.launch(
|
|
305
|
+
kernel,
|
|
306
|
+
dim=1,
|
|
307
|
+
device=device,
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
|
|
129
311
|
class TestPrint(unittest.TestCase):
|
|
130
312
|
pass
|
|
131
313
|
|
|
@@ -134,6 +316,14 @@ devices = get_test_devices()
|
|
|
134
316
|
add_function_test(TestPrint, "test_print", test_print, devices=devices, check_output=False)
|
|
135
317
|
add_function_test(TestPrint, "test_print_numeric", test_print_numeric, devices=devices, check_output=False)
|
|
136
318
|
add_function_test(TestPrint, "test_print_boolean", test_print_boolean, devices=devices, check_output=False)
|
|
319
|
+
add_function_test(TestPrint, "test_print_adjoint", test_print_adjoint, devices=devices, check_output=False)
|
|
320
|
+
add_function_test(
|
|
321
|
+
TestPrint,
|
|
322
|
+
"test_print_error_variadic_arg_count",
|
|
323
|
+
test_print_error_variadic_arg_count,
|
|
324
|
+
devices=devices,
|
|
325
|
+
check_output=False,
|
|
326
|
+
)
|
|
137
327
|
|
|
138
328
|
|
|
139
329
|
if __name__ == "__main__":
|
warp/tests/test_spatial.py
CHANGED
|
@@ -1611,7 +1611,7 @@ def test_spatial_matmat_multiplication(test, device, dtype, register_kernels=Fal
|
|
|
1611
1611
|
tol = {
|
|
1612
1612
|
np.float16: 2.0e-2,
|
|
1613
1613
|
np.float32: 5.0e-6,
|
|
1614
|
-
np.float64:
|
|
1614
|
+
np.float64: 5.0e-7,
|
|
1615
1615
|
}.get(dtype, 0)
|
|
1616
1616
|
|
|
1617
1617
|
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|