Skip to content

Commit d97022f

Browse files
authored
Add GitHub Actions (#668)
* Add gh actions workflow for precommit. * Add workflow for Lie group tests. * Move installation steps to separate yaml files. * Add optimizer tests. * Add other unit tests. * Fix baspacho deps issue. * Add GPU unit tests. * Add test for install from wheel. * Try sudo apt-get install cmake for gpu test. * Comment out GPU dependent tests. * Comment out optimizer tests. * Revert CircleCI config changes.
1 parent 1284c35 commit d97022f

File tree

6 files changed

+341
-0
lines changed

6 files changed

+341
-0
lines changed

.github/workflows/lie_tests.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: test-lie-groups
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
test_lie_groups:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [3.8, 3.9, 3.10.15]
13+
steps:
14+
- uses: actions/[email protected]
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/[email protected]
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- uses: actions/[email protected]
20+
- name: Install suitesparse
21+
run: |
22+
sudo apt-get update && sudo apt-get install -y libsuitesparse-dev
23+
- name: Create Conda env
24+
run: |
25+
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
26+
/bin/bash ~/miniconda.sh -b -p ~/conda
27+
export PATH=~/conda/bin:$PATH
28+
conda create --name theseus python=${{ matrix.python-version }}
29+
source activate theseus
30+
pip install --progress-bar off --upgrade pip
31+
pip install --progress-bar off --upgrade setuptools
32+
- name: Install Torch
33+
run: |
34+
export PATH=~/conda/bin:$PATH
35+
source activate theseus
36+
pip install torch
37+
- name: Install torchlie and torchkin
38+
run: |
39+
export PATH=~/conda/bin:$PATH
40+
source activate theseus
41+
cd torchlie
42+
pip install -e .
43+
cd ../torchkin
44+
pip install -e .
45+
- name: Install theseus without Baspacho
46+
run: |
47+
export PATH=~/conda/bin:$PATH
48+
source activate theseus
49+
pip install -e ".[dev]"
50+
- name: Run Lie groups tests
51+
run: |
52+
export PATH=~/conda/bin:$PATH
53+
source activate theseus
54+
python -m pytest tests/theseus_tests/geometry -m "not cudaext"
55+
python -m pytest tests/torchlie_tests -m "not cudaext"

.github/workflows/optim_tests.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# name: test-optimizers
2+
# on:
3+
# pull_request:
4+
# branches:
5+
# - main
6+
7+
# jobs:
8+
# test_optimizers:
9+
# runs-on: ubuntu-latest
10+
# strategy:
11+
# matrix:
12+
# python-version: [3.8, 3.9, 3.10.15]
13+
# steps:
14+
# - uses: actions/[email protected]
15+
# - name: Set up Python ${{ matrix.python-version }}
16+
# uses: actions/[email protected]
17+
# with:
18+
# python-version: ${{ matrix.python-version }}
19+
# - uses: actions/[email protected]
20+
# - name: Install suitesparse
21+
# run: |
22+
# sudo apt-get update && sudo apt-get install -y libsuitesparse-dev
23+
# - name: Create Conda env
24+
# run: |
25+
# wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
26+
# /bin/bash ~/miniconda.sh -b -p ~/conda
27+
# export PATH=~/conda/bin:$PATH
28+
# conda create --name theseus python=${{ matrix.python-version }}
29+
# source activate theseus
30+
# pip install --progress-bar off --upgrade pip
31+
# pip install --progress-bar off --upgrade setuptools
32+
# - name: Install Torch
33+
# run: |
34+
# export PATH=~/conda/bin:$PATH
35+
# source activate theseus
36+
# pip install torch
37+
# - name: Build Baspacho CPU
38+
# run: |
39+
# sudo apt-get install -y libopenblas-pthread-dev
40+
# git clone https://github.com/facebookresearch/baspacho.git
41+
# cd baspacho
42+
# echo $(pwd)
43+
# cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBLA_STATIC=ON -DBASPACHO_USE_CUBLAS=0 -DBUILD_SHARED_LIBS=OFF -DBASPACHO_BUILD_TESTS=OFF -DBASPACHO_BUILD_EXAMPLES=OFF
44+
# cmake --build build -- -j16
45+
# - name: Install torchlie and torchkin
46+
# run: |
47+
# export PATH=~/conda/bin:$PATH
48+
# source activate theseus
49+
# cd torchlie
50+
# pip install -e .
51+
# cd ../torchkin
52+
# pip install -e .
53+
# - name: Install theseus
54+
# run: |
55+
# export PATH=~/conda/bin:$PATH
56+
# source activate theseus
57+
# echo $(pwd)
58+
# BASPACHO_ROOT_DIR=./baspacho pip install -e ".[dev]"
59+
# - name: Run Optimizer tests
60+
# run: |
61+
# export PATH=~/conda/bin:$PATH
62+
# source activate theseus
63+
# # the full baspacho test for CPU fails, we only run an abriged version in CI
64+
# python -m pytest tests/theseus_tests/optimizer -m "not cudaext" -k "not test_baspacho_solver_cpu_full"
65+
# python -m pytest tests/theseus_tests/test_theseus_layer.py -m "not cudaext"

.github/workflows/other_tests.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: test-others
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
test_others:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [3.8, 3.9, 3.10.15]
13+
steps:
14+
- uses: actions/[email protected]
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/[email protected]
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- uses: actions/[email protected]
20+
- name: Install suitesparse
21+
run: |
22+
sudo apt-get update && sudo apt-get install -y libsuitesparse-dev
23+
- name: Create Conda env
24+
run: |
25+
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
26+
/bin/bash ~/miniconda.sh -b -p ~/conda
27+
export PATH=~/conda/bin:$PATH
28+
conda create --name theseus python=${{ matrix.python-version }}
29+
source activate theseus
30+
pip install --progress-bar off --upgrade pip
31+
pip install --progress-bar off --upgrade setuptools
32+
- name: Install Torch
33+
run: |
34+
export PATH=~/conda/bin:$PATH
35+
source activate theseus
36+
pip install torch
37+
- name: Install torchlie and torchkin
38+
run: |
39+
export PATH=~/conda/bin:$PATH
40+
source activate theseus
41+
cd torchlie
42+
pip install -e .
43+
cd ../torchkin
44+
pip install -e .
45+
- name: Install theseus without Baspacho
46+
run: |
47+
export PATH=~/conda/bin:$PATH
48+
source activate theseus
49+
pip install -e ".[dev]"
50+
- name: Run other tests
51+
run: |
52+
export PATH=~/conda/bin:$PATH
53+
source activate theseus
54+
python -m pytest tests -m "not cudaext" -s --ignore=tests/theseus_tests/geometry/ --ignore=tests/optimizer --ignore-glob=tests/theseus_tests/test_theseus_layer.py --ignore=tests/lie_tests

.github/workflows/precommit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: pre-commit checks
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
precommit:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [3.8, 3.9, 3.10.15]
13+
steps:
14+
- uses: actions/[email protected]
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/[email protected]
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Running precommit checks
20+
run: |
21+
pip install pre-commit
22+
pre-commit install-hooks
23+
pre-commit run --all-files --show-diff-on-failure

.github/workflows/test_wheel.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# name: test-wheel
2+
# on:
3+
# pull_request:
4+
# branches:
5+
# - main
6+
7+
# jobs:
8+
# test_wheel:
9+
# runs-on: ubuntu-latest
10+
# strategy:
11+
# matrix:
12+
# python-version: [3.10.15]
13+
# steps:
14+
# - uses: actions/[email protected]
15+
# - name: Set up Python ${{ matrix.python-version }}
16+
# uses: actions/[email protected]
17+
# with:
18+
# python-version: ${{ matrix.python-version }}
19+
# - uses: actions/[email protected]
20+
# - name: Install suitesparse
21+
# run: |
22+
# sudo apt-get update && sudo apt-get install -y libsuitesparse-dev
23+
# - name: Create Conda env
24+
# run: |
25+
# wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
26+
# /bin/bash ~/miniconda.sh -b -p ~/conda
27+
# export PATH=~/conda/bin:$PATH
28+
# conda create --name theseus python=${{ matrix.python-version }}
29+
# source activate theseus
30+
# pip install --progress-bar off --upgrade pip
31+
# pip install --progress-bar off --upgrade setuptools
32+
# - name: Install CUDA 11
33+
# run: |
34+
# # download and install nvidia drivers, cuda, etc
35+
# wget --quiet --no-clobber -P ~/nvidia-downloads https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux.run
36+
# time sudo /bin/bash ~/nvidia-downloads/cuda_11.7.1_515.65.01_linux.run --no-drm --silent --driver --toolkit
37+
# sudo ldconfig /usr/local/cuda/lib64
38+
# echo "Done installing NVIDIA drivers and CUDA libraries."
39+
# nvidia-smi
40+
# - name: Install Torch CUDA 11
41+
# run: |
42+
# export PATH=~/conda/bin:$PATH
43+
# source activate theseus
44+
# which python && which pip
45+
# pip install --progress-bar off torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
46+
# python -c 'import torch; print("Torch version:", torch.__version__); assert torch.cuda.is_available()'
47+
# - name: Build CUDA wheel
48+
# run: |
49+
# echo $(pwd)
50+
# echo $(ls)
51+
# export PATH=~/conda/bin:$PATH
52+
# source activate theseus
53+
# which python && which pip
54+
# THESEUS_GIT_COMMIT=$(git --git-dir project/.git log --format="%H" -n 1)
55+
# THESEUS_VERSION=$(grep -Eo "[0-9].[0-9].[0-9][.0-9a-z]*" project/theseus/_version.py | tail -n 1)
56+
# ./build_scripts/build_wheel.sh . ${THESEUS_GIT_COMMIT} 11.8 ${THESEUS_VERSION}
57+
# pip install $(ls */*.whl)
58+
# pip install -r ./requirements/dev.txt
59+
# - name: Install theseus from wheel and run tests
60+
# run: |
61+
# mv theseus theseus_tmp
62+
# export PATH=~/conda/bin:$PATH
63+
# source activate theseus
64+
# which python && which pip
65+
# python -m pytest tests/theseus_tests/test_theseus_layer.py
66+
# pytest -s tests/theseus_tests/ -m "cudaext"

.github/workflows/tests_gpu.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# name: gpu-tests
2+
# on:
3+
# pull_request:
4+
# branches:
5+
# - main
6+
7+
# jobs:
8+
# test_with_gpu:
9+
# runs-on: 4-core-ubuntu-gpu-t4 # meta configured gpu runner https://www.internalfb.com/intern/opensource/ci/github-actions/runners/
10+
# strategy:
11+
# matrix:
12+
# python-version: [3.10.15]
13+
# steps:
14+
# - uses: actions/[email protected]
15+
# - name: Set up Python ${{ matrix.python-version }}
16+
# uses: actions/[email protected]
17+
# with:
18+
# python-version: ${{ matrix.python-version }}
19+
# - uses: actions/[email protected]
20+
# - name: Install suitesparse
21+
# run: |
22+
# sudo apt-get update && sudo apt-get install -y libsuitesparse-dev
23+
# - name: Create Conda env
24+
# run: |
25+
# wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
26+
# /bin/bash ~/miniconda.sh -b -p ~/conda
27+
# export PATH=~/conda/bin:$PATH
28+
# conda create --name theseus python=${{ matrix.python-version }}
29+
# source activate theseus
30+
# pip install --progress-bar off --upgrade pip
31+
# pip install --progress-bar off --upgrade setuptools
32+
# - name: Install CUDA 11
33+
# run: |
34+
# # download and install nvidia drivers, cuda, etc
35+
# wget --quiet --no-clobber -P ~/nvidia-downloads https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux.run
36+
# time sudo /bin/bash ~/nvidia-downloads/cuda_11.7.1_515.65.01_linux.run --no-drm --silent --driver --toolkit
37+
# sudo ldconfig /usr/local/cuda/lib64
38+
# echo "Done installing NVIDIA drivers and CUDA libraries."
39+
# nvidia-smi
40+
# - name: Install Torch CUDA 11
41+
# run: |
42+
# export PATH=~/conda/bin:$PATH
43+
# source activate theseus
44+
# which python && which pip
45+
# pip install --progress-bar off torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
46+
# python -c 'import torch; print("Torch version:", torch.__version__); assert torch.cuda.is_available()'
47+
# - name: Install recent cmake
48+
# run: |
49+
# sudo apt-get update
50+
# sudo apt-get install -y cmake
51+
# - name: Build Baspacho GPU
52+
# run: |
53+
# sudo apt-get install -y libopenblas-pthread-dev
54+
# git clone https://github.com/facebookresearch/baspacho.git
55+
# cd baspacho
56+
# cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBLA_STATIC=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DBUILD_SHARED_LIBS=OFF -DBASPACHO_CUDA_ARCHS='detect' -DBASPACHO_BUILD_TESTS=OFF -DBASPACHO_BUILD_EXAMPLES=OFF
57+
# cmake --build build -- -j16
58+
# - name: Install torchlie and torchkin
59+
# run: |
60+
# export PATH=~/conda/bin:$PATH
61+
# source activate theseus
62+
# cd torchlie
63+
# pip install -e .
64+
# cd ../torchkin
65+
# pip install -e .
66+
# - name: Install theseus
67+
# run: |
68+
# export PATH=~/conda/bin:$PATH
69+
# source activate theseus
70+
# echo $(pwd)
71+
# BASPACHO_ROOT_DIR=./baspacho pip install -e ".[dev]"
72+
# - name: Run Lie groups tests
73+
# run: |
74+
# export PATH=~/conda/bin:$PATH
75+
# source activate theseus
76+
# pytest -s tests/theseus_tests/test_theseus_layer.py
77+
# pytest -s tests/theseus_tests/ -m "cudaext"
78+
# pytest -s tests/theseus_tests/test_pgo_benchmark.py -s

0 commit comments

Comments
 (0)