Skip to content

Commit f23e0c2

Browse files
author
Vincent Moens
committed
Update
[ghstack-poisoned]
1 parent 1f02802 commit f23e0c2

2 files changed

Lines changed: 102 additions & 15 deletions

File tree

.github/workflows/benchmarks.yml

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,64 @@ jobs:
2222
benchmark_cpu:
2323
name: CPU Pytest benchmark
2424
runs-on: linux.g5.4xlarge.nvidia.gpu
25+
defaults:
26+
run:
27+
shell: bash -l {0}
28+
container:
29+
image: nvidia/cuda:12.3.0-base-ubuntu22.04
30+
options: --gpus all
2531
steps:
26-
- uses: actions/checkout@v3
27-
- uses: actions/setup-python@v4
32+
- name: Who triggered this?
33+
run: |
34+
echo "Action triggered by ${{ github.event.pull_request.html_url }}"
35+
- name: Install deps
36+
run: |
37+
export TZ=Europe/London
38+
export DEBIAN_FRONTEND=noninteractive # tzdata bug
39+
apt-get update -y
40+
apt-get update -y
41+
apt-get upgrade -y
42+
apt-get -y install gcc curl g++ unzip wget sudo git cmake
43+
- name: Check ldd --version
44+
run: ldd --version
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
with:
48+
fetch-depth: 50 # this is to make sure we obtain the target base commit
49+
- name: Python Setup
50+
uses: actions/setup-python@v4
2851
with:
2952
python-version: '3.10'
53+
- name: Setup conda
54+
run: |
55+
rm -rf $HOME/miniconda
56+
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
57+
bash ~/miniconda.sh -b -p $HOME/miniconda
58+
- name: setup Path
59+
run: |
60+
echo "$HOME/miniconda/bin" >> $GITHUB_PATH
61+
echo "CONDA=$HOME/miniconda" >> $GITHUB_PATH
62+
- name: create and activate conda env
63+
run: |
64+
$HOME/miniconda/bin/conda create --name build_binary python=${{ matrix.python-version }}
65+
$HOME/miniconda/bin/conda info
66+
$HOME/miniconda/bin/activate build_binary
67+
- name: Setup git
68+
run: git config --global --add safe.directory /__w/tensordict/tensordict
69+
- name: setup Path
70+
run: |
71+
echo /usr/local/bin >> $GITHUB_PATH
3072
- name: Setup Environment
3173
run: |
32-
apt-get -y install gcc curl g++ unzip wget sudo git cmake
33-
pip install ninja -U
34-
pip install -e .
35-
pip install pytest pytest-benchmark
74+
python -m pip install ninja pybind11 -U
75+
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121
76+
python -m pip install -e .
77+
python -m pip install pytest pytest-benchmark
78+
- name: check GPU presence
79+
run: |
80+
python -c """import torch
81+
assert torch.cuda.device_count()
82+
"""
3683
- name: Run benchmarks
3784
run: |
3885
cd benchmarks/
@@ -44,7 +91,7 @@ jobs:
4491
uses: benchmark-action/github-action-benchmark@v1
4592
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
4693
with:
47-
name: CPU Benchmark Results
94+
name: GPU Benchmark Results
4895
tool: 'pytest'
4996
output-file-path: benchmarks/output.json
5097
fail-on-alert: true
@@ -55,7 +102,6 @@ jobs:
55102
gh-pages-branch: gh-pages
56103
auto-push: true
57104

58-
59105
benchmark_gpu:
60106
name: GPU Pytest benchmark
61107
runs-on: linux.g5.4xlarge.nvidia.gpu
@@ -108,7 +154,7 @@ jobs:
108154
echo /usr/local/bin >> $GITHUB_PATH
109155
- name: Setup Environment
110156
run: |
111-
python -m pip install ninja -U
157+
python -m pip install ninja pybind11 -U
112158
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121
113159
python -m pip install -e .
114160
python -m pip install pytest pytest-benchmark

.github/workflows/benchmarks_pr.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,30 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15+
1516
benchmark_cpu:
1617
name: CPU Pytest benchmark
1718
runs-on: linux.g5.4xlarge.nvidia.gpu
19+
defaults:
20+
run:
21+
shell: bash -l {0}
22+
container:
23+
image: nvidia/cuda:12.3.0-base-ubuntu22.04
24+
options: --gpus all
1825
steps:
1926
- name: Who triggered this?
2027
run: |
2128
echo "Action triggered by ${{ github.event.pull_request.html_url }}"
29+
- name: Install deps
30+
run: |
31+
export TZ=Europe/London
32+
export DEBIAN_FRONTEND=noninteractive # tzdata bug
33+
apt-get update -y
34+
apt-get update -y
35+
apt-get upgrade -y
36+
apt-get -y install gcc curl g++ unzip wget sudo git cmake
37+
- name: Check ldd --version
38+
run: ldd --version
2239
- name: Checkout
2340
uses: actions/checkout@v3
2441
with:
@@ -27,12 +44,36 @@ jobs:
2744
uses: actions/setup-python@v4
2845
with:
2946
python-version: '3.10'
47+
- name: Setup conda
48+
run: |
49+
rm -rf $HOME/miniconda
50+
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
51+
bash ~/miniconda.sh -b -p $HOME/miniconda
52+
- name: setup Path
53+
run: |
54+
echo "$HOME/miniconda/bin" >> $GITHUB_PATH
55+
echo "CONDA=$HOME/miniconda" >> $GITHUB_PATH
56+
- name: create and activate conda env
57+
run: |
58+
$HOME/miniconda/bin/conda create --name build_binary python=${{ matrix.python-version }}
59+
$HOME/miniconda/bin/conda info
60+
$HOME/miniconda/bin/activate build_binary
61+
- name: Setup git
62+
run: git config --global --add safe.directory /__w/tensordict/tensordict
63+
- name: setup Path
64+
run: |
65+
echo /usr/local/bin >> $GITHUB_PATH
3066
- name: Setup Environment
3167
run: |
32-
apt-get -y install gcc curl g++ unzip wget sudo git cmake
33-
python -m pip install ninja -U
34-
pip install -e .
35-
pip install pytest pytest-benchmark
68+
python -m pip install ninja pybind11 -U
69+
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121
70+
python -m pip install -e .
71+
python -m pip install pytest pytest-benchmark
72+
- name: check GPU presence
73+
run: |
74+
python -c """import torch
75+
assert torch.cuda.device_count()
76+
"""
3677
- name: Setup benchmarks
3778
run: |
3879
echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
@@ -61,7 +102,7 @@ jobs:
61102
comparison-benchmark-metric: 'ops'
62103
comparison-higher-is-better: true
63104
comparison-threshold: 5
64-
benchmark-title: 'Result of CPU Benchmark Tests'
105+
benchmark-title: 'Result of GPU Benchmark Tests'
65106

66107
benchmark_gpu:
67108
name: GPU Pytest benchmark
@@ -115,7 +156,7 @@ jobs:
115156
echo /usr/local/bin >> $GITHUB_PATH
116157
- name: Setup Environment
117158
run: |
118-
python -m pip install ninja -U
159+
python -m pip install ninja pybind11 -U
119160
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121
120161
python -m pip install -e .
121162
python -m pip install pytest pytest-benchmark

0 commit comments

Comments
 (0)