Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into tensordict-revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens committed Nov 20, 2023
2 parents bf436e3 + 9bd09ae commit 88cce92
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 65 deletions.
136 changes: 72 additions & 64 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- "*"
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -34,6 +37,7 @@ jobs:
python -m pytest --rank 0 --benchmark-json output.json
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
with:
name: CPU Benchmark Results
tool: 'pytest'
Expand All @@ -57,67 +61,71 @@ jobs:
image: nvidia/cuda:12.3.0-base-ubuntu22.04
options: --gpus all
steps:
- name: Install deps
run: |
export TZ=Europe/London
export DEBIAN_FRONTEND=noninteractive # tzdata bug
apt-get update -y
apt-get update -y
apt-get upgrade -y
apt-get -y install gcc curl g++ unzip wget sudo git cmake
- name: Check ldd --version
run: ldd --version
- name: Checkout
uses: actions/checkout@v3
- name: Update pip
run: |
apt-get install python3.8 python3-pip -y
pip3 install --upgrade pip
- name: Setup conda
run: |
rm -rf $HOME/miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
- name: setup Path
run: |
echo "$HOME/miniconda/bin" >> $GITHUB_PATH
echo "CONDA=$HOME/miniconda" >> $GITHUB_PATH
- name: create and activate conda env
run: |
$HOME/miniconda/bin/conda create --name build_binary python=${{ matrix.python-version }}
$HOME/miniconda/bin/conda info
$HOME/miniconda/bin/activate build_binary
- name: Setup git
run: git config --global --add safe.directory /__w/tensordict/tensordict
- name: setup Path
run: |
echo /usr/local/bin >> $GITHUB_PATH
- name: Setup Environment
run: |
python -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121
python -m pip install -e .
python -m pip install pytest pytest-benchmark
- name: check GPU presence
run: |
python -c """import torch
assert torch.cuda.device_count()
"""
- name: Run benchmarks
run: |
cd benchmarks/
python -m pytest --rank 0 --benchmark-json output.json
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: GPU Benchmark Results
tool: 'pytest'
output-file-path: benchmarks/output.json
fail-on-alert: true
alert-threshold: '200%'
alert-comment-cc-users: '@vmoens'
comment-on-alert: true
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: gh-pages
auto-push: true


- name: Who triggered this?
run: |
echo "Action triggered by ${{ github.event.pull_request.html_url }}"
- name: Install deps
run: |
export TZ=Europe/London
export DEBIAN_FRONTEND=noninteractive # tzdata bug
apt-get update -y
apt-get update -y
apt-get upgrade -y
apt-get -y install gcc curl g++ unzip wget sudo git cmake
- name: Check ldd --version
run: ldd --version
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 50 # this is to make sure we obtain the target base commit
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup conda
run: |
rm -rf $HOME/miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
- name: setup Path
run: |
echo "$HOME/miniconda/bin" >> $GITHUB_PATH
echo "CONDA=$HOME/miniconda" >> $GITHUB_PATH
- name: create and activate conda env
run: |
$HOME/miniconda/bin/conda create --name build_binary python=${{ matrix.python-version }}
$HOME/miniconda/bin/conda info
$HOME/miniconda/bin/activate build_binary
- name: Setup git
run: git config --global --add safe.directory /__w/tensordict/tensordict
- name: setup Path
run: |
echo /usr/local/bin >> $GITHUB_PATH
- name: Setup Environment
run: |
python -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121
python -m pip install -e .
python -m pip install pytest pytest-benchmark
- name: check GPU presence
run: |
python -c """import torch
assert torch.cuda.device_count()
"""
- name: Run benchmarks
run: |
cd benchmarks/
python -m pytest --rank 0 --benchmark-json output.json
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
with:
name: GPU Benchmark Results
tool: 'pytest'
output-file-path: benchmarks/output.json
fail-on-alert: true
alert-threshold: '200%'
alert-comment-cc-users: '@vmoens'
comment-on-alert: true
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: gh-pages
auto-push: true
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
git checkout ${{ github.event.pull_request.base.sha }}
$RUN_BENCHMARK ${{ env.BASELINE_JSON }}
git checkout ${{ github.event.pull_request.head.sha }}
$RUN_BENCHMARK ${{ env.CONTENDER_JSON }}
$RUN_BENCHMARK ${{ env.CONTENDER_JSON }}
- name: Publish results
uses: apbard/pytest-benchmark-commenter@v3
with:
Expand Down

0 comments on commit 88cce92

Please sign in to comment.