11name : Continuous Benchmark (PR)
2-
32on :
43 pull_request :
54
@@ -12,6 +11,7 @@ concurrency:
1211 cancel-in-progress : true
1312
1413jobs :
14+
1515 benchmark_cpu :
1616 name : CPU Pytest benchmark
1717 runs-on : ubuntu-20.04
@@ -26,28 +26,30 @@ jobs:
2626 - name : Python Setup
2727 uses : actions/setup-python@v4
2828 with :
29- python-version : 3.9
30- - name : Setup Environment
31- run : |
32- python3 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
33- python3 -m pip install git+https://github.com/pytorch/tensordict
34- python3 setup.py develop
35- python3 -m pip install pytest pytest-benchmark
36- python3 -m pip install "gym[accept-rom-license,atari]"
37- python3 -m pip install "dm_control" "mujoco"
38- export TD_GET_DEFAULTS_TO_NONE=1
29+ python-version : ' 3.10'
3930 - name : Setup benchmarks
4031 run : |
4132 echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
4233 echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
4334 echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
4435 echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
4536 echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
46- - name : Run benchmarks
37+ - name : Setup Environment and tests
4738 run : |
39+ python3.10 -m venv ./py310
40+ source ./py310/bin/activate
41+
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+
4849 cd benchmarks/
4950 export TORCHDYNAMO_INLINE_INBUILT_NN_MODULES=1
50- RUN_BENCHMARK="pytest --rank 0 --benchmark-json "
51+ export TD_GET_DEFAULTS_TO_NONE=1
52+ RUN_BENCHMARK="python3 -m pytest -vvv --rank 0 --ignore test_collectors_benchmark.py --benchmark-json "
5153 git checkout ${{ github.event.pull_request.base.sha }}
5254 $RUN_BENCHMARK ${{ env.BASELINE_JSON }}
5355 git checkout ${{ github.event.pull_request.head.sha }}
@@ -71,22 +73,23 @@ jobs:
7173 run :
7274 shell : bash -l {0}
7375 container :
74- image : nvidia/cuda:12.3.0-base -ubuntu22.04
76+ image : nvidia/cuda:12.4.1-cudnn-runtime -ubuntu22.04
7577 options : --gpus all
7678 steps :
79+ - name : Set GITHUB_BRANCH environment variable
80+ run : |
81+ if [ "${{ github.event_name }}" == "push" ]; then
82+ export GITHUB_BRANCH=${{ github.event.branch }}
83+ elif [ "${{ github.event_name }}" == "pull_request" ]; then
84+ export GITHUB_BRANCH=${{ github.event.pull_request.head.ref }}
85+ else
86+ echo "Unsupported event type"
87+ exit 1
88+ fi
89+ echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV
7790 - name : Who triggered this?
7891 run : |
7992 echo "Action triggered by ${{ github.event.pull_request.html_url }}"
80- - name : Install deps
81- run : |
82- export TZ=Europe/London
83- export DEBIAN_FRONTEND=noninteractive # tzdata bug
84- apt-get update -y
85- apt-get install software-properties-common -y
86- add-apt-repository ppa:git-core/candidate -y
87- apt-get update -y
88- apt-get upgrade -y
89- 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
9093 - name : Check ldd --version
9194 run : ldd --version
9295 - name : Checkout
@@ -96,38 +99,50 @@ jobs:
9699 - name : Python Setup
97100 uses : actions/setup-python@v4
98101 with :
99- python-version : 3.9
102+ python-version : ' 3.10'
103+ - name : Setup Environment
104+ run : |
105+ export TZ=Europe/London
106+ export DEBIAN_FRONTEND=noninteractive # tzdata bug
107+ apt-get update -y
108+ apt-get install software-properties-common -y
109+ add-apt-repository ppa:git-core/candidate -y
110+ apt-get update -y
111+ apt-get upgrade -y
112+ 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
100113 - name : Setup git
101114 run : git config --global --add safe.directory /__w/rl/rl
102115 - name : setup Path
103116 run : |
104117 echo /usr/local/bin >> $GITHUB_PATH
105- - name : Setup Environment
106- run : |
107- python3 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121 -U
108- python3 -m pip install git+https://github.com/pytorch/tensordict
109- python3 setup.py develop
110- python3 -m pip install pytest pytest-benchmark
111- python3 -m pip install "gym[accept-rom-license,atari]"
112- python3 -m pip install "dm_control" "mujoco"
113- export TD_GET_DEFAULTS_TO_NONE=1
114- - name : check GPU presence
115- run : |
116- python -c """import torch
117- assert torch.cuda.device_count()
118- """
119118 - name : Setup benchmarks
120119 run : |
121120 echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
122121 echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
123122 echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
124123 echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
125124 echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
126- - name : Run benchmarks
125+ - name : Run
127126 run : |
127+ python3.10 -m venv --system-site-packages ./py310
128+ source ./py310/bin/activate
129+ export PYTHON_INCLUDE_DIR=/usr/include/python3.10
130+
131+ python3.10 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu124 -U
132+ python3.10 -m pip install cmake ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
133+ python3.10 -m pip install git+https://github.com/pytorch/tensordict
134+ python3.10 setup.py develop
135+ # python3.10 -m pip install git+https://github.com/pytorch/rl@$GITHUB_BRANCH
136+
137+ # test import
138+ python3 -c """import torch
139+ assert torch.cuda.device_count()
140+ """
141+
128142 cd benchmarks/
129143 export TORCHDYNAMO_INLINE_INBUILT_NN_MODULES=1
130- RUN_BENCHMARK="pytest --rank 0 --benchmark-json "
144+ export TD_GET_DEFAULTS_TO_NONE=1
145+ RUN_BENCHMARK="python3 -m pytest -vvv --rank 0 --ignore test_collectors_benchmark.py --benchmark-json "
131146 git checkout ${{ github.event.pull_request.base.sha }}
132147 $RUN_BENCHMARK ${{ env.BASELINE_JSON }}
133148 git checkout ${{ github.event.pull_request.head.sha }}
0 commit comments