warp-lang 0.11.0__py3-none-manylinux2014_x86_64.whl → 1.0.0__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.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +8 -0
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +7 -6
- warp/build_dll.py +70 -79
- warp/builtins.py +10 -6
- warp/codegen.py +51 -19
- warp/config.py +7 -8
- warp/constants.py +3 -0
- warp/context.py +948 -245
- warp/dlpack.py +198 -113
- warp/examples/assets/bunny.usd +0 -0
- warp/examples/assets/cartpole.urdf +110 -0
- warp/examples/assets/crazyflie.usd +0 -0
- warp/examples/assets/cube.usda +42 -0
- warp/examples/assets/nv_ant.xml +92 -0
- warp/examples/assets/nv_humanoid.xml +183 -0
- warp/examples/assets/quadruped.urdf +268 -0
- warp/examples/assets/rocks.nvdb +0 -0
- warp/examples/assets/rocks.usd +0 -0
- warp/examples/assets/sphere.usda +56 -0
- warp/examples/assets/torus.usda +105 -0
- warp/examples/benchmarks/benchmark_api.py +383 -0
- warp/examples/benchmarks/benchmark_cloth.py +279 -0
- warp/examples/benchmarks/benchmark_cloth_cupy.py +88 -0
- warp/examples/benchmarks/benchmark_cloth_jax.py +100 -0
- warp/examples/benchmarks/benchmark_cloth_numba.py +142 -0
- warp/examples/benchmarks/benchmark_cloth_numpy.py +77 -0
- warp/examples/benchmarks/benchmark_cloth_pytorch.py +86 -0
- warp/examples/benchmarks/benchmark_cloth_taichi.py +112 -0
- warp/examples/benchmarks/benchmark_cloth_warp.py +146 -0
- warp/examples/benchmarks/benchmark_launches.py +295 -0
- warp/examples/core/example_dem.py +221 -0
- warp/examples/core/example_fluid.py +267 -0
- warp/examples/core/example_graph_capture.py +129 -0
- warp/examples/core/example_marching_cubes.py +177 -0
- warp/examples/core/example_mesh.py +154 -0
- warp/examples/core/example_mesh_intersect.py +193 -0
- warp/examples/core/example_nvdb.py +169 -0
- warp/examples/core/example_raycast.py +89 -0
- warp/examples/core/example_raymarch.py +178 -0
- warp/examples/core/example_render_opengl.py +141 -0
- warp/examples/core/example_sph.py +389 -0
- warp/examples/core/example_torch.py +181 -0
- warp/examples/core/example_wave.py +249 -0
- warp/examples/fem/bsr_utils.py +380 -0
- warp/examples/fem/example_apic_fluid.py +391 -0
- warp/examples/fem/example_convection_diffusion.py +168 -0
- warp/examples/fem/example_convection_diffusion_dg.py +209 -0
- warp/examples/fem/example_convection_diffusion_dg0.py +194 -0
- warp/examples/fem/example_deformed_geometry.py +159 -0
- warp/examples/fem/example_diffusion.py +173 -0
- warp/examples/fem/example_diffusion_3d.py +152 -0
- warp/examples/fem/example_diffusion_mgpu.py +214 -0
- warp/examples/fem/example_mixed_elasticity.py +222 -0
- warp/examples/fem/example_navier_stokes.py +243 -0
- warp/examples/fem/example_stokes.py +192 -0
- warp/examples/fem/example_stokes_transfer.py +249 -0
- warp/examples/fem/mesh_utils.py +109 -0
- warp/examples/fem/plot_utils.py +287 -0
- warp/examples/optim/example_bounce.py +248 -0
- warp/examples/optim/example_cloth_throw.py +210 -0
- warp/examples/optim/example_diffray.py +535 -0
- warp/examples/optim/example_drone.py +850 -0
- warp/examples/optim/example_inverse_kinematics.py +169 -0
- warp/examples/optim/example_inverse_kinematics_torch.py +170 -0
- warp/examples/optim/example_spring_cage.py +234 -0
- warp/examples/optim/example_trajectory.py +201 -0
- warp/examples/sim/example_cartpole.py +128 -0
- warp/examples/sim/example_cloth.py +184 -0
- warp/examples/sim/example_granular.py +113 -0
- warp/examples/sim/example_granular_collision_sdf.py +185 -0
- warp/examples/sim/example_jacobian_ik.py +213 -0
- warp/examples/sim/example_particle_chain.py +106 -0
- warp/examples/sim/example_quadruped.py +179 -0
- warp/examples/sim/example_rigid_chain.py +191 -0
- warp/examples/sim/example_rigid_contact.py +176 -0
- warp/examples/sim/example_rigid_force.py +126 -0
- warp/examples/sim/example_rigid_gyroscopic.py +97 -0
- warp/examples/sim/example_rigid_soft_contact.py +124 -0
- warp/examples/sim/example_soft_body.py +178 -0
- warp/fabric.py +29 -20
- warp/fem/cache.py +0 -1
- warp/fem/dirichlet.py +0 -2
- warp/fem/integrate.py +0 -1
- warp/jax.py +45 -0
- warp/jax_experimental.py +339 -0
- warp/native/builtin.h +12 -0
- warp/native/bvh.cu +18 -18
- warp/native/clang/clang.cpp +8 -3
- warp/native/cuda_util.cpp +94 -5
- warp/native/cuda_util.h +35 -6
- warp/native/cutlass_gemm.cpp +1 -1
- warp/native/cutlass_gemm.cu +4 -1
- warp/native/error.cpp +66 -0
- warp/native/error.h +27 -0
- warp/native/mesh.cu +2 -2
- warp/native/reduce.cu +4 -4
- warp/native/runlength_encode.cu +2 -2
- warp/native/scan.cu +2 -2
- warp/native/sparse.cu +0 -1
- warp/native/temp_buffer.h +2 -2
- warp/native/warp.cpp +95 -60
- warp/native/warp.cu +1053 -218
- warp/native/warp.h +49 -32
- warp/optim/linear.py +33 -16
- warp/render/render_opengl.py +202 -101
- warp/render/render_usd.py +82 -40
- warp/sim/__init__.py +13 -4
- warp/sim/articulation.py +4 -5
- warp/sim/collide.py +320 -175
- warp/sim/import_mjcf.py +25 -30
- warp/sim/import_urdf.py +94 -63
- warp/sim/import_usd.py +51 -36
- warp/sim/inertia.py +3 -2
- warp/sim/integrator.py +233 -0
- warp/sim/integrator_euler.py +447 -469
- warp/sim/integrator_featherstone.py +1991 -0
- warp/sim/integrator_xpbd.py +1420 -640
- warp/sim/model.py +765 -487
- warp/sim/particles.py +2 -1
- warp/sim/render.py +35 -13
- warp/sim/utils.py +222 -11
- warp/stubs.py +8 -0
- warp/tape.py +16 -1
- warp/tests/aux_test_grad_customs.py +23 -0
- warp/tests/test_array.py +190 -1
- warp/tests/test_async.py +656 -0
- warp/tests/test_bool.py +50 -0
- warp/tests/test_dlpack.py +164 -11
- warp/tests/test_examples.py +166 -74
- warp/tests/test_fem.py +8 -1
- warp/tests/test_generics.py +15 -5
- warp/tests/test_grad.py +1 -1
- warp/tests/test_grad_customs.py +172 -12
- warp/tests/test_jax.py +254 -0
- warp/tests/test_large.py +29 -6
- warp/tests/test_launch.py +25 -0
- warp/tests/test_linear_solvers.py +20 -3
- warp/tests/test_matmul.py +61 -16
- warp/tests/test_matmul_lite.py +13 -13
- warp/tests/test_mempool.py +186 -0
- warp/tests/test_multigpu.py +3 -0
- warp/tests/test_options.py +16 -2
- warp/tests/test_peer.py +137 -0
- warp/tests/test_print.py +3 -1
- warp/tests/test_quat.py +23 -0
- warp/tests/test_sim_kinematics.py +97 -0
- warp/tests/test_snippet.py +126 -3
- warp/tests/test_streams.py +108 -79
- warp/tests/test_torch.py +16 -8
- warp/tests/test_utils.py +32 -27
- warp/tests/test_verify_fp.py +65 -0
- warp/tests/test_volume.py +1 -1
- warp/tests/unittest_serial.py +2 -0
- warp/tests/unittest_suites.py +12 -0
- warp/tests/unittest_utils.py +14 -7
- warp/thirdparty/unittest_parallel.py +15 -3
- warp/torch.py +10 -8
- warp/types.py +363 -246
- warp/utils.py +143 -19
- warp_lang-1.0.0.dist-info/LICENSE.md +126 -0
- warp_lang-1.0.0.dist-info/METADATA +394 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/RECORD +167 -86
- warp/sim/optimizer.py +0 -138
- warp_lang-0.11.0.dist-info/LICENSE.md +0 -36
- warp_lang-0.11.0.dist-info/METADATA +0 -238
- /warp/tests/{walkthough_debug.py → walkthrough_debug.py} +0 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/WHEEL +0 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/top_level.txt +0 -0
warp/tests/test_array.py
CHANGED
|
@@ -167,7 +167,6 @@ def test_4d_transposed(test, device):
|
|
|
167
167
|
strides=a_T.__array_interface__["strides"],
|
|
168
168
|
capacity=arr.capacity,
|
|
169
169
|
ptr=arr.ptr,
|
|
170
|
-
owner=False,
|
|
171
170
|
requires_grad=arr.requires_grad,
|
|
172
171
|
device=device,
|
|
173
172
|
)
|
|
@@ -249,6 +248,17 @@ def test_shape(test, device):
|
|
|
249
248
|
wp.launch(f4, dim=1, inputs=[a4], device=device)
|
|
250
249
|
|
|
251
250
|
|
|
251
|
+
def test_negative_shape(test, device):
|
|
252
|
+
with test.assertRaisesRegex(ValueError, "Array shapes must be non-negative"):
|
|
253
|
+
_ = wp.zeros(shape=-1, dtype=int, device=device)
|
|
254
|
+
|
|
255
|
+
with test.assertRaisesRegex(ValueError, "Array shapes must be non-negative"):
|
|
256
|
+
_ = wp.zeros(shape=-(2**32), dtype=int, device=device)
|
|
257
|
+
|
|
258
|
+
with test.assertRaisesRegex(ValueError, "Array shapes must be non-negative"):
|
|
259
|
+
_ = wp.zeros(shape=(10, -1), dtype=int, device=device)
|
|
260
|
+
|
|
261
|
+
|
|
252
262
|
@wp.kernel
|
|
253
263
|
def sum_array(arr: wp.array(dtype=float), loss: wp.array(dtype=float)):
|
|
254
264
|
tid = wp.tid()
|
|
@@ -1451,6 +1461,178 @@ def test_full_struct(test, device):
|
|
|
1451
1461
|
assert_np_equal(na, expected)
|
|
1452
1462
|
|
|
1453
1463
|
|
|
1464
|
+
def test_ones_scalar(test, device):
|
|
1465
|
+
dim = 4
|
|
1466
|
+
|
|
1467
|
+
for ndim in range(1, 5):
|
|
1468
|
+
shape = (dim,) * ndim
|
|
1469
|
+
|
|
1470
|
+
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1471
|
+
a = wp.ones(shape, dtype=wptype, device=device)
|
|
1472
|
+
na = a.numpy()
|
|
1473
|
+
|
|
1474
|
+
test.assertEqual(a.shape, shape)
|
|
1475
|
+
test.assertEqual(a.dtype, wptype)
|
|
1476
|
+
test.assertEqual(na.shape, shape)
|
|
1477
|
+
test.assertEqual(na.dtype, nptype)
|
|
1478
|
+
assert_np_equal(na, np.ones(shape, dtype=nptype))
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
def test_ones_vector(test, device):
|
|
1482
|
+
dim = 4
|
|
1483
|
+
|
|
1484
|
+
for ndim in range(1, 5):
|
|
1485
|
+
shape = (dim,) * ndim
|
|
1486
|
+
|
|
1487
|
+
for veclen in [2, 3, 4, 5]:
|
|
1488
|
+
npshape = (*shape, veclen)
|
|
1489
|
+
|
|
1490
|
+
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1491
|
+
vectype = wp.types.vector(veclen, wptype)
|
|
1492
|
+
|
|
1493
|
+
a = wp.ones(shape, dtype=vectype, device=device)
|
|
1494
|
+
na = a.numpy()
|
|
1495
|
+
|
|
1496
|
+
test.assertEqual(a.shape, shape)
|
|
1497
|
+
test.assertEqual(a.dtype, vectype)
|
|
1498
|
+
test.assertEqual(na.shape, npshape)
|
|
1499
|
+
test.assertEqual(na.dtype, nptype)
|
|
1500
|
+
assert_np_equal(na, np.ones(npshape, dtype=nptype))
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
def test_ones_matrix(test, device):
|
|
1504
|
+
dim = 4
|
|
1505
|
+
|
|
1506
|
+
for ndim in range(1, 5):
|
|
1507
|
+
shape = (dim,) * ndim
|
|
1508
|
+
|
|
1509
|
+
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1510
|
+
matrix_types = [
|
|
1511
|
+
# square matrices
|
|
1512
|
+
wp.types.matrix((2, 2), wptype),
|
|
1513
|
+
wp.types.matrix((3, 3), wptype),
|
|
1514
|
+
wp.types.matrix((4, 4), wptype),
|
|
1515
|
+
wp.types.matrix((5, 5), wptype),
|
|
1516
|
+
# non-square matrices
|
|
1517
|
+
wp.types.matrix((2, 3), wptype),
|
|
1518
|
+
wp.types.matrix((3, 2), wptype),
|
|
1519
|
+
wp.types.matrix((3, 4), wptype),
|
|
1520
|
+
wp.types.matrix((4, 3), wptype),
|
|
1521
|
+
]
|
|
1522
|
+
|
|
1523
|
+
for mattype in matrix_types:
|
|
1524
|
+
npshape = (*shape, *mattype._shape_)
|
|
1525
|
+
|
|
1526
|
+
a = wp.ones(shape, dtype=mattype, device=device)
|
|
1527
|
+
na = a.numpy()
|
|
1528
|
+
|
|
1529
|
+
test.assertEqual(a.shape, shape)
|
|
1530
|
+
test.assertEqual(a.dtype, mattype)
|
|
1531
|
+
test.assertEqual(na.shape, npshape)
|
|
1532
|
+
test.assertEqual(na.dtype, nptype)
|
|
1533
|
+
assert_np_equal(na, np.ones(npshape, dtype=nptype))
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
def test_ones_like_scalar(test, device):
|
|
1537
|
+
dim = 4
|
|
1538
|
+
|
|
1539
|
+
for ndim in range(1, 5):
|
|
1540
|
+
shape = (dim,) * ndim
|
|
1541
|
+
|
|
1542
|
+
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1543
|
+
|
|
1544
|
+
# source array
|
|
1545
|
+
a = wp.zeros(shape, dtype=wptype, device=device)
|
|
1546
|
+
na = a.numpy()
|
|
1547
|
+
test.assertEqual(a.shape, shape)
|
|
1548
|
+
test.assertEqual(a.dtype, wptype)
|
|
1549
|
+
test.assertEqual(na.shape, shape)
|
|
1550
|
+
test.assertEqual(na.dtype, nptype)
|
|
1551
|
+
assert_np_equal(na, np.zeros(shape, dtype=nptype))
|
|
1552
|
+
|
|
1553
|
+
# ones array
|
|
1554
|
+
b = wp.ones_like(a)
|
|
1555
|
+
nb = b.numpy()
|
|
1556
|
+
test.assertEqual(b.shape, shape)
|
|
1557
|
+
test.assertEqual(b.dtype, wptype)
|
|
1558
|
+
test.assertEqual(nb.shape, shape)
|
|
1559
|
+
test.assertEqual(nb.dtype, nptype)
|
|
1560
|
+
assert_np_equal(nb, np.ones(shape, dtype=nptype))
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
def test_ones_like_vector(test, device):
|
|
1564
|
+
dim = 4
|
|
1565
|
+
|
|
1566
|
+
for ndim in range(1, 5):
|
|
1567
|
+
shape = (dim,) * ndim
|
|
1568
|
+
|
|
1569
|
+
for veclen in [2, 3, 4, 5]:
|
|
1570
|
+
npshape = (*shape, veclen)
|
|
1571
|
+
|
|
1572
|
+
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1573
|
+
vectype = wp.types.vector(veclen, wptype)
|
|
1574
|
+
|
|
1575
|
+
# source array
|
|
1576
|
+
a = wp.zeros(shape, dtype=vectype, device=device)
|
|
1577
|
+
na = a.numpy()
|
|
1578
|
+
test.assertEqual(a.shape, shape)
|
|
1579
|
+
test.assertEqual(a.dtype, vectype)
|
|
1580
|
+
test.assertEqual(na.shape, npshape)
|
|
1581
|
+
test.assertEqual(na.dtype, nptype)
|
|
1582
|
+
assert_np_equal(na, np.zeros(npshape, dtype=nptype))
|
|
1583
|
+
|
|
1584
|
+
# ones array
|
|
1585
|
+
b = wp.ones_like(a)
|
|
1586
|
+
nb = b.numpy()
|
|
1587
|
+
test.assertEqual(b.shape, shape)
|
|
1588
|
+
test.assertEqual(b.dtype, vectype)
|
|
1589
|
+
test.assertEqual(nb.shape, npshape)
|
|
1590
|
+
test.assertEqual(nb.dtype, nptype)
|
|
1591
|
+
assert_np_equal(nb, np.ones(npshape, dtype=nptype))
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
def test_ones_like_matrix(test, device):
|
|
1595
|
+
dim = 4
|
|
1596
|
+
|
|
1597
|
+
for ndim in range(1, 5):
|
|
1598
|
+
shape = (dim,) * ndim
|
|
1599
|
+
|
|
1600
|
+
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1601
|
+
matrix_types = [
|
|
1602
|
+
# square matrices
|
|
1603
|
+
wp.types.matrix((2, 2), wptype),
|
|
1604
|
+
wp.types.matrix((3, 3), wptype),
|
|
1605
|
+
wp.types.matrix((4, 4), wptype),
|
|
1606
|
+
wp.types.matrix((5, 5), wptype),
|
|
1607
|
+
# non-square matrices
|
|
1608
|
+
wp.types.matrix((2, 3), wptype),
|
|
1609
|
+
wp.types.matrix((3, 2), wptype),
|
|
1610
|
+
wp.types.matrix((3, 4), wptype),
|
|
1611
|
+
wp.types.matrix((4, 3), wptype),
|
|
1612
|
+
]
|
|
1613
|
+
|
|
1614
|
+
for mattype in matrix_types:
|
|
1615
|
+
npshape = (*shape, *mattype._shape_)
|
|
1616
|
+
|
|
1617
|
+
# source array
|
|
1618
|
+
a = wp.zeros(shape, dtype=mattype, device=device)
|
|
1619
|
+
na = a.numpy()
|
|
1620
|
+
test.assertEqual(a.shape, shape)
|
|
1621
|
+
test.assertEqual(a.dtype, mattype)
|
|
1622
|
+
test.assertEqual(na.shape, npshape)
|
|
1623
|
+
test.assertEqual(na.dtype, nptype)
|
|
1624
|
+
assert_np_equal(na, np.zeros(npshape, dtype=nptype))
|
|
1625
|
+
|
|
1626
|
+
# ones array
|
|
1627
|
+
b = wp.ones_like(a)
|
|
1628
|
+
nb = b.numpy()
|
|
1629
|
+
test.assertEqual(b.shape, shape)
|
|
1630
|
+
test.assertEqual(b.dtype, mattype)
|
|
1631
|
+
test.assertEqual(nb.shape, npshape)
|
|
1632
|
+
test.assertEqual(nb.dtype, nptype)
|
|
1633
|
+
assert_np_equal(nb, np.ones(npshape, dtype=nptype))
|
|
1634
|
+
|
|
1635
|
+
|
|
1454
1636
|
def test_round_trip(test, device):
|
|
1455
1637
|
rng = np.random.default_rng(123)
|
|
1456
1638
|
dim_x = 4
|
|
@@ -2093,6 +2275,7 @@ class TestArray(unittest.TestCase):
|
|
|
2093
2275
|
|
|
2094
2276
|
|
|
2095
2277
|
add_function_test(TestArray, "test_shape", test_shape, devices=devices)
|
|
2278
|
+
add_function_test(TestArray, "test_negative_shape", test_negative_shape, devices=devices)
|
|
2096
2279
|
add_function_test(TestArray, "test_flatten", test_flatten, devices=devices)
|
|
2097
2280
|
add_function_test(TestArray, "test_reshape", test_reshape, devices=devices)
|
|
2098
2281
|
add_function_test(TestArray, "test_slicing", test_slicing, devices=devices)
|
|
@@ -2114,6 +2297,12 @@ add_function_test(TestArray, "test_full_scalar", test_full_scalar, devices=devic
|
|
|
2114
2297
|
add_function_test(TestArray, "test_full_vector", test_full_vector, devices=devices)
|
|
2115
2298
|
add_function_test(TestArray, "test_full_matrix", test_full_matrix, devices=devices)
|
|
2116
2299
|
add_function_test(TestArray, "test_full_struct", test_full_struct, devices=devices)
|
|
2300
|
+
add_function_test(TestArray, "test_ones_scalar", test_ones_scalar, devices=devices)
|
|
2301
|
+
add_function_test(TestArray, "test_ones_vector", test_ones_vector, devices=devices)
|
|
2302
|
+
add_function_test(TestArray, "test_ones_matrix", test_ones_matrix, devices=devices)
|
|
2303
|
+
add_function_test(TestArray, "test_ones_like_scalar", test_ones_like_scalar, devices=devices)
|
|
2304
|
+
add_function_test(TestArray, "test_ones_like_vector", test_ones_like_vector, devices=devices)
|
|
2305
|
+
add_function_test(TestArray, "test_ones_like_matrix", test_ones_like_matrix, devices=devices)
|
|
2117
2306
|
add_function_test(TestArray, "test_empty_array", test_empty_array, devices=devices)
|
|
2118
2307
|
add_function_test(TestArray, "test_empty_from_numpy", test_empty_from_numpy, devices=devices)
|
|
2119
2308
|
add_function_test(TestArray, "test_empty_from_list", test_empty_from_list, devices=devices)
|