Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 多实体场景下use_hibernation=True时结果异常 #704

Open
big-ZWZ opened this issue Feb 11, 2025 · 0 comments
Open

[Bug]: 多实体场景下use_hibernation=True时结果异常 #704

big-ZWZ opened this issue Feb 11, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@big-ZWZ
Copy link

big-ZWZ commented Feb 11, 2025

Bug Description

感谢开源这么易用的物理引擎!

我尝试搭建一个n=x * x * x个立方体堆叠的场景(见下图),但遇到以下现象:

  1. 关闭自动休眠时,多个立方体正确堆叠,但随着立方体数量的增加(n=1、8、27、64),FPS下降极快。这一点其它框架例如mjx似乎并不明显
    Image
  2. 开启自动休眠时,1)立方体发生穿模,2)FPS仍然较低
    Image

Steps to Reproduce

import argparse
import time
import genesis as gs
import numpy as np

parser = argparse.ArgumentParser()
parser.add_argument("-B", type=int, default=1) # batch size
parser.add_argument("-n", type=int, default=100)
parser.add_argument("-v", action="store_true", default=False) # visualize

args = parser.parse_args()

########################## init ##########################
gs.init(backend=gs.gpu)

########################## create a scene ##########################
scene = gs.Scene(
show_viewer=args.v,
viewer_options=gs.options.ViewerOptions(
camera_pos=(10, 10, 10),
camera_lookat=(0.0, 0.0, 0.0),
camera_fov=40,
),
rigid_options=gs.options.RigidOptions(
dt=0.01,
constraint_solver=gs.constraint_solver.Newton,
# use_contact_island=True,
# use_hibernation=True,
),
)

########################## entities ##########################
plane = scene.add_entity(
gs.morphs.Plane(),
)

gap=1.01
ground_height=0.5
floor = int(np.cbrt(args.n))
for i in range(floor):
for j in range(floor):
for k in range(floor):
scene.add_entity(
gs.morphs.Box(
pos=(igap, jgap, k*gap+ground_height),
size=(1, 1, 1),
),
)

########################## build ##########################
n_envs = args.B
scene.build(n_envs=n_envs)

for i in range(50):
scene.step()

iter = 400
t0 = time.perf_counter()
for i in range(iter):
scene.step()
t1 = time.perf_counter()

print(f'{(t1 - t0)*1000:,.3f} ms')
print(f'per env: {iter / (t1 - t0):,.2f} FPS')
print(f'total : {iter / (t1 - t0) * n_envs:,.2f} FPS')

Expected Behavior

期望:

  1. 描述下为什么增加有限的刚体,FPS下降剧烈
  2. 开启/关闭 自动休眠有相同的仿真结果

Screenshots/Videos

No response

Relevant log output

python test_genesis.py -B 1 -n 1\8\27\64

自动休眠:
n = 1、8、27、64
FPS = 2,718.32 、1,346.54 、360.02、12.38

关闭自动休眠+单env下:
n = 1、8、27、64
FPS = 2,818.94 、310.81、24.30、3.08

Environment

  • OS: Ubuntu 22.04
  • GPU: NVIDIA RTX A6000
  • Driver Version: 565.57.01
  • CUDA Version: 12.7

Release version or Commit ID

v0.2.1

Additional Context

No response

@big-ZWZ big-ZWZ added the bug Something isn't working label Feb 11, 2025
@YilingQiao YilingQiao self-assigned this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants