warp-lang 1.6.1__py3-none-macosx_10_13_universal2.whl → 1.7.0__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 +21 -7
- warp/autograd.py +14 -6
- warp/bin/libwarp-clang.dylib +0 -0
- warp/bin/libwarp.dylib +0 -0
- warp/build.py +424 -6
- warp/build_dll.py +20 -20
- warp/builtins.py +467 -368
- warp/codegen.py +193 -125
- warp/config.py +56 -12
- warp/constants.py +14 -6
- warp/context.py +524 -277
- warp/dlpack.py +22 -12
- warp/examples/__init__.py +14 -6
- warp/examples/assets/nonuniform.usd +0 -0
- warp/examples/assets/nvidia_logo.png +0 -0
- warp/examples/benchmarks/benchmark_api.py +14 -6
- warp/examples/benchmarks/benchmark_cloth.py +14 -6
- warp/examples/benchmarks/benchmark_cloth_cupy.py +14 -6
- warp/examples/benchmarks/benchmark_cloth_jax.py +14 -6
- warp/examples/benchmarks/benchmark_cloth_numba.py +15 -0
- warp/examples/benchmarks/benchmark_cloth_numpy.py +14 -6
- warp/examples/benchmarks/benchmark_cloth_paddle.py +14 -6
- warp/examples/benchmarks/benchmark_cloth_pytorch.py +14 -6
- warp/examples/benchmarks/benchmark_cloth_taichi.py +14 -6
- warp/examples/benchmarks/benchmark_cloth_warp.py +14 -6
- warp/examples/benchmarks/benchmark_gemm.py +82 -48
- warp/examples/benchmarks/benchmark_interop_paddle.py +14 -6
- warp/examples/benchmarks/benchmark_interop_torch.py +14 -6
- warp/examples/benchmarks/benchmark_launches.py +14 -6
- warp/examples/benchmarks/benchmark_tile_load_store.py +103 -0
- warp/examples/browse.py +14 -6
- warp/examples/core/example_cupy.py +14 -6
- warp/examples/core/example_dem.py +14 -6
- warp/examples/core/example_fluid.py +14 -6
- warp/examples/core/example_graph_capture.py +14 -6
- warp/examples/core/example_marching_cubes.py +14 -6
- warp/examples/core/example_mesh.py +14 -6
- warp/examples/core/example_mesh_intersect.py +14 -6
- warp/examples/core/example_nvdb.py +14 -6
- warp/examples/core/example_raycast.py +14 -6
- warp/examples/core/example_raymarch.py +14 -6
- warp/examples/core/example_render_opengl.py +14 -6
- warp/examples/core/example_sample_mesh.py +300 -0
- warp/examples/core/example_sph.py +14 -6
- warp/examples/core/example_torch.py +14 -6
- warp/examples/core/example_wave.py +14 -6
- warp/examples/fem/example_adaptive_grid.py +14 -6
- warp/examples/fem/example_apic_fluid.py +15 -7
- warp/examples/fem/example_burgers.py +16 -8
- warp/examples/fem/example_convection_diffusion.py +14 -6
- warp/examples/fem/example_convection_diffusion_dg.py +14 -6
- warp/examples/fem/example_deformed_geometry.py +15 -7
- warp/examples/fem/example_diffusion.py +14 -6
- warp/examples/fem/example_diffusion_3d.py +14 -6
- warp/examples/fem/example_diffusion_mgpu.py +14 -6
- warp/examples/fem/example_distortion_energy.py +15 -7
- warp/examples/fem/example_magnetostatics.py +20 -12
- warp/examples/fem/example_mixed_elasticity.py +14 -6
- warp/examples/fem/example_navier_stokes.py +14 -6
- warp/examples/fem/example_nonconforming_contact.py +14 -6
- warp/examples/fem/example_stokes.py +14 -6
- warp/examples/fem/example_stokes_transfer.py +14 -6
- warp/examples/fem/example_streamlines.py +14 -6
- warp/examples/fem/utils.py +24 -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_bounce.py +14 -6
- warp/examples/optim/example_cloth_throw.py +14 -6
- warp/examples/optim/example_diffray.py +14 -6
- warp/examples/optim/example_drone.py +14 -6
- warp/examples/optim/example_fluid_checkpoint.py +497 -0
- warp/examples/optim/example_inverse_kinematics.py +14 -6
- warp/examples/optim/example_inverse_kinematics_torch.py +14 -6
- warp/examples/optim/example_softbody_properties.py +14 -6
- warp/examples/optim/example_spring_cage.py +14 -6
- warp/examples/optim/example_trajectory.py +14 -6
- warp/examples/sim/example_cartpole.py +14 -6
- warp/examples/sim/example_cloth.py +14 -6
- warp/examples/sim/example_cloth_self_contact.py +14 -6
- warp/examples/sim/example_granular.py +14 -6
- warp/examples/sim/example_granular_collision_sdf.py +14 -6
- warp/examples/sim/example_jacobian_ik.py +14 -6
- warp/examples/sim/example_particle_chain.py +14 -6
- warp/examples/sim/example_quadruped.py +14 -6
- warp/examples/sim/example_rigid_chain.py +14 -6
- warp/examples/sim/example_rigid_contact.py +14 -6
- warp/examples/sim/example_rigid_force.py +14 -6
- warp/examples/sim/example_rigid_gyroscopic.py +14 -6
- warp/examples/sim/example_rigid_soft_contact.py +14 -6
- warp/examples/sim/example_soft_body.py +14 -6
- warp/examples/tile/example_tile_cholesky.py +14 -6
- warp/examples/tile/example_tile_convolution.py +14 -6
- warp/examples/tile/example_tile_fft.py +14 -6
- warp/examples/tile/example_tile_filtering.py +14 -6
- warp/examples/tile/example_tile_matmul.py +16 -10
- warp/examples/tile/example_tile_mlp.py +14 -6
- warp/examples/tile/example_tile_nbody.py +14 -6
- warp/examples/tile/example_tile_walker.py +14 -6
- warp/fabric.py +15 -0
- warp/fem/__init__.py +26 -1
- warp/fem/adaptivity.py +19 -4
- warp/fem/cache.py +15 -0
- warp/fem/dirichlet.py +15 -0
- warp/fem/domain.py +15 -0
- warp/fem/field/__init__.py +15 -0
- warp/fem/field/field.py +15 -0
- warp/fem/field/nodal_field.py +37 -68
- warp/fem/field/restriction.py +15 -0
- warp/fem/field/virtual.py +77 -23
- warp/fem/geometry/__init__.py +15 -0
- warp/fem/geometry/adaptive_nanogrid.py +24 -10
- warp/fem/geometry/closest_point.py +16 -1
- warp/fem/geometry/deformed_geometry.py +20 -2
- warp/fem/geometry/element.py +15 -0
- warp/fem/geometry/geometry.py +20 -0
- warp/fem/geometry/grid_2d.py +27 -12
- warp/fem/geometry/grid_3d.py +27 -15
- warp/fem/geometry/hexmesh.py +20 -7
- warp/fem/geometry/nanogrid.py +24 -11
- warp/fem/geometry/partition.py +15 -0
- warp/fem/geometry/quadmesh.py +28 -13
- warp/fem/geometry/tetmesh.py +18 -4
- warp/fem/geometry/trimesh.py +18 -8
- warp/fem/integrate.py +277 -93
- warp/fem/linalg.py +20 -5
- warp/fem/operator.py +15 -0
- warp/fem/polynomial.py +15 -0
- warp/fem/quadrature/__init__.py +15 -0
- warp/fem/quadrature/pic_quadrature.py +52 -22
- warp/fem/quadrature/quadrature.py +209 -25
- warp/fem/space/__init__.py +16 -1
- warp/fem/space/basis_function_space.py +19 -2
- warp/fem/space/basis_space.py +40 -18
- warp/fem/space/dof_mapper.py +15 -0
- warp/fem/space/function_space.py +15 -0
- warp/fem/space/grid_2d_function_space.py +15 -0
- warp/fem/space/grid_3d_function_space.py +15 -0
- warp/fem/space/hexmesh_function_space.py +17 -2
- warp/fem/space/nanogrid_function_space.py +15 -0
- warp/fem/space/partition.py +21 -2
- warp/fem/space/quadmesh_function_space.py +23 -8
- warp/fem/space/restriction.py +15 -0
- warp/fem/space/shape/__init__.py +15 -0
- warp/fem/space/shape/cube_shape_function.py +38 -23
- warp/fem/space/shape/shape_function.py +15 -0
- warp/fem/space/shape/square_shape_function.py +27 -12
- warp/fem/space/shape/tet_shape_function.py +15 -0
- warp/fem/space/shape/triangle_shape_function.py +16 -1
- warp/fem/space/tetmesh_function_space.py +18 -3
- warp/fem/space/topology.py +15 -0
- warp/fem/space/trimesh_function_space.py +17 -2
- warp/fem/types.py +15 -0
- warp/fem/utils.py +27 -6
- warp/jax.py +28 -7
- warp/jax_experimental/__init__.py +16 -0
- warp/{jax_experimental.py → jax_experimental/custom_call.py} +28 -33
- warp/jax_experimental/ffi.py +698 -0
- warp/jax_experimental/xla_ffi.py +602 -0
- warp/math.py +103 -6
- warp/native/array.h +28 -6
- warp/native/builtin.h +44 -9
- warp/native/bvh.cpp +18 -7
- warp/native/bvh.cu +57 -20
- warp/native/bvh.h +17 -7
- warp/native/clang/clang.cpp +45 -9
- warp/native/coloring.cpp +15 -6
- warp/native/crt.cpp +15 -6
- warp/native/crt.h +15 -6
- warp/native/cuda_crt.h +15 -6
- warp/native/cuda_util.cpp +29 -6
- warp/native/cuda_util.h +17 -6
- warp/native/error.cpp +15 -6
- warp/native/error.h +15 -6
- warp/native/exports.h +85 -63
- warp/native/fabric.h +15 -6
- warp/native/hashgrid.cpp +15 -6
- warp/native/hashgrid.cu +15 -6
- warp/native/hashgrid.h +15 -6
- warp/native/initializer_array.h +15 -6
- warp/native/intersect.h +41 -32
- warp/native/intersect_adj.h +48 -39
- warp/native/intersect_tri.h +17 -0
- warp/native/marching.cpp +16 -0
- warp/native/marching.cu +16 -7
- warp/native/marching.h +17 -0
- warp/native/mat.h +528 -15
- warp/native/mathdx.cpp +15 -6
- warp/native/matnn.h +15 -6
- warp/native/mesh.cpp +15 -6
- warp/native/mesh.cu +15 -6
- warp/native/mesh.h +25 -16
- warp/native/noise.h +15 -6
- warp/native/quat.h +114 -17
- warp/native/rand.h +21 -6
- warp/native/range.h +15 -6
- warp/native/reduce.cpp +15 -6
- warp/native/reduce.cu +15 -6
- warp/native/runlength_encode.cpp +15 -6
- warp/native/runlength_encode.cu +15 -6
- warp/native/scan.cpp +15 -6
- warp/native/scan.cu +15 -6
- warp/native/scan.h +15 -6
- warp/native/solid_angle.h +17 -0
- warp/native/sort.cpp +137 -65
- warp/native/sort.cu +167 -21
- warp/native/sort.h +23 -7
- warp/native/sparse.cpp +58 -28
- warp/native/sparse.cu +67 -23
- warp/native/spatial.h +15 -6
- warp/native/svd.h +131 -6
- warp/native/temp_buffer.h +15 -6
- warp/native/tile.h +316 -111
- warp/native/tile_reduce.h +61 -9
- warp/native/vec.h +83 -13
- warp/native/volume.cpp +100 -119
- warp/native/volume.cu +15 -6
- warp/native/volume.h +15 -6
- warp/native/volume_builder.cu +40 -16
- warp/native/volume_builder.h +21 -6
- warp/native/volume_impl.h +15 -6
- warp/native/warp.cpp +20 -12
- warp/native/warp.cu +114 -16
- warp/native/warp.h +34 -16
- warp/optim/__init__.py +14 -6
- warp/optim/adam.py +14 -6
- warp/optim/linear.py +25 -10
- warp/optim/sgd.py +14 -6
- warp/paddle.py +14 -6
- warp/render/__init__.py +14 -6
- warp/render/render_opengl.py +14 -6
- warp/render/render_usd.py +14 -6
- warp/render/utils.py +14 -6
- warp/sim/__init__.py +14 -7
- warp/sim/articulation.py +18 -10
- warp/sim/collide.py +35 -16
- warp/sim/graph_coloring.py +14 -6
- warp/sim/import_mjcf.py +463 -162
- warp/sim/import_snu.py +14 -7
- warp/sim/import_urdf.py +46 -18
- warp/sim/import_usd.py +14 -7
- warp/sim/inertia.py +14 -6
- warp/sim/integrator.py +14 -6
- warp/sim/integrator_euler.py +19 -11
- warp/sim/integrator_featherstone.py +17 -16
- warp/sim/integrator_vbd.py +222 -8
- warp/sim/integrator_xpbd.py +19 -11
- warp/sim/model.py +56 -19
- warp/sim/particles.py +14 -6
- warp/sim/render.py +14 -6
- warp/sim/utils.py +17 -2
- warp/sparse.py +657 -555
- warp/stubs.py +231 -19
- warp/tape.py +14 -6
- warp/tests/aux_test_class_kernel.py +14 -6
- warp/tests/aux_test_compile_consts_dummy.py +14 -6
- warp/tests/aux_test_conditional_unequal_types_kernels.py +14 -6
- warp/tests/aux_test_dependent.py +14 -6
- warp/tests/aux_test_grad_customs.py +14 -6
- warp/tests/aux_test_instancing_gc.py +14 -6
- warp/tests/aux_test_module_unload.py +14 -6
- warp/tests/aux_test_name_clash1.py +14 -6
- warp/tests/aux_test_name_clash2.py +14 -6
- warp/tests/aux_test_unresolved_func.py +14 -6
- warp/tests/aux_test_unresolved_symbol.py +14 -6
- warp/tests/cuda/__init__.py +0 -0
- warp/tests/{test_async.py → cuda/test_async.py} +14 -6
- warp/tests/{test_ipc.py → cuda/test_ipc.py} +14 -6
- warp/tests/{test_mempool.py → cuda/test_mempool.py} +53 -6
- warp/tests/{test_multigpu.py → cuda/test_multigpu.py} +14 -6
- warp/tests/{test_peer.py → cuda/test_peer.py} +14 -6
- warp/tests/{test_pinned.py → cuda/test_pinned.py} +14 -6
- warp/tests/{test_streams.py → cuda/test_streams.py} +85 -6
- warp/tests/geometry/__init__.py +0 -0
- warp/tests/{test_bvh.py → geometry/test_bvh.py} +14 -6
- warp/tests/{test_hash_grid.py → geometry/test_hash_grid.py} +14 -6
- warp/tests/{test_marching_cubes.py → geometry/test_marching_cubes.py} +14 -6
- warp/tests/{test_mesh.py → geometry/test_mesh.py} +14 -6
- warp/tests/{test_mesh_query_aabb.py → geometry/test_mesh_query_aabb.py} +14 -6
- warp/tests/{test_mesh_query_point.py → geometry/test_mesh_query_point.py} +80 -69
- warp/tests/{test_mesh_query_ray.py → geometry/test_mesh_query_ray.py} +15 -7
- warp/tests/{test_volume.py → geometry/test_volume.py} +55 -12
- warp/tests/{test_volume_write.py → geometry/test_volume_write.py} +14 -6
- warp/tests/interop/__init__.py +0 -0
- warp/tests/{test_dlpack.py → interop/test_dlpack.py} +42 -11
- warp/tests/{test_jax.py → interop/test_jax.py} +14 -6
- warp/tests/{test_paddle.py → interop/test_paddle.py} +14 -6
- warp/tests/{test_torch.py → interop/test_torch.py} +14 -6
- warp/tests/run_coverage_serial.py +14 -6
- warp/tests/sim/__init__.py +0 -0
- warp/tests/{disabled_kinematics.py → sim/disabled_kinematics.py} +23 -16
- warp/tests/{flaky_test_sim_grad.py → sim/flaky_test_sim_grad.py} +14 -6
- warp/tests/{test_collision.py → sim/test_collision.py} +16 -8
- warp/tests/{test_coloring.py → sim/test_coloring.py} +14 -7
- warp/tests/{test_model.py → sim/test_model.py} +55 -7
- warp/tests/{test_sim_grad_bounce_linear.py → sim/test_sim_grad_bounce_linear.py} +14 -6
- warp/tests/{test_sim_kinematics.py → sim/test_sim_kinematics.py} +16 -7
- warp/tests/sim/test_vbd.py +597 -0
- warp/tests/test_adam.py +14 -6
- warp/tests/test_arithmetic.py +14 -6
- warp/tests/test_array.py +14 -6
- warp/tests/test_array_reduce.py +14 -6
- warp/tests/test_assert.py +14 -6
- warp/tests/test_atomic.py +14 -6
- warp/tests/test_bool.py +15 -7
- warp/tests/test_builtins_resolution.py +14 -6
- warp/tests/test_closest_point_edge_edge.py +14 -6
- warp/tests/test_codegen.py +14 -6
- warp/tests/test_codegen_instancing.py +14 -6
- warp/tests/test_compile_consts.py +14 -6
- warp/tests/test_conditional.py +14 -6
- warp/tests/test_context.py +14 -6
- warp/tests/test_copy.py +14 -6
- warp/tests/test_ctypes.py +14 -6
- warp/tests/test_dense.py +14 -6
- warp/tests/test_devices.py +14 -6
- warp/tests/test_examples.py +42 -42
- warp/tests/test_fabricarray.py +14 -6
- warp/tests/test_fast_math.py +14 -6
- warp/tests/test_fem.py +37 -10
- warp/tests/test_fp16.py +14 -6
- warp/tests/test_func.py +14 -6
- warp/tests/test_future_annotations.py +14 -6
- warp/tests/test_generics.py +14 -6
- warp/tests/test_grad.py +14 -6
- warp/tests/test_grad_customs.py +14 -6
- warp/tests/test_grad_debug.py +14 -6
- warp/tests/test_implicit_init.py +14 -6
- warp/tests/test_import.py +14 -6
- warp/tests/test_indexedarray.py +14 -6
- warp/tests/test_intersect.py +14 -6
- warp/tests/test_iter.py +14 -6
- warp/tests/test_large.py +14 -6
- warp/tests/test_launch.py +14 -6
- warp/tests/test_lerp.py +14 -6
- warp/tests/test_linear_solvers.py +15 -11
- warp/tests/test_lvalue.py +14 -6
- warp/tests/test_mat.py +247 -85
- warp/tests/test_mat_lite.py +14 -6
- warp/tests/test_mat_scalar_ops.py +18 -10
- warp/tests/test_math.py +14 -6
- warp/tests/test_mlp.py +14 -6
- warp/tests/test_module_hashing.py +14 -6
- warp/tests/test_modules_lite.py +14 -6
- warp/tests/test_noise.py +14 -6
- warp/tests/test_operators.py +14 -6
- warp/tests/test_options.py +14 -6
- warp/tests/test_overwrite.py +15 -60
- warp/tests/test_print.py +14 -6
- warp/tests/test_quat.py +81 -52
- warp/tests/test_rand.py +58 -43
- warp/tests/test_reload.py +14 -6
- warp/tests/test_rounding.py +14 -6
- warp/tests/test_runlength_encode.py +14 -6
- warp/tests/test_scalar_ops.py +14 -6
- warp/tests/test_smoothstep.py +14 -6
- warp/tests/test_snippet.py +15 -0
- warp/tests/test_sparse.py +61 -12
- warp/tests/test_spatial.py +89 -6
- warp/tests/test_special_values.py +14 -6
- warp/tests/test_static.py +15 -7
- warp/tests/test_struct.py +14 -6
- warp/tests/test_tape.py +14 -6
- warp/tests/test_transient_module.py +14 -6
- warp/tests/test_triangle_closest_point.py +14 -6
- warp/tests/test_types.py +14 -6
- warp/tests/test_utils.py +98 -10
- warp/tests/test_vec.py +60 -40
- warp/tests/test_vec_lite.py +14 -6
- warp/tests/test_vec_scalar_ops.py +14 -6
- warp/tests/test_verify_fp.py +14 -6
- warp/tests/tile/__init__.py +0 -0
- warp/tests/{test_tile.py → tile/test_tile.py} +150 -57
- warp/tests/{test_tile_load.py → tile/test_tile_load.py} +15 -7
- warp/tests/{test_tile_mathdx.py → tile/test_tile_mathdx.py} +23 -12
- warp/tests/{test_tile_mlp.py → tile/test_tile_mlp.py} +39 -20
- warp/tests/{test_tile_reduce.py → tile/test_tile_reduce.py} +74 -7
- warp/tests/{test_tile_shared_memory.py → tile/test_tile_shared_memory.py} +14 -6
- warp/tests/{test_tile_view.py → tile/test_tile_view.py} +15 -7
- warp/tests/unittest_serial.py +15 -6
- warp/tests/unittest_suites.py +59 -65
- warp/tests/unittest_utils.py +16 -7
- warp/tests/walkthrough_debug.py +14 -6
- warp/thirdparty/unittest_parallel.py +15 -8
- warp/torch.py +14 -6
- warp/types.py +124 -664
- warp/utils.py +151 -78
- {warp_lang-1.6.1.dist-info → warp_lang-1.7.0.dist-info}/METADATA +39 -12
- warp_lang-1.7.0.dist-info/RECORD +429 -0
- {warp_lang-1.6.1.dist-info → warp_lang-1.7.0.dist-info}/WHEEL +1 -1
- warp_lang-1.7.0.dist-info/licenses/LICENSE.md +202 -0
- warp/examples/optim/example_walker.py +0 -309
- warp/native/cutlass_gemm.cpp +0 -34
- warp/native/cutlass_gemm.cu +0 -373
- warp/tests/test_matmul.py +0 -503
- warp/tests/test_matmul_lite.py +0 -403
- warp/tests/test_vbd.py +0 -378
- warp/tests/unused_test_misc.py +0 -69
- warp_lang-1.6.1.dist-info/LICENSE.md +0 -126
- warp_lang-1.6.1.dist-info/RECORD +0 -419
- {warp_lang-1.6.1.dist-info → warp_lang-1.7.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -1,309 +0,0 @@
|
|
|
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
|
-
###########################################################################
|
|
9
|
-
# Example Walker
|
|
10
|
-
#
|
|
11
|
-
# Trains a tetrahedral mesh quadruped to run. Feeds 8 time-varying input
|
|
12
|
-
# phases as inputs into a single layer fully connected network with a tanh
|
|
13
|
-
# activation function. Interprets the output of the network as tet
|
|
14
|
-
# activations, which are fed into the wp.sim soft mesh model. This is
|
|
15
|
-
# simulated forward in time and then evaluated based on the center of mass
|
|
16
|
-
# momentum of the mesh.
|
|
17
|
-
#
|
|
18
|
-
# This example uses the deprecated wp.matmul() for matrix multiplication,
|
|
19
|
-
# which will be removed in a future version. See the updated version of
|
|
20
|
-
# this example, example_tile_walker.py, in examples/tile for the new
|
|
21
|
-
# approach to GEMMs using Warp's tile API.
|
|
22
|
-
#
|
|
23
|
-
###########################################################################
|
|
24
|
-
|
|
25
|
-
import math
|
|
26
|
-
import os
|
|
27
|
-
|
|
28
|
-
import numpy as np
|
|
29
|
-
from pxr import Gf, Usd, UsdGeom
|
|
30
|
-
|
|
31
|
-
import warp as wp
|
|
32
|
-
import warp.examples
|
|
33
|
-
import warp.optim
|
|
34
|
-
import warp.sim
|
|
35
|
-
import warp.sim.render
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@wp.kernel
|
|
39
|
-
def loss_kernel(com: wp.array(dtype=wp.vec3), loss: wp.array(dtype=float)):
|
|
40
|
-
tid = wp.tid()
|
|
41
|
-
vx = com[tid][0]
|
|
42
|
-
vy = com[tid][1]
|
|
43
|
-
vz = com[tid][2]
|
|
44
|
-
delta = wp.sqrt(vx * vx) + wp.sqrt(vy * vy) - vz
|
|
45
|
-
|
|
46
|
-
wp.atomic_add(loss, 0, delta)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
@wp.kernel
|
|
50
|
-
def com_kernel(velocities: wp.array(dtype=wp.vec3), n: int, com: wp.array(dtype=wp.vec3)):
|
|
51
|
-
tid = wp.tid()
|
|
52
|
-
v = velocities[tid]
|
|
53
|
-
a = v / wp.float32(n)
|
|
54
|
-
wp.atomic_add(com, 0, a)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@wp.kernel
|
|
58
|
-
def compute_phases(phases: wp.array(dtype=float), sim_time: float):
|
|
59
|
-
tid = wp.tid()
|
|
60
|
-
phases[tid] = wp.sin(phase_freq * sim_time + wp.float32(tid) * phase_step)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@wp.kernel
|
|
64
|
-
def activation_function(tet_activations: wp.array(dtype=float), activation_inputs: wp.array(dtype=float)):
|
|
65
|
-
tid = wp.tid()
|
|
66
|
-
activation = wp.tanh(activation_inputs[tid])
|
|
67
|
-
tet_activations[tid] = activation_strength * activation
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
phase_count = 8
|
|
71
|
-
phase_step = wp.constant((2.0 * math.pi) / phase_count)
|
|
72
|
-
phase_freq = wp.constant(5.0)
|
|
73
|
-
activation_strength = wp.constant(0.3)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class Example:
|
|
77
|
-
def __init__(self, stage_path="example_walker.usd", verbose=False, num_frames=300):
|
|
78
|
-
self.verbose = verbose
|
|
79
|
-
|
|
80
|
-
fps = 60
|
|
81
|
-
self.frame_dt = 1.0 / fps
|
|
82
|
-
self.num_frames = num_frames
|
|
83
|
-
|
|
84
|
-
self.sim_substeps = 80
|
|
85
|
-
self.sim_dt = self.frame_dt / self.sim_substeps
|
|
86
|
-
self.sim_time = 0.0
|
|
87
|
-
|
|
88
|
-
self.iter = 0
|
|
89
|
-
self.train_rate = 0.025
|
|
90
|
-
|
|
91
|
-
self.phase_count = phase_count
|
|
92
|
-
|
|
93
|
-
self.render_time = 0.0
|
|
94
|
-
|
|
95
|
-
# bear
|
|
96
|
-
asset_stage = Usd.Stage.Open(os.path.join(warp.examples.get_asset_directory(), "bear.usd"))
|
|
97
|
-
|
|
98
|
-
geom = UsdGeom.Mesh(asset_stage.GetPrimAtPath("/root/bear"))
|
|
99
|
-
points = geom.GetPointsAttr().Get()
|
|
100
|
-
|
|
101
|
-
xform = Gf.Matrix4f(geom.ComputeLocalToWorldTransform(0.0))
|
|
102
|
-
for i in range(len(points)):
|
|
103
|
-
points[i] = xform.Transform(points[i])
|
|
104
|
-
|
|
105
|
-
self.points = [wp.vec3(point) for point in points]
|
|
106
|
-
self.tet_indices = geom.GetPrim().GetAttribute("tetraIndices").Get()
|
|
107
|
-
|
|
108
|
-
# sim model
|
|
109
|
-
builder = wp.sim.ModelBuilder()
|
|
110
|
-
builder.add_soft_mesh(
|
|
111
|
-
pos=wp.vec3(0.0, 0.5, 0.0),
|
|
112
|
-
rot=wp.quat_identity(),
|
|
113
|
-
scale=1.0,
|
|
114
|
-
vel=wp.vec3(0.0, 0.0, 0.0),
|
|
115
|
-
vertices=self.points,
|
|
116
|
-
indices=self.tet_indices,
|
|
117
|
-
density=1.0,
|
|
118
|
-
k_mu=2000.0,
|
|
119
|
-
k_lambda=2000.0,
|
|
120
|
-
k_damp=2.0,
|
|
121
|
-
tri_ke=0.0,
|
|
122
|
-
tri_ka=1e-8,
|
|
123
|
-
tri_kd=0.0,
|
|
124
|
-
tri_drag=0.0,
|
|
125
|
-
tri_lift=0.0,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
# finalize model
|
|
129
|
-
self.model = builder.finalize(requires_grad=True)
|
|
130
|
-
self.control = self.model.control()
|
|
131
|
-
|
|
132
|
-
self.model.soft_contact_ke = 2.0e3
|
|
133
|
-
self.model.soft_contact_kd = 0.1
|
|
134
|
-
self.model.soft_contact_kf = 10.0
|
|
135
|
-
self.model.soft_contact_mu = 0.7
|
|
136
|
-
|
|
137
|
-
radii = wp.zeros(self.model.particle_count, dtype=float)
|
|
138
|
-
radii.fill_(0.05)
|
|
139
|
-
self.model.particle_radius = radii
|
|
140
|
-
self.model.ground = True
|
|
141
|
-
|
|
142
|
-
# allocate sim states
|
|
143
|
-
self.states = []
|
|
144
|
-
for _i in range(self.num_frames * self.sim_substeps + 1):
|
|
145
|
-
self.states.append(self.model.state(requires_grad=True))
|
|
146
|
-
|
|
147
|
-
# initialize the integrator.
|
|
148
|
-
self.integrator = wp.sim.SemiImplicitIntegrator()
|
|
149
|
-
|
|
150
|
-
# model input
|
|
151
|
-
self.phases = []
|
|
152
|
-
for _i in range(self.num_frames):
|
|
153
|
-
self.phases.append(wp.zeros(self.phase_count, dtype=float, requires_grad=True))
|
|
154
|
-
|
|
155
|
-
# single layer linear network
|
|
156
|
-
rng = np.random.default_rng(42)
|
|
157
|
-
k = 1.0 / self.phase_count
|
|
158
|
-
weights = rng.uniform(-np.sqrt(k), np.sqrt(k), (self.model.tet_count, self.phase_count))
|
|
159
|
-
self.weights = wp.array(weights, dtype=float, requires_grad=True)
|
|
160
|
-
self.bias = wp.zeros(self.model.tet_count, dtype=float, requires_grad=True)
|
|
161
|
-
|
|
162
|
-
# tanh activation layer
|
|
163
|
-
self.activation_inputs = []
|
|
164
|
-
self.tet_activations = []
|
|
165
|
-
for _i in range(self.num_frames):
|
|
166
|
-
self.activation_inputs.append(wp.zeros(self.model.tet_count, dtype=float, requires_grad=True))
|
|
167
|
-
self.tet_activations.append(wp.zeros(self.model.tet_count, dtype=float, requires_grad=True))
|
|
168
|
-
|
|
169
|
-
# optimization
|
|
170
|
-
self.loss = wp.zeros(1, dtype=float, requires_grad=True)
|
|
171
|
-
self.coms = []
|
|
172
|
-
for _i in range(self.num_frames):
|
|
173
|
-
self.coms.append(wp.zeros(1, dtype=wp.vec3, requires_grad=True))
|
|
174
|
-
self.optimizer = warp.optim.Adam([self.weights.flatten()], lr=self.train_rate)
|
|
175
|
-
|
|
176
|
-
# rendering
|
|
177
|
-
if stage_path:
|
|
178
|
-
self.renderer = wp.sim.render.SimRenderer(self.model, stage_path)
|
|
179
|
-
else:
|
|
180
|
-
self.renderer = None
|
|
181
|
-
|
|
182
|
-
# capture forward/backward passes
|
|
183
|
-
self.use_cuda_graph = wp.get_device().is_cuda
|
|
184
|
-
if self.use_cuda_graph:
|
|
185
|
-
with wp.ScopedCapture() as capture:
|
|
186
|
-
self.tape = wp.Tape()
|
|
187
|
-
with self.tape:
|
|
188
|
-
for i in range(self.num_frames):
|
|
189
|
-
self.forward(i)
|
|
190
|
-
self.tape.backward(self.loss)
|
|
191
|
-
self.graph = capture.graph
|
|
192
|
-
|
|
193
|
-
def forward(self, frame):
|
|
194
|
-
with wp.ScopedTimer("network", active=self.verbose):
|
|
195
|
-
# build sinusoidal input phases
|
|
196
|
-
wp.launch(kernel=compute_phases, dim=self.phase_count, inputs=[self.phases[frame], self.sim_time])
|
|
197
|
-
# fully connected, linear transformation layer
|
|
198
|
-
wp.matmul(
|
|
199
|
-
self.weights,
|
|
200
|
-
self.phases[frame].reshape((self.phase_count, 1)),
|
|
201
|
-
self.bias.reshape((self.model.tet_count, 1)),
|
|
202
|
-
self.activation_inputs[frame].reshape((self.model.tet_count, 1)),
|
|
203
|
-
)
|
|
204
|
-
# tanh activation function
|
|
205
|
-
wp.launch(
|
|
206
|
-
kernel=activation_function,
|
|
207
|
-
dim=self.model.tet_count,
|
|
208
|
-
inputs=[self.tet_activations[frame], self.activation_inputs[frame]],
|
|
209
|
-
)
|
|
210
|
-
self.control.tet_activations = self.tet_activations[frame]
|
|
211
|
-
|
|
212
|
-
with wp.ScopedTimer("simulate", active=self.verbose):
|
|
213
|
-
# run simulation loop
|
|
214
|
-
for i in range(self.sim_substeps):
|
|
215
|
-
self.states[frame * self.sim_substeps + i].clear_forces()
|
|
216
|
-
self.integrator.simulate(
|
|
217
|
-
self.model,
|
|
218
|
-
self.states[frame * self.sim_substeps + i],
|
|
219
|
-
self.states[frame * self.sim_substeps + i + 1],
|
|
220
|
-
self.sim_dt,
|
|
221
|
-
self.control,
|
|
222
|
-
)
|
|
223
|
-
self.sim_time += self.sim_dt
|
|
224
|
-
|
|
225
|
-
with wp.ScopedTimer("loss", active=self.verbose):
|
|
226
|
-
# compute center of mass velocity
|
|
227
|
-
wp.launch(
|
|
228
|
-
com_kernel,
|
|
229
|
-
dim=self.model.particle_count,
|
|
230
|
-
inputs=[
|
|
231
|
-
self.states[(frame + 1) * self.sim_substeps].particle_qd,
|
|
232
|
-
self.model.particle_count,
|
|
233
|
-
self.coms[frame],
|
|
234
|
-
],
|
|
235
|
-
outputs=[],
|
|
236
|
-
)
|
|
237
|
-
# compute loss
|
|
238
|
-
wp.launch(loss_kernel, dim=1, inputs=[self.coms[frame], self.loss], outputs=[])
|
|
239
|
-
|
|
240
|
-
def step(self):
|
|
241
|
-
with wp.ScopedTimer("step"):
|
|
242
|
-
if self.use_cuda_graph:
|
|
243
|
-
wp.capture_launch(self.graph)
|
|
244
|
-
else:
|
|
245
|
-
self.tape = wp.Tape()
|
|
246
|
-
with self.tape:
|
|
247
|
-
for i in range(self.num_frames):
|
|
248
|
-
self.forward(i)
|
|
249
|
-
self.tape.backward(self.loss)
|
|
250
|
-
|
|
251
|
-
# optimization
|
|
252
|
-
x = self.weights.grad.flatten()
|
|
253
|
-
self.optimizer.step([x])
|
|
254
|
-
|
|
255
|
-
loss = self.loss.numpy()
|
|
256
|
-
if self.verbose:
|
|
257
|
-
print(f"Iteration {self.iter}: {loss}")
|
|
258
|
-
|
|
259
|
-
# reset sim
|
|
260
|
-
self.sim_time = 0.0
|
|
261
|
-
self.states[0] = self.model.state(requires_grad=True)
|
|
262
|
-
|
|
263
|
-
# clear grads and zero arrays for next iteration
|
|
264
|
-
self.tape.zero()
|
|
265
|
-
self.loss.zero_()
|
|
266
|
-
for i in range(self.num_frames):
|
|
267
|
-
self.coms[i].zero_()
|
|
268
|
-
|
|
269
|
-
self.iter += 1
|
|
270
|
-
|
|
271
|
-
def render(self):
|
|
272
|
-
if self.renderer is None:
|
|
273
|
-
return
|
|
274
|
-
|
|
275
|
-
with wp.ScopedTimer("render"):
|
|
276
|
-
for i in range(self.num_frames + 1):
|
|
277
|
-
self.renderer.begin_frame(self.render_time)
|
|
278
|
-
self.renderer.render(self.states[i * self.sim_substeps])
|
|
279
|
-
self.renderer.end_frame()
|
|
280
|
-
|
|
281
|
-
self.render_time += self.frame_dt
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if __name__ == "__main__":
|
|
285
|
-
import argparse
|
|
286
|
-
|
|
287
|
-
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
288
|
-
parser.add_argument("--device", type=str, default=None, help="Override the default Warp device.")
|
|
289
|
-
parser.add_argument(
|
|
290
|
-
"--stage_path",
|
|
291
|
-
type=lambda x: None if x == "None" else str(x),
|
|
292
|
-
default="example_walker.usd",
|
|
293
|
-
help="Path to the output USD file.",
|
|
294
|
-
)
|
|
295
|
-
parser.add_argument("--num_frames", type=int, default=300, help="Total number of frames per training iteration.")
|
|
296
|
-
parser.add_argument("--train_iters", type=int, default=30, help="Total number of training iterations.")
|
|
297
|
-
parser.add_argument("--verbose", action="store_true", help="Print out additional status messages during execution.")
|
|
298
|
-
|
|
299
|
-
args = parser.parse_known_args()[0]
|
|
300
|
-
|
|
301
|
-
with wp.ScopedDevice(args.device):
|
|
302
|
-
example = Example(stage_path=args.stage_path, verbose=args.verbose, num_frames=args.num_frames)
|
|
303
|
-
|
|
304
|
-
for _ in range(args.train_iters):
|
|
305
|
-
example.step()
|
|
306
|
-
example.render()
|
|
307
|
-
|
|
308
|
-
if example.renderer:
|
|
309
|
-
example.renderer.save()
|
warp/native/cutlass_gemm.cpp
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#include "builtin.h"
|
|
10
|
-
|
|
11
|
-
// stubs for platforms where there is no CUDA
|
|
12
|
-
#if !WP_ENABLE_CUDA || !WP_ENABLE_CUTLASS
|
|
13
|
-
|
|
14
|
-
extern "C"
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
WP_API
|
|
18
|
-
bool cutlass_gemm(
|
|
19
|
-
void* context, int compute_capability,
|
|
20
|
-
int m, int n, int k,
|
|
21
|
-
const char* datatype_str,
|
|
22
|
-
const void* a, const void* b, const void* c, void* d,
|
|
23
|
-
float alpha, float beta,
|
|
24
|
-
bool row_major_a, bool row_major_b,
|
|
25
|
-
bool allow_tf32x3_arith,
|
|
26
|
-
int batch_count)
|
|
27
|
-
{
|
|
28
|
-
printf("CUDA is disabled and/or CUTLASS is disabled.\n");
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
} // extern "C"
|
|
33
|
-
|
|
34
|
-
#endif // !WP_ENABLE_CUDA || !WP_ENABLE_CUTLASS
|