warp-lang 1.6.2__py3-none-win_amd64.whl → 1.7.1__py3-none-win_amd64.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.

Files changed (191) hide show
  1. warp/__init__.py +7 -1
  2. warp/autograd.py +12 -2
  3. warp/bin/warp-clang.dll +0 -0
  4. warp/bin/warp.dll +0 -0
  5. warp/build.py +410 -0
  6. warp/build_dll.py +6 -14
  7. warp/builtins.py +463 -372
  8. warp/codegen.py +196 -124
  9. warp/config.py +42 -6
  10. warp/context.py +496 -271
  11. warp/dlpack.py +8 -6
  12. warp/examples/assets/nonuniform.usd +0 -0
  13. warp/examples/assets/nvidia_logo.png +0 -0
  14. warp/examples/benchmarks/benchmark_cloth.py +1 -1
  15. warp/examples/benchmarks/benchmark_tile_load_store.py +103 -0
  16. warp/examples/core/example_sample_mesh.py +300 -0
  17. warp/examples/distributed/example_jacobi_mpi.py +507 -0
  18. warp/examples/fem/example_apic_fluid.py +1 -1
  19. warp/examples/fem/example_burgers.py +2 -2
  20. warp/examples/fem/example_deformed_geometry.py +1 -1
  21. warp/examples/fem/example_distortion_energy.py +1 -1
  22. warp/examples/fem/example_magnetostatics.py +6 -6
  23. warp/examples/fem/utils.py +9 -3
  24. warp/examples/interop/example_jax_callable.py +116 -0
  25. warp/examples/interop/example_jax_ffi_callback.py +132 -0
  26. warp/examples/interop/example_jax_kernel.py +205 -0
  27. warp/examples/optim/example_fluid_checkpoint.py +497 -0
  28. warp/examples/tile/example_tile_matmul.py +2 -4
  29. warp/fem/__init__.py +11 -1
  30. warp/fem/adaptivity.py +4 -4
  31. warp/fem/field/field.py +11 -1
  32. warp/fem/field/nodal_field.py +56 -88
  33. warp/fem/field/virtual.py +62 -23
  34. warp/fem/geometry/adaptive_nanogrid.py +16 -13
  35. warp/fem/geometry/closest_point.py +1 -1
  36. warp/fem/geometry/deformed_geometry.py +5 -2
  37. warp/fem/geometry/geometry.py +5 -0
  38. warp/fem/geometry/grid_2d.py +12 -12
  39. warp/fem/geometry/grid_3d.py +12 -15
  40. warp/fem/geometry/hexmesh.py +5 -7
  41. warp/fem/geometry/nanogrid.py +9 -11
  42. warp/fem/geometry/quadmesh.py +13 -13
  43. warp/fem/geometry/tetmesh.py +3 -4
  44. warp/fem/geometry/trimesh.py +7 -20
  45. warp/fem/integrate.py +262 -93
  46. warp/fem/linalg.py +5 -5
  47. warp/fem/quadrature/pic_quadrature.py +37 -22
  48. warp/fem/quadrature/quadrature.py +194 -25
  49. warp/fem/space/__init__.py +1 -1
  50. warp/fem/space/basis_function_space.py +4 -2
  51. warp/fem/space/basis_space.py +25 -18
  52. warp/fem/space/hexmesh_function_space.py +2 -2
  53. warp/fem/space/partition.py +6 -2
  54. warp/fem/space/quadmesh_function_space.py +8 -8
  55. warp/fem/space/shape/cube_shape_function.py +23 -23
  56. warp/fem/space/shape/square_shape_function.py +12 -12
  57. warp/fem/space/shape/triangle_shape_function.py +1 -1
  58. warp/fem/space/tetmesh_function_space.py +3 -3
  59. warp/fem/space/trimesh_function_space.py +2 -2
  60. warp/fem/utils.py +12 -6
  61. warp/jax.py +14 -1
  62. warp/jax_experimental/__init__.py +16 -0
  63. warp/{jax_experimental.py → jax_experimental/custom_call.py} +28 -29
  64. warp/jax_experimental/ffi.py +702 -0
  65. warp/jax_experimental/xla_ffi.py +602 -0
  66. warp/math.py +89 -0
  67. warp/native/array.h +13 -0
  68. warp/native/builtin.h +29 -3
  69. warp/native/bvh.cpp +3 -1
  70. warp/native/bvh.cu +42 -14
  71. warp/native/bvh.h +2 -1
  72. warp/native/clang/clang.cpp +30 -3
  73. warp/native/cuda_util.cpp +14 -0
  74. warp/native/cuda_util.h +2 -0
  75. warp/native/exports.h +68 -63
  76. warp/native/intersect.h +26 -26
  77. warp/native/intersect_adj.h +33 -33
  78. warp/native/marching.cu +1 -1
  79. warp/native/mat.h +513 -9
  80. warp/native/mesh.h +10 -10
  81. warp/native/quat.h +99 -11
  82. warp/native/rand.h +6 -0
  83. warp/native/sort.cpp +122 -59
  84. warp/native/sort.cu +152 -15
  85. warp/native/sort.h +8 -1
  86. warp/native/sparse.cpp +43 -22
  87. warp/native/sparse.cu +52 -17
  88. warp/native/svd.h +116 -0
  89. warp/native/tile.h +312 -116
  90. warp/native/tile_reduce.h +46 -3
  91. warp/native/vec.h +68 -7
  92. warp/native/volume.cpp +85 -113
  93. warp/native/volume_builder.cu +25 -10
  94. warp/native/volume_builder.h +6 -0
  95. warp/native/warp.cpp +5 -6
  96. warp/native/warp.cu +100 -11
  97. warp/native/warp.h +19 -10
  98. warp/optim/linear.py +10 -10
  99. warp/render/render_opengl.py +19 -17
  100. warp/render/render_usd.py +93 -3
  101. warp/sim/articulation.py +4 -4
  102. warp/sim/collide.py +32 -19
  103. warp/sim/import_mjcf.py +449 -155
  104. warp/sim/import_urdf.py +32 -12
  105. warp/sim/inertia.py +189 -156
  106. warp/sim/integrator_euler.py +8 -5
  107. warp/sim/integrator_featherstone.py +3 -10
  108. warp/sim/integrator_vbd.py +207 -2
  109. warp/sim/integrator_xpbd.py +8 -5
  110. warp/sim/model.py +71 -25
  111. warp/sim/render.py +4 -0
  112. warp/sim/utils.py +2 -2
  113. warp/sparse.py +642 -555
  114. warp/stubs.py +217 -20
  115. warp/tests/__main__.py +0 -15
  116. warp/tests/assets/torus.usda +1 -1
  117. warp/tests/cuda/__init__.py +0 -0
  118. warp/tests/{test_mempool.py → cuda/test_mempool.py} +39 -0
  119. warp/tests/{test_streams.py → cuda/test_streams.py} +71 -0
  120. warp/tests/geometry/__init__.py +0 -0
  121. warp/tests/{test_mesh_query_point.py → geometry/test_mesh_query_point.py} +66 -63
  122. warp/tests/{test_mesh_query_ray.py → geometry/test_mesh_query_ray.py} +1 -1
  123. warp/tests/{test_volume.py → geometry/test_volume.py} +41 -6
  124. warp/tests/interop/__init__.py +0 -0
  125. warp/tests/{test_dlpack.py → interop/test_dlpack.py} +28 -5
  126. warp/tests/sim/__init__.py +0 -0
  127. warp/tests/{disabled_kinematics.py → sim/disabled_kinematics.py} +9 -10
  128. warp/tests/{test_collision.py → sim/test_collision.py} +236 -205
  129. warp/tests/sim/test_inertia.py +161 -0
  130. warp/tests/{test_model.py → sim/test_model.py} +40 -0
  131. warp/tests/{flaky_test_sim_grad.py → sim/test_sim_grad.py} +4 -0
  132. warp/tests/{test_sim_kinematics.py → sim/test_sim_kinematics.py} +2 -1
  133. warp/tests/sim/test_vbd.py +597 -0
  134. warp/tests/sim/test_xpbd.py +399 -0
  135. warp/tests/test_bool.py +1 -1
  136. warp/tests/test_codegen.py +24 -3
  137. warp/tests/test_examples.py +40 -38
  138. warp/tests/test_fem.py +98 -14
  139. warp/tests/test_linear_solvers.py +0 -11
  140. warp/tests/test_mat.py +577 -156
  141. warp/tests/test_mat_scalar_ops.py +4 -4
  142. warp/tests/test_overwrite.py +0 -60
  143. warp/tests/test_quat.py +356 -151
  144. warp/tests/test_rand.py +44 -37
  145. warp/tests/test_sparse.py +47 -6
  146. warp/tests/test_spatial.py +75 -0
  147. warp/tests/test_static.py +1 -1
  148. warp/tests/test_utils.py +84 -4
  149. warp/tests/test_vec.py +336 -178
  150. warp/tests/tile/__init__.py +0 -0
  151. warp/tests/{test_tile.py → tile/test_tile.py} +136 -51
  152. warp/tests/{test_tile_load.py → tile/test_tile_load.py} +98 -1
  153. warp/tests/{test_tile_mathdx.py → tile/test_tile_mathdx.py} +9 -6
  154. warp/tests/{test_tile_mlp.py → tile/test_tile_mlp.py} +25 -14
  155. warp/tests/{test_tile_reduce.py → tile/test_tile_reduce.py} +60 -1
  156. warp/tests/{test_tile_view.py → tile/test_tile_view.py} +1 -1
  157. warp/tests/unittest_serial.py +1 -0
  158. warp/tests/unittest_suites.py +45 -62
  159. warp/tests/unittest_utils.py +2 -1
  160. warp/thirdparty/unittest_parallel.py +3 -1
  161. warp/types.py +175 -666
  162. warp/utils.py +137 -72
  163. {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/METADATA +46 -12
  164. {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/RECORD +184 -171
  165. {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/WHEEL +1 -1
  166. {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info/licenses}/LICENSE.md +0 -26
  167. warp/examples/optim/example_walker.py +0 -317
  168. warp/native/cutlass_gemm.cpp +0 -43
  169. warp/native/cutlass_gemm.cu +0 -382
  170. warp/tests/test_matmul.py +0 -511
  171. warp/tests/test_matmul_lite.py +0 -411
  172. warp/tests/test_vbd.py +0 -386
  173. warp/tests/unused_test_misc.py +0 -77
  174. /warp/tests/{test_async.py → cuda/test_async.py} +0 -0
  175. /warp/tests/{test_ipc.py → cuda/test_ipc.py} +0 -0
  176. /warp/tests/{test_multigpu.py → cuda/test_multigpu.py} +0 -0
  177. /warp/tests/{test_peer.py → cuda/test_peer.py} +0 -0
  178. /warp/tests/{test_pinned.py → cuda/test_pinned.py} +0 -0
  179. /warp/tests/{test_bvh.py → geometry/test_bvh.py} +0 -0
  180. /warp/tests/{test_hash_grid.py → geometry/test_hash_grid.py} +0 -0
  181. /warp/tests/{test_marching_cubes.py → geometry/test_marching_cubes.py} +0 -0
  182. /warp/tests/{test_mesh.py → geometry/test_mesh.py} +0 -0
  183. /warp/tests/{test_mesh_query_aabb.py → geometry/test_mesh_query_aabb.py} +0 -0
  184. /warp/tests/{test_volume_write.py → geometry/test_volume_write.py} +0 -0
  185. /warp/tests/{test_jax.py → interop/test_jax.py} +0 -0
  186. /warp/tests/{test_paddle.py → interop/test_paddle.py} +0 -0
  187. /warp/tests/{test_torch.py → interop/test_torch.py} +0 -0
  188. /warp/tests/{test_coloring.py → sim/test_coloring.py} +0 -0
  189. /warp/tests/{test_sim_grad_bounce_linear.py → sim/test_sim_grad_bounce_linear.py} +0 -0
  190. /warp/tests/{test_tile_shared_memory.py → tile/test_tile_shared_memory.py} +0 -0
  191. {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/top_level.txt +0 -0
warp/sim/articulation.py CHANGED
@@ -30,7 +30,7 @@ def compute_2d_rotational_dofs(
30
30
  """
31
31
  Computes the rotation quaternion and 3D angular velocity given the joint axes, coordinates and velocities.
32
32
  """
33
- q_off = wp.quat_from_matrix(wp.mat33(axis_0, axis_1, wp.cross(axis_0, axis_1)))
33
+ q_off = wp.quat_from_matrix(wp.matrix_from_cols(axis_0, axis_1, wp.cross(axis_0, axis_1)))
34
34
 
35
35
  # body local axes
36
36
  local_0 = wp.quat_rotate(q_off, wp.vec3(1.0, 0.0, 0.0))
@@ -60,7 +60,7 @@ def invert_2d_rotational_dofs(
60
60
  """
61
61
  Computes generalized joint position and velocity coordinates for a 2D rotational joint given the joint axes, relative orientations and angular velocity differences between the two bodies the joint connects.
62
62
  """
63
- q_off = wp.quat_from_matrix(wp.mat33(axis_0, axis_1, wp.cross(axis_0, axis_1)))
63
+ q_off = wp.quat_from_matrix(wp.matrix_from_cols(axis_0, axis_1, wp.cross(axis_0, axis_1)))
64
64
  q_pc = wp.quat_inverse(q_off) * wp.quat_inverse(q_p) * q_c * q_off
65
65
 
66
66
  # decompose to a compound rotation each axis
@@ -106,7 +106,7 @@ def compute_3d_rotational_dofs(
106
106
  """
107
107
  Computes the rotation quaternion and 3D angular velocity given the joint axes, coordinates and velocities.
108
108
  """
109
- q_off = wp.quat_from_matrix(wp.mat33(axis_0, axis_1, axis_2))
109
+ q_off = wp.quat_from_matrix(wp.matrix_from_cols(axis_0, axis_1, axis_2))
110
110
 
111
111
  # body local axes
112
112
  local_0 = wp.quat_rotate(q_off, wp.vec3(1.0, 0.0, 0.0))
@@ -136,7 +136,7 @@ def invert_3d_rotational_dofs(
136
136
  """
137
137
  Computes generalized joint position and velocity coordinates for a 3D rotational joint given the joint axes, relative orientations and angular velocity differences between the two bodies the joint connects.
138
138
  """
139
- q_off = wp.quat_from_matrix(wp.mat33(axis_0, axis_1, axis_2))
139
+ q_off = wp.quat_from_matrix(wp.matrix_from_cols(axis_0, axis_1, axis_2))
140
140
  q_pc = wp.quat_inverse(q_off) * wp.quat_inverse(q_p) * q_c * q_off
141
141
 
142
142
  # decompose to a compound rotation each axis
warp/sim/collide.py CHANGED
@@ -17,10 +17,12 @@
17
17
  Collision handling functions and kernels.
18
18
  """
19
19
 
20
+ from typing import Optional
21
+
20
22
  import numpy as np
21
23
 
22
24
  import warp as wp
23
- from warp.sim.model import Model
25
+ from warp.sim.model import Model, State
24
26
 
25
27
  from .model import PARTICLE_FLAG_ACTIVE, ModelShapeGeometry
26
28
 
@@ -612,9 +614,9 @@ def volume_grad(volume: wp.uint64, p: wp.vec3):
612
614
  @wp.func
613
615
  def counter_increment(counter: wp.array(dtype=int), counter_index: int, tids: wp.array(dtype=int), tid: int):
614
616
  # increment counter, remember which thread received which counter value
615
- next_count = wp.atomic_add(counter, counter_index, 1)
616
- tids[tid] = next_count
617
- return next_count
617
+ count = wp.atomic_add(counter, counter_index, 1)
618
+ tids[tid] = count
619
+ return count
618
620
 
619
621
 
620
622
  @wp.func_replay(counter_increment)
@@ -627,10 +629,10 @@ def limited_counter_increment(
627
629
  counter: wp.array(dtype=int), counter_index: int, tids: wp.array(dtype=int), tid: int, index_limit: int
628
630
  ):
629
631
  # increment counter but only if it is smaller than index_limit, remember which thread received which counter value
630
- next_count = wp.atomic_add(counter, counter_index, 1)
631
- if next_count < index_limit or index_limit < 0:
632
- tids[tid] = next_count
633
- return next_count
632
+ count = wp.atomic_add(counter, counter_index, 1)
633
+ if count < index_limit or index_limit < 0:
634
+ tids[tid] = count
635
+ return count
634
636
  tids[tid] = -1
635
637
  return -1
636
638
 
@@ -1545,6 +1547,8 @@ def handle_contact_pairs(
1545
1547
  # reached contact point limit
1546
1548
  return
1547
1549
  index = counter_increment(contact_count, 0, contact_tids, tid)
1550
+ if index == -1:
1551
+ return
1548
1552
  contact_shape0[index] = shape_a
1549
1553
  contact_shape1[index] = shape_b
1550
1554
  # transform from world into body frame (so the contact point includes the shape transform)
@@ -1556,17 +1560,23 @@ def handle_contact_pairs(
1556
1560
  contact_thickness[index] = thickness
1557
1561
 
1558
1562
 
1559
- def collide(model, state, edge_sdf_iter: int = 10, iterate_mesh_vertices: bool = True, requires_grad: bool = None):
1560
- """
1561
- Generates contact points for the particles and rigid bodies in the model,
1562
- to be used in the contact dynamics kernel of the integrator.
1563
+ def collide(
1564
+ model: Model,
1565
+ state: State,
1566
+ edge_sdf_iter: int = 10,
1567
+ iterate_mesh_vertices: bool = True,
1568
+ requires_grad: Optional[bool] = None,
1569
+ ) -> None:
1570
+ """Generate contact points for the particles and rigid bodies in the model for use in contact-dynamics kernels.
1563
1571
 
1564
1572
  Args:
1565
- model: the model to be simulated
1566
- state: the state of the model
1567
- edge_sdf_iter: number of search iterations for finding closest contact points between edges and SDF
1568
- iterate_mesh_vertices: whether to iterate over all vertices of a mesh for contact generation (used for capsule/box <> mesh collision)
1569
- requires_grad: whether to duplicate contact arrays for gradient computation (if None uses model.requires_grad)
1573
+ model: The model to be simulated.
1574
+ state: The state of the model.
1575
+ edge_sdf_iter: Number of search iterations for finding closest contact points between edges and SDF.
1576
+ iterate_mesh_vertices: Whether to iterate over all vertices of a mesh for contact generation
1577
+ (used for capsule/box <> mesh collision).
1578
+ requires_grad: Whether to duplicate contact arrays for gradient computation
1579
+ (if ``None``, uses ``model.requires_grad``).
1570
1580
  """
1571
1581
 
1572
1582
  if requires_grad is None:
@@ -1682,16 +1692,19 @@ def collide(model, state, edge_sdf_iter: int = 10, iterate_mesh_vertices: bool =
1682
1692
  model.rigid_contact_normal = wp.empty_like(model.rigid_contact_normal)
1683
1693
  model.rigid_contact_thickness = wp.empty_like(model.rigid_contact_thickness)
1684
1694
  model.rigid_contact_count = wp.zeros_like(model.rigid_contact_count)
1685
- model.rigid_contact_tids = wp.zeros_like(model.rigid_contact_tids)
1695
+ model.rigid_contact_tids = wp.full_like(model.rigid_contact_tids, -1)
1686
1696
  model.rigid_contact_shape0 = wp.empty_like(model.rigid_contact_shape0)
1687
1697
  model.rigid_contact_shape1 = wp.empty_like(model.rigid_contact_shape1)
1698
+
1688
1699
  if model.rigid_contact_pairwise_counter is not None:
1689
1700
  model.rigid_contact_pairwise_counter = wp.zeros_like(model.rigid_contact_pairwise_counter)
1690
1701
  else:
1691
1702
  model.rigid_contact_count.zero_()
1692
- model.rigid_contact_tids.zero_()
1703
+ model.rigid_contact_tids.fill_(-1)
1704
+
1693
1705
  if model.rigid_contact_pairwise_counter is not None:
1694
1706
  model.rigid_contact_pairwise_counter.zero_()
1707
+
1695
1708
  model.rigid_contact_shape0.fill_(-1)
1696
1709
  model.rigid_contact_shape1.fill_(-1)
1697
1710