@@ -14,11 +14,30 @@ jobs:
14
14
15
15
benchmark_cpu :
16
16
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
18
24
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
19
36
- name : Who triggered this?
20
37
run : |
21
38
echo "Action triggered by ${{ github.event.pull_request.html_url }}"
39
+ - name : Check ldd --version
40
+ run : ldd --version
22
41
- name : Checkout
23
42
uses : actions/checkout@v4
24
43
with :
@@ -27,28 +46,50 @@ jobs:
27
46
uses : actions/setup-python@v4
28
47
with :
29
48
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
30
64
- name : Setup benchmarks
31
65
run : |
32
66
echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
33
67
echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
34
68
echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
35
69
echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
36
70
echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
37
- - name : Setup Environment and tests
71
+ - name : Run
38
72
run : |
39
- python3.10 -m venv ./py310
73
+ python3.10 -m venv --system-site-packages ./py310
40
74
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
+ """
41
88
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
-
49
89
cd benchmarks/
50
90
export TORCHDYNAMO_INLINE_INBUILT_NN_MODULES=1
51
91
export COMPOSITE_LP_AGGREGATE=0
92
+ export CUDA_VISIBLE_DEVICES=
52
93
export TD_GET_DEFAULTS_TO_NONE=1
53
94
RUN_BENCHMARK="python3 -m pytest -vvv --rank 0 --ignore test_collectors_benchmark.py --benchmark-json "
54
95
git checkout ${{ github.event.pull_request.base.sha }}
57
98
$RUN_BENCHMARK ${{ env.CONTENDER_JSON }}
58
99
- name : Publish results
59
100
uses : apbard/pytest-benchmark-commenter@v3
101
+ env :
102
+ GIT_WORK_TREE : /__w/rl/rl
60
103
with :
61
104
token : ${{ secrets.GITHUB_TOKEN }}
62
105
benchmark-file : ${{ env.CONTENDER_JSON }}
@@ -130,7 +173,8 @@ jobs:
130
173
export PYTHON_INCLUDE_DIR=/usr/include/python3.10
131
174
132
175
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]"
134
178
python3.10 -m pip install git+https://github.com/pytorch/tensordict
135
179
python3.10 setup.py develop
136
180
# python3.10 -m pip install git+https://github.com/pytorch/rl@$GITHUB_BRANCH
0 commit comments