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_lvalue.py
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.
|
|
3
7
|
|
|
4
8
|
import unittest
|
|
5
9
|
|
|
10
|
+
import warp as wp
|
|
11
|
+
from warp.tests.unittest_utils import *
|
|
12
|
+
|
|
6
13
|
wp.init()
|
|
7
|
-
wp.config.mode = "debug"
|
|
8
14
|
|
|
9
15
|
|
|
10
16
|
@wp.kernel
|
|
@@ -88,6 +94,54 @@ def test_lookup(test, device):
|
|
|
88
94
|
raise AssertionError(f"Unexpected result, got: {f} expected: {1}")
|
|
89
95
|
|
|
90
96
|
|
|
97
|
+
@wp.func
|
|
98
|
+
def lookup3(foos: wp.array(dtype=wp.float32), index: int):
|
|
99
|
+
return foos[index]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@wp.kernel
|
|
103
|
+
def grad_kernel(foos: wp.array(dtype=wp.float32), bars: wp.array(dtype=wp.float32)):
|
|
104
|
+
i = wp.tid()
|
|
105
|
+
|
|
106
|
+
x = lookup3(foos, i)
|
|
107
|
+
bars[i] = x * wp.float32(i) + 1.0
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_grad(test, device):
|
|
111
|
+
num = 10
|
|
112
|
+
data = np.linspace(20, 20 + num, num, endpoint=False, dtype=np.float32)
|
|
113
|
+
input = wp.array(data, device=device, requires_grad=True)
|
|
114
|
+
output = wp.zeros(num, dtype=wp.float32, device=device)
|
|
115
|
+
|
|
116
|
+
ones = wp.array(np.ones(len(output)), dtype=wp.float32, device=device)
|
|
117
|
+
|
|
118
|
+
tape = wp.Tape()
|
|
119
|
+
with tape:
|
|
120
|
+
wp.launch(
|
|
121
|
+
kernel=grad_kernel,
|
|
122
|
+
dim=(num,),
|
|
123
|
+
inputs=[input],
|
|
124
|
+
outputs=[output],
|
|
125
|
+
device=device,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
tape.backward(grads={output: ones})
|
|
129
|
+
|
|
130
|
+
wp.synchronize()
|
|
131
|
+
|
|
132
|
+
# test forward results
|
|
133
|
+
for i, f in enumerate(output.list()):
|
|
134
|
+
expected = data[i] * i + 1
|
|
135
|
+
if f != expected:
|
|
136
|
+
raise AssertionError(f"Unexpected result, got: {f} expected: {expected}")
|
|
137
|
+
|
|
138
|
+
# test backward results
|
|
139
|
+
for i, f in enumerate(tape.gradients[input].list()):
|
|
140
|
+
expected = i
|
|
141
|
+
if f != expected:
|
|
142
|
+
raise AssertionError(f"Unexpected result, got: {f} expected: {expected}")
|
|
143
|
+
|
|
144
|
+
|
|
91
145
|
@wp.func
|
|
92
146
|
def lookup2(foos: wp.array(dtype=wp.uint32), index: int):
|
|
93
147
|
if index % 2 == 0:
|
|
@@ -102,7 +156,7 @@ def lookup2(foos: wp.array(dtype=wp.uint32), index: int):
|
|
|
102
156
|
def lookup2_kernel(foos: wp.array(dtype=wp.uint32)):
|
|
103
157
|
i = wp.tid()
|
|
104
158
|
|
|
105
|
-
x =
|
|
159
|
+
x = lookup2(foos, i)
|
|
106
160
|
foos[i] = x + wp.uint32(1)
|
|
107
161
|
|
|
108
162
|
|
|
@@ -401,44 +455,39 @@ def test_swizzle(test, device):
|
|
|
401
455
|
raise AssertionError(f"Unexpected result, got: {f} expected: {expected}")
|
|
402
456
|
|
|
403
457
|
|
|
404
|
-
|
|
405
|
-
v = wp.vec3(1, 2, 3)
|
|
406
|
-
with test.assertRaisesRegex(
|
|
407
|
-
AttributeError,
|
|
408
|
-
r"'vec3f' object has no attribute 'foo'$",
|
|
409
|
-
):
|
|
410
|
-
v.foo
|
|
411
|
-
|
|
412
|
-
try:
|
|
413
|
-
v.bar = 123
|
|
414
|
-
except AttributeError:
|
|
415
|
-
test.fail()
|
|
458
|
+
devices = get_test_devices()
|
|
416
459
|
|
|
417
460
|
|
|
418
|
-
|
|
419
|
-
|
|
461
|
+
class TestLValue(unittest.TestCase):
|
|
462
|
+
def test_swizzle_error_invalid_attribute(self):
|
|
463
|
+
v = wp.vec3(1, 2, 3)
|
|
464
|
+
with self.assertRaisesRegex(
|
|
465
|
+
AttributeError,
|
|
466
|
+
r"'vec3f' object has no attribute 'foo'$",
|
|
467
|
+
):
|
|
468
|
+
v.foo
|
|
420
469
|
|
|
421
|
-
|
|
422
|
-
|
|
470
|
+
try:
|
|
471
|
+
v.bar = 123
|
|
472
|
+
except AttributeError:
|
|
473
|
+
self.fail()
|
|
423
474
|
|
|
424
|
-
add_function_test(TestLValue, "test_rmw_array", test_rmw_array, devices=devices)
|
|
425
|
-
add_function_test(TestLValue, "test_rmw_array_struct", test_rmw_array_struct, devices=devices)
|
|
426
|
-
add_function_test(TestLValue, "test_lookup", test_lookup, devices=devices)
|
|
427
|
-
add_function_test(TestLValue, "test_lookup2", test_lookup2, devices=devices)
|
|
428
|
-
add_function_test(TestLValue, "test_unary", test_unary, devices=devices)
|
|
429
|
-
add_function_test(TestLValue, "test_rvalue", test_rvalue, devices=devices)
|
|
430
|
-
add_function_test(TestLValue, "test_intermediate", test_intermediate, devices=devices)
|
|
431
|
-
add_function_test(TestLValue, "test_array_assign", test_array_assign, devices=devices)
|
|
432
|
-
add_function_test(TestLValue, "test_array_struct_assign", test_array_struct_assign, devices=devices)
|
|
433
|
-
add_function_test(TestLValue, "test_array_struct_struct_assign", test_array_struct_struct_assign, devices=devices)
|
|
434
|
-
add_function_test(TestLValue, "test_complex", test_complex, devices=devices)
|
|
435
|
-
add_function_test(TestLValue, "test_swizzle", test_swizzle, devices=devices)
|
|
436
|
-
add_function_test(TestLValue, "test_swizzle_error_invalid_attribute", test_swizzle_error_invalid_attribute)
|
|
437
475
|
|
|
438
|
-
|
|
476
|
+
add_function_test(TestLValue, "test_rmw_array", test_rmw_array, devices=devices)
|
|
477
|
+
add_function_test(TestLValue, "test_rmw_array_struct", test_rmw_array_struct, devices=devices)
|
|
478
|
+
add_function_test(TestLValue, "test_lookup", test_lookup, devices=devices)
|
|
479
|
+
add_function_test(TestLValue, "test_lookup2", test_lookup2, devices=devices)
|
|
480
|
+
add_function_test(TestLValue, "test_grad", test_grad, devices=devices)
|
|
481
|
+
add_function_test(TestLValue, "test_unary", test_unary, devices=devices)
|
|
482
|
+
add_function_test(TestLValue, "test_rvalue", test_rvalue, devices=devices)
|
|
483
|
+
add_function_test(TestLValue, "test_intermediate", test_intermediate, devices=devices)
|
|
484
|
+
add_function_test(TestLValue, "test_array_assign", test_array_assign, devices=devices)
|
|
485
|
+
add_function_test(TestLValue, "test_array_struct_assign", test_array_struct_assign, devices=devices)
|
|
486
|
+
add_function_test(TestLValue, "test_array_struct_struct_assign", test_array_struct_struct_assign, devices=devices)
|
|
487
|
+
add_function_test(TestLValue, "test_complex", test_complex, devices=devices)
|
|
488
|
+
add_function_test(TestLValue, "test_swizzle", test_swizzle, devices=devices)
|
|
439
489
|
|
|
440
490
|
|
|
441
491
|
if __name__ == "__main__":
|
|
442
492
|
wp.build.clear_kernel_cache()
|
|
443
|
-
_ = register(unittest.TestCase)
|
|
444
493
|
unittest.main(verbosity=2)
|
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
# distribution of this software and related documentation without an express
|
|
6
6
|
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import unittest
|
|
9
|
+
|
|
9
10
|
import numpy as np
|
|
10
|
-
import math
|
|
11
11
|
|
|
12
12
|
import warp as wp
|
|
13
|
-
from warp.tests.
|
|
14
|
-
|
|
15
|
-
import unittest
|
|
13
|
+
from warp.tests.unittest_utils import *
|
|
16
14
|
|
|
17
15
|
wp.init()
|
|
18
16
|
|
|
@@ -39,7 +37,7 @@ def test_marching_cubes(test, device):
|
|
|
39
37
|
|
|
40
38
|
radius = dim / 4.0
|
|
41
39
|
|
|
42
|
-
wp.launch(make_field, dim=field.shape, inputs=[field, wp.vec3(dim / 2, dim / 2, dim / 2), radius], device=
|
|
40
|
+
wp.launch(make_field, dim=field.shape, inputs=[field, wp.vec3(dim / 2, dim / 2, dim / 2), radius], device=device)
|
|
43
41
|
|
|
44
42
|
iso.surface(field=field, threshold=0.0)
|
|
45
43
|
|
|
@@ -52,18 +50,16 @@ def test_marching_cubes(test, device):
|
|
|
52
50
|
iso.resize(nx=dim * 2, ny=dim * 2, nz=dim * 2, max_verts=max_verts, max_tris=max_tris)
|
|
53
51
|
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
devices = get_unique_cuda_test_devices()
|
|
54
|
+
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
class TestMarchingCubes(unittest.TestCase):
|
|
57
|
+
pass
|
|
60
58
|
|
|
61
|
-
add_function_test(TestMarchingCubes, "test_marching_cubes", test_marching_cubes, devices=devices)
|
|
62
59
|
|
|
63
|
-
|
|
60
|
+
add_function_test(TestMarchingCubes, "test_marching_cubes", test_marching_cubes, devices=devices)
|
|
64
61
|
|
|
65
62
|
|
|
66
63
|
if __name__ == "__main__":
|
|
67
64
|
wp.build.clear_kernel_cache()
|
|
68
|
-
_ = register(unittest.TestCase)
|
|
69
65
|
unittest.main(verbosity=2)
|