warp-lang 1.2.1__py3-none-manylinux2014_x86_64.whl → 1.3.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 -6
- warp/autograd.py +823 -0
- warp/bin/warp.so +0 -0
- warp/build.py +6 -2
- warp/builtins.py +1410 -886
- warp/codegen.py +503 -166
- warp/config.py +48 -18
- warp/context.py +401 -199
- warp/dlpack.py +8 -0
- warp/examples/assets/bunny.usd +0 -0
- warp/examples/benchmarks/benchmark_cloth_warp.py +1 -1
- warp/examples/benchmarks/benchmark_interop_torch.py +158 -0
- warp/examples/benchmarks/benchmark_launches.py +1 -1
- warp/examples/core/example_cupy.py +78 -0
- warp/examples/fem/example_apic_fluid.py +17 -36
- warp/examples/fem/example_burgers.py +9 -18
- warp/examples/fem/example_convection_diffusion.py +7 -17
- warp/examples/fem/example_convection_diffusion_dg.py +27 -47
- warp/examples/fem/example_deformed_geometry.py +11 -22
- warp/examples/fem/example_diffusion.py +7 -18
- warp/examples/fem/example_diffusion_3d.py +24 -28
- warp/examples/fem/example_diffusion_mgpu.py +7 -14
- warp/examples/fem/example_magnetostatics.py +190 -0
- warp/examples/fem/example_mixed_elasticity.py +111 -80
- warp/examples/fem/example_navier_stokes.py +30 -34
- warp/examples/fem/example_nonconforming_contact.py +290 -0
- warp/examples/fem/example_stokes.py +17 -32
- warp/examples/fem/example_stokes_transfer.py +12 -21
- warp/examples/fem/example_streamlines.py +350 -0
- warp/examples/fem/utils.py +936 -0
- warp/fabric.py +5 -2
- warp/fem/__init__.py +13 -3
- warp/fem/cache.py +161 -11
- warp/fem/dirichlet.py +37 -28
- warp/fem/domain.py +105 -14
- warp/fem/field/__init__.py +14 -3
- warp/fem/field/field.py +454 -11
- warp/fem/field/nodal_field.py +33 -18
- warp/fem/geometry/deformed_geometry.py +50 -15
- warp/fem/geometry/hexmesh.py +12 -24
- warp/fem/geometry/nanogrid.py +106 -31
- warp/fem/geometry/quadmesh_2d.py +6 -11
- warp/fem/geometry/tetmesh.py +103 -61
- warp/fem/geometry/trimesh_2d.py +98 -47
- warp/fem/integrate.py +231 -186
- warp/fem/operator.py +14 -9
- warp/fem/quadrature/pic_quadrature.py +35 -9
- warp/fem/quadrature/quadrature.py +119 -32
- warp/fem/space/basis_space.py +98 -22
- warp/fem/space/collocated_function_space.py +3 -1
- warp/fem/space/function_space.py +7 -2
- warp/fem/space/grid_2d_function_space.py +3 -3
- warp/fem/space/grid_3d_function_space.py +4 -4
- warp/fem/space/hexmesh_function_space.py +3 -2
- warp/fem/space/nanogrid_function_space.py +12 -14
- warp/fem/space/partition.py +45 -47
- warp/fem/space/restriction.py +19 -16
- warp/fem/space/shape/cube_shape_function.py +91 -3
- warp/fem/space/shape/shape_function.py +7 -0
- warp/fem/space/shape/square_shape_function.py +32 -0
- warp/fem/space/shape/tet_shape_function.py +11 -7
- warp/fem/space/shape/triangle_shape_function.py +10 -1
- warp/fem/space/topology.py +116 -42
- warp/fem/types.py +8 -1
- warp/fem/utils.py +301 -83
- warp/native/array.h +16 -0
- warp/native/builtin.h +0 -15
- warp/native/cuda_util.cpp +14 -6
- warp/native/exports.h +1348 -1308
- warp/native/quat.h +79 -0
- warp/native/rand.h +27 -4
- warp/native/sparse.cpp +83 -81
- warp/native/sparse.cu +381 -453
- warp/native/vec.h +64 -0
- warp/native/volume.cpp +40 -49
- warp/native/volume_builder.cu +2 -3
- warp/native/volume_builder.h +12 -17
- warp/native/warp.cu +3 -3
- warp/native/warp.h +69 -59
- warp/render/render_opengl.py +17 -9
- warp/sim/articulation.py +117 -17
- warp/sim/collide.py +35 -29
- warp/sim/model.py +123 -18
- warp/sim/render.py +3 -1
- warp/sparse.py +867 -203
- warp/stubs.py +312 -541
- warp/tape.py +29 -1
- warp/tests/disabled_kinematics.py +1 -1
- warp/tests/test_adam.py +1 -1
- warp/tests/test_arithmetic.py +1 -1
- warp/tests/test_array.py +58 -1
- warp/tests/test_array_reduce.py +1 -1
- warp/tests/test_async.py +1 -1
- warp/tests/test_atomic.py +1 -1
- warp/tests/test_bool.py +1 -1
- warp/tests/test_builtins_resolution.py +1 -1
- warp/tests/test_bvh.py +6 -1
- warp/tests/test_closest_point_edge_edge.py +1 -1
- warp/tests/test_codegen.py +66 -1
- warp/tests/test_compile_consts.py +1 -1
- warp/tests/test_conditional.py +1 -1
- warp/tests/test_copy.py +1 -1
- warp/tests/test_ctypes.py +1 -1
- warp/tests/test_dense.py +1 -1
- warp/tests/test_devices.py +1 -1
- warp/tests/test_dlpack.py +1 -1
- warp/tests/test_examples.py +33 -4
- warp/tests/test_fabricarray.py +5 -2
- warp/tests/test_fast_math.py +1 -1
- warp/tests/test_fem.py +213 -6
- warp/tests/test_fp16.py +1 -1
- warp/tests/test_func.py +1 -1
- warp/tests/test_future_annotations.py +90 -0
- warp/tests/test_generics.py +1 -1
- warp/tests/test_grad.py +1 -1
- warp/tests/test_grad_customs.py +1 -1
- warp/tests/test_grad_debug.py +247 -0
- warp/tests/test_hash_grid.py +6 -1
- warp/tests/test_implicit_init.py +354 -0
- warp/tests/test_import.py +1 -1
- warp/tests/test_indexedarray.py +1 -1
- warp/tests/test_intersect.py +1 -1
- warp/tests/test_jax.py +1 -1
- warp/tests/test_large.py +1 -1
- warp/tests/test_launch.py +1 -1
- warp/tests/test_lerp.py +1 -1
- warp/tests/test_linear_solvers.py +1 -1
- warp/tests/test_lvalue.py +1 -1
- warp/tests/test_marching_cubes.py +5 -2
- warp/tests/test_mat.py +34 -35
- warp/tests/test_mat_lite.py +2 -1
- warp/tests/test_mat_scalar_ops.py +1 -1
- warp/tests/test_math.py +1 -1
- warp/tests/test_matmul.py +20 -16
- warp/tests/test_matmul_lite.py +1 -1
- warp/tests/test_mempool.py +1 -1
- warp/tests/test_mesh.py +5 -2
- warp/tests/test_mesh_query_aabb.py +1 -1
- warp/tests/test_mesh_query_point.py +1 -1
- warp/tests/test_mesh_query_ray.py +1 -1
- warp/tests/test_mlp.py +1 -1
- warp/tests/test_model.py +1 -1
- warp/tests/test_module_hashing.py +77 -1
- warp/tests/test_modules_lite.py +1 -1
- warp/tests/test_multigpu.py +1 -1
- warp/tests/test_noise.py +1 -1
- warp/tests/test_operators.py +1 -1
- warp/tests/test_options.py +1 -1
- warp/tests/test_overwrite.py +542 -0
- warp/tests/test_peer.py +1 -1
- warp/tests/test_pinned.py +1 -1
- warp/tests/test_print.py +1 -1
- warp/tests/test_quat.py +15 -1
- warp/tests/test_rand.py +1 -1
- warp/tests/test_reload.py +1 -1
- warp/tests/test_rounding.py +1 -1
- warp/tests/test_runlength_encode.py +1 -1
- warp/tests/test_scalar_ops.py +95 -0
- warp/tests/test_sim_grad.py +1 -1
- warp/tests/test_sim_kinematics.py +1 -1
- warp/tests/test_smoothstep.py +1 -1
- warp/tests/test_sparse.py +82 -15
- warp/tests/test_spatial.py +1 -1
- warp/tests/test_special_values.py +2 -11
- warp/tests/test_streams.py +11 -1
- warp/tests/test_struct.py +1 -1
- warp/tests/test_tape.py +1 -1
- warp/tests/test_torch.py +194 -1
- warp/tests/test_transient_module.py +1 -1
- warp/tests/test_types.py +1 -1
- warp/tests/test_utils.py +1 -1
- warp/tests/test_vec.py +15 -63
- warp/tests/test_vec_lite.py +2 -1
- warp/tests/test_vec_scalar_ops.py +122 -39
- warp/tests/test_verify_fp.py +1 -1
- warp/tests/test_volume.py +28 -2
- warp/tests/test_volume_write.py +1 -1
- warp/tests/unittest_serial.py +1 -1
- warp/tests/unittest_suites.py +9 -1
- warp/tests/walkthrough_debug.py +1 -1
- warp/thirdparty/unittest_parallel.py +2 -5
- warp/torch.py +103 -41
- warp/types.py +344 -227
- warp/utils.py +11 -2
- {warp_lang-1.2.1.dist-info → warp_lang-1.3.0.dist-info}/METADATA +99 -46
- warp_lang-1.3.0.dist-info/RECORD +368 -0
- warp/examples/fem/bsr_utils.py +0 -378
- warp/examples/fem/mesh_utils.py +0 -133
- warp/examples/fem/plot_utils.py +0 -292
- warp_lang-1.2.1.dist-info/RECORD +0 -359
- {warp_lang-1.2.1.dist-info → warp_lang-1.3.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.2.1.dist-info → warp_lang-1.3.0.dist-info}/WHEEL +0 -0
- {warp_lang-1.2.1.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
warp/tests/test_indexedarray.py
CHANGED
warp/tests/test_intersect.py
CHANGED
warp/tests/test_jax.py
CHANGED
warp/tests/test_large.py
CHANGED
warp/tests/test_launch.py
CHANGED
warp/tests/test_lerp.py
CHANGED
|
@@ -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.
|
|
188
|
+
wp.clear_kernel_cache()
|
|
189
189
|
unittest.main(verbosity=2)
|
warp/tests/test_lvalue.py
CHANGED
|
@@ -52,12 +52,15 @@ devices = get_selected_cuda_test_devices()
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
class TestMarchingCubes(unittest.TestCase):
|
|
55
|
-
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
72
|
+
def test_anon_constructor_error_shape_mismatch(test, device):
|
|
73
73
|
@wp.kernel
|
|
74
74
|
def kernel():
|
|
75
|
-
wp.matrix(
|
|
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\(\)
|
|
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
|
|
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"
|
|
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"
|
|
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
|
|
127
|
+
def test_anon_xform_constructor_error_type_mismatch(test, device):
|
|
129
128
|
@wp.kernel
|
|
130
129
|
def kernel():
|
|
131
|
-
wp.
|
|
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"
|
|
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
|
|
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"
|
|
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.
|
|
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"
|
|
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"
|
|
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"
|
|
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
|
-
"
|
|
1720
|
-
|
|
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
|
-
"
|
|
1726
|
-
|
|
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
|
-
"
|
|
1732
|
-
|
|
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
|
-
"
|
|
1744
|
-
|
|
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
|
-
"
|
|
1750
|
-
|
|
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.
|
|
1797
|
+
wp.clear_kernel_cache()
|
|
1799
1798
|
unittest.main(verbosity=2, failfast=True)
|
warp/tests/test_mat_lite.py
CHANGED
|
@@ -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.
|
|
113
|
+
wp.clear_kernel_cache()
|
|
113
114
|
unittest.main(verbosity=2, failfast=True)
|
warp/tests/test_math.py
CHANGED