1
1
name : Continuous Benchmark (PR)
2
-
3
2
on :
4
3
pull_request :
5
4
@@ -12,6 +11,7 @@ concurrency:
12
11
cancel-in-progress : true
13
12
14
13
jobs :
14
+
15
15
benchmark_cpu :
16
16
name : CPU Pytest benchmark
17
17
runs-on : ubuntu-20.04
@@ -26,28 +26,30 @@ jobs:
26
26
- name : Python Setup
27
27
uses : actions/setup-python@v4
28
28
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'
39
30
- name : Setup benchmarks
40
31
run : |
41
32
echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
42
33
echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
43
34
echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
44
35
echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
45
36
echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
46
- - name : Run benchmarks
37
+ - name : Setup Environment and tests
47
38
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
+
48
49
cd benchmarks/
49
50
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 "
51
53
git checkout ${{ github.event.pull_request.base.sha }}
52
54
$RUN_BENCHMARK ${{ env.BASELINE_JSON }}
53
55
git checkout ${{ github.event.pull_request.head.sha }}
@@ -71,22 +73,23 @@ jobs:
71
73
run :
72
74
shell : bash -l {0}
73
75
container :
74
- image : nvidia/cuda:12.3.0-base -ubuntu22.04
76
+ image : nvidia/cuda:12.4.1-cudnn-runtime -ubuntu22.04
75
77
options : --gpus all
76
78
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
77
90
- name : Who triggered this?
78
91
run : |
79
92
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
90
93
- name : Check ldd --version
91
94
run : ldd --version
92
95
- name : Checkout
@@ -96,38 +99,50 @@ jobs:
96
99
- name : Python Setup
97
100
uses : actions/setup-python@v4
98
101
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
100
113
- name : Setup git
101
114
run : git config --global --add safe.directory /__w/rl/rl
102
115
- name : setup Path
103
116
run : |
104
117
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
- """
119
118
- name : Setup benchmarks
120
119
run : |
121
120
echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
122
121
echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
123
122
echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
124
123
echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
125
124
echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
126
- - name : Run benchmarks
125
+ - name : Run
127
126
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
+
128
142
cd benchmarks/
129
143
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 "
131
146
git checkout ${{ github.event.pull_request.base.sha }}
132
147
$RUN_BENCHMARK ${{ env.BASELINE_JSON }}
133
148
git checkout ${{ github.event.pull_request.head.sha }}
0 commit comments