SAPIEN icon indicating copy to clipboard operation
SAPIEN copied to clipboard

RuntimeError: GPU PhysX can only be enabled once before any other code involving PhysX

Open erwincoumans opened this issue 1 year ago • 2 comments

System:

Describe the bug

RuntimeError                              Traceback (most recent call last)
[<ipython-input-6-e701a4c4bdd2>](https://localhost:8080/#) in <cell line: 8>()
      6 import time
      7 num_envs = 2048 # you can go up to 4096 on better GPUs
----> 8 env = gym.make("PickCube-v1", num_envs=num_envs)
      9 env.unwrapped.print_sim_details()
     10 obs, _ = env.reset(seed=0)

5 frames
[/usr/local/lib/python3.10/dist-packages/sapien/physx/__init__.py](https://localhost:8080/#) in enable_gpu()
     46         ctypes.CDLL(str(dll), ctypes.RTLD_LOCAL)
     47 
---> 48     _enable_gpu()

RuntimeError: GPU PhysX can only be enabled once before any other code involving PhysX

To Reproduce Steps to reproduce the behavior (use pastebin for code):

  1. open https://colab.research.google.com/github/haosulab/ManiSkill/blob/main/examples/tutorials/1_quickstart.ipynb#scrollTo=VHxJTaQA-cPq
  2. run all cells

Cell 6 1.2 GPU (State-only) reports the error, even after restarting the run-time.

erwincoumans avatar May 10 '24 19:05 erwincoumans

image

erwincoumans avatar May 10 '24 19:05 erwincoumans

Sorry I just saw this, this issue should probably go to the ManiSkill repo but I will take a look here. Does this bug still exist? There have been some updates since 2 weeks ago. I just tried running the notebook code again, running the setup code section and then just 1.2 + 1.3 and it is ok

Note that there is a bug with colab where GPU memory doesn't get released if you create environments via python code in the cell. It works fine otherwise if you are calling scripts like the example PPO code there (since the process closes completely), hence why the notebook mentions having to restart session

StoneT2000 avatar May 23 '24 01:05 StoneT2000