diffneusim 1.0.0__py3-none-any.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.
- diffneusim/__init__.py +1 -0
- diffneusim/_cache.py +42 -0
- diffneusim/_paths.py +5 -0
- diffneusim/bindings/rew14_ext.cu +115 -0
- diffneusim/bindings/soft14_capi.cpp +443 -0
- diffneusim/bindings/soft14_engine_ext.cu +596 -0
- diffneusim/bindings/soft_capi.cpp +782 -0
- diffneusim/bindings/soft_engine_ext.cu +495 -0
- diffneusim/core/cpu_engine/build.sh +40 -0
- diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
- diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
- diffneusim/core/diff/dual.h +126 -0
- diffneusim/core/include/diffneusim/macros.h +35 -0
- diffneusim/core/kin/kinematic_tree.h +273 -0
- diffneusim/core/math/so3.h +182 -0
- diffneusim/core/soft/adj/out_adj.h +102 -0
- diffneusim/core/soft/adj/rnea_adj.h +425 -0
- diffneusim/core/soft/adj/rows_adj.h +439 -0
- diffneusim/core/soft/adj/rows_functor.h +89 -0
- diffneusim/core/soft/adj/rows_lanes.h +443 -0
- diffneusim/core/soft/adj/shell_adj.h +243 -0
- diffneusim/core/soft/adj/tree_adj.h +356 -0
- diffneusim/core/soft/collide.h +183 -0
- diffneusim/core/soft/gpu/adj14.cuh +233 -0
- diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
- diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
- diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
- diffneusim/core/soft/gpu/body14.cuh +47 -0
- diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
- diffneusim/core/soft/gpu/chol_small.cuh +123 -0
- diffneusim/core/soft/gpu/chol_split.cuh +193 -0
- diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
- diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
- diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
- diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
- diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
- diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
- diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
- diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
- diffneusim/core/soft/gpu/k_pre.cuh +52 -0
- diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
- diffneusim/core/soft/gpu/kp14.cuh +465 -0
- diffneusim/core/soft/gpu/l2v2.cuh +367 -0
- diffneusim/core/soft/gpu/l2x14.cuh +319 -0
- diffneusim/core/soft/gpu/l3.cuh +1483 -0
- diffneusim/core/soft/gpu/model_view.cuh +48 -0
- diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
- diffneusim/core/soft/gpu/mus_classes.h +182 -0
- diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
- diffneusim/core/soft/gpu/rew14.cuh +177 -0
- diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
- diffneusim/core/soft/gpu/tree_m.cuh +247 -0
- diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
- diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
- diffneusim/core/soft/hand.h +124 -0
- diffneusim/core/soft/impedance.h +115 -0
- diffneusim/core/soft/jvp.h +202 -0
- diffneusim/core/soft/kin.h +250 -0
- diffneusim/core/soft/muscle.h +1208 -0
- diffneusim/core/soft/newton.h +371 -0
- diffneusim/core/soft/rows.h +176 -0
- diffneusim/core/soft/step.h +188 -0
- diffneusim/core/soft/tape.h +313 -0
- diffneusim/core/soft/x14/collide14.h +69 -0
- diffneusim/core/soft/x14/jvp14.h +182 -0
- diffneusim/core/soft/x14/law14.h +453 -0
- diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
- diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
- diffneusim/core/soft/x14adj/reward14.h +484 -0
- diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
- diffneusim/core/soft/x14adj/scan14.h +349 -0
- diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
- diffneusim/core/soft/x14adj/sweep14.h +255 -0
- diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
- diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
- diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
- diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
- diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
- diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
- diffneusim/data/reference/pose3/pose3_scone.json +305 -0
- diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
- diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
- diffneusim/data/reference/x016run/MD5SUMS +241 -0
- diffneusim/data/reference/x016run/x016run_states.txt +240 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
- diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/engine/__init__.py +0 -0
- diffneusim/engine/build_tag.py +52 -0
- diffneusim/engine/case_tables.py +46 -0
- diffneusim/engine/d16_body.py +80 -0
- diffneusim/engine/engine14.py +367 -0
- diffneusim/engine/gen_split.py +159 -0
- diffneusim/engine/hand_format.py +69 -0
- diffneusim/engine/live14.py +149 -0
- diffneusim/engine/phase_b_tree.py +137 -0
- diffneusim/engine/soft14.py +130 -0
- diffneusim/engine/soft_capi.py +373 -0
- diffneusim/engine/soft_engine.py +165 -0
- diffneusim/engine/step14.py +132 -0
- diffneusim/engine/tape_format.py +89 -0
- diffneusim/engine/x14cpu.py +163 -0
- diffneusim/env/__init__.py +0 -0
- diffneusim/env/absent.py +20 -0
- diffneusim/env/cpu14.py +105 -0
- diffneusim/env/e0loop14.py +224 -0
- diffneusim/env/env14.py +568 -0
- diffneusim/env/kin_contact14.py +193 -0
- diffneusim/env/mimic_sites_x14.json +366 -0
- diffneusim/env/old_count.py +78 -0
- diffneusim/env/rew14.py +114 -0
- diffneusim/env/rew14_hook.py +105 -0
- diffneusim/g1/__init__.py +1 -0
- diffneusim/g1/arm_a2.py +165 -0
- diffneusim/g1/arm_a3.py +576 -0
- diffneusim/g1/read_a3.py +79 -0
- diffneusim/g1/rg1_read.py +89 -0
- diffneusim/model/__init__.py +66 -0
- diffneusim/model/case.py +17 -0
- diffneusim/model/dnmodel.py +79 -0
- diffneusim/model/fuse_fixed.py +281 -0
- diffneusim/model/monitor.py +834 -0
- diffneusim/models/BODIES.toml +48 -0
- diffneusim/models/MANIFEST.toml +979 -0
- diffneusim/models/cases/G290/case.bin +0 -0
- diffneusim/models/cases/G290/case.json +1 -0
- diffneusim/models/cases/G356-SRC/case.bin +0 -0
- diffneusim/models/cases/G356-SRC/case.json +1 -0
- diffneusim/models/cases/G416/case.bin +0 -0
- diffneusim/models/cases/G416/case.json +1 -0
- diffneusim/models/cases/M290C-SRC/case.bin +0 -0
- diffneusim/models/cases/M290C-SRC/case.json +1 -0
- diffneusim/models/cases/M290R-SRC/case.bin +0 -0
- diffneusim/models/cases/M290R-SRC/case.json +1 -0
- diffneusim/models/cases/M356C-SRC/case.bin +0 -0
- diffneusim/models/cases/M356C-SRC/case.json +1 -0
- diffneusim/models/cases/M356R-SRC/case.bin +0 -0
- diffneusim/models/cases/M356R-SRC/case.json +1 -0
- diffneusim/models/cases/M416C-SRC/case.bin +0 -0
- diffneusim/models/cases/M416C-SRC/case.json +1 -0
- diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
- diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
- diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
- diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_meshes/1mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2distph.stl +0 -0
- diffneusim/models/fullbody_meshes/2mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2midph.stl +0 -0
- diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/3distph.stl +0 -0
- diffneusim/models/fullbody_meshes/3mc.stl +0 -0
- diffneusim/models/fullbody_meshes/3midph.stl +0 -0
- diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/4distph.stl +0 -0
- diffneusim/models/fullbody_meshes/4mc.stl +0 -0
- diffneusim/models/fullbody_meshes/4midph.stl +0 -0
- diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/5distph.stl +0 -0
- diffneusim/models/fullbody_meshes/5mc.stl +0 -0
- diffneusim/models/fullbody_meshes/5midph.stl +0 -0
- diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/NOTICE +2 -0
- diffneusim/models/fullbody_meshes/capitate.stl +0 -0
- diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
- diffneusim/models/fullbody_meshes/hamate.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
- diffneusim/models/fullbody_meshes/humerus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
- diffneusim/models/fullbody_meshes/lunate.stl +0 -0
- diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
- diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/radius.stl +0 -0
- diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
- diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
- diffneusim/models/fullbody_meshes/scapula.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thorax.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
- diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
- diffneusim/models/fullbody_meshes/ulna.stl +0 -0
- diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
- diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
- diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
- diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
- diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
- diffneusim/models/source/unitree_g1/g1.xml +308 -0
- diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
- diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
- diffneusim/models/unitree_g1.dnmodel +4393 -0
- diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
- diffneusim/rl/__init__.py +2 -0
- diffneusim/rl/dynsyn_layer.py +146 -0
- diffneusim/rl/footstep_plan.py +337 -0
- diffneusim/rl/g1_bm_env.py +572 -0
- diffneusim/rl/g1_bm_eval.py +168 -0
- diffneusim/rl/g1_bm_fused.py +275 -0
- diffneusim/rl/g1_bm_ppo.py +622 -0
- diffneusim/rl/g1_bm_sapo.py +551 -0
- diffneusim/rl/g1_ppo.py +395 -0
- diffneusim/rl/g1_sapo_soft.py +240 -0
- diffneusim/rl/g1_soft_env.py +452 -0
- diffneusim/rl/g1_soft_grad.py +145 -0
- diffneusim/rl/geyer_curves_torch.py +108 -0
- diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
- diffneusim/rl/imitation.py +2027 -0
- diffneusim/rl/imitation_reward_v2.py +248 -0
- diffneusim/rl/imitation_reward_v3.py +349 -0
- diffneusim/rl/latent_task.py +175 -0
- diffneusim/rl/llc_reward.py +316 -0
- diffneusim/rl/millard_curves_torch.py +154 -0
- diffneusim/rl/mirror_symmetry.py +212 -0
- diffneusim/rl/model_path.py +35 -0
- diffneusim/rl/mvae_recon.py +123 -0
- diffneusim/rl/nets_shac.py +599 -0
- diffneusim/rl/reset_pool.py +154 -0
- diffneusim/rl/sapo_capture.py +873 -0
- diffneusim/rl/sapo_vec.py +1051 -0
- diffneusim/rl/shac_vec.py +346 -0
- diffneusim/rl/state_prior.py +151 -0
- diffneusim/rl/step_library.py +105 -0
- diffneusim/rl/task_walk_env.py +1793 -0
- diffneusim/rl/task_walk_reward.py +3300 -0
- diffneusim/run.py +23 -0
- diffneusim/run_env.py +46 -0
- diffneusim/tasks/__init__.py +147 -0
- diffneusim/tasks/legacy_names.py +63 -0
- diffneusim/tasks/paths.py +79 -0
- diffneusim/tasks/settings.py +202 -0
- diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
- diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
- diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
- diffneusim/train/__init__.py +0 -0
- diffneusim/train/eval_ckpt.py +239 -0
- diffneusim/train/eval_mimic.py +133 -0
- diffneusim/train/gait_report.py +203 -0
- diffneusim/train/gcot_chain.py +51 -0
- diffneusim/train/levers.py +135 -0
- diffneusim/train/masked_reset.py +314 -0
- diffneusim/train/rl_algorithm_suite.py +917 -0
- diffneusim/train/train14.py +240 -0
- diffneusim/train/train_tw14.py +674 -0
- diffneusim/viz/__init__.py +5 -0
- diffneusim/viz/__main__.py +41 -0
- diffneusim/viz/camera.py +115 -0
- diffneusim/viz/dnrec.py +118 -0
- diffneusim/viz/dnrec_io.py +686 -0
- diffneusim/viz/hud.py +565 -0
- diffneusim/viz/meshes.py +458 -0
- diffneusim/viz/play.py +237 -0
- diffneusim/viz/record.py +74 -0
- diffneusim/viz/render.py +1402 -0
- diffneusim/viz/renderer.py +268 -0
- diffneusim/viz/rl_env_render.py +635 -0
- diffneusim/viz/snapshot.py +54 -0
- diffneusim/viz/strobe.py +124 -0
- diffneusim/viz/to_mp4.py +58 -0
- diffneusim/viz/ui.py +481 -0
- diffneusim/viz/viewer.py +2086 -0
- diffneusim-1.0.0.dist-info/METADATA +226 -0
- diffneusim-1.0.0.dist-info/RECORD +682 -0
- diffneusim-1.0.0.dist-info/WHEEL +5 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
- diffneusim-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""The 14x training path's binding (2026-11-03; board item 4, the GO): the cotangent charts at the autograd Function's
|
|
2
|
+
boundary, the tape window and the Function (forward = engine14.control_step on a tape slot, backward = the adj14_control_step).
|
|
3
|
+
|
|
4
|
+
Charts. The engine's q [n, 40] holds quaternions (the free root's and the two hip balls'); the adjoint's cotangents are in the
|
|
5
|
+
tangent chart [n, 37] (the and jvp14.h's): the root's world translation and body-frame rotation, each ball's body-frame
|
|
6
|
+
rotation, quat <- quat (x) exp(delta / 2) (right-trivialized), translations and hinges additive.
|
|
7
|
+
out a cotangent g of q1 (raw, from the loss) -> the tangent's: delta-bar = 1/2 Im(conj(q1) (x) g_quat) (q1 unit)
|
|
8
|
+
in a tangent cotangent at q -> q's raw cotangent: g_quat = (2 / |q|) q^ (x) (0, delta-bar) (q^ = q / |q|; the engine
|
|
9
|
+
normalizes its input quaternions, so the raw cotangent is tangent to the sphere)
|
|
10
|
+
"""
|
|
11
|
+
import pathlib
|
|
12
|
+
|
|
13
|
+
import torch
|
|
14
|
+
|
|
15
|
+
HERE = pathlib.Path(__file__).resolve().parent
|
|
16
|
+
# (3a) was: sys.path.insert(0, str(HERE))
|
|
17
|
+
from diffneusim.engine import engine14 # noqa: E402
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Chart14:
|
|
21
|
+
"""The law's coordinate map (soft14's law JSON): raw q index sets and their tangent indices"""
|
|
22
|
+
def __init__(self, law):
|
|
23
|
+
self.nq, self.nv = law["nq"], law["nv"]
|
|
24
|
+
lin_q, lin_t, quats = [], [], []
|
|
25
|
+
for b in law["bodies"][1:]:
|
|
26
|
+
qa, da = b["qadr"], b["dadr"]
|
|
27
|
+
if b["jtype"] == "free":
|
|
28
|
+
lin_q += [qa, qa + 1, qa + 2]; lin_t += [da, da + 1, da + 2]
|
|
29
|
+
quats.append((qa + 3, da + 3))
|
|
30
|
+
elif b["jtype"] == "ball":
|
|
31
|
+
quats.append((qa, da))
|
|
32
|
+
elif b["jtype"] == "hinge" and b.get("master_dadr", -1) < 0:
|
|
33
|
+
lin_q.append(qa); lin_t.append(da)
|
|
34
|
+
self.lin_q, self.lin_t, self.quats = lin_q, lin_t, quats
|
|
35
|
+
assert len(lin_q) + 4 * len(quats) == self.nq and len(lin_t) + 3 * len(quats) == self.nv, "every coordinate is mapped once"
|
|
36
|
+
self._dev = {}
|
|
37
|
+
|
|
38
|
+
def idx(self, device):
|
|
39
|
+
"""index tensors on a device (the batched conversions: one gather per block, all quaternions at once)"""
|
|
40
|
+
if device not in self._dev:
|
|
41
|
+
L = lambda x: torch.tensor(x, dtype=torch.long, device=device) # noqa: E731
|
|
42
|
+
self._dev[device] = dict(lq=L(self.lin_q), lt=L(self.lin_t), qq=L([[qa + k for k in range(4)] for qa, _ in self.quats]),
|
|
43
|
+
qt=L([[da + k for k in range(3)] for _, da in self.quats]),
|
|
44
|
+
conj=torch.tensor([1.0, -1.0, -1.0, -1.0], device=device))
|
|
45
|
+
return self._dev[device]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _qmul(a, b): # [..., 4] wxyz
|
|
49
|
+
w1, x1, y1, z1 = a.unbind(-1); w2, x2, y2, z2 = b.unbind(-1)
|
|
50
|
+
return torch.stack([w1 * w2 - x1 * x2 - y1 * y2 - z1 * z2, w1 * x2 + x1 * w2 + y1 * z2 - z1 * y2,
|
|
51
|
+
w1 * y2 - x1 * z2 + y1 * w2 + z1 * x2, w1 * z2 + x1 * y2 - y1 * x2 + z1 * w2], -1)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def q_cot_to_tangent(C, q1, g):
|
|
55
|
+
"""g [n, nq] (the loss's gradient in q1's raw coordinates) -> [n, nv] in q1's tangent chart (all quaternions in one batch)"""
|
|
56
|
+
I = C.idx(g.device)
|
|
57
|
+
out = torch.empty(g.shape[0], C.nv, dtype=g.dtype, device=g.device)
|
|
58
|
+
out[:, I["lt"]] = g[:, I["lq"]]
|
|
59
|
+
r = _qmul(q1[:, I["qq"]] * I["conj"].to(q1.dtype), g[:, I["qq"]]) # [n, nquat, 4]
|
|
60
|
+
out[:, I["qt"]] = 0.5 * r[..., 1:]
|
|
61
|
+
return out
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def tangent_cot_to_q(C, q, gt):
|
|
65
|
+
"""gt [n, nv] (a cotangent in q's tangent chart) -> [n, nq] in q's raw coordinates (through the engine's normalization; all
|
|
66
|
+
quaternions in one batch)"""
|
|
67
|
+
I = C.idx(gt.device)
|
|
68
|
+
out = torch.empty(gt.shape[0], C.nq, dtype=gt.dtype, device=gt.device)
|
|
69
|
+
out[:, I["lq"]] = gt[:, I["lt"]]
|
|
70
|
+
Q = q[:, I["qq"]] # [n, nquat, 4]
|
|
71
|
+
r = torch.linalg.norm(Q, dim=-1, keepdim=True)
|
|
72
|
+
pure = torch.nn.functional.pad(gt[:, I["qt"]], (1, 0)) # (0, delta-bar)
|
|
73
|
+
out[:, I["qq"]] = (2.0 / r) * _qmul(Q / r, pure)
|
|
74
|
+
return out
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class Window14:
|
|
78
|
+
"""One BPTT window's tape: H control steps' records (engine14.alloc_tape under tape_plan's 16 GB rule), a slot per forward
|
|
79
|
+
in order; the adjoint's flags OR-ed on the device (no sync per backward) and asserted by check() / reset() at the window's
|
|
80
|
+
end (after the trainer's backward)."""
|
|
81
|
+
def __init__(self, n, horizon, word_bytes=4, device="cuda"):
|
|
82
|
+
self.plan = engine14.tape_plan(n, horizon, word_bytes=word_bytes)
|
|
83
|
+
self.rec = engine14.alloc_tape(self.plan, device)
|
|
84
|
+
self.H, self.t = horizon, 0
|
|
85
|
+
self.flags = torch.zeros(n, dtype=torch.int32, device=device)
|
|
86
|
+
|
|
87
|
+
def next_slot(self):
|
|
88
|
+
assert self.t < self.H, f"the window's {self.H} control steps are used: reset() at the window's start"
|
|
89
|
+
s = self.t
|
|
90
|
+
self.t += 1
|
|
91
|
+
return s
|
|
92
|
+
|
|
93
|
+
def check(self):
|
|
94
|
+
bad = int((self.flags != 0).sum())
|
|
95
|
+
assert bad == 0, (f"the adjoint flagged {bad} worlds (1: a contact slot not reproduced, 2: a limit-row count, 4: a bad "
|
|
96
|
+
f"record): {torch.nonzero(self.flags).flatten()[:8].tolist()}")
|
|
97
|
+
|
|
98
|
+
def reset(self):
|
|
99
|
+
self.check()
|
|
100
|
+
self.t = 0
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Step14(torch.autograd.Function):
|
|
104
|
+
"""One engine14 control step on the training path (board item 4). forward: control_step on the window's next tape slot;
|
|
105
|
+
the outputs are copies (the engine reuses its buffers). backward: the composed adjoint (step 4: the rigid adjoint and the
|
|
106
|
+
muscle_adj per substep) from that slot's records, the cotangents converted at the boundary in the binding (q1's raw -> its
|
|
107
|
+
tangent chart; q's tangent -> raw). Gradients reach q, v, lce, a and u; warm carries none.
|
|
108
|
+
q1, v1, lce1, a1, warm1 = Step14.apply(q, v, lce, a, u, warm, eng, win, chart)"""
|
|
109
|
+
@staticmethod
|
|
110
|
+
def forward(ctx, q, v, lce, a, u, warm, eng, win, C):
|
|
111
|
+
slot = win.next_slot()
|
|
112
|
+
o = eng.control_step(q.detach(), v.detach(), warm, lce.detach(), a.detach(), u.detach(), tape=win.rec[slot])
|
|
113
|
+
q1, v1, l1, a1, w1 = (o[k].clone() for k in ("qpos", "qvel", "lce", "a", "warm"))
|
|
114
|
+
ctx.save_for_backward(q.detach(), a.detach(), u.detach(), q1, l1)
|
|
115
|
+
ctx.eng, ctx.win, ctx.slot, ctx.C = eng, win, slot, C
|
|
116
|
+
ctx.mark_non_differentiable(w1)
|
|
117
|
+
return q1, v1, l1, a1, w1
|
|
118
|
+
|
|
119
|
+
@staticmethod
|
|
120
|
+
def backward(ctx, gq1, gv1, gl1, ga1, gw1):
|
|
121
|
+
q, a0, u, q1, l1 = ctx.saved_tensors
|
|
122
|
+
z = lambda ref: torch.zeros_like(ref) # noqa: E731 (the launcher takes zeros, not null, for an absent cotangent)
|
|
123
|
+
g1 = gq1.contiguous() if gq1 is not None else z(q1)
|
|
124
|
+
wv = gv1.contiguous() if gv1 is not None else torch.zeros(q.shape[0], ctx.C.nv, dtype=q.dtype, device=q.device)
|
|
125
|
+
wl = gl1.contiguous() if gl1 is not None else z(l1)
|
|
126
|
+
wa = ga1.contiguous() if ga1 is not None else z(a0)
|
|
127
|
+
gq, vbar, lbar, abar, ubar, flags = ctx.eng.adjoint_mus_raw(ctx.win.rec[ctx.slot], a0, u, l1, q, q1, g1, wv, wl, wa)
|
|
128
|
+
fl = flags[0]
|
|
129
|
+
for k in range(1, flags.shape[0]):
|
|
130
|
+
fl = fl | flags[k]
|
|
131
|
+
ctx.win.flags.bitwise_or_(fl)
|
|
132
|
+
return gq, vbar, lbar, abar, ubar, None, None, None, None
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""D16 L4: the tape record (core/soft/tape.h) from Python. The layout comes from the C header through the C ABI
|
|
2
|
+
(soft_tape_layout), so there is one source of truth; decode() splits records into fields the way B's reader does.
|
|
3
|
+
Records are float32 words (production) or float64 words (the f64 build): integer fields are stored bitwise, a u32 in a
|
|
4
|
+
float word and the same u32 zero-extended in a double word, so they are read by reinterpreting the words, never by value.
|
|
5
|
+
"""
|
|
6
|
+
import ctypes
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
KEYS = ("nq", "nv", "ntri", "maxcon", "maxrows", "hdr", "flags", "min_nu", "reserved", "clamp", "zone", "con", "qpos", "qvel",
|
|
11
|
+
"qacc", "qadv", "LH", "LQ", "words", "n_clamp", "n_zone", "n_con", "npose", "pose", "nmus", "mus")
|
|
12
|
+
FLAGS = dict(overflow=1 << 0, nonconv=1 << 9, singular=1 << 10, warm=1 << 12, stalled=1 << 13, pose=1 << 14, mus=1 << 15)
|
|
13
|
+
CON_NONE = 0xFFFF
|
|
14
|
+
MAXCON, MAXROWS = 64, 192 # the GPU capacities (core/soft/gpu/l2.cuh kMaxCon, kMaxRows)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def layout(lib, nq, nv, maxcon=MAXCON, maxrows=MAXROWS, npose=0, nmus=0):
|
|
18
|
+
"""npose > 0: the optional POSE block (the bodies' frames at the substep's input q) after L_Q; nmus > 0: the optional MUS
|
|
19
|
+
block (lce_prev [nmus]) after it. Through soft_tape_layout2 (26 entries: the 24 of soft_tape_layout, then nmus, mus)."""
|
|
20
|
+
# the library's own count and names must equal KEYS (an entry inserted in the C array would otherwise shift every later
|
|
21
|
+
# index silently; the request after d5's crash, 2026-11-02)
|
|
22
|
+
getattr(lib, "soft_tape_layout2_keys").restype = ctypes.c_char_p
|
|
23
|
+
n_lib, k_lib = int(getattr(lib, "soft_tape_layout2_count")()), getattr(lib, "soft_tape_layout2_keys")().decode()
|
|
24
|
+
assert n_lib == len(KEYS) and k_lib == ",".join(KEYS), (n_lib, len(KEYS), k_lib, ",".join(KEYS))
|
|
25
|
+
out = np.zeros(len(KEYS), np.int32)
|
|
26
|
+
lib.soft_tape_layout2(nq, nv, maxcon, maxrows, npose, nmus, out.ctypes.data_as(ctypes.POINTER(ctypes.c_int)))
|
|
27
|
+
return dict(zip(KEYS, (int(x) for x in out)))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def words_u32(rec):
|
|
31
|
+
"""the records' words as u32 (the low half of a double word)"""
|
|
32
|
+
r = np.ascontiguousarray(rec)
|
|
33
|
+
if r.dtype == np.float32:
|
|
34
|
+
return r.view(np.uint32)
|
|
35
|
+
assert r.dtype == np.float64
|
|
36
|
+
return (r.view(np.uint64) & np.uint64(0xFFFFFFFF)).astype(np.uint32)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def tri_unpack(packed, n):
|
|
40
|
+
i, j = np.tril_indices(n)
|
|
41
|
+
out = np.zeros(packed.shape[:-1] + (n, n), packed.dtype)
|
|
42
|
+
out[..., i, j] = packed[..., i * (i + 1) // 2 + j]
|
|
43
|
+
return out
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def decode(rec, lay):
|
|
47
|
+
"""records (..., words) -> dict: ncon, nefc, nlim, niter, flags (+ one bool per FLAGS key), min_nu, clamp (bool, nv),
|
|
48
|
+
zone (bool, maxrows), pair / slot (int, maxcon; -1 past ncon), qpos, qvel, qacc, qacc_adv, L_H, L_Q (lower, nv x nv)"""
|
|
49
|
+
a = np.ascontiguousarray(rec)
|
|
50
|
+
assert a.shape[-1] == lay["words"], (a.shape, lay["words"])
|
|
51
|
+
u = words_u32(a).astype(np.int64)
|
|
52
|
+
if a.dtype == np.float64: # an int word of the f64 record has its high half zero
|
|
53
|
+
hi = a.view(np.uint64) >> np.uint64(32)
|
|
54
|
+
ints = [lay["hdr"], lay["flags"], lay["reserved"]] + list(range(lay["clamp"], lay["qpos"]))
|
|
55
|
+
assert not hi[..., ints].any(), "an integer word of the f64 record has a nonzero high half"
|
|
56
|
+
hdr, flags = u[..., lay["hdr"]], u[..., lay["flags"]]
|
|
57
|
+
out = dict(ncon=hdr & 255, nefc=(hdr >> 8) & 255, nlim=(hdr >> 16) & 255, niter=hdr >> 24, flags=flags,
|
|
58
|
+
reserved=u[..., lay["reserved"]], min_nu=a[..., lay["min_nu"]])
|
|
59
|
+
for k, b in FLAGS.items():
|
|
60
|
+
out[k] = (flags & b) != 0
|
|
61
|
+
nv, nr, nc = lay["nv"], lay["maxrows"], lay["maxcon"]
|
|
62
|
+
bits = lambda w: ((w[..., :, None] >> np.arange(32)) & 1).astype(bool).reshape(w.shape[:-1] + (-1,)) # noqa: E731
|
|
63
|
+
out["clamp"] = bits(u[..., lay["clamp"]:lay["clamp"] + lay["n_clamp"]])[..., :nv]
|
|
64
|
+
out["zone"] = bits(u[..., lay["zone"]:lay["zone"] + lay["n_zone"]])[..., :nr]
|
|
65
|
+
cw = u[..., lay["con"]:lay["con"] + lay["n_con"]]
|
|
66
|
+
e = np.stack([cw & 0xFFFF, cw >> 16], -1).reshape(cw.shape[:-1] + (-1,))[..., :nc]
|
|
67
|
+
past = np.arange(nc) >= out["ncon"][..., None]
|
|
68
|
+
out["con_raw"] = e
|
|
69
|
+
out["pair"], out["slot"] = np.where(past, -1, e & 511), np.where(past, -1, e >> 9)
|
|
70
|
+
for name, key, n in (("qpos", "qpos", lay["nq"]), ("qvel", "qvel", nv), ("qacc", "qacc", nv), ("qacc_adv", "qadv", nv)):
|
|
71
|
+
out[name] = a[..., lay[key]:lay[key] + n]
|
|
72
|
+
out["L_H"] = tri_unpack(a[..., lay["LH"]:lay["LH"] + lay["ntri"]], nv)
|
|
73
|
+
out["L_Q"] = tri_unpack(a[..., lay["LQ"]:lay["LQ"] + lay["ntri"]], nv)
|
|
74
|
+
np_, nm_ = lay["npose"], lay.get("nmus", 0) # (a layout read from an older file has no nmus: 0)
|
|
75
|
+
end_q = lay["pose"] if np_ > 0 else (lay["mus"] if nm_ > 0 else lay["words"])
|
|
76
|
+
pads = [range(lay["qadv"] + nv, lay["LH"]), range(lay["LH"] + lay["ntri"], lay["LQ"]),
|
|
77
|
+
range(lay["LQ"] + lay["ntri"], end_q)]
|
|
78
|
+
if np_ > 0:
|
|
79
|
+
o = lay["pose"]
|
|
80
|
+
out["xpos"] = a[..., o:o + 3 * np_].reshape(a.shape[:-1] + (np_, 3))
|
|
81
|
+
out["xquat"] = a[..., o + 3 * np_:o + 7 * np_].reshape(a.shape[:-1] + (np_, 4))
|
|
82
|
+
pads.append(range(o + 7 * np_, lay["mus"] if nm_ > 0 else lay["words"]))
|
|
83
|
+
if nm_ > 0:
|
|
84
|
+
out["lce_prev"] = a[..., lay["mus"]:lay["mus"] + nm_]
|
|
85
|
+
pads.append(range(lay["mus"] + nm_, lay["words"]))
|
|
86
|
+
assert (out["pose"] == (np_ > 0)).all(), "the flags' POSE bit disagrees with the layout"
|
|
87
|
+
assert (out["mus"] == (nm_ > 0)).all(), "the flags' MUS bit disagrees with the layout"
|
|
88
|
+
out["pad"] = np.concatenate([u[..., list(r)] for r in pads], -1)
|
|
89
|
+
return out
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""ctypes loader of the CPU engine prototype (x14_cpu.cpp: the GPU engine's own device code on the host through the fiber shim), and its
|
|
2
|
+
prototype gate (ENGINE_UNIFY_PLAN.md phase 2: the 14x control step's time on the Mac against the 10 ms rule, and its agreement with the f64
|
|
3
|
+
oracle).
|
|
4
|
+
python tools/d16_unify/cpu_engine/x14cpu.py --case CASE_DIR --law-npz NPZ [--oracle C1_OUT.npz] [--variant e0|mm] [--rows N] [--steps S]
|
|
5
|
+
[--out OUT.json]
|
|
6
|
+
--oracle: c1_cpu.py's output for the same rows at --steps 1 (its law is the e0 variant): the CPU engine's f64 control step against it."""
|
|
7
|
+
import argparse
|
|
8
|
+
import ctypes
|
|
9
|
+
import importlib.util
|
|
10
|
+
import json
|
|
11
|
+
import pathlib
|
|
12
|
+
import subprocess
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
import numpy as np
|
|
16
|
+
|
|
17
|
+
from diffneusim._paths import ROOT as ROOT # (3a) the repo root
|
|
18
|
+
_s = importlib.util.spec_from_file_location("case_tables", ROOT / "engine" / "case_tables.py")
|
|
19
|
+
KG = importlib.util.module_from_spec(_s)
|
|
20
|
+
_s.loader.exec_module(KG)
|
|
21
|
+
NSUB, KFIB = 5, 6
|
|
22
|
+
VP = ctypes.c_void_p
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class X14Cpu:
|
|
26
|
+
def __init__(self, lib, case_dir, prec):
|
|
27
|
+
self.L = ctypes.CDLL(str(lib))
|
|
28
|
+
self.L.x14cpu_new.restype = VP
|
|
29
|
+
self.L.x14cpu_run.restype = ctypes.c_double
|
|
30
|
+
self.has_flags = hasattr(self.L, "x14cpu_run_flags") # a library built before 11-11 lacks it (run() still works)
|
|
31
|
+
if self.has_flags:
|
|
32
|
+
self.L.x14cpu_run_flags.restype = ctypes.c_double
|
|
33
|
+
sz = (ctypes.c_int * 6)()
|
|
34
|
+
self.L.x14cpu_sizes(sz)
|
|
35
|
+
self.nq, self.nv, self.nm = sz[0], sz[1], sz[2]
|
|
36
|
+
self.prec, self.ft = prec, (np.float32 if prec == 0 else np.float64)
|
|
37
|
+
C = KG.load_case(case_dir)
|
|
38
|
+
# the law (11-17, M0): a Millard case runs on a Millard build only (build.sh TAG OUT -DD16_X14_MILLARD exports x14cpu_millard),
|
|
39
|
+
# a Geyer case on a Geyer build only; the Millard case's eleven arrays follow the perm, in case_tables.MILLARD's order (the build's a[52 ..])
|
|
40
|
+
self.millard = KG.is_millard(C)
|
|
41
|
+
assert self.millard == hasattr(self.L, "x14cpu_millard"), (
|
|
42
|
+
f"{lib} is a {'Millard' if hasattr(self.L, 'x14cpu_millard') else 'Geyer'} build and {case_dir} a "
|
|
43
|
+
f"{'Millard' if self.millard else 'Geyer'} case: build the CPU engine with -DD16_X14_MILLARD for a Millard case, without it otherwise")
|
|
44
|
+
if "perm" not in C:
|
|
45
|
+
C["perm"] = np.arange(self.nm, dtype=np.int32)
|
|
46
|
+
self.keep = [np.ascontiguousarray(C[k], dtype=self.ft if (k in KG.FLOATS or C[k].dtype.kind == "f") else np.int32)
|
|
47
|
+
for k in KG.TABLE + ["perm"]]
|
|
48
|
+
assert len(self.keep) == 44, len(self.keep)
|
|
49
|
+
self.keep += [np.ascontiguousarray(C[k], dtype=self.ft if C[k].dtype.kind == "f" else np.int32) for k in KG.law_names(C)]
|
|
50
|
+
assert len(self.keep) == (55 if self.millard else 44), len(self.keep)
|
|
51
|
+
tabs = (VP * len(self.keep))(*[a.ctypes.data for a in self.keep])
|
|
52
|
+
self.dims = np.array(KG.bind_dims(C), np.int32)
|
|
53
|
+
self.h = VP(self.L.x14cpu_new(prec, self.dims.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), tabs))
|
|
54
|
+
|
|
55
|
+
def run(self, q, v, w, lce, a, u, steps=1, nsub=NSUB):
|
|
56
|
+
"""steps control steps of nsub substeps (2 ms each), u held; n worlds in rows, run together as the binding's grid. Returns (q, v, warm,
|
|
57
|
+
lce, a), stats [n, steps, nsub, 6] (tail14's rows: ncon, nefc, niter, warm kept, nlim, cap), wall seconds"""
|
|
58
|
+
n = q.shape[0]
|
|
59
|
+
ins = [np.ascontiguousarray(x, dtype=self.ft) for x in (q, v, w, lce, a, u)]
|
|
60
|
+
outs = [np.zeros((n, self.nq), self.ft), np.zeros((n, self.nv), self.ft), np.zeros((n, self.nv), self.ft),
|
|
61
|
+
np.zeros((n, self.nm), self.ft), np.zeros((n, self.nm), self.ft)]
|
|
62
|
+
st = np.zeros((n, steps, nsub, 6), np.int32)
|
|
63
|
+
secs = self.L.x14cpu_run(self.prec, self.h, n, *[x.ctypes.data_as(VP) for x in ins], nsub, KFIB, steps,
|
|
64
|
+
*[x.ctypes.data_as(VP) for x in outs], st.ctypes.data_as(ctypes.POINTER(ctypes.c_int)))
|
|
65
|
+
return outs, st, secs
|
|
66
|
+
|
|
67
|
+
def run_flags(self, q, v, w, lce, a, u, steps=1, nsub=NSUB):
|
|
68
|
+
"""run() plus the engine's flag word per world (tail14's, as the binding's flags: kFlagOverflow 1, kFlagCap 4, kFlagRankLoss,
|
|
69
|
+
kFlagHandOrder, kFlagHandOverflow 256), OR-ed over the steps: returns (outs, stats, wall seconds, flags uint32 [n])"""
|
|
70
|
+
assert self.has_flags, "this CPU engine library predates x14cpu_run_flags (11-11): rebuild it with build.sh"
|
|
71
|
+
n = q.shape[0]
|
|
72
|
+
ins = [np.ascontiguousarray(x, dtype=self.ft) for x in (q, v, w, lce, a, u)]
|
|
73
|
+
outs = [np.zeros((n, self.nq), self.ft), np.zeros((n, self.nv), self.ft), np.zeros((n, self.nv), self.ft),
|
|
74
|
+
np.zeros((n, self.nm), self.ft), np.zeros((n, self.nm), self.ft)]
|
|
75
|
+
st = np.zeros((n, steps, nsub, 6), np.int32)
|
|
76
|
+
fl = np.zeros(n, np.uint32)
|
|
77
|
+
secs = self.L.x14cpu_run_flags(self.prec, self.h, n, *[x.ctypes.data_as(VP) for x in ins], nsub, KFIB, steps,
|
|
78
|
+
*[x.ctypes.data_as(VP) for x in outs], st.ctypes.data_as(ctypes.POINTER(ctypes.c_int)),
|
|
79
|
+
fl.ctypes.data_as(VP))
|
|
80
|
+
return outs, st, secs, fl
|
|
81
|
+
|
|
82
|
+
def act(self, u, a_prev, dt=0.002):
|
|
83
|
+
"""k_act14: the engine's activation alone (k_mus's first stage), [n, nm] -> [n, nm]"""
|
|
84
|
+
u, a_prev = (np.ascontiguousarray(x, dtype=self.ft) for x in (u, a_prev))
|
|
85
|
+
out = np.zeros_like(a_prev)
|
|
86
|
+
self.L.x14cpu_act(self.prec, self.h, u.shape[0], u.ctypes.data_as(VP), a_prev.ctypes.data_as(VP), ctypes.c_double(dt), out.ctypes.data_as(VP))
|
|
87
|
+
return out
|
|
88
|
+
|
|
89
|
+
def act_vjp(self, u, a_prev, a_bar, dt=0.002):
|
|
90
|
+
"""k_act14_vjp: (u_bar, a_prev_bar) for a cotangent a_bar of k_act14's output"""
|
|
91
|
+
u, a_prev, a_bar = (np.ascontiguousarray(x, dtype=self.ft) for x in (u, a_prev, a_bar))
|
|
92
|
+
ub, ab = np.zeros_like(u), np.zeros_like(u)
|
|
93
|
+
self.L.x14cpu_act_vjp(self.prec, self.h, u.shape[0], u.ctypes.data_as(VP), a_prev.ctypes.data_as(VP), ctypes.c_double(dt),
|
|
94
|
+
a_bar.ctypes.data_as(VP), ub.ctypes.data_as(VP), ab.ctypes.data_as(VP))
|
|
95
|
+
return ub, ab
|
|
96
|
+
|
|
97
|
+
def step_rec(self, q, v, w, lce, a, u, nsub=NSUB):
|
|
98
|
+
"""one control step with the substeps' activations recorded: (q, v, warm, lce, a), rec_a [nsub, n, nm]"""
|
|
99
|
+
n = q.shape[0]
|
|
100
|
+
ins = [np.ascontiguousarray(x, dtype=self.ft) for x in (q, v, w, lce, a, u)]
|
|
101
|
+
outs = [np.zeros((n, self.nq), self.ft), np.zeros((n, self.nv), self.ft), np.zeros((n, self.nv), self.ft),
|
|
102
|
+
np.zeros((n, self.nm), self.ft), np.zeros((n, self.nm), self.ft)]
|
|
103
|
+
rec = np.zeros((nsub, n, self.nm), self.ft)
|
|
104
|
+
self.L.x14cpu_step_rec.restype = ctypes.c_double
|
|
105
|
+
self.L.x14cpu_step_rec(self.prec, self.h, n, *[x.ctypes.data_as(VP) for x in ins], nsub, KFIB, *[x.ctypes.data_as(VP) for x in outs],
|
|
106
|
+
rec.ctypes.data_as(VP))
|
|
107
|
+
return outs, rec
|
|
108
|
+
|
|
109
|
+
def equil(self, q, lce, a0, outer=8, dt=0.002):
|
|
110
|
+
"""k_mus_equil: the fibres' isometric equilibrium at fixed q and a0 (engine14.equil_lce's Geyer path: outer rounds of KFIB Newton steps)"""
|
|
111
|
+
ins = [np.ascontiguousarray(x, dtype=self.ft) for x in (q, lce, a0)]
|
|
112
|
+
out = np.zeros_like(ins[1])
|
|
113
|
+
self.L.x14cpu_equil(self.prec, self.h, q.shape[0], *[x.ctypes.data_as(VP) for x in ins], KFIB, int(outer), ctypes.c_double(dt),
|
|
114
|
+
out.ctypes.data_as(VP))
|
|
115
|
+
return out
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def rel(x, ref):
|
|
119
|
+
return float(np.max(np.abs(x - ref) / np.maximum(1.0, np.abs(ref))))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def main():
|
|
123
|
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
|
124
|
+
ap.add_argument("--case", required=True)
|
|
125
|
+
ap.add_argument("--law-npz", required=True)
|
|
126
|
+
ap.add_argument("--oracle")
|
|
127
|
+
ap.add_argument("--variant", choices=("e0", "mm"), default="e0")
|
|
128
|
+
ap.add_argument("--rows", type=int, default=40)
|
|
129
|
+
ap.add_argument("--steps", type=int, default=20)
|
|
130
|
+
ap.add_argument("--build-dir", required=True)
|
|
131
|
+
ap.add_argument("--out")
|
|
132
|
+
a = ap.parse_args()
|
|
133
|
+
lib = subprocess.run([str(ROOT / "core" / "cpu_engine" / "build.sh"), a.variant, a.build_dir], check=True, capture_output=True,
|
|
134
|
+
text=True).stdout.strip().splitlines()[-1]
|
|
135
|
+
z = np.load(a.law_npz)
|
|
136
|
+
m = a.rows
|
|
137
|
+
st = dict(q=z["q"][:m], v=z["qd_law"][:m], w=z["warm"][:m], lce=z["lce"][:m], a=z["a"][:m], u=z["u"][:m])
|
|
138
|
+
res = dict(variant=a.variant, lib=lib, rows=m, steps=a.steps, nsub=NSUB, kfib=KFIB)
|
|
139
|
+
for prec, name in ((1, "f64"), (0, "f32")):
|
|
140
|
+
E = X14Cpu(lib, a.case, prec)
|
|
141
|
+
(q1, v1, w1, l1, a1), s1, _ = E.run(st["q"], st["v"], st["w"], st["lce"], st["a"], st["u"], steps=1)
|
|
142
|
+
(q2, v2, _, l2, _), _, _ = E.run(st["q"], st["v"], st["w"], st["lce"], st["a"], st["u"], steps=1)
|
|
143
|
+
det = bool(np.array_equal(q1, q2) and np.array_equal(v1, v2) and np.array_equal(l1, l2))
|
|
144
|
+
fin = bool(all(np.isfinite(x).all() for x in (q1, v1, w1, l1, a1)))
|
|
145
|
+
(qT, vT, _, lT, _), sT, secs = E.run(st["q"], st["v"], st["w"], st["lce"], st["a"], st["u"], steps=a.steps)
|
|
146
|
+
r = dict(deterministic=det, finite_1step=fin, finite_run=bool(np.isfinite(qT).all() and np.isfinite(lT).all()),
|
|
147
|
+
seconds=round(secs, 4), ms_per_control_step=round(1e3 * secs / (m * a.steps), 3),
|
|
148
|
+
niter_hist=np.bincount(sT[..., 2].ravel(), minlength=5).tolist(), nefc_max=int(sT[..., 1].max()),
|
|
149
|
+
big_path_substeps=int((sT[..., 1] > 128).sum()), root_z_range=[round(float(qT[:, 2].min()), 3), round(float(qT[:, 2].max()), 3)])
|
|
150
|
+
if a.oracle and prec == 1:
|
|
151
|
+
o = np.load(a.oracle)
|
|
152
|
+
k = o["q"].shape[0]
|
|
153
|
+
assert k <= m and json.loads(str(o["meta"]))["steps"] == 1, "the oracle: c1_cpu --steps 1 on the first rows"
|
|
154
|
+
r["vs_oracle_1step"] = dict(rows=k, q=rel(q1[:k], o["q"]), v=rel(v1[:k], o["v"]), lce=rel(l1[:k], o["lce"]), a=rel(a1[:k], o["a"]),
|
|
155
|
+
warm=rel(w1[:k], o["warm"]))
|
|
156
|
+
res[name] = r
|
|
157
|
+
print(name, json.dumps(r), flush=True)
|
|
158
|
+
if a.out:
|
|
159
|
+
pathlib.Path(a.out).write_text(json.dumps(res, indent=1))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
if __name__ == "__main__":
|
|
163
|
+
sys.exit(main())
|
|
File without changes
|
diffneusim/env/absent.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""The handles the environment kept for the development tree's earlier CUDA engine, which is not part of DiffNeuSim. Every run steps the
|
|
2
|
+
engine env14 installs (E0_ENGINE14=1): its step, activation and fibre equilibrium replace these handles at install, and the walking tasks
|
|
3
|
+
assert at run time that nothing reaches them (E0_ENV14_NO_OLD=1). An Absent keeps the plain attributes it is given (the model path) and
|
|
4
|
+
stops any call with an error naming it, so a setting that would need the earlier engine fails at once instead of running something else."""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Absent:
|
|
8
|
+
def __init__(self, what, **attrs):
|
|
9
|
+
self._what = what
|
|
10
|
+
self.__dict__.update(attrs)
|
|
11
|
+
|
|
12
|
+
def __getattr__(self, name):
|
|
13
|
+
if name.startswith("__"):
|
|
14
|
+
raise AttributeError(name)
|
|
15
|
+
what = self._what
|
|
16
|
+
|
|
17
|
+
def absent(*a, **kw):
|
|
18
|
+
raise AssertionError(f"{what}.{name}: the earlier engine is not part of DiffNeuSim; every run steps the engine env14 installs "
|
|
19
|
+
"(E0_ENGINE14=1), so a setting that reaches this has no engine to run on")
|
|
20
|
+
return absent
|
diffneusim/env/cpu14.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""env14's CPU backend (feat/d16-taskwalk step 5, the Mac dry-run; E0_ENV14_BACKEND=cpu): Engine14's interface on the CPU engine
|
|
2
|
+
(tools/d16_unify/cpu_engine: the GPU binding's own kernels, x14_engine_kernels.cuh, through the fiber shim). Forward only: there is no CPU
|
|
3
|
+
adjoint, so env14 refuses a gradient-enabled step on it. The engine's dtype is the env's tensors' (float32 by default) and its device the
|
|
4
|
+
CPU. E0_ENV14_CPU_LIB names the built library (tools/d16_unify/cpu_engine/build.sh TAG DIR; the body's tag must match D16_BODY)."""
|
|
5
|
+
import importlib.util
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
import torch
|
|
9
|
+
|
|
10
|
+
from diffneusim._paths import ROOT as _ROOT # (3a) the repo root
|
|
11
|
+
_s = importlib.util.spec_from_file_location("x14cpu", _ROOT / "engine" / "x14cpu.py")
|
|
12
|
+
X = importlib.util.module_from_spec(_s)
|
|
13
|
+
_s.loader.exec_module(X)
|
|
14
|
+
# engine14.EQUIL_DT_MILLARD, EQUIL_POLISH_MILLARD (the review's decision (a), 11-05; MILLARD14.md gate 6), written out here because engine14 loads the
|
|
15
|
+
# CUDA extension at import; tools/millard_m0/cpu_millard_gate.py asserts they equal engine14's
|
|
16
|
+
EQUIL_DT_MILLARD, EQUIL_POLISH_MILLARD = (0.1, 2.0), 4
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CpuExt:
|
|
20
|
+
"""the binding's act / act_vjp signatures (lists of [n, NM] tensors, in place)"""
|
|
21
|
+
|
|
22
|
+
def __init__(self, E):
|
|
23
|
+
self.E = E
|
|
24
|
+
|
|
25
|
+
def act(self, b, dt):
|
|
26
|
+
b[2].copy_(torch.from_numpy(self.E.act(b[0].numpy(), b[1].numpy(), dt)))
|
|
27
|
+
|
|
28
|
+
def act_vjp(self, b, dt):
|
|
29
|
+
ub, ab = self.E.act_vjp(b[0].numpy(), b[1].numpy(), b[2].numpy(), dt)
|
|
30
|
+
b[3].copy_(torch.from_numpy(ub))
|
|
31
|
+
b[4].copy_(torch.from_numpy(ab))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class CpuEngine14:
|
|
35
|
+
def __init__(self, n, dtype, case_dir, lib):
|
|
36
|
+
self.E = X.X14Cpu(lib, case_dir, 1 if dtype == torch.float64 else 0)
|
|
37
|
+
assert self.E.has_flags, f"{lib} predates the flag word (x14cpu_run_flags, 11-11): rebuild the CPU engine with build.sh"
|
|
38
|
+
self.case = X.KG.load_case(case_dir)
|
|
39
|
+
# a Millard case (11-17, M0) runs on a Millard build of the CPU engine (X14Cpu asserts the pairing); its reset is engine14's
|
|
40
|
+
# Millard schedule, so X14_EQUIL_SCHEDULE (the Geyer-root arm) is refused here as engine14 refuses it
|
|
41
|
+
self.millard, self.equil_schedule, self.equil_log, self.equil_kfib = X.KG.is_millard(self.case), None, [], X.KFIB
|
|
42
|
+
assert self.millard == self.E.millard
|
|
43
|
+
import os
|
|
44
|
+
# X14_MILLARD_EQUIL_SCHEDULE (2026-11-18; engine14's option, OFF by default): a Millard case's reset as these launches instead of
|
|
45
|
+
# the Millard schedule, mirrored here so a CPU dry run follows the same reset (at the CPU engine's own precision)
|
|
46
|
+
msch = os.environ.get("X14_MILLARD_EQUIL_SCHEDULE", "")
|
|
47
|
+
self.millard_schedule = [(int(r), float(d)) for r, d in (x.split(":") for x in msch.split(","))] if msch else None
|
|
48
|
+
assert self.millard_schedule is None or (self.millard and all(r >= 1 and d > 0 for r, d in self.millard_schedule)), \
|
|
49
|
+
f"X14_MILLARD_EQUIL_SCHEDULE={msch!r}: Millard cases only, rounds >= 1, dt > 0 (engine14)"
|
|
50
|
+
self.n, self.dt = n, dtype
|
|
51
|
+
self.ext = CpuExt(self.E)
|
|
52
|
+
self.calls = dict(control_step=0, equil=0)
|
|
53
|
+
# the engine's flag word per world, as engine14's i["flags"]: OR-ed over every control step since zero_flags() (the CPU engine
|
|
54
|
+
# runs the binding's tail14, so the bits are the binding's: kFlagOverflow 1, kFlagCap 4, kFlagHandOverflow 256, ...)
|
|
55
|
+
self.i = dict(flags=torch.zeros(n, dtype=torch.int32))
|
|
56
|
+
|
|
57
|
+
def control_step(self, q, v, warm, lce, a, u, record=False, parts=15, tape=None):
|
|
58
|
+
assert not record and tape is None, "the CPU backend is untaped (forward only)"
|
|
59
|
+
assert not torch.is_grad_enabled(), "the CPU backend has no adjoint: run the dry-run under no_grad"
|
|
60
|
+
outs, stats, _, fl = self.E.run_flags(*(x.detach().numpy() for x in (q, v, warm, lce, a, u)))
|
|
61
|
+
self.calls["control_step"] += 1
|
|
62
|
+
assert fl.max(initial=0) < 2 ** 31, "a flag bit above the int32 word"
|
|
63
|
+
self.i["flags"] |= torch.from_numpy(fl.astype(np.int32))
|
|
64
|
+
t = [torch.from_numpy(x).to(self.dt) for x in outs]
|
|
65
|
+
return dict(qpos=t[0], qvel=t[1], warm=t[2], lce=t[3], a=t[4], stats=torch.from_numpy(stats[:, 0]), flags=self.i["flags"])
|
|
66
|
+
|
|
67
|
+
def zero_flags(self):
|
|
68
|
+
self.i["flags"].zero_()
|
|
69
|
+
|
|
70
|
+
def equil_lce(self, q, lce, a0, mask, outer=8, out=None):
|
|
71
|
+
assert bool(mask.all()), "the CPU backend equilibrates every world"
|
|
72
|
+
if self.millard and self.millard_schedule is not None: # engine14's X14_MILLARD_EQUIL_SCHEDULE: its launches, the first from the seed
|
|
73
|
+
assert int(outer) == 8, f"X14_MILLARD_EQUIL_SCHEDULE with outer {outer}: the schedule sets the rounds"
|
|
74
|
+
r = lce.numpy()
|
|
75
|
+
for k, d in self.millard_schedule:
|
|
76
|
+
r = self.E.equil(q.numpy(), r, a0.numpy(), int(k), dt=d)
|
|
77
|
+
r = torch.from_numpy(r).to(self.dt)
|
|
78
|
+
if not self.equil_log:
|
|
79
|
+
self.equil_log.extend(self.millard_schedule)
|
|
80
|
+
self.calls["equil"] += 1
|
|
81
|
+
if out is None:
|
|
82
|
+
return r
|
|
83
|
+
out.copy_(r)
|
|
84
|
+
return out
|
|
85
|
+
if self.millard: # engine14.equil_lce's Millard path: `outer` rounds at EQUIL_DT_MILLARD[0], then EQUIL_POLISH_MILLARD in place at [1]
|
|
86
|
+
r0 = self.E.equil(q.numpy(), lce.numpy(), a0.numpy(), int(outer), dt=EQUIL_DT_MILLARD[0])
|
|
87
|
+
r = torch.from_numpy(self.E.equil(q.numpy(), r0, a0.numpy(), EQUIL_POLISH_MILLARD, dt=EQUIL_DT_MILLARD[1])).to(self.dt)
|
|
88
|
+
if len(self.equil_log) < 2:
|
|
89
|
+
self.equil_log += [(int(outer), EQUIL_DT_MILLARD[0]), (EQUIL_POLISH_MILLARD, EQUIL_DT_MILLARD[1])]
|
|
90
|
+
self.calls["equil"] += 1
|
|
91
|
+
if out is None:
|
|
92
|
+
return r
|
|
93
|
+
out.copy_(r)
|
|
94
|
+
return out
|
|
95
|
+
r = torch.from_numpy(self.E.equil(q.numpy(), lce.numpy(), a0.numpy(), int(outer))).to(self.dt)
|
|
96
|
+
if len(self.equil_log) < 2:
|
|
97
|
+
self.equil_log.append((int(outer), 0.002))
|
|
98
|
+
self.calls["equil"] += 1
|
|
99
|
+
if out is None:
|
|
100
|
+
return r
|
|
101
|
+
out.copy_(r)
|
|
102
|
+
return out
|
|
103
|
+
|
|
104
|
+
def equil_residual(self, q, lce, a0, mask):
|
|
105
|
+
return (torch.from_numpy(self.E.equil(q.numpy(), lce.numpy(), a0.numpy(), 1)).to(self.dt) - lce).abs()
|