warp-lang 1.2.2__py3-none-win_amd64.whl → 1.3.0__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 (194) hide show
  1. warp/__init__.py +8 -6
  2. warp/autograd.py +823 -0
  3. warp/bin/warp-clang.dll +0 -0
  4. warp/bin/warp.dll +0 -0
  5. warp/build.py +6 -2
  6. warp/builtins.py +1410 -886
  7. warp/codegen.py +503 -166
  8. warp/config.py +48 -18
  9. warp/context.py +400 -198
  10. warp/dlpack.py +8 -0
  11. warp/examples/assets/bunny.usd +0 -0
  12. warp/examples/benchmarks/benchmark_cloth_warp.py +1 -1
  13. warp/examples/benchmarks/benchmark_interop_torch.py +158 -0
  14. warp/examples/benchmarks/benchmark_launches.py +1 -1
  15. warp/examples/core/example_cupy.py +78 -0
  16. warp/examples/fem/example_apic_fluid.py +17 -36
  17. warp/examples/fem/example_burgers.py +9 -18
  18. warp/examples/fem/example_convection_diffusion.py +7 -17
  19. warp/examples/fem/example_convection_diffusion_dg.py +27 -47
  20. warp/examples/fem/example_deformed_geometry.py +11 -22
  21. warp/examples/fem/example_diffusion.py +7 -18
  22. warp/examples/fem/example_diffusion_3d.py +24 -28
  23. warp/examples/fem/example_diffusion_mgpu.py +7 -14
  24. warp/examples/fem/example_magnetostatics.py +190 -0
  25. warp/examples/fem/example_mixed_elasticity.py +111 -80
  26. warp/examples/fem/example_navier_stokes.py +30 -34
  27. warp/examples/fem/example_nonconforming_contact.py +290 -0
  28. warp/examples/fem/example_stokes.py +17 -32
  29. warp/examples/fem/example_stokes_transfer.py +12 -21
  30. warp/examples/fem/example_streamlines.py +350 -0
  31. warp/examples/fem/utils.py +936 -0
  32. warp/fabric.py +5 -2
  33. warp/fem/__init__.py +13 -3
  34. warp/fem/cache.py +161 -11
  35. warp/fem/dirichlet.py +37 -28
  36. warp/fem/domain.py +105 -14
  37. warp/fem/field/__init__.py +14 -3
  38. warp/fem/field/field.py +454 -11
  39. warp/fem/field/nodal_field.py +33 -18
  40. warp/fem/geometry/deformed_geometry.py +50 -15
  41. warp/fem/geometry/hexmesh.py +12 -24
  42. warp/fem/geometry/nanogrid.py +106 -31
  43. warp/fem/geometry/quadmesh_2d.py +6 -11
  44. warp/fem/geometry/tetmesh.py +103 -61
  45. warp/fem/geometry/trimesh_2d.py +98 -47
  46. warp/fem/integrate.py +231 -186
  47. warp/fem/operator.py +14 -9
  48. warp/fem/quadrature/pic_quadrature.py +35 -9
  49. warp/fem/quadrature/quadrature.py +119 -32
  50. warp/fem/space/basis_space.py +98 -22
  51. warp/fem/space/collocated_function_space.py +3 -1
  52. warp/fem/space/function_space.py +7 -2
  53. warp/fem/space/grid_2d_function_space.py +3 -3
  54. warp/fem/space/grid_3d_function_space.py +4 -4
  55. warp/fem/space/hexmesh_function_space.py +3 -2
  56. warp/fem/space/nanogrid_function_space.py +12 -14
  57. warp/fem/space/partition.py +45 -47
  58. warp/fem/space/restriction.py +19 -16
  59. warp/fem/space/shape/cube_shape_function.py +91 -3
  60. warp/fem/space/shape/shape_function.py +7 -0
  61. warp/fem/space/shape/square_shape_function.py +32 -0
  62. warp/fem/space/shape/tet_shape_function.py +11 -7
  63. warp/fem/space/shape/triangle_shape_function.py +10 -1
  64. warp/fem/space/topology.py +116 -42
  65. warp/fem/types.py +8 -1
  66. warp/fem/utils.py +301 -83
  67. warp/native/array.h +16 -0
  68. warp/native/builtin.h +0 -15
  69. warp/native/cuda_util.cpp +14 -6
  70. warp/native/exports.h +1348 -1308
  71. warp/native/quat.h +79 -0
  72. warp/native/rand.h +27 -4
  73. warp/native/sparse.cpp +83 -81
  74. warp/native/sparse.cu +381 -453
  75. warp/native/vec.h +64 -0
  76. warp/native/volume.cpp +40 -49
  77. warp/native/volume_builder.cu +2 -3
  78. warp/native/volume_builder.h +12 -17
  79. warp/native/warp.cu +3 -3
  80. warp/native/warp.h +69 -59
  81. warp/render/render_opengl.py +17 -9
  82. warp/sim/articulation.py +117 -17
  83. warp/sim/collide.py +35 -29
  84. warp/sim/model.py +123 -18
  85. warp/sim/render.py +3 -1
  86. warp/sparse.py +867 -203
  87. warp/stubs.py +312 -541
  88. warp/tape.py +29 -1
  89. warp/tests/disabled_kinematics.py +1 -1
  90. warp/tests/test_adam.py +1 -1
  91. warp/tests/test_arithmetic.py +1 -1
  92. warp/tests/test_array.py +58 -1
  93. warp/tests/test_array_reduce.py +1 -1
  94. warp/tests/test_async.py +1 -1
  95. warp/tests/test_atomic.py +1 -1
  96. warp/tests/test_bool.py +1 -1
  97. warp/tests/test_builtins_resolution.py +1 -1
  98. warp/tests/test_bvh.py +6 -1
  99. warp/tests/test_closest_point_edge_edge.py +1 -1
  100. warp/tests/test_codegen.py +66 -1
  101. warp/tests/test_compile_consts.py +1 -1
  102. warp/tests/test_conditional.py +1 -1
  103. warp/tests/test_copy.py +1 -1
  104. warp/tests/test_ctypes.py +1 -1
  105. warp/tests/test_dense.py +1 -1
  106. warp/tests/test_devices.py +1 -1
  107. warp/tests/test_dlpack.py +1 -1
  108. warp/tests/test_examples.py +33 -4
  109. warp/tests/test_fabricarray.py +5 -2
  110. warp/tests/test_fast_math.py +1 -1
  111. warp/tests/test_fem.py +213 -6
  112. warp/tests/test_fp16.py +1 -1
  113. warp/tests/test_func.py +1 -1
  114. warp/tests/test_future_annotations.py +90 -0
  115. warp/tests/test_generics.py +1 -1
  116. warp/tests/test_grad.py +1 -1
  117. warp/tests/test_grad_customs.py +1 -1
  118. warp/tests/test_grad_debug.py +247 -0
  119. warp/tests/test_hash_grid.py +6 -1
  120. warp/tests/test_implicit_init.py +354 -0
  121. warp/tests/test_import.py +1 -1
  122. warp/tests/test_indexedarray.py +1 -1
  123. warp/tests/test_intersect.py +1 -1
  124. warp/tests/test_jax.py +1 -1
  125. warp/tests/test_large.py +1 -1
  126. warp/tests/test_launch.py +1 -1
  127. warp/tests/test_lerp.py +1 -1
  128. warp/tests/test_linear_solvers.py +1 -1
  129. warp/tests/test_lvalue.py +1 -1
  130. warp/tests/test_marching_cubes.py +5 -2
  131. warp/tests/test_mat.py +34 -35
  132. warp/tests/test_mat_lite.py +2 -1
  133. warp/tests/test_mat_scalar_ops.py +1 -1
  134. warp/tests/test_math.py +1 -1
  135. warp/tests/test_matmul.py +20 -16
  136. warp/tests/test_matmul_lite.py +1 -1
  137. warp/tests/test_mempool.py +1 -1
  138. warp/tests/test_mesh.py +5 -2
  139. warp/tests/test_mesh_query_aabb.py +1 -1
  140. warp/tests/test_mesh_query_point.py +1 -1
  141. warp/tests/test_mesh_query_ray.py +1 -1
  142. warp/tests/test_mlp.py +1 -1
  143. warp/tests/test_model.py +1 -1
  144. warp/tests/test_module_hashing.py +77 -1
  145. warp/tests/test_modules_lite.py +1 -1
  146. warp/tests/test_multigpu.py +1 -1
  147. warp/tests/test_noise.py +1 -1
  148. warp/tests/test_operators.py +1 -1
  149. warp/tests/test_options.py +1 -1
  150. warp/tests/test_overwrite.py +542 -0
  151. warp/tests/test_peer.py +1 -1
  152. warp/tests/test_pinned.py +1 -1
  153. warp/tests/test_print.py +1 -1
  154. warp/tests/test_quat.py +15 -1
  155. warp/tests/test_rand.py +1 -1
  156. warp/tests/test_reload.py +1 -1
  157. warp/tests/test_rounding.py +1 -1
  158. warp/tests/test_runlength_encode.py +1 -1
  159. warp/tests/test_scalar_ops.py +95 -0
  160. warp/tests/test_sim_grad.py +1 -1
  161. warp/tests/test_sim_kinematics.py +1 -1
  162. warp/tests/test_smoothstep.py +1 -1
  163. warp/tests/test_sparse.py +82 -15
  164. warp/tests/test_spatial.py +1 -1
  165. warp/tests/test_special_values.py +2 -11
  166. warp/tests/test_streams.py +11 -1
  167. warp/tests/test_struct.py +1 -1
  168. warp/tests/test_tape.py +1 -1
  169. warp/tests/test_torch.py +194 -1
  170. warp/tests/test_transient_module.py +1 -1
  171. warp/tests/test_types.py +1 -1
  172. warp/tests/test_utils.py +1 -1
  173. warp/tests/test_vec.py +15 -63
  174. warp/tests/test_vec_lite.py +2 -1
  175. warp/tests/test_vec_scalar_ops.py +65 -1
  176. warp/tests/test_verify_fp.py +1 -1
  177. warp/tests/test_volume.py +28 -2
  178. warp/tests/test_volume_write.py +1 -1
  179. warp/tests/unittest_serial.py +1 -1
  180. warp/tests/unittest_suites.py +9 -1
  181. warp/tests/walkthrough_debug.py +1 -1
  182. warp/thirdparty/unittest_parallel.py +2 -5
  183. warp/torch.py +103 -41
  184. warp/types.py +341 -224
  185. warp/utils.py +11 -2
  186. {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/METADATA +99 -46
  187. warp_lang-1.3.0.dist-info/RECORD +368 -0
  188. warp/examples/fem/bsr_utils.py +0 -378
  189. warp/examples/fem/mesh_utils.py +0 -133
  190. warp/examples/fem/plot_utils.py +0 -292
  191. warp_lang-1.2.2.dist-info/RECORD +0 -359
  192. {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/LICENSE.md +0 -0
  193. {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/WHEEL +0 -0
  194. {warp_lang-1.2.2.dist-info → warp_lang-1.3.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,354 @@
1
+ # Copyright (c) 2024 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.
7
+
8
+ import unittest
9
+
10
+ import warp as wp
11
+ from warp.tests.unittest_utils import *
12
+
13
+ # Array Initialization
14
+ # ------------------------------------------------------------------------------
15
+
16
+
17
+ def test_array_from_data(test, device):
18
+ wp.array((1.0, 2.0, 3.0), dtype=float)
19
+
20
+
21
+ class TestImplicitInitArrayFromData(unittest.TestCase):
22
+ pass
23
+
24
+
25
+ add_function_test(
26
+ TestImplicitInitArrayFromData,
27
+ "test_array_from_data",
28
+ test_array_from_data,
29
+ check_output=False,
30
+ )
31
+
32
+
33
+ def test_array_from_ptr(test, device):
34
+ wp.array(ptr=0, shape=(123,), dtype=float)
35
+
36
+
37
+ class TestImplicitInitArrayFromPtr(unittest.TestCase):
38
+ pass
39
+
40
+
41
+ add_function_test(
42
+ TestImplicitInitArrayFromPtr,
43
+ "test_array_from_ptr",
44
+ test_array_from_ptr,
45
+ check_output=False,
46
+ )
47
+
48
+
49
+ # Builtin Call
50
+ # ------------------------------------------------------------------------------
51
+
52
+
53
+ def test_builtin_call(test, device):
54
+ wp.sin(1.23)
55
+
56
+
57
+ class TestImplicitInitBuiltinCall(unittest.TestCase):
58
+ pass
59
+
60
+
61
+ add_function_test(
62
+ TestImplicitInitBuiltinCall,
63
+ "test_builtin_call",
64
+ test_builtin_call,
65
+ check_output=False,
66
+ )
67
+
68
+
69
+ # Devices
70
+ # ------------------------------------------------------------------------------
71
+
72
+
73
+ def test_get_cuda_device_count(test, device):
74
+ wp.get_cuda_device_count()
75
+
76
+
77
+ class TestImplicitInitGetCudaDeviceCount(unittest.TestCase):
78
+ pass
79
+
80
+
81
+ add_function_test(
82
+ TestImplicitInitGetCudaDeviceCount,
83
+ "test_get_cuda_device_count",
84
+ test_get_cuda_device_count,
85
+ check_output=False,
86
+ )
87
+
88
+
89
+ def test_get_cuda_devices(test, device):
90
+ wp.get_cuda_devices()
91
+
92
+
93
+ class TestImplicitInitGetCudaDevices(unittest.TestCase):
94
+ pass
95
+
96
+
97
+ add_function_test(
98
+ TestImplicitInitGetCudaDevices,
99
+ "test_get_cuda_devices",
100
+ test_get_cuda_devices,
101
+ check_output=False,
102
+ )
103
+
104
+
105
+ def test_get_device(test, device):
106
+ wp.get_device("cpu")
107
+
108
+
109
+ class TestImplicitInitGetDevice(unittest.TestCase):
110
+ pass
111
+
112
+
113
+ add_function_test(
114
+ TestImplicitInitGetDevice,
115
+ "test_get_device",
116
+ test_get_device,
117
+ check_output=False,
118
+ )
119
+
120
+
121
+ def test_get_devices(test, device):
122
+ wp.get_devices()
123
+
124
+
125
+ class TestImplicitInitGetDevices(unittest.TestCase):
126
+ pass
127
+
128
+
129
+ add_function_test(
130
+ TestImplicitInitGetDevices,
131
+ "test_get_devices",
132
+ test_get_devices,
133
+ check_output=False,
134
+ )
135
+
136
+
137
+ def test_get_preferred_device(test, device):
138
+ wp.get_preferred_device()
139
+
140
+
141
+ class TestImplicitInitGetPreferredDevice(unittest.TestCase):
142
+ pass
143
+
144
+
145
+ add_function_test(
146
+ TestImplicitInitGetPreferredDevice,
147
+ "test_get_preferred_device",
148
+ test_get_preferred_device,
149
+ check_output=False,
150
+ )
151
+
152
+
153
+ def test_is_cpu_available(test, device):
154
+ wp.is_cpu_available()
155
+
156
+
157
+ class TestImplicitInitIsCpuAvailable(unittest.TestCase):
158
+ pass
159
+
160
+
161
+ add_function_test(
162
+ TestImplicitInitIsCpuAvailable,
163
+ "test_is_cpu_available",
164
+ test_is_cpu_available,
165
+ check_output=False,
166
+ )
167
+
168
+
169
+ def test_is_cuda_available(test, device):
170
+ wp.is_cuda_available()
171
+
172
+
173
+ class TestImplicitInitIsCudaAvailable(unittest.TestCase):
174
+ pass
175
+
176
+
177
+ add_function_test(
178
+ TestImplicitInitIsCudaAvailable,
179
+ "test_is_cuda_available",
180
+ test_is_cuda_available,
181
+ check_output=False,
182
+ )
183
+
184
+
185
+ def test_is_device_available(test, device):
186
+ wp.is_device_available("cpu")
187
+
188
+
189
+ class TestImplicitInitIsDeviceAvailable(unittest.TestCase):
190
+ pass
191
+
192
+
193
+ add_function_test(
194
+ TestImplicitInitIsDeviceAvailable,
195
+ "test_is_device_available",
196
+ test_is_device_available,
197
+ check_output=False,
198
+ )
199
+
200
+
201
+ def test_set_device(test, device):
202
+ wp.set_device("cpu")
203
+
204
+
205
+ class TestImplicitInitSetDevice(unittest.TestCase):
206
+ pass
207
+
208
+
209
+ add_function_test(
210
+ TestImplicitInitSetDevice,
211
+ "test_set_device",
212
+ test_set_device,
213
+ check_output=False,
214
+ )
215
+
216
+
217
+ # Launch
218
+ # ------------------------------------------------------------------------------
219
+
220
+
221
+ @wp.kernel
222
+ def launch_kernel():
223
+ pass
224
+
225
+
226
+ def test_launch(test, device):
227
+ wp.launch(launch_kernel, dim=1)
228
+
229
+
230
+ class TestImplicitInitLaunch(unittest.TestCase):
231
+ pass
232
+
233
+
234
+ add_function_test(
235
+ TestImplicitInitLaunch,
236
+ "test_launch",
237
+ test_launch,
238
+ check_output=False,
239
+ )
240
+
241
+
242
+ # Mempool
243
+ # ------------------------------------------------------------------------------
244
+
245
+
246
+ def test_is_mempool_enabled(test, device):
247
+ wp.is_mempool_enabled("cpu")
248
+
249
+
250
+ class TestImplicitInitIsMempoolEnabled(unittest.TestCase):
251
+ pass
252
+
253
+
254
+ add_function_test(
255
+ TestImplicitInitIsMempoolEnabled,
256
+ "test_is_mempool_enabled",
257
+ test_is_mempool_enabled,
258
+ check_output=False,
259
+ )
260
+
261
+
262
+ def test_is_mempool_supported(test, device):
263
+ wp.is_mempool_supported("cpu")
264
+
265
+
266
+ class TestImplicitInitIsMempoolSupported(unittest.TestCase):
267
+ pass
268
+
269
+
270
+ add_function_test(
271
+ TestImplicitInitIsMempoolSupported,
272
+ "test_is_mempool_supported",
273
+ test_is_mempool_supported,
274
+ check_output=False,
275
+ )
276
+
277
+
278
+ # Mempool Access
279
+ # ------------------------------------------------------------------------------
280
+
281
+
282
+ def test_is_mempool_access_enabled(test, device):
283
+ wp.is_mempool_access_enabled("cpu", "cpu")
284
+
285
+
286
+ class TestImplicitInitIsMempoolAccessEnabled(unittest.TestCase):
287
+ pass
288
+
289
+
290
+ add_function_test(
291
+ TestImplicitInitIsMempoolAccessEnabled,
292
+ "test_is_mempool_access_enabled",
293
+ test_is_mempool_access_enabled,
294
+ check_output=False,
295
+ )
296
+
297
+
298
+ def test_is_mempool_access_supported(test, device):
299
+ wp.is_mempool_access_supported("cpu", "cpu")
300
+
301
+
302
+ class TestImplicitInitIsMempoolAccessSupported(unittest.TestCase):
303
+ pass
304
+
305
+
306
+ add_function_test(
307
+ TestImplicitInitIsMempoolAccessSupported,
308
+ "test_is_mempool_access_supported",
309
+ test_is_mempool_access_supported,
310
+ check_output=False,
311
+ )
312
+
313
+
314
+ # Peer Access
315
+ # ------------------------------------------------------------------------------
316
+
317
+
318
+ def test_is_peer_access_enabled(test, device):
319
+ wp.is_peer_access_enabled("cpu", "cpu")
320
+
321
+
322
+ class TestImplicitInitIsPeerAccessEnabled(unittest.TestCase):
323
+ pass
324
+
325
+
326
+ add_function_test(
327
+ TestImplicitInitIsPeerAccessEnabled,
328
+ "test_is_peer_access_enabled",
329
+ test_is_peer_access_enabled,
330
+ check_output=False,
331
+ )
332
+
333
+
334
+ def test_is_peer_access_supported(test, device):
335
+ wp.is_peer_access_supported("cpu", "cpu")
336
+
337
+
338
+ class TestImplicitInitIsPeerAccessSupported(unittest.TestCase):
339
+ pass
340
+
341
+
342
+ add_function_test(
343
+ TestImplicitInitIsPeerAccessSupported,
344
+ "test_is_peer_access_supported",
345
+ test_is_peer_access_supported,
346
+ check_output=False,
347
+ )
348
+
349
+
350
+ if __name__ == "__main__":
351
+ # Do not clear the kernel cache or call anything that would initialize Warp
352
+ # since these tests are specifically aiming to catch issues where Warp isn't
353
+ # correctly initialized upon calling certain public APIs.
354
+ unittest.main(verbosity=2, failfast=True)
warp/tests/test_import.py CHANGED
@@ -33,5 +33,5 @@ add_kernel_test(TestImport, kernel=test_import_func, name="test_import_func", di
33
33
 
34
34
 
35
35
  if __name__ == "__main__":
36
- wp.build.clear_kernel_cache()
36
+ wp.clear_kernel_cache()
37
37
  unittest.main(verbosity=2)
@@ -1128,5 +1128,5 @@ add_function_test(TestIndexedArray, "test_indexedarray_fill_struct", test_indexe
1128
1128
 
1129
1129
 
1130
1130
  if __name__ == "__main__":
1131
- wp.build.clear_kernel_cache()
1131
+ wp.clear_kernel_cache()
1132
1132
  unittest.main(verbosity=2)
@@ -61,5 +61,5 @@ add_function_test(TestIntersect, "test_intersect_tri", test_intersect_tri, devic
61
61
 
62
62
 
63
63
  if __name__ == "__main__":
64
- wp.build.clear_kernel_cache()
64
+ wp.clear_kernel_cache()
65
65
  unittest.main(verbosity=2, failfast=False)
warp/tests/test_jax.py CHANGED
@@ -301,5 +301,5 @@ except Exception as e:
301
301
 
302
302
 
303
303
  if __name__ == "__main__":
304
- wp.build.clear_kernel_cache()
304
+ wp.clear_kernel_cache()
305
305
  unittest.main(verbosity=2)
warp/tests/test_large.py CHANGED
@@ -165,5 +165,5 @@ add_function_test(TestLarge, "test_large_array_excessive_numpy", test_large_arra
165
165
 
166
166
 
167
167
  if __name__ == "__main__":
168
- wp.build.clear_kernel_cache()
168
+ wp.clear_kernel_cache()
169
169
  unittest.main(verbosity=2)
warp/tests/test_launch.py CHANGED
@@ -348,5 +348,5 @@ add_function_test(TestLaunch, "test_launch_tuple_args", test_launch_tuple_args,
348
348
 
349
349
 
350
350
  if __name__ == "__main__":
351
- wp.build.clear_kernel_cache()
351
+ wp.clear_kernel_cache()
352
352
  unittest.main(verbosity=2)
warp/tests/test_lerp.py CHANGED
@@ -213,5 +213,5 @@ add_function_test(TestLerp, "test_lerp", test_lerp, devices=devices)
213
213
 
214
214
 
215
215
  if __name__ == "__main__":
216
- wp.build.clear_kernel_cache()
216
+ wp.clear_kernel_cache()
217
217
  unittest.main(verbosity=2)
@@ -185,5 +185,5 @@ add_function_test(TestLinearSolvers, "test_bicgstab", test_bicgstab, devices=dev
185
185
  add_function_test(TestLinearSolvers, "test_gmres", test_gmres, devices=devices)
186
186
 
187
187
  if __name__ == "__main__":
188
- wp.build.clear_kernel_cache()
188
+ wp.clear_kernel_cache()
189
189
  unittest.main(verbosity=2)
warp/tests/test_lvalue.py CHANGED
@@ -415,5 +415,5 @@ add_function_test(TestLValue, "test_slice", test_slice, devices=devices)
415
415
 
416
416
 
417
417
  if __name__ == "__main__":
418
- wp.build.clear_kernel_cache()
418
+ wp.clear_kernel_cache()
419
419
  unittest.main(verbosity=2)
@@ -52,12 +52,15 @@ devices = get_selected_cuda_test_devices()
52
52
 
53
53
 
54
54
  class TestMarchingCubes(unittest.TestCase):
55
- pass
55
+ def test_marching_cubes_new_del(self):
56
+ # test the scenario in which a MarchingCubes instance is created but not initialized before gc
57
+ instance = wp.MarchingCubes.__new__(wp.MarchingCubes)
58
+ instance.__del__()
56
59
 
57
60
 
58
61
  add_function_test(TestMarchingCubes, "test_marching_cubes", test_marching_cubes, devices=devices)
59
62
 
60
63
 
61
64
  if __name__ == "__main__":
62
- wp.build.clear_kernel_cache()
65
+ wp.clear_kernel_cache()
63
66
  unittest.main(verbosity=2)
warp/tests/test_mat.py CHANGED
@@ -52,14 +52,14 @@ def get_select_kernel(dtype):
52
52
  return getkernel(output_select_kernel_fn, suffix=dtype.__name__)
53
53
 
54
54
 
55
- def test_anon_constructor_error_shape_keyword_missing(test, device):
55
+ def test_anon_constructor_error_shape_arg_missing(test, device):
56
56
  @wp.kernel
57
57
  def kernel():
58
58
  wp.matrix(1.0, 2.0, 3.0)
59
59
 
60
60
  with test.assertRaisesRegex(
61
61
  RuntimeError,
62
- r"shape keyword must be specified when calling matrix\(\) function$",
62
+ r"the `shape` argument must be specified when initializing a matrix by value$",
63
63
  ):
64
64
  wp.launch(
65
65
  kernel,
@@ -69,14 +69,18 @@ def test_anon_constructor_error_shape_keyword_missing(test, device):
69
69
  )
70
70
 
71
71
 
72
- def test_anon_constructor_error_dtype_keyword_missing(test, device):
72
+ def test_anon_constructor_error_shape_mismatch(test, device):
73
73
  @wp.kernel
74
74
  def kernel():
75
- wp.matrix(shape=(3, 3))
75
+ wp.matrix(
76
+ wp.matrix(shape=(1, 2), dtype=float),
77
+ shape=(3, 4),
78
+ dtype=float,
79
+ )
76
80
 
77
81
  with test.assertRaisesRegex(
78
82
  RuntimeError,
79
- r"matrix\(\) must have dtype as a keyword argument if it has no " r"positional arguments$",
83
+ r"incompatible matrix of shape \(3, 4\) given when copy constructing a matrix of shape \(1, 2\)$",
80
84
  ):
81
85
  wp.launch(
82
86
  kernel,
@@ -86,18 +90,14 @@ def test_anon_constructor_error_dtype_keyword_missing(test, device):
86
90
  )
87
91
 
88
92
 
89
- def test_anon_constructor_error_shape_mismatch(test, device):
93
+ def test_anon_constructor_error_type_mismatch(test, device):
90
94
  @wp.kernel
91
95
  def kernel():
92
- wp.matrix(
93
- wp.matrix(shape=(1, 2), dtype=float),
94
- shape=(3, 4),
95
- dtype=float,
96
- )
96
+ wp.matrix(1.0, shape=(3, 2), dtype=wp.float16)
97
97
 
98
98
  with test.assertRaisesRegex(
99
99
  RuntimeError,
100
- r"Incompatible matrix sizes for casting copy constructor, " r"\(3, 4\) vs \(1, 2\)$",
100
+ r"the value used to fill this matrix is expected to be of the type `float16`$",
101
101
  ):
102
102
  wp.launch(
103
103
  kernel,
@@ -114,8 +114,7 @@ def test_anon_constructor_error_invalid_arg_count(test, device):
114
114
 
115
115
  with test.assertRaisesRegex(
116
116
  RuntimeError,
117
- r"Wrong number of arguments for matrix\(\) function, must initialize "
118
- r"with either a scalar value, or m\*n values$",
117
+ r"incompatible number of values given \(3\) when constructing a matrix of shape \(2, 2\)$",
119
118
  ):
120
119
  wp.launch(
121
120
  kernel,
@@ -125,14 +124,14 @@ def test_anon_constructor_error_invalid_arg_count(test, device):
125
124
  )
126
125
 
127
126
 
128
- def test_tpl_constructor_error_incompatible_sizes(test, device):
127
+ def test_anon_xform_constructor_error_type_mismatch(test, device):
129
128
  @wp.kernel
130
129
  def kernel():
131
- wp.mat33(wp.mat22(1.0, 2.0, 3.0, 4.0))
130
+ wp.matrix(wp.vec3(1.0, 2.0, 3.0), wp.quat(0.0, 0.0, 0.0, 1.0), wp.vec3(2.0, 2.0, 2.0), wp.float64)
132
131
 
133
132
  with test.assertRaisesRegex(
134
133
  RuntimeError,
135
- r"Incompatible matrix sizes for casting copy constructor, " r"\(3, 3\) vs \(2, 2\)$",
134
+ r"all values used to initialize this transformation matrix are expected to be of the type `float64`$",
136
135
  ):
137
136
  wp.launch(
138
137
  kernel,
@@ -142,14 +141,14 @@ def test_tpl_constructor_error_incompatible_sizes(test, device):
142
141
  )
143
142
 
144
143
 
145
- def test_tpl_constructor_error_invalid_scalar_type(test, device):
144
+ def test_tpl_constructor_error_incompatible_sizes(test, device):
146
145
  @wp.kernel
147
146
  def kernel():
148
- wp.mat22(1, 2, 3, 4)
147
+ wp.mat33(wp.mat22(1.0, 2.0, 3.0, 4.0))
149
148
 
150
149
  with test.assertRaisesRegex(
151
150
  RuntimeError,
152
- r"Wrong scalar type for mat 2,2,<class 'warp.types.float32'> constructor$",
151
+ r"incompatible matrix of shape \(3, 3\) given when copy constructing a matrix of shape \(2, 2\)$",
153
152
  ):
154
153
  wp.launch(
155
154
  kernel,
@@ -162,11 +161,11 @@ def test_tpl_constructor_error_invalid_scalar_type(test, device):
162
161
  def test_tpl_constructor_error_invalid_vector_count(test, device):
163
162
  @wp.kernel
164
163
  def kernel():
165
- wp.mat22(wp.vec3(1.0, 2.0, 3.0))
164
+ wp.mat33(wp.vec3(1.0, 2.0, 3.0), wp.vec3(1.0, 2.0, 3.0))
166
165
 
167
166
  with test.assertRaisesRegex(
168
167
  RuntimeError,
169
- r"Wrong number of vectors when attempting to construct a matrix " r"with column vectors$",
168
+ r"incompatible number of column vectors given \(2\) when constructing a matrix of shape \(3, 3\)$",
170
169
  ):
171
170
  wp.launch(
172
171
  kernel,
@@ -183,7 +182,7 @@ def test_tpl_constructor_error_invalid_vector_shape(test, device):
183
182
 
184
183
  with test.assertRaisesRegex(
185
184
  RuntimeError,
186
- r"Wrong vector row count when attempting to construct a matrix " r"with column vectors$",
185
+ r"incompatible column vector lengths given when constructing a matrix of shape \(2, 2\)$",
187
186
  ):
188
187
  wp.launch(
189
188
  kernel,
@@ -200,7 +199,7 @@ def test_tpl_constructor_error_invalid_arg_count(test, device):
200
199
 
201
200
  with test.assertRaisesRegex(
202
201
  RuntimeError,
203
- r"Wrong number of scalars when attempting to construct a matrix " r"from a list of components$",
202
+ r"incompatible number of values given \(3\) when constructing a matrix of shape \(2, 2\)$",
204
203
  ):
205
204
  wp.launch(
206
205
  kernel,
@@ -1716,20 +1715,20 @@ for dtype in np_signed_int_types + np_float_types:
1716
1715
 
1717
1716
  add_function_test(
1718
1717
  TestMat,
1719
- "test_anon_constructor_error_shape_keyword_missing",
1720
- test_anon_constructor_error_shape_keyword_missing,
1718
+ "test_anon_constructor_error_shape_arg_missing",
1719
+ test_anon_constructor_error_shape_arg_missing,
1721
1720
  devices=devices,
1722
1721
  )
1723
1722
  add_function_test(
1724
1723
  TestMat,
1725
- "test_anon_constructor_error_dtype_keyword_missing",
1726
- test_anon_constructor_error_dtype_keyword_missing,
1724
+ "test_anon_constructor_error_shape_mismatch",
1725
+ test_anon_constructor_error_shape_mismatch,
1727
1726
  devices=devices,
1728
1727
  )
1729
1728
  add_function_test(
1730
1729
  TestMat,
1731
- "test_anon_constructor_error_shape_mismatch",
1732
- test_anon_constructor_error_shape_mismatch,
1730
+ "test_anon_constructor_error_type_mismatch",
1731
+ test_anon_constructor_error_type_mismatch,
1733
1732
  devices=devices,
1734
1733
  )
1735
1734
  add_function_test(
@@ -1740,14 +1739,14 @@ add_function_test(
1740
1739
  )
1741
1740
  add_function_test(
1742
1741
  TestMat,
1743
- "test_tpl_constructor_error_incompatible_sizes",
1744
- test_tpl_constructor_error_incompatible_sizes,
1742
+ "test_anon_xform_constructor_error_type_mismatch",
1743
+ test_anon_xform_constructor_error_type_mismatch,
1745
1744
  devices=devices,
1746
1745
  )
1747
1746
  add_function_test(
1748
1747
  TestMat,
1749
- "test_tpl_constructor_error_invalid_scalar_type",
1750
- test_tpl_constructor_error_invalid_scalar_type,
1748
+ "test_tpl_constructor_error_incompatible_sizes",
1749
+ test_tpl_constructor_error_incompatible_sizes,
1751
1750
  devices=devices,
1752
1751
  )
1753
1752
  add_function_test(
@@ -1795,5 +1794,5 @@ for dtype in np_float_types:
1795
1794
 
1796
1795
 
1797
1796
  if __name__ == "__main__":
1798
- wp.build.clear_kernel_cache()
1797
+ wp.clear_kernel_cache()
1799
1798
  unittest.main(verbosity=2, failfast=True)
@@ -24,6 +24,7 @@ def test_matrix_constructor_value_func():
24
24
  wp.vec3d(wp.float64(1.0), wp.float64(2.0), wp.float64(3.0)),
25
25
  wp.vec3d(wp.float64(1.0), wp.float64(2.0), wp.float64(3.0)),
26
26
  )
27
+ g = wp.matrix(1.0, shape=(3, 2))
27
28
 
28
29
 
29
30
  # Test matrix constructors using explicit type (float16)
@@ -109,5 +110,5 @@ add_kernel_test(TestMatLite, test_constructors_default_precision, dim=1, devices
109
110
 
110
111
 
111
112
  if __name__ == "__main__":
112
- wp.build.clear_kernel_cache()
113
+ wp.clear_kernel_cache()
113
114
  unittest.main(verbosity=2, failfast=True)
@@ -2901,5 +2901,5 @@ for dtype in np_scalar_types:
2901
2901
 
2902
2902
 
2903
2903
  if __name__ == "__main__":
2904
- wp.build.clear_kernel_cache()
2904
+ wp.clear_kernel_cache()
2905
2905
  unittest.main(verbosity=2, failfast=True)
warp/tests/test_math.py CHANGED
@@ -120,5 +120,5 @@ add_function_test(TestMath, "test_scalar_math", test_scalar_math, devices=device
120
120
 
121
121
 
122
122
  if __name__ == "__main__":
123
- wp.build.clear_kernel_cache()
123
+ wp.clear_kernel_cache()
124
124
  unittest.main(verbosity=2)