Skip to content

Commit 3555838

Browse files
authored
Proper multi-gpu support with PPO (#178)
* Add multi-gpu example * fix pre-commit * Add documentation and benchmark * Update documentation * Quick fix * Also record world size in the params * remove trailing space * revert changes * Update test cases * Update test cases * Fix CI * Fix tests * Fix pre-commit * Fix tests * Add a note that multi gpu only supported in linux
1 parent eba6452 commit 3555838

16 files changed

+833
-5
lines changed

.github/workflows/tests.yaml

+53-3
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ jobs:
5656
poetry-version: ${{ matrix.poetry-version }}
5757

5858
# atari tests
59-
- name: Install core dependencies
60-
run: poetry install -E pytest
6159
- name: Install atari dependencies
62-
run: poetry install -E atari
60+
run: poetry install -E "pytest atari"
6361
- name: Downgrade setuptools
6462
run: poetry run pip install setuptools==59.5.0
6563
- name: Run atari tests
@@ -156,3 +154,55 @@ jobs:
156154
libosmesa6-dev patchelf
157155
- name: Run mujoco tests
158156
run: poetry run pytest tests/test_mujoco.py
157+
158+
test-envpool-envs:
159+
strategy:
160+
fail-fast: false
161+
matrix:
162+
python-version: [3.8]
163+
poetry-version: [1.1.11]
164+
os: [ubuntu-18.04]
165+
runs-on: ${{ matrix.os }}
166+
steps:
167+
- uses: actions/checkout@v2
168+
- uses: actions/setup-python@v2
169+
with:
170+
python-version: ${{ matrix.python-version }}
171+
- name: Run image
172+
uses: abatilo/actions-poetry@v2.0.0
173+
with:
174+
poetry-version: ${{ matrix.poetry-version }}
175+
176+
# envpool tests
177+
- name: Install envpool dependencies
178+
run: poetry install -E "pytest envpool"
179+
- name: Downgrade setuptools
180+
run: poetry run pip install setuptools==59.5.0
181+
- name: Run envpool tests
182+
run: poetry run pytest tests/test_envpool.py
183+
184+
test-atari-multigpu-envs:
185+
strategy:
186+
fail-fast: false
187+
matrix:
188+
python-version: [3.8]
189+
poetry-version: [1.1.11]
190+
os: [ubuntu-18.04]
191+
runs-on: ${{ matrix.os }}
192+
steps:
193+
- uses: actions/checkout@v2
194+
- uses: actions/setup-python@v2
195+
with:
196+
python-version: ${{ matrix.python-version }}
197+
- name: Run image
198+
uses: abatilo/actions-poetry@v2.0.0
199+
with:
200+
poetry-version: ${{ matrix.poetry-version }}
201+
202+
# atari multigpu tests
203+
- name: Install atari dependencies
204+
run: poetry install -E "pytest atari"
205+
- name: Downgrade setuptools
206+
run: poetry run pip install setuptools==59.5.0
207+
- name: Run atari tests
208+
run: poetry run pytest tests/test_atari_multigpu.py

benchmark/ppo.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,11 @@ xvfb-run -a python -m cleanrl_utils.benchmark \
4141
--env-ids starpilot bossfight bigfish \
4242
--command "poetry run python cleanrl/ppo_procgen.py --track --capture-video" \
4343
--num-seeds 3 \
44-
--workers 1
44+
--workers 1
45+
46+
poetry install -E atari
47+
xvfb-run -a python -m cleanrl_utils.benchmark \
48+
--env-ids PongNoFrameskip-v4 BeamRiderNoFrameskip-v4 BreakoutNoFrameskip-v4 \
49+
--command "poetry run torchrun --standalone --nnodes=1 --nproc_per_node=2 cleanrl/ppo_atari_multigpu.py --track --capture-video" \
50+
--num-seeds 3 \
51+
--workers 1

0 commit comments

Comments
 (0)