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

updateUnity extremely slow for vector environments #70

Open
prafael18 opened this issue May 4, 2022 · 4 comments
Open

updateUnity extremely slow for vector environments #70

prafael18 opened this issue May 4, 2022 · 4 comments

Comments

@prafael18
Copy link

Hey everyone!

I was trying to train an agent using the depth images with the default SAC implementation from stable-baselines3 and noticed that training was extremely slow. After doing some profiling, I noticed that the bottleneck was in the updateUnity call, which is needed to retrieve the depth images. I was wondering if this was expected or if I'm doing something wrong that might be making this call take longer than expected.

By the way, I'm running the RPG_Flightmare standalone on a GPU, which I made sure of by checking with nvidia-smi, and I'm training with num_envs = 25. In the Flightmare paper, you guys advertise rendering speeds of up to 230Hz on a laptop, which I assume is achieved for a single environment (i.e. num_envs = 1). Therefore, I find it strange that I'm getting speeds closer to 1.6Hz on a GPU, even if for a larger number of environments. For reference, updateUnity runs at approximately 16Hz for num_envs = 1 on my GPU.

These are my PC specs:

CPU: AMD Ryzen 9 3900X 12-Core Processor
GPU: GeForce RTX 2070 SUPER
RAM: 32GiB DDR4 2133 MHz

And these are my profiling results:

env.wrapper.step() took 0.42ms
env.wrapper.updateUnity() took 616.98ms
env.get_info() took 1.24ms
env.get_depth_image() took 0.04ms
env.get_obs() took 0.05ms
sac.collect_rollouts() took 621.87ms
sac.train() took 39.49ms
@antonilo
Copy link
Contributor

antonilo commented May 7, 2022

You might want to decrease the image resolution if you train with depth images from scratch

@prafael18
Copy link
Author

I forgot to mention, but these results were for an 84x84 depth image, which is the resolution used by the original DQN network.

@Lu-tju
Copy link

Lu-tju commented May 21, 2022

Hi,
I have met the same problem as you. I run on the server with Xeon(R) CPU E5-2620 and 4 * GeForce RTX 2080. I find that the CPU, GPU, memory, and disk io take up very little, but the rendering of unity is very slow. On my own computer, the unity works well and CPU can consume up to 100%, it looks as if the server does not play a role. Note that it's not caused by training parameters, because it happens when I run run_vision_demo.py as well.
Have you solved this problem?
thanks a lot!

@ali-alridha
Copy link

Facing the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants