This is an implementation of an older version of the open source Overcooked-AI environment that is compatible with a javascript demo, built on the Madrona game engine. You can also read our post about the process of porting Overcooked to Madrona.
If you have already followed the instructions from the main README, Overcooked should already be installed. Otherwise, follow the following directions:
conda create -n madrona python=3.10
conda activate madrona
pip install torch numpy tensorboard
git clone --recurse-submodules https://github.com/bsarkar321/madrona_rl_envs
mkdir build && cd build
cmake ..
make -j
cd ..
pip install -e .
pip install -e oldercooked_ai
On some systems, you may need to specify the cuda toolkit directory for cmake as follows:
cmake -D CUDAToolkit_ROOT=/usr/local/cuda-12.0 ..
For testing correctness, ensure that the madrona conda environment is active and you are in the scripts directory.
For all of the following commands, the last line should be “Error rate: 0.0”
Verify that baseline (original overcooked-ai) installation passes tests:
python overcooked2_example.py --num-envs 32 --verbose --validation --asserts --use-baseline --layout simple
python overcooked2_example.py --num-envs 32 --verbose --validation --asserts --use-baseline --layout random1
python overcooked2_example.py --num-envs 32 --verbose --validation --asserts --use-baseline --layout scenario1_s
Verify that the simplified implementation passes tests:
python overcooked2_example.py --num-envs 32 --verbose --validation --asserts --use-simplified --layout simple
python overcooked2_example.py --num-envs 32 --verbose --validation --asserts --use-simplified --layout random1
python overcooked2_example.py --num-envs 32 --verbose --validation --asserts --use-simplified --layout scenario1_s
Verify that CPU version passes tests:
python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --use-cpu --layout simple
python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --use-cpu --layout random1
python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --use-cpu --layout scenario1_s
Verify that debug GPU version passes tests (note: remove /tmp/bugsimplecache if it exists):
MADRONA_MWGPU_KERNEL_CACHE=/tmp/bugsimplecache python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --debug-compile --layout simple
MADRONA_MWGPU_KERNEL_CACHE=/tmp/bugsimplecache python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --debug-compile --layout random1
MADRONA_MWGPU_KERNEL_CACHE=/tmp/bugsimplecache python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --debug-compile --layout scenario1_s
Verify that optimized GPU version passes tests (note: remove /tmp/simplecache if it exists):
MADRONA_MWGPU_KERNEL_CACHE=/tmp/simplecache python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --layout simple
MADRONA_MWGPU_KERNEL_CACHE=/tmp/simplecache python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --layout random1
MADRONA_MWGPU_KERNEL_CACHE=/tmp/simplecache python overcooked2_example.py --num-envs 100 --verbose --validation --asserts --layout scenario1_s
After validating correctness, we can determine the simulation throughput (in terms of steps * worlds / sec). Note that, in general, throughput increases as the number of environments increases.
To test the baseline, run the following command.
python overcooked2_example.py --num-envs 32 --use-baseline
To test the madrona versions for cpu and gpu, run the following commands:
python overcooked2_example.py --use-cpu --num-envs 32
MADRONA_MWGPU_KERNEL_CACHE=/tmp/simplecache python overcooked2_example.py --num-envs 32
When testing using 8 cores of an AMD EPYC 7402 Processor, an A40 GPU, and 64 GB RAM, I get the following performance numbers in the cramped_room environment:
num-envs | baseline | madrona cpu | madrona gpu |
---|---|---|---|
32 | 2400 | 102000 | 138000 |
100 | 2400 | 239000 | 424000 |
1000 | - | 498000 | 3680000 |
10000 | - | 401000 | 19100000 |
100000 | - | - | 18500000 |