@@ -14,11 +14,30 @@ jobs:
1414
1515 benchmark_cpu :
1616 name : CPU Pytest benchmark
17- runs-on : ubuntu-20.04
17+ runs-on : linux.g5.4xlarge.nvidia.cpu
18+ defaults :
19+ run :
20+ shell : bash -l {0}
21+ container :
22+ image : nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
23+ options : --cpus all
1824 steps :
25+ - name : Set GITHUB_BRANCH environment variable
26+ run : |
27+ if [ "${{ github.event_name }}" == "push" ]; then
28+ export GITHUB_BRANCH=${{ github.event.branch }}
29+ elif [ "${{ github.event_name }}" == "pull_request" ]; then
30+ export GITHUB_BRANCH=${{ github.event.pull_request.head.ref }}
31+ else
32+ echo "Unsupported event type"
33+ exit 1
34+ fi
35+ echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV
1936 - name : Who triggered this?
2037 run : |
2138 echo "Action triggered by ${{ github.event.pull_request.html_url }}"
39+ - name : Check ldd --version
40+ run : ldd --version
2241 - name : Checkout
2342 uses : actions/checkout@v4
2443 with :
@@ -27,28 +46,50 @@ jobs:
2746 uses : actions/setup-python@v4
2847 with :
2948 python-version : ' 3.10'
49+ - name : Setup Environment
50+ run : |
51+ export TZ=Europe/London
52+ export DEBIAN_FRONTEND=noninteractive # tzdata bug
53+ apt-get update -y
54+ apt-get install software-properties-common cmake -y
55+ add-apt-repository ppa:git-core/candidate -y
56+ apt-get update -y
57+ apt-get upgrade -y
58+ apt-get -y install libglu1-mesa libgl1-mesa-glx libosmesa6 gcc curl g++ unzip wget libglfw3-dev libgles2-mesa-dev libglew-dev sudo git cmake libz-dev libpython3.10-dev
59+ - name : Setup git
60+ run : git config --global --add safe.directory /__w/rl/rl
61+ - name : setup Path
62+ run : |
63+ echo /usr/local/bin >> $GITHUB_PATH
3064 - name : Setup benchmarks
3165 run : |
3266 echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
3367 echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
3468 echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
3569 echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
3670 echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
37- - name : Setup Environment and tests
71+ - name : Run
3872 run : |
39- python3.10 -m venv ./py310
73+ python3.10 -m venv --system-site-packages ./py310
4074 source ./py310/bin/activate
75+ export PYTHON_INCLUDE_DIR=/usr/include/python3.10
76+
77+ python3.10 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128 -U
78+ python3.10 -m pip install ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
79+ python3.10 -m pip install "pybind11[global]"
80+ python3.10 -m pip install git+https://github.com/pytorch/tensordict
81+ python3.10 setup.py develop
82+ # python3.10 -m pip install git+https://github.com/pytorch/rl@$GITHUB_BRANCH
83+
84+ # test import
85+ python3 -c """import torch
86+ assert torch.cuda.device_count()
87+ """
4188
42- python3 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
43- python3 -m pip install git+https://github.com/pytorch/tensordict
44- python3 setup.py develop
45- python3 -m pip install pytest pytest-benchmark
46- python3 -m pip install "gym[accept-rom-license,atari]"
47- python3 -m pip install "dm_control" "mujoco"
48-
4989 cd benchmarks/
5090 export TORCHDYNAMO_INLINE_INBUILT_NN_MODULES=1
5191 export COMPOSITE_LP_AGGREGATE=0
92+ export CUDA_VISIBLE_DEVICES=
5293 export TD_GET_DEFAULTS_TO_NONE=1
5394 RUN_BENCHMARK="python3 -m pytest -vvv --rank 0 --ignore test_collectors_benchmark.py --benchmark-json "
5495 git checkout ${{ github.event.pull_request.base.sha }}
5798 $RUN_BENCHMARK ${{ env.CONTENDER_JSON }}
5899 - name : Publish results
59100 uses : apbard/pytest-benchmark-commenter@v3
101+ env :
102+ GIT_WORK_TREE : /__w/rl/rl
60103 with :
61104 token : ${{ secrets.GITHUB_TOKEN }}
62105 benchmark-file : ${{ env.CONTENDER_JSON }}
@@ -130,7 +173,8 @@ jobs:
130173 export PYTHON_INCLUDE_DIR=/usr/include/python3.10
131174
132175 python3.10 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128 -U
133- python3.10 -m pip install cmake ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
176+ python3.10 -m pip install ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
177+ python3.10 -m pip install "pybind11[global]"
134178 python3.10 -m pip install git+https://github.com/pytorch/tensordict
135179 python3.10 setup.py develop
136180 # python3.10 -m pip install git+https://github.com/pytorch/rl@$GITHUB_BRANCH
0 commit comments