Skip to content

bug: 域随机化引起的场景构建卡顿 #245

Description

@humble02

Pre-flight checklist

  • I searched existing issues (open and closed) and found no duplicate.
  • I checked the README Troubleshooting section — this is not one of the documented pitfalls.
  • The bug does not reproduce in a pure Genesis script without GeneLab. (If unsure, leave unchecked and say so below — simulator bugs belong on the Genesis tracker.)

What happened

unchecked
genesis: rigid_solver.py lines 744-833
# TODO: Simple numpy-based for-loop for now as it is not performance critical
for i_b_, i_b in enumerate(envs_idx):
# Compute the inverted mass matrix efficiently
mass_mat_L_inv = np.eye(self.n_dofs_)
for i_d in range(self.n_dofs_):
for j_d in range(i_d):
mass_mat_L_inv[i_d] -= mass_mat_L[i_d, j_d, i_b] * mass_mat_L_inv[j_d]
mass_mat_inv = (mass_mat_L_inv * mass_mat_D_inv[:, i_b]) @ mass_mat_L_inv.T
# ... per-link Jacobian build + A = jac @ mass_mat_inv @ jac.T ...
# Stop there if not batched
if not batched:
break
当对为 armature/mass/friction 使用域随机化,会开启batch,对每个 env 都跑一遍:先 O(n_dofs²) 求质量矩阵逆,再对每根连杆(~30)组雅可比做矩阵乘计算,在单核 CPU 上串行。导致训练启动非常慢,4096环境需约15~20分钟。
以上为gpt5.6给我的解释。

Steps to reproduce

uv run genelab train Genelab-Velocity-Mattress-Unitree-G1-v0 --num_envs 4096

Environment

genelab 0.4.0
genesis 1.2.1
torch 2.10.0+cu128 cuda 12.8

RL backend

rsl_rl

Simulation backend

GPU (gpu=True)

Logs / traceback

1

Anything else

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions