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.
Files changed (187) hide show
  1. docs/conf.py +3 -4
  2. examples/env/env_ant.py +1 -1
  3. examples/env/env_cartpole.py +1 -1
  4. examples/env/env_humanoid.py +1 -1
  5. examples/example_dem.py +28 -26
  6. examples/example_diffray.py +37 -30
  7. examples/example_fluid.py +7 -3
  8. examples/example_jacobian_ik.py +1 -1
  9. examples/example_mesh_intersect.py +10 -7
  10. examples/example_nvdb.py +3 -3
  11. examples/example_render_opengl.py +19 -10
  12. examples/example_sim_cartpole.py +9 -5
  13. examples/example_sim_cloth.py +29 -25
  14. examples/example_sim_fk_grad.py +2 -2
  15. examples/example_sim_fk_grad_torch.py +3 -3
  16. examples/example_sim_grad_bounce.py +11 -8
  17. examples/example_sim_grad_cloth.py +12 -9
  18. examples/example_sim_granular.py +2 -2
  19. examples/example_sim_granular_collision_sdf.py +13 -13
  20. examples/example_sim_neo_hookean.py +3 -3
  21. examples/example_sim_particle_chain.py +2 -2
  22. examples/example_sim_quadruped.py +8 -5
  23. examples/example_sim_rigid_chain.py +8 -5
  24. examples/example_sim_rigid_contact.py +13 -10
  25. examples/example_sim_rigid_fem.py +2 -2
  26. examples/example_sim_rigid_gyroscopic.py +2 -2
  27. examples/example_sim_rigid_kinematics.py +1 -1
  28. examples/example_sim_trajopt.py +3 -2
  29. examples/fem/example_apic_fluid.py +5 -7
  30. examples/fem/example_diffusion_mgpu.py +18 -16
  31. warp/__init__.py +3 -2
  32. warp/bin/warp.so +0 -0
  33. warp/build_dll.py +29 -9
  34. warp/builtins.py +206 -7
  35. warp/codegen.py +58 -38
  36. warp/config.py +3 -1
  37. warp/context.py +234 -128
  38. warp/fem/__init__.py +2 -2
  39. warp/fem/cache.py +2 -1
  40. warp/fem/field/nodal_field.py +18 -17
  41. warp/fem/geometry/hexmesh.py +11 -6
  42. warp/fem/geometry/quadmesh_2d.py +16 -12
  43. warp/fem/geometry/tetmesh.py +19 -8
  44. warp/fem/geometry/trimesh_2d.py +18 -7
  45. warp/fem/integrate.py +341 -196
  46. warp/fem/quadrature/__init__.py +1 -1
  47. warp/fem/quadrature/pic_quadrature.py +138 -53
  48. warp/fem/quadrature/quadrature.py +81 -9
  49. warp/fem/space/__init__.py +1 -1
  50. warp/fem/space/basis_space.py +169 -51
  51. warp/fem/space/grid_2d_function_space.py +2 -2
  52. warp/fem/space/grid_3d_function_space.py +2 -2
  53. warp/fem/space/hexmesh_function_space.py +2 -2
  54. warp/fem/space/partition.py +9 -6
  55. warp/fem/space/quadmesh_2d_function_space.py +2 -2
  56. warp/fem/space/shape/cube_shape_function.py +27 -15
  57. warp/fem/space/shape/square_shape_function.py +29 -18
  58. warp/fem/space/tetmesh_function_space.py +2 -2
  59. warp/fem/space/topology.py +10 -0
  60. warp/fem/space/trimesh_2d_function_space.py +2 -2
  61. warp/fem/utils.py +10 -5
  62. warp/native/array.h +49 -8
  63. warp/native/builtin.h +31 -14
  64. warp/native/cuda_util.cpp +8 -3
  65. warp/native/cuda_util.h +1 -0
  66. warp/native/exports.h +1177 -1108
  67. warp/native/intersect.h +4 -4
  68. warp/native/intersect_adj.h +8 -8
  69. warp/native/mat.h +65 -6
  70. warp/native/mesh.h +126 -5
  71. warp/native/quat.h +28 -4
  72. warp/native/vec.h +76 -14
  73. warp/native/warp.cu +1 -6
  74. warp/render/render_opengl.py +261 -109
  75. warp/sim/import_mjcf.py +13 -7
  76. warp/sim/import_urdf.py +14 -14
  77. warp/sim/inertia.py +17 -18
  78. warp/sim/model.py +67 -67
  79. warp/sim/render.py +1 -1
  80. warp/sparse.py +6 -6
  81. warp/stubs.py +19 -81
  82. warp/tape.py +1 -1
  83. warp/tests/__main__.py +3 -6
  84. warp/tests/{test_class_kernel.py → aux_test_class_kernel.py} +9 -1
  85. warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -0
  86. warp/tests/{test_dependent.py → aux_test_dependent.py} +2 -2
  87. warp/tests/{test_reference.py → aux_test_reference.py} +1 -1
  88. warp/tests/aux_test_unresolved_func.py +14 -0
  89. warp/tests/aux_test_unresolved_symbol.py +14 -0
  90. warp/tests/{test_kinematics.py → disabled_kinematics.py} +10 -12
  91. warp/tests/run_coverage_serial.py +31 -0
  92. warp/tests/test_adam.py +102 -106
  93. warp/tests/test_arithmetic.py +39 -40
  94. warp/tests/test_array.py +46 -48
  95. warp/tests/test_array_reduce.py +25 -19
  96. warp/tests/test_atomic.py +62 -26
  97. warp/tests/test_bool.py +16 -11
  98. warp/tests/test_builtins_resolution.py +1292 -0
  99. warp/tests/test_bvh.py +9 -12
  100. warp/tests/test_closest_point_edge_edge.py +53 -57
  101. warp/tests/test_codegen.py +164 -134
  102. warp/tests/test_compile_consts.py +13 -19
  103. warp/tests/test_conditional.py +30 -32
  104. warp/tests/test_copy.py +9 -12
  105. warp/tests/test_ctypes.py +90 -98
  106. warp/tests/test_dense.py +20 -14
  107. warp/tests/test_devices.py +34 -35
  108. warp/tests/test_dlpack.py +74 -75
  109. warp/tests/test_examples.py +215 -97
  110. warp/tests/test_fabricarray.py +15 -21
  111. warp/tests/test_fast_math.py +14 -11
  112. warp/tests/test_fem.py +280 -97
  113. warp/tests/test_fp16.py +19 -15
  114. warp/tests/test_func.py +177 -194
  115. warp/tests/test_generics.py +71 -77
  116. warp/tests/test_grad.py +83 -32
  117. warp/tests/test_grad_customs.py +7 -9
  118. warp/tests/test_hash_grid.py +6 -10
  119. warp/tests/test_import.py +9 -23
  120. warp/tests/test_indexedarray.py +19 -21
  121. warp/tests/test_intersect.py +15 -9
  122. warp/tests/test_large.py +17 -19
  123. warp/tests/test_launch.py +14 -17
  124. warp/tests/test_lerp.py +63 -63
  125. warp/tests/test_lvalue.py +84 -35
  126. warp/tests/test_marching_cubes.py +9 -13
  127. warp/tests/test_mat.py +388 -3004
  128. warp/tests/test_mat_lite.py +9 -12
  129. warp/tests/test_mat_scalar_ops.py +2889 -0
  130. warp/tests/test_math.py +10 -11
  131. warp/tests/test_matmul.py +104 -100
  132. warp/tests/test_matmul_lite.py +72 -98
  133. warp/tests/test_mesh.py +35 -32
  134. warp/tests/test_mesh_query_aabb.py +18 -25
  135. warp/tests/test_mesh_query_point.py +39 -23
  136. warp/tests/test_mesh_query_ray.py +9 -21
  137. warp/tests/test_mlp.py +8 -9
  138. warp/tests/test_model.py +89 -93
  139. warp/tests/test_modules_lite.py +15 -25
  140. warp/tests/test_multigpu.py +87 -114
  141. warp/tests/test_noise.py +10 -12
  142. warp/tests/test_operators.py +14 -21
  143. warp/tests/test_options.py +10 -11
  144. warp/tests/test_pinned.py +16 -18
  145. warp/tests/test_print.py +16 -20
  146. warp/tests/test_quat.py +121 -88
  147. warp/tests/test_rand.py +12 -13
  148. warp/tests/test_reload.py +27 -32
  149. warp/tests/test_rounding.py +7 -10
  150. warp/tests/test_runlength_encode.py +105 -106
  151. warp/tests/test_smoothstep.py +8 -9
  152. warp/tests/test_snippet.py +13 -22
  153. warp/tests/test_sparse.py +30 -29
  154. warp/tests/test_spatial.py +179 -174
  155. warp/tests/test_streams.py +100 -107
  156. warp/tests/test_struct.py +98 -67
  157. warp/tests/test_tape.py +11 -17
  158. warp/tests/test_torch.py +89 -86
  159. warp/tests/test_transient_module.py +9 -12
  160. warp/tests/test_types.py +328 -50
  161. warp/tests/test_utils.py +217 -218
  162. warp/tests/test_vec.py +133 -2133
  163. warp/tests/test_vec_lite.py +8 -11
  164. warp/tests/test_vec_scalar_ops.py +2099 -0
  165. warp/tests/test_volume.py +391 -382
  166. warp/tests/test_volume_write.py +122 -135
  167. warp/tests/unittest_serial.py +35 -0
  168. warp/tests/unittest_suites.py +291 -0
  169. warp/tests/{test_base.py → unittest_utils.py} +138 -25
  170. warp/tests/{test_misc.py → unused_test_misc.py} +13 -5
  171. warp/tests/{test_debug.py → walkthough_debug.py} +2 -15
  172. warp/thirdparty/unittest_parallel.py +257 -54
  173. warp/types.py +119 -98
  174. warp/utils.py +14 -0
  175. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/METADATA +2 -1
  176. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/RECORD +182 -178
  177. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/WHEEL +1 -1
  178. warp/tests/test_all.py +0 -239
  179. warp/tests/test_conditional_unequal_types_kernels.py +0 -14
  180. warp/tests/test_coverage.py +0 -38
  181. warp/tests/test_unresolved_func.py +0 -7
  182. warp/tests/test_unresolved_symbol.py +0 -7
  183. /warp/tests/{test_compile_consts_dummy.py → aux_test_compile_consts_dummy.py} +0 -0
  184. /warp/tests/{test_reference_reference.py → aux_test_reference_reference.py} +0 -0
  185. /warp/tests/{test_square.py → aux_test_square.py} +0 -0
  186. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/LICENSE.md +0 -0
  187. {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
- import warp as wp
2
- from warp.tests.test_base import *
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 = lookup(foos, i)
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
- def test_swizzle_error_invalid_attribute(test, device):
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
- def register(parent):
419
- devices = get_test_devices()
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
- class TestLValue(parent):
422
- pass
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
- return TestLValue
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
- # include parent path
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.test_base import *
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="cuda")
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
- def register(parent):
56
- devices = ["cuda"]
53
+ devices = get_unique_cuda_test_devices()
54
+
57
55
 
58
- class TestMarchingCubes(parent):
59
- pass
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
- return TestMarchingCubes
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)