warp-lang 1.6.2__py3-none-macosx_10_13_universal2.whl → 1.7.1__py3-none-macosx_10_13_universal2.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 +7 -1
- warp/autograd.py +12 -2
- warp/bin/libwarp-clang.dylib +0 -0
- warp/bin/libwarp.dylib +0 -0
- warp/build.py +410 -0
- warp/build_dll.py +6 -14
- warp/builtins.py +463 -372
- warp/codegen.py +196 -124
- warp/config.py +42 -6
- warp/context.py +496 -271
- warp/dlpack.py +8 -6
- warp/examples/assets/nonuniform.usd +0 -0
- warp/examples/assets/nvidia_logo.png +0 -0
- warp/examples/benchmarks/benchmark_cloth.py +1 -1
- warp/examples/benchmarks/benchmark_tile_load_store.py +103 -0
- warp/examples/core/example_sample_mesh.py +300 -0
- warp/examples/distributed/example_jacobi_mpi.py +507 -0
- warp/examples/fem/example_apic_fluid.py +1 -1
- warp/examples/fem/example_burgers.py +2 -2
- warp/examples/fem/example_deformed_geometry.py +1 -1
- warp/examples/fem/example_distortion_energy.py +1 -1
- warp/examples/fem/example_magnetostatics.py +6 -6
- warp/examples/fem/utils.py +9 -3
- warp/examples/interop/example_jax_callable.py +116 -0
- warp/examples/interop/example_jax_ffi_callback.py +132 -0
- warp/examples/interop/example_jax_kernel.py +205 -0
- warp/examples/optim/example_fluid_checkpoint.py +497 -0
- warp/examples/tile/example_tile_matmul.py +2 -4
- warp/fem/__init__.py +11 -1
- warp/fem/adaptivity.py +4 -4
- warp/fem/field/field.py +11 -1
- warp/fem/field/nodal_field.py +56 -88
- warp/fem/field/virtual.py +62 -23
- warp/fem/geometry/adaptive_nanogrid.py +16 -13
- warp/fem/geometry/closest_point.py +1 -1
- warp/fem/geometry/deformed_geometry.py +5 -2
- warp/fem/geometry/geometry.py +5 -0
- warp/fem/geometry/grid_2d.py +12 -12
- warp/fem/geometry/grid_3d.py +12 -15
- warp/fem/geometry/hexmesh.py +5 -7
- warp/fem/geometry/nanogrid.py +9 -11
- warp/fem/geometry/quadmesh.py +13 -13
- warp/fem/geometry/tetmesh.py +3 -4
- warp/fem/geometry/trimesh.py +7 -20
- warp/fem/integrate.py +262 -93
- warp/fem/linalg.py +5 -5
- warp/fem/quadrature/pic_quadrature.py +37 -22
- warp/fem/quadrature/quadrature.py +194 -25
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/basis_function_space.py +4 -2
- warp/fem/space/basis_space.py +25 -18
- warp/fem/space/hexmesh_function_space.py +2 -2
- warp/fem/space/partition.py +6 -2
- warp/fem/space/quadmesh_function_space.py +8 -8
- warp/fem/space/shape/cube_shape_function.py +23 -23
- warp/fem/space/shape/square_shape_function.py +12 -12
- warp/fem/space/shape/triangle_shape_function.py +1 -1
- warp/fem/space/tetmesh_function_space.py +3 -3
- warp/fem/space/trimesh_function_space.py +2 -2
- warp/fem/utils.py +12 -6
- warp/jax.py +14 -1
- warp/jax_experimental/__init__.py +16 -0
- warp/{jax_experimental.py → jax_experimental/custom_call.py} +28 -29
- warp/jax_experimental/ffi.py +702 -0
- warp/jax_experimental/xla_ffi.py +602 -0
- warp/math.py +89 -0
- warp/native/array.h +13 -0
- warp/native/builtin.h +29 -3
- warp/native/bvh.cpp +3 -1
- warp/native/bvh.cu +42 -14
- warp/native/bvh.h +2 -1
- warp/native/clang/clang.cpp +30 -3
- warp/native/cuda_util.cpp +14 -0
- warp/native/cuda_util.h +2 -0
- warp/native/exports.h +68 -63
- warp/native/intersect.h +26 -26
- warp/native/intersect_adj.h +33 -33
- warp/native/marching.cu +1 -1
- warp/native/mat.h +513 -9
- warp/native/mesh.h +10 -10
- warp/native/quat.h +99 -11
- warp/native/rand.h +6 -0
- warp/native/sort.cpp +122 -59
- warp/native/sort.cu +152 -15
- warp/native/sort.h +8 -1
- warp/native/sparse.cpp +43 -22
- warp/native/sparse.cu +52 -17
- warp/native/svd.h +116 -0
- warp/native/tile.h +312 -116
- warp/native/tile_reduce.h +46 -3
- warp/native/vec.h +68 -7
- warp/native/volume.cpp +85 -113
- warp/native/volume_builder.cu +25 -10
- warp/native/volume_builder.h +6 -0
- warp/native/warp.cpp +5 -6
- warp/native/warp.cu +100 -11
- warp/native/warp.h +19 -10
- warp/optim/linear.py +10 -10
- warp/render/render_opengl.py +19 -17
- warp/render/render_usd.py +93 -3
- warp/sim/articulation.py +4 -4
- warp/sim/collide.py +32 -19
- warp/sim/import_mjcf.py +449 -155
- warp/sim/import_urdf.py +32 -12
- warp/sim/inertia.py +189 -156
- warp/sim/integrator_euler.py +8 -5
- warp/sim/integrator_featherstone.py +3 -10
- warp/sim/integrator_vbd.py +207 -2
- warp/sim/integrator_xpbd.py +8 -5
- warp/sim/model.py +71 -25
- warp/sim/render.py +4 -0
- warp/sim/utils.py +2 -2
- warp/sparse.py +642 -555
- warp/stubs.py +217 -20
- warp/tests/__main__.py +0 -15
- warp/tests/assets/torus.usda +1 -1
- warp/tests/cuda/__init__.py +0 -0
- warp/tests/{test_mempool.py → cuda/test_mempool.py} +39 -0
- warp/tests/{test_streams.py → cuda/test_streams.py} +71 -0
- warp/tests/geometry/__init__.py +0 -0
- warp/tests/{test_mesh_query_point.py → geometry/test_mesh_query_point.py} +66 -63
- warp/tests/{test_mesh_query_ray.py → geometry/test_mesh_query_ray.py} +1 -1
- warp/tests/{test_volume.py → geometry/test_volume.py} +41 -6
- warp/tests/interop/__init__.py +0 -0
- warp/tests/{test_dlpack.py → interop/test_dlpack.py} +28 -5
- warp/tests/sim/__init__.py +0 -0
- warp/tests/{disabled_kinematics.py → sim/disabled_kinematics.py} +9 -10
- warp/tests/{test_collision.py → sim/test_collision.py} +236 -205
- warp/tests/sim/test_inertia.py +161 -0
- warp/tests/{test_model.py → sim/test_model.py} +40 -0
- warp/tests/{flaky_test_sim_grad.py → sim/test_sim_grad.py} +4 -0
- warp/tests/{test_sim_kinematics.py → sim/test_sim_kinematics.py} +2 -1
- warp/tests/sim/test_vbd.py +597 -0
- warp/tests/sim/test_xpbd.py +399 -0
- warp/tests/test_bool.py +1 -1
- warp/tests/test_codegen.py +24 -3
- warp/tests/test_examples.py +40 -38
- warp/tests/test_fem.py +98 -14
- warp/tests/test_linear_solvers.py +0 -11
- warp/tests/test_mat.py +577 -156
- warp/tests/test_mat_scalar_ops.py +4 -4
- warp/tests/test_overwrite.py +0 -60
- warp/tests/test_quat.py +356 -151
- warp/tests/test_rand.py +44 -37
- warp/tests/test_sparse.py +47 -6
- warp/tests/test_spatial.py +75 -0
- warp/tests/test_static.py +1 -1
- warp/tests/test_utils.py +84 -4
- warp/tests/test_vec.py +336 -178
- warp/tests/tile/__init__.py +0 -0
- warp/tests/{test_tile.py → tile/test_tile.py} +136 -51
- warp/tests/{test_tile_load.py → tile/test_tile_load.py} +98 -1
- warp/tests/{test_tile_mathdx.py → tile/test_tile_mathdx.py} +9 -6
- warp/tests/{test_tile_mlp.py → tile/test_tile_mlp.py} +25 -14
- warp/tests/{test_tile_reduce.py → tile/test_tile_reduce.py} +60 -1
- warp/tests/{test_tile_view.py → tile/test_tile_view.py} +1 -1
- warp/tests/unittest_serial.py +1 -0
- warp/tests/unittest_suites.py +45 -62
- warp/tests/unittest_utils.py +2 -1
- warp/thirdparty/unittest_parallel.py +3 -1
- warp/types.py +175 -666
- warp/utils.py +137 -72
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/METADATA +46 -12
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/RECORD +184 -171
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/WHEEL +1 -1
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info/licenses}/LICENSE.md +0 -26
- warp/examples/optim/example_walker.py +0 -317
- warp/native/cutlass_gemm.cpp +0 -43
- warp/native/cutlass_gemm.cu +0 -382
- warp/tests/test_matmul.py +0 -511
- warp/tests/test_matmul_lite.py +0 -411
- warp/tests/test_vbd.py +0 -386
- warp/tests/unused_test_misc.py +0 -77
- /warp/tests/{test_async.py → cuda/test_async.py} +0 -0
- /warp/tests/{test_ipc.py → cuda/test_ipc.py} +0 -0
- /warp/tests/{test_multigpu.py → cuda/test_multigpu.py} +0 -0
- /warp/tests/{test_peer.py → cuda/test_peer.py} +0 -0
- /warp/tests/{test_pinned.py → cuda/test_pinned.py} +0 -0
- /warp/tests/{test_bvh.py → geometry/test_bvh.py} +0 -0
- /warp/tests/{test_hash_grid.py → geometry/test_hash_grid.py} +0 -0
- /warp/tests/{test_marching_cubes.py → geometry/test_marching_cubes.py} +0 -0
- /warp/tests/{test_mesh.py → geometry/test_mesh.py} +0 -0
- /warp/tests/{test_mesh_query_aabb.py → geometry/test_mesh_query_aabb.py} +0 -0
- /warp/tests/{test_volume_write.py → geometry/test_volume_write.py} +0 -0
- /warp/tests/{test_jax.py → interop/test_jax.py} +0 -0
- /warp/tests/{test_paddle.py → interop/test_paddle.py} +0 -0
- /warp/tests/{test_torch.py → interop/test_torch.py} +0 -0
- /warp/tests/{test_coloring.py → sim/test_coloring.py} +0 -0
- /warp/tests/{test_sim_grad_bounce_linear.py → sim/test_sim_grad_bounce_linear.py} +0 -0
- /warp/tests/{test_tile_shared_memory.py → tile/test_tile_shared_memory.py} +0 -0
- {warp_lang-1.6.2.dist-info → warp_lang-1.7.1.dist-info}/top_level.txt +0 -0
warp/tests/test_fem.py
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
import math
|
|
17
|
+
import platform
|
|
17
18
|
import unittest
|
|
18
19
|
from typing import Any
|
|
19
20
|
|
|
@@ -33,6 +34,7 @@ from warp.fem.utils import (
|
|
|
33
34
|
grid_to_tets,
|
|
34
35
|
grid_to_tris,
|
|
35
36
|
)
|
|
37
|
+
from warp.sparse import bsr_zeros
|
|
36
38
|
from warp.tests.unittest_utils import *
|
|
37
39
|
|
|
38
40
|
vec6f = wp.vec(length=6, dtype=float)
|
|
@@ -147,11 +149,12 @@ def test_interpolate_gradient(test, device):
|
|
|
147
149
|
scalar_space = fem.make_polynomial_space(geo, degree=2)
|
|
148
150
|
|
|
149
151
|
# Point-based vector space
|
|
150
|
-
# So we can test gradient with respect to
|
|
152
|
+
# So we can test gradient with respect to interpolation point position
|
|
151
153
|
point_coords = wp.array([[[0.5, 0.5, 0.0]]], dtype=fem.Coords, requires_grad=True)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
point_quadrature = fem.ExplicitQuadrature(
|
|
155
|
+
domain=fem.Cells(geo), points=point_coords, weights=wp.array([[1.0]], dtype=float)
|
|
154
156
|
)
|
|
157
|
+
interpolation_nodes = fem.PointBasisSpace(point_quadrature)
|
|
155
158
|
vector_space = fem.make_collocated_function_space(interpolation_nodes, dtype=wp.vec2)
|
|
156
159
|
|
|
157
160
|
# Initialize scalar field with known function
|
|
@@ -213,6 +216,23 @@ def test_interpolate_gradient(test, device):
|
|
|
213
216
|
)
|
|
214
217
|
assert_np_equal(point_coords.grad.numpy(), np.array([[[2.0, 0.0, 0.0]]]))
|
|
215
218
|
|
|
219
|
+
# Compare against jacobian
|
|
220
|
+
scalar_trial = fem.make_trial(scalar_space)
|
|
221
|
+
jacobian = bsr_zeros(
|
|
222
|
+
rows_of_blocks=point_quadrature.total_point_count(),
|
|
223
|
+
cols_of_blocks=scalar_space.node_count(),
|
|
224
|
+
block_type=wp.mat(shape=(2, 1), dtype=float),
|
|
225
|
+
)
|
|
226
|
+
fem.interpolate(
|
|
227
|
+
grad_field,
|
|
228
|
+
dest=jacobian,
|
|
229
|
+
quadrature=point_quadrature,
|
|
230
|
+
fields={"p": scalar_trial},
|
|
231
|
+
kernel_options={"enable_backward": False},
|
|
232
|
+
)
|
|
233
|
+
assert jacobian.nnz_sync() == 4 # one non-zero per edge center
|
|
234
|
+
assert_np_equal((jacobian @ scalar_field.dof_values.grad).numpy(), [[0.0, 0.5]])
|
|
235
|
+
|
|
216
236
|
|
|
217
237
|
@integrand
|
|
218
238
|
def vector_divergence_form(s: Sample, u: Field, q: Field):
|
|
@@ -456,6 +476,22 @@ def _test_geo_cells(
|
|
|
456
476
|
wp.atomic_add(cell_measures, s.element_index, fem.measure(domain, s) * s.qp_weight)
|
|
457
477
|
|
|
458
478
|
|
|
479
|
+
@fem.integrand(kernel_options={"enable_backward": False})
|
|
480
|
+
def _test_cell_lookup(
|
|
481
|
+
s: fem.Sample,
|
|
482
|
+
domain: fem.Domain,
|
|
483
|
+
):
|
|
484
|
+
pos = domain(s)
|
|
485
|
+
|
|
486
|
+
s_guess = fem.lookup(domain, pos, s)
|
|
487
|
+
wp.expect_eq(s_guess.element_index, s.element_index)
|
|
488
|
+
wp.expect_near(domain(s_guess), pos, 0.001)
|
|
489
|
+
|
|
490
|
+
s_noguess = fem.lookup(domain, pos)
|
|
491
|
+
wp.expect_eq(s_noguess.element_index, s.element_index)
|
|
492
|
+
wp.expect_near(domain(s_noguess), pos, 0.001)
|
|
493
|
+
|
|
494
|
+
|
|
459
495
|
@fem.integrand(kernel_options={"enable_backward": False, "max_unroll": 1})
|
|
460
496
|
def _test_geo_sides(
|
|
461
497
|
s: fem.Sample,
|
|
@@ -508,7 +544,7 @@ def _test_side_normals(
|
|
|
508
544
|
wp.expect_near(F_cross[k], nor[k], 0.0001)
|
|
509
545
|
|
|
510
546
|
|
|
511
|
-
def _launch_test_geometry_kernel(geo: fem.Geometry, device):
|
|
547
|
+
def _launch_test_geometry_kernel(geo: fem.Geometry, device, test_cell_lookup: bool = True):
|
|
512
548
|
cell_measures = wp.zeros(dtype=float, device=device, shape=geo.cell_count())
|
|
513
549
|
cell_quadrature = fem.RegularQuadrature(fem.Cells(geo), order=2)
|
|
514
550
|
|
|
@@ -521,6 +557,12 @@ def _launch_test_geometry_kernel(geo: fem.Geometry, device):
|
|
|
521
557
|
quadrature=cell_quadrature,
|
|
522
558
|
values={"cell_measures": cell_measures},
|
|
523
559
|
)
|
|
560
|
+
if test_cell_lookup:
|
|
561
|
+
fem.interpolate(
|
|
562
|
+
_test_cell_lookup,
|
|
563
|
+
quadrature=cell_quadrature,
|
|
564
|
+
)
|
|
565
|
+
|
|
524
566
|
fem.interpolate(
|
|
525
567
|
_test_geo_sides,
|
|
526
568
|
quadrature=side_quadrature,
|
|
@@ -558,7 +600,7 @@ def test_triangle_mesh(test, device):
|
|
|
558
600
|
with wp.ScopedDevice(device):
|
|
559
601
|
positions, tri_vidx = _gen_trimesh(N, N)
|
|
560
602
|
|
|
561
|
-
geo = fem.Trimesh2D(tri_vertex_indices=tri_vidx, positions=positions)
|
|
603
|
+
geo = fem.Trimesh2D(tri_vertex_indices=tri_vidx, positions=positions, build_bvh=True)
|
|
562
604
|
|
|
563
605
|
test.assertEqual(geo.cell_count(), 2 * (N) ** 2)
|
|
564
606
|
test.assertEqual(geo.vertex_count(), (N + 1) ** 2)
|
|
@@ -576,7 +618,7 @@ def test_triangle_mesh(test, device):
|
|
|
576
618
|
positions = np.hstack((positions, np.ones((positions.shape[0], 1))))
|
|
577
619
|
positions = wp.array(positions, device=device, dtype=wp.vec3)
|
|
578
620
|
|
|
579
|
-
geo = fem.Trimesh3D(tri_vertex_indices=tri_vidx, positions=positions)
|
|
621
|
+
geo = fem.Trimesh3D(tri_vertex_indices=tri_vidx, positions=positions, build_bvh=True)
|
|
580
622
|
|
|
581
623
|
test.assertEqual(geo.cell_count(), 2 * (N) ** 2)
|
|
582
624
|
test.assertEqual(geo.vertex_count(), (N + 1) ** 2)
|
|
@@ -602,7 +644,7 @@ def test_quad_mesh(test, device):
|
|
|
602
644
|
test.assertEqual(geo.side_count(), 2 * (N + 1) * N)
|
|
603
645
|
test.assertEqual(geo.boundary_side_count(), 4 * N)
|
|
604
646
|
|
|
605
|
-
side_measures, cell_measures = _launch_test_geometry_kernel(geo, device)
|
|
647
|
+
side_measures, cell_measures = _launch_test_geometry_kernel(geo, device, test_cell_lookup=False)
|
|
606
648
|
|
|
607
649
|
assert_np_equal(side_measures.numpy(), np.full(side_measures.shape, 1.0 / (N)), tol=1.0e-4)
|
|
608
650
|
assert_np_equal(cell_measures.numpy(), np.full(cell_measures.shape, 1.0 / (N**2)), tol=1.0e-4)
|
|
@@ -620,7 +662,7 @@ def test_quad_mesh(test, device):
|
|
|
620
662
|
test.assertEqual(geo.side_count(), 2 * (N + 1) * N)
|
|
621
663
|
test.assertEqual(geo.boundary_side_count(), 4 * N)
|
|
622
664
|
|
|
623
|
-
side_measures, cell_measures = _launch_test_geometry_kernel(geo, device)
|
|
665
|
+
side_measures, cell_measures = _launch_test_geometry_kernel(geo, device, test_cell_lookup=False)
|
|
624
666
|
|
|
625
667
|
assert_np_equal(side_measures.numpy(), np.full(side_measures.shape, 1.0 / (N)), tol=1.0e-4)
|
|
626
668
|
assert_np_equal(cell_measures.numpy(), np.full(cell_measures.shape, 1.0 / (N**2)), tol=1.0e-4)
|
|
@@ -649,7 +691,7 @@ def test_tet_mesh(test, device):
|
|
|
649
691
|
with wp.ScopedDevice(device):
|
|
650
692
|
positions, tet_vidx = _gen_tetmesh(N, N, N)
|
|
651
693
|
|
|
652
|
-
geo = fem.Tetmesh(tet_vertex_indices=tet_vidx, positions=positions)
|
|
694
|
+
geo = fem.Tetmesh(tet_vertex_indices=tet_vidx, positions=positions, build_bvh=True)
|
|
653
695
|
|
|
654
696
|
test.assertEqual(geo.cell_count(), 5 * (N) ** 3)
|
|
655
697
|
test.assertEqual(geo.vertex_count(), (N + 1) ** 3)
|
|
@@ -677,7 +719,7 @@ def test_hex_mesh(test, device):
|
|
|
677
719
|
test.assertEqual(geo.boundary_side_count(), 6 * N * N)
|
|
678
720
|
test.assertEqual(geo.edge_count(), 3 * N * (N + 1) ** 2)
|
|
679
721
|
|
|
680
|
-
side_measures, cell_measures = _launch_test_geometry_kernel(geo, device)
|
|
722
|
+
side_measures, cell_measures = _launch_test_geometry_kernel(geo, device, test_cell_lookup=False)
|
|
681
723
|
|
|
682
724
|
assert_np_equal(side_measures.numpy(), np.full(side_measures.shape, 1.0 / (N**2)), tol=1.0e-4)
|
|
683
725
|
assert_np_equal(cell_measures.numpy(), np.full(cell_measures.shape, 1.0 / (N**3)), tol=1.0e-4)
|
|
@@ -713,6 +755,9 @@ def _refinement_field(x: wp.vec3):
|
|
|
713
755
|
def test_adaptive_nanogrid(test, device):
|
|
714
756
|
# 3 res-1 voxels, 8 res-0 voxels
|
|
715
757
|
|
|
758
|
+
if platform.system() == "Windows" or (device.is_cuda and wp.context.runtime.toolkit_version[0] == 11):
|
|
759
|
+
test.skipTest("Skipping test due to NVRTC bug on CUDA 11 and Windows")
|
|
760
|
+
|
|
716
761
|
res0 = wp.array(
|
|
717
762
|
[
|
|
718
763
|
[2, 2, 0],
|
|
@@ -737,7 +782,6 @@ def test_adaptive_nanogrid(test, device):
|
|
|
737
782
|
dtype=int,
|
|
738
783
|
device=device,
|
|
739
784
|
)
|
|
740
|
-
|
|
741
785
|
grid0 = wp.Volume.allocate_by_voxels(res0, 0.5, device=device)
|
|
742
786
|
grid1 = wp.Volume.allocate_by_voxels(res1, 1.0, device=device)
|
|
743
787
|
geo = fem.adaptive_nanogrid_from_hierarchy([grid0, grid1])
|
|
@@ -800,7 +844,7 @@ def test_deformed_geometry(test, device):
|
|
|
800
844
|
test.assertEqual(geo.side_count(), 6 * (N + 1) * N**2 + (N**3) * 4)
|
|
801
845
|
test.assertEqual(geo.boundary_side_count(), 12 * N * N)
|
|
802
846
|
|
|
803
|
-
side_measures, cell_measures = _launch_test_geometry_kernel(deformed_geo,
|
|
847
|
+
side_measures, cell_measures = _launch_test_geometry_kernel(deformed_geo, device, test_cell_lookup=False)
|
|
804
848
|
|
|
805
849
|
test.assertAlmostEqual(
|
|
806
850
|
np.sum(cell_measures.numpy()), scale**3, places=4, msg=f"cell_measures = {cell_measures.numpy()}"
|
|
@@ -834,6 +878,45 @@ def test_deformed_geometry(test, device):
|
|
|
834
878
|
],
|
|
835
879
|
)
|
|
836
880
|
|
|
881
|
+
# Test with Trimesh3d (different space and cell dimensions)
|
|
882
|
+
positions, tri_vidx = _gen_trimesh(N, N)
|
|
883
|
+
positions = positions.numpy()
|
|
884
|
+
positions = np.hstack((positions, np.ones((positions.shape[0], 1))))
|
|
885
|
+
positions = wp.array(positions, device=device, dtype=wp.vec3)
|
|
886
|
+
|
|
887
|
+
geo = fem.Trimesh3D(tri_vertex_indices=tri_vidx, positions=positions)
|
|
888
|
+
|
|
889
|
+
vector_space = fem.make_polynomial_space(geo, dtype=wp.vec3, degree=1)
|
|
890
|
+
pos_field = vector_space.make_field()
|
|
891
|
+
fem.interpolate(
|
|
892
|
+
_rigid_deformation_field,
|
|
893
|
+
dest=pos_field,
|
|
894
|
+
values={"translation": translation, "rotation": rotation, "scale": scale},
|
|
895
|
+
)
|
|
896
|
+
|
|
897
|
+
deformed_geo = pos_field.make_deformed_geometry()
|
|
898
|
+
|
|
899
|
+
@wp.kernel
|
|
900
|
+
def _test_deformed_geometry_normal(geo_arg: geo.CellArg, def_arg: deformed_geo.CellArg, rotation: wp.vec3):
|
|
901
|
+
i = wp.tid()
|
|
902
|
+
|
|
903
|
+
s = make_free_sample(i, Coords(0.5, 0.5, 0.0))
|
|
904
|
+
geo_n = geo.cell_normal(geo_arg, s)
|
|
905
|
+
def_n = deformed_geo.cell_normal(def_arg, s)
|
|
906
|
+
|
|
907
|
+
q = wp.quat_from_axis_angle(wp.normalize(rotation), wp.length(rotation))
|
|
908
|
+
wp.expect_near(wp.quat_rotate(q, geo_n), def_n, 0.001)
|
|
909
|
+
|
|
910
|
+
wp.launch(
|
|
911
|
+
_test_deformed_geometry_normal,
|
|
912
|
+
dim=geo.cell_count(),
|
|
913
|
+
inputs=[
|
|
914
|
+
geo.cell_arg_value(wp.get_device()),
|
|
915
|
+
deformed_geo.cell_arg_value(wp.get_device()),
|
|
916
|
+
rotation,
|
|
917
|
+
],
|
|
918
|
+
)
|
|
919
|
+
|
|
837
920
|
wp.synchronize()
|
|
838
921
|
|
|
839
922
|
|
|
@@ -1828,7 +1911,7 @@ def test_vector_spaces(test, device):
|
|
|
1828
1911
|
|
|
1829
1912
|
@wp.kernel
|
|
1830
1913
|
def test_qr_eigenvalues():
|
|
1831
|
-
tol =
|
|
1914
|
+
tol = 5.0e-7
|
|
1832
1915
|
|
|
1833
1916
|
# zero
|
|
1834
1917
|
Zero = wp.mat33(0.0)
|
|
@@ -1868,7 +1951,7 @@ def test_qr_eigenvalues():
|
|
|
1868
1951
|
wp.expect_near(wp.ddot(Err4, Err4), 0.0, tol)
|
|
1869
1952
|
|
|
1870
1953
|
# test robustness to low requested tolerance
|
|
1871
|
-
Rank6 =
|
|
1954
|
+
Rank6 = wp.matrix_from_cols(
|
|
1872
1955
|
vec6f(0.00171076, 0.0, 0.0, 0.0, 0.0, 0.0),
|
|
1873
1956
|
vec6f(0.0, 0.00169935, 6.14367e-06, -3.52589e-05, 3.02397e-05, -1.53458e-11),
|
|
1874
1957
|
vec6f(0.0, 6.14368e-06, 0.00172217, 2.03568e-05, 1.74589e-05, -2.92627e-05),
|
|
@@ -1965,6 +2048,7 @@ class TestFemUtilities(unittest.TestCase):
|
|
|
1965
2048
|
|
|
1966
2049
|
|
|
1967
2050
|
add_kernel_test(TestFemUtilities, test_qr_eigenvalues, dim=1, devices=devices)
|
|
2051
|
+
|
|
1968
2052
|
add_kernel_test(TestFemUtilities, test_qr_inverse, dim=100, devices=devices)
|
|
1969
2053
|
add_function_test(TestFemUtilities, "test_array_axpy", test_array_axpy)
|
|
1970
2054
|
|
|
@@ -21,8 +21,6 @@ import warp as wp
|
|
|
21
21
|
from warp.optim.linear import bicgstab, cg, cr, gmres, preconditioner
|
|
22
22
|
from warp.tests.unittest_utils import *
|
|
23
23
|
|
|
24
|
-
wp.init() # For runtime.core.is_cutlass_enabled()
|
|
25
|
-
|
|
26
24
|
|
|
27
25
|
def _check_linear_solve(test, A, b, func, *args, **kwargs):
|
|
28
26
|
# test from zero
|
|
@@ -185,15 +183,6 @@ class TestLinearSolvers(unittest.TestCase):
|
|
|
185
183
|
|
|
186
184
|
devices = get_test_devices()
|
|
187
185
|
|
|
188
|
-
if not wp.context.runtime.core.is_cutlass_enabled():
|
|
189
|
-
devices = [d for d in devices if not d.is_cuda]
|
|
190
|
-
print("Skipping CUDA linear solver tests because CUTLASS is not supported in this build")
|
|
191
|
-
|
|
192
|
-
if wp.context.runtime.core.is_debug_enabled():
|
|
193
|
-
# cutlass-based matmul is *very* slow in debug mode -- skip
|
|
194
|
-
devices = [d for d in devices if not d.is_cuda]
|
|
195
|
-
print("Skipping CUDA linear solver tests in debug mode")
|
|
196
|
-
|
|
197
186
|
add_function_test(TestLinearSolvers, "test_cg", test_cg, devices=devices)
|
|
198
187
|
add_function_test(TestLinearSolvers, "test_cr", test_cr, devices=devices)
|
|
199
188
|
add_function_test(TestLinearSolvers, "test_bicgstab", test_bicgstab, devices=devices)
|