warp-lang 1.8.0__py3-none-manylinux_2_34_aarch64.whl → 1.9.0__py3-none-manylinux_2_34_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.

Files changed (153) hide show
  1. warp/__init__.py +282 -103
  2. warp/__init__.pyi +482 -110
  3. warp/bin/warp-clang.so +0 -0
  4. warp/bin/warp.so +0 -0
  5. warp/build.py +93 -30
  6. warp/build_dll.py +48 -63
  7. warp/builtins.py +955 -137
  8. warp/codegen.py +327 -209
  9. warp/config.py +1 -1
  10. warp/context.py +1363 -800
  11. warp/examples/core/example_marching_cubes.py +1 -0
  12. warp/examples/core/example_render_opengl.py +100 -3
  13. warp/examples/fem/example_apic_fluid.py +98 -52
  14. warp/examples/fem/example_convection_diffusion_dg.py +25 -4
  15. warp/examples/fem/example_diffusion_mgpu.py +8 -3
  16. warp/examples/fem/utils.py +68 -22
  17. warp/examples/interop/example_jax_callable.py +34 -4
  18. warp/examples/interop/example_jax_kernel.py +27 -1
  19. warp/fabric.py +1 -1
  20. warp/fem/cache.py +27 -19
  21. warp/fem/domain.py +2 -2
  22. warp/fem/field/nodal_field.py +2 -2
  23. warp/fem/field/virtual.py +266 -166
  24. warp/fem/geometry/geometry.py +5 -5
  25. warp/fem/integrate.py +200 -91
  26. warp/fem/space/restriction.py +4 -0
  27. warp/fem/space/shape/tet_shape_function.py +3 -10
  28. warp/jax_experimental/custom_call.py +1 -1
  29. warp/jax_experimental/ffi.py +203 -54
  30. warp/marching_cubes.py +708 -0
  31. warp/native/array.h +103 -8
  32. warp/native/builtin.h +90 -9
  33. warp/native/bvh.cpp +64 -28
  34. warp/native/bvh.cu +58 -58
  35. warp/native/bvh.h +2 -2
  36. warp/native/clang/clang.cpp +7 -7
  37. warp/native/coloring.cpp +13 -3
  38. warp/native/crt.cpp +2 -2
  39. warp/native/crt.h +3 -5
  40. warp/native/cuda_util.cpp +42 -11
  41. warp/native/cuda_util.h +10 -4
  42. warp/native/exports.h +1842 -1908
  43. warp/native/fabric.h +2 -1
  44. warp/native/hashgrid.cpp +37 -37
  45. warp/native/hashgrid.cu +2 -2
  46. warp/native/initializer_array.h +1 -1
  47. warp/native/intersect.h +4 -4
  48. warp/native/mat.h +1913 -119
  49. warp/native/mathdx.cpp +43 -43
  50. warp/native/mesh.cpp +24 -24
  51. warp/native/mesh.cu +26 -26
  52. warp/native/mesh.h +5 -3
  53. warp/native/nanovdb/GridHandle.h +179 -12
  54. warp/native/nanovdb/HostBuffer.h +8 -7
  55. warp/native/nanovdb/NanoVDB.h +517 -895
  56. warp/native/nanovdb/NodeManager.h +323 -0
  57. warp/native/nanovdb/PNanoVDB.h +2 -2
  58. warp/native/quat.h +337 -16
  59. warp/native/rand.h +7 -7
  60. warp/native/range.h +7 -1
  61. warp/native/reduce.cpp +10 -10
  62. warp/native/reduce.cu +13 -14
  63. warp/native/runlength_encode.cpp +2 -2
  64. warp/native/runlength_encode.cu +5 -5
  65. warp/native/scan.cpp +3 -3
  66. warp/native/scan.cu +4 -4
  67. warp/native/sort.cpp +10 -10
  68. warp/native/sort.cu +22 -22
  69. warp/native/sparse.cpp +8 -8
  70. warp/native/sparse.cu +14 -14
  71. warp/native/spatial.h +366 -17
  72. warp/native/svd.h +23 -8
  73. warp/native/temp_buffer.h +2 -2
  74. warp/native/tile.h +303 -70
  75. warp/native/tile_radix_sort.h +5 -1
  76. warp/native/tile_reduce.h +16 -25
  77. warp/native/tuple.h +2 -2
  78. warp/native/vec.h +385 -18
  79. warp/native/volume.cpp +54 -54
  80. warp/native/volume.cu +1 -1
  81. warp/native/volume.h +2 -1
  82. warp/native/volume_builder.cu +30 -37
  83. warp/native/warp.cpp +150 -149
  84. warp/native/warp.cu +337 -193
  85. warp/native/warp.h +227 -226
  86. warp/optim/linear.py +736 -271
  87. warp/render/imgui_manager.py +289 -0
  88. warp/render/render_opengl.py +137 -57
  89. warp/render/render_usd.py +0 -1
  90. warp/sim/collide.py +1 -2
  91. warp/sim/graph_coloring.py +2 -2
  92. warp/sim/integrator_vbd.py +10 -2
  93. warp/sparse.py +559 -176
  94. warp/tape.py +2 -0
  95. warp/tests/aux_test_module_aot.py +7 -0
  96. warp/tests/cuda/test_async.py +3 -3
  97. warp/tests/cuda/test_conditional_captures.py +101 -0
  98. warp/tests/geometry/test_marching_cubes.py +233 -12
  99. warp/tests/sim/test_cloth.py +89 -6
  100. warp/tests/sim/test_coloring.py +82 -7
  101. warp/tests/test_array.py +56 -5
  102. warp/tests/test_assert.py +53 -0
  103. warp/tests/test_atomic_cas.py +127 -114
  104. warp/tests/test_codegen.py +3 -2
  105. warp/tests/test_context.py +8 -15
  106. warp/tests/test_enum.py +136 -0
  107. warp/tests/test_examples.py +2 -2
  108. warp/tests/test_fem.py +45 -2
  109. warp/tests/test_fixedarray.py +229 -0
  110. warp/tests/test_func.py +18 -15
  111. warp/tests/test_future_annotations.py +7 -5
  112. warp/tests/test_linear_solvers.py +30 -0
  113. warp/tests/test_map.py +1 -1
  114. warp/tests/test_mat.py +1540 -378
  115. warp/tests/test_mat_assign_copy.py +178 -0
  116. warp/tests/test_mat_constructors.py +574 -0
  117. warp/tests/test_module_aot.py +287 -0
  118. warp/tests/test_print.py +69 -0
  119. warp/tests/test_quat.py +162 -34
  120. warp/tests/test_quat_assign_copy.py +145 -0
  121. warp/tests/test_reload.py +2 -1
  122. warp/tests/test_sparse.py +103 -0
  123. warp/tests/test_spatial.py +140 -34
  124. warp/tests/test_spatial_assign_copy.py +160 -0
  125. warp/tests/test_static.py +48 -0
  126. warp/tests/test_struct.py +43 -3
  127. warp/tests/test_tape.py +38 -0
  128. warp/tests/test_types.py +0 -20
  129. warp/tests/test_vec.py +216 -441
  130. warp/tests/test_vec_assign_copy.py +143 -0
  131. warp/tests/test_vec_constructors.py +325 -0
  132. warp/tests/tile/test_tile.py +206 -152
  133. warp/tests/tile/test_tile_cholesky.py +605 -0
  134. warp/tests/tile/test_tile_load.py +169 -0
  135. warp/tests/tile/test_tile_mathdx.py +2 -558
  136. warp/tests/tile/test_tile_matmul.py +179 -0
  137. warp/tests/tile/test_tile_mlp.py +1 -1
  138. warp/tests/tile/test_tile_reduce.py +100 -11
  139. warp/tests/tile/test_tile_shared_memory.py +16 -16
  140. warp/tests/tile/test_tile_sort.py +59 -55
  141. warp/tests/unittest_suites.py +16 -0
  142. warp/tests/walkthrough_debug.py +1 -1
  143. warp/thirdparty/unittest_parallel.py +108 -9
  144. warp/types.py +554 -264
  145. warp/utils.py +68 -86
  146. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/METADATA +28 -65
  147. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/RECORD +150 -138
  148. warp/native/marching.cpp +0 -19
  149. warp/native/marching.cu +0 -514
  150. warp/native/marching.h +0 -19
  151. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/WHEEL +0 -0
  152. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/licenses/LICENSE.md +0 -0
  153. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,178 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ import unittest
17
+
18
+ import numpy as np
19
+
20
+ import warp as wp
21
+ from warp.tests.unittest_utils import *
22
+
23
+
24
+ def setUpModule():
25
+ wp.config.enable_vector_component_overwrites = True
26
+
27
+
28
+ def tearDownModule():
29
+ wp.config.enable_vector_component_overwrites = False
30
+
31
+
32
+ @wp.kernel
33
+ def mat_assign_element(x: wp.array(dtype=float), y: wp.array(dtype=wp.mat22)):
34
+ i = wp.tid()
35
+
36
+ a = wp.mat22()
37
+ a[0, 0] = 1.0 * x[i]
38
+ a[0, 1] = 2.0 * x[i]
39
+ a[1, 0] = 3.0 * x[i]
40
+ a[1, 1] = 4.0 * x[i]
41
+
42
+ y[i] = a
43
+
44
+
45
+ @wp.kernel
46
+ def mat_assign_row(x: wp.array(dtype=wp.vec2), y: wp.array(dtype=wp.mat22)):
47
+ i = wp.tid()
48
+
49
+ a = wp.mat22()
50
+ a[0] = 1.0 * x[i]
51
+ a[1] = 2.0 * x[i]
52
+
53
+ y[i] = a
54
+
55
+
56
+ def test_mat_assign(test, device):
57
+ # matrix element
58
+ x = wp.ones(1, dtype=float, requires_grad=True, device=device)
59
+ y = wp.zeros(1, dtype=wp.mat22, requires_grad=True, device=device)
60
+
61
+ tape = wp.Tape()
62
+ with tape:
63
+ wp.launch(mat_assign_element, 1, inputs=[x], outputs=[y], device=device)
64
+
65
+ y.grad = wp.ones_like(y)
66
+ tape.backward()
67
+
68
+ assert_np_equal(y.numpy(), np.array([[[1.0, 2.0], [3.0, 4.0]]], dtype=float))
69
+ assert_np_equal(x.grad.numpy(), np.array([10.0], dtype=float))
70
+
71
+ # matrix row
72
+ x = wp.ones(1, dtype=wp.vec2, requires_grad=True, device=device)
73
+ y = wp.zeros(1, dtype=wp.mat22, requires_grad=True, device=device)
74
+
75
+ tape = wp.Tape()
76
+ with tape:
77
+ wp.launch(mat_assign_row, 1, inputs=[x], outputs=[y], device=device)
78
+
79
+ y.grad = wp.ones_like(y)
80
+ tape.backward()
81
+
82
+ assert_np_equal(y.numpy(), np.array([[[1.0, 1.0], [2.0, 2.0]]], dtype=float))
83
+ assert_np_equal(x.grad.numpy(), np.array([[3.0, 3.0]], dtype=float))
84
+
85
+
86
+ def test_matrix_assign_copy(test, device):
87
+ @wp.kernel(module="unique")
88
+ def mat_in_register_overwrite(x: wp.array2d(dtype=wp.mat22), y: wp.array(dtype=wp.vec2)):
89
+ i, j = wp.tid()
90
+
91
+ a = wp.mat22()
92
+ a[0] = y[i]
93
+ a[0, 1] = 3.0
94
+ x[i, j] = a
95
+
96
+ x = wp.zeros((1, 1), dtype=wp.mat22, device=device, requires_grad=True)
97
+ y = wp.ones(1, dtype=wp.vec2, device=device, requires_grad=True)
98
+
99
+ tape = wp.Tape()
100
+ with tape:
101
+ wp.launch(mat_in_register_overwrite, dim=(1, 1), inputs=[x, y], device=device)
102
+
103
+ tape.backward(grads={x: wp.ones_like(x, requires_grad=False)})
104
+
105
+ assert_np_equal(x.numpy(), np.array([[[[1.0, 3.0], [0.0, 0.0]]]], dtype=float))
106
+ assert_np_equal(y.grad.numpy(), np.array([[1.0, 0.0]], dtype=float))
107
+
108
+
109
+ def test_mat_slicing_assign_backward(test, device):
110
+ mat23 = wp.mat((2, 3), float)
111
+
112
+ @wp.kernel(module="unique")
113
+ def kernel(
114
+ arr_x: wp.array(dtype=wp.vec2),
115
+ arr_y: wp.array(dtype=mat23),
116
+ arr_z: wp.array(dtype=wp.mat44),
117
+ ):
118
+ i = wp.tid()
119
+
120
+ z = arr_z[i]
121
+
122
+ z[0, :2] = arr_x[i]
123
+ z[:2, 1:] = arr_y[i]
124
+
125
+ z[:2, 3] += arr_x[i][:2]
126
+ z[1:-1, :2] += arr_y[i][::-1, :-1]
127
+
128
+ z[2:, 3] -= arr_x[i][0:]
129
+ z[3:, -1:] -= arr_y[i][:1, :1]
130
+
131
+ arr_z[i] = z
132
+
133
+ x = wp.ones(1, dtype=wp.vec2, requires_grad=True, device=device)
134
+ y = wp.ones(1, dtype=mat23, requires_grad=True, device=device)
135
+ z = wp.zeros(1, dtype=wp.mat44, requires_grad=True, device=device)
136
+
137
+ tape = wp.Tape()
138
+ with tape:
139
+ wp.launch(kernel, 1, inputs=(x, y), outputs=(z,), device=device)
140
+
141
+ z.grad = wp.ones_like(z)
142
+ tape.backward()
143
+
144
+ assert_np_equal(
145
+ z.numpy(),
146
+ np.array(
147
+ (
148
+ (
149
+ (1.0, 1.0, 1.0, 2.0),
150
+ (1.0, 2.0, 1.0, 2.0),
151
+ (1.0, 1.0, 0.0, -1.0),
152
+ (0.0, 0.0, 0.0, -2.0),
153
+ ),
154
+ ),
155
+ dtype=float,
156
+ ),
157
+ )
158
+ assert_np_equal(x.grad.numpy(), np.array(((1.0, 0.0),), dtype=float))
159
+ assert_np_equal(y.grad.numpy(), np.array((((1.0, 2.0, 1.0), (2.0, 2.0, 1.0)),), dtype=float))
160
+
161
+
162
+ devices = get_test_devices()
163
+
164
+
165
+ class TestMatAssignCopy(unittest.TestCase):
166
+ pass
167
+
168
+
169
+ add_function_test(TestMatAssignCopy, "test_mat_assign", test_mat_assign, devices=devices)
170
+ add_function_test(TestMatAssignCopy, "test_matrix_assign_copy", test_matrix_assign_copy, devices=devices)
171
+ add_function_test(
172
+ TestMatAssignCopy, "test_mat_slicing_assign_backward", test_mat_slicing_assign_backward, devices=devices
173
+ )
174
+
175
+
176
+ if __name__ == "__main__":
177
+ wp.clear_kernel_cache()
178
+ unittest.main(verbosity=2, failfast=True)