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

RTX 30xx compatibility #115

Closed
alex404 opened this issue Oct 13, 2021 · 8 comments
Closed

RTX 30xx compatibility #115

alex404 opened this issue Oct 13, 2021 · 8 comments

Comments

@alex404
Copy link
Contributor

alex404 commented Oct 13, 2021

Hello, I was wondering if you could update the environment.yaml file to more recent versions of pytorch and cuda (i.e. 1.9.* and 11.*) to "officially" support RTX 30xx cards.

I have an AMD 5950x and an RTX 3090, and I've been able to get sample-factory running with vizdoom by installing vizdoom with pip in a conda environment and running sample-factory straight from the repository. The performance is great (I'm getting about 100K FPS), but I guess because I'm not using your vizdoom branch I'm locked out of the multi-agent framework. I'm also hoping to rely on sample-factory for a longer-term research project, and I worry that other issues might arise if I have to use it in this "unofficial" way.

Thanks for your hard work. This is an impressive piece of software!

@alex-petrenko
Copy link
Owner

Thank you for this inquiry. I guess there are several separate issues here.

First of all, the most straightforward way to install SF is via PyPI: pip install sample-factory
This will pull all the most recent versions of Pytorch, etc. Since this just requires a Python environment, you are free to setup your CUDA and CuDNN any way you like. I recommend initializing a conda env with the latest version of CUDA libraries, but you can use a system-wide installation as well. Let me know if you need any help or assistance with this. Generally, you just need an installation that supports GPU-accelerated Pytorch on your machine. Should not be any different than any other deep learning environment. For example, consult Pytorch installation guide for that: https://pytorch.org/get-started/locally/

VizDoom is a separate issue. If you want to replicate the results from the article exactly, you are advised to use the custom fork:
pip install git+https://github.com/alex-petrenko/ViZDoom@doom_bot_project#egg=vizdoom

If you just want to work with the latest Vizdoom, you should install it from pip normally. I believe some important fixes from doom_bot_project were merged into master Vizdoom as a part of this pull request: Farama-Foundation/ViZDoom#486
And so they should be included into the latest PyPI release 1.1.9.
I perhaps should update the installation instructions to reflect this.

Let me know if the multiplayer stuff works with the latest VizDoom from PyPI! If it does not, I can help to debug the issue.

@alex-petrenko
Copy link
Owner

Also, for 100K FPS, how many CPU cores are you using?
And what are the parameters such as number of workers, environments per worker, and batch size?

@alex404
Copy link
Contributor Author

alex404 commented Oct 16, 2021

Thanks for your reply and general advice. I haven't actually tried to run the multi-agent simulations yet because we haven't needed for our project, but it's good to hear that you think it should be generally supported without using your fork. If you have the time I think it would be helpful to update the README.md, because right now it strongly encourages new users to use your environment.yml and vizdoom fork, which isn't viable for people with the newest generation of cards, and doesn't seem strictly necessary.

Anyway, running

python -m sample_factory.algorithms.appo.train_appo --env=doom_benchmark --algo=APPO --env_frameskip=4 --use_rnn=True --num_workers=36 --num_envs_per_worker=24 --num_policies=1 --ppo_epochs=1 --rollout=32 --recurrence=32 --batch_size=8192 --wide_aspect_ratio=False --experiment=doom_5950x_RTX3090_bench --policy_workers_per_policy=2

for half an hour or so resulting in the program spitting out FPS: 100948.4. While running it maxes out the 16-cores/32 threads of my CPU, and seems to run around 50-60% utilization on my GPU.

I'll let you know when I get around to trying out the multi-agent simulations, but I'm pretty swamped for the next month, so it'll be a bit of time.

Thanks again!

@alex-petrenko
Copy link
Owner

alex-petrenko commented Oct 17, 2021 via email

@alex404
Copy link
Contributor Author

alex404 commented Oct 17, 2021

FYI, I tried running the same command with --batch_size=2048 and --num_works=16, and only got FPS: 85642.7

I then tried with --num_works=32 and --batch_size=2048, and got FPS: 101767.2, so a slight boost over what I had before.

@alex-petrenko
Copy link
Owner

alex-petrenko commented Oct 18, 2021 via email

@alex404
Copy link
Contributor Author

alex404 commented Oct 19, 2021

Cool, thanks for the tip!

@alex-petrenko
Copy link
Owner

Thanks for your reply and general advice. I haven't actually tried to run the multi-agent simulations yet because we haven't needed for our project, but it's good to hear that you think it should be generally supported without using your fork. If you have the time I think it would be helpful to update the README.md, because right now it strongly encourages new users to use your environment.yml and vizdoom fork, which isn't viable for people with the newest generation of cards, and doesn't seem strictly necessary.

Anyway, running

python -m sample_factory.algorithms.appo.train_appo --env=doom_benchmark --algo=APPO --env_frameskip=4 --use_rnn=True --num_workers=36 --num_envs_per_worker=24 --num_policies=1 --ppo_epochs=1 --rollout=32 --recurrence=32 --batch_size=8192 --wide_aspect_ratio=False --experiment=doom_5950x_RTX3090_bench --policy_workers_per_policy=2

for half an hour or so resulting in the program spitting out FPS: 100948.4. While running it maxes out the 16-cores/32 threads of my CPU, and seems to run around 50-60% utilization on my GPU.

I'll let you know when I get around to trying out the multi-agent simulations, but I'm pretty swamped for the next month, so it'll be a bit of time.

Thanks again!

I updated the README which now recommends installing VizDoom>=1.1.9 from PyPI. Everything works on it including the multi-agent stuff.

I still found that my environment.yml gives better performance than starting from an empty conda env and installing sample factory in it. I believe this is due to some performance regressions in the latest versions of MKL or Numpy. So I kept both options for now. Other than performance, everything seems to work with just pip install.

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

2 participants