Skip to content

Commit 1daef4e

Browse files
committed
initial
0 parents  commit 1daef4e

File tree

155 files changed

+34695
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+34695
-0
lines changed

.clang-format

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BasedOnStyle: LLVM
2+
AlignAfterOpenBracket: BlockIndent
3+
BinPackArguments: false
4+
BinPackParameters: false
5+
IndentWidth: 4

.clangd_template

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To set up the clangd config.
2+
# 1. Activate an environment with cuda installed. (probably via conda, skip if using system CUDA)
3+
# 2. Run:
4+
# echo "# Autogenerated, see .clangd_template\!" > .clangd && sed -e "/^#/d" -e "s|YOUR_CUDA_PATH|$(dirname $(dirname $(which nvcc)))|" .clangd_template >> .clangd
5+
CompileFlags:
6+
Add:
7+
- -Xclang
8+
- -fcuda-allow-variadic-functions
9+
- --cuda-path=YOUR_CUDA_PATH
10+
Remove:
11+
- --diag_suppress=*
12+
- --generate-code=*
13+
- -gencode=*
14+
- -forward-unknown-to-host-compiler
15+
- -Xcompiler
16+
- -Xcudafe
17+
- --use_fast_math
18+
- --options-file
19+
- --compiler-options
20+
- --expt-relaxed-constexpr

.github/workflows/building.yml

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Building Wheels
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
7+
wheel:
8+
runs-on: ${{ matrix.os }}
9+
environment: production
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
# os: [windows-2019]
15+
# python-version: ['3.7']
16+
# torch-version: [1.11.0]
17+
# cuda-version: ['cu113']
18+
os: [ubuntu-20.04, windows-2019]
19+
# support version based on: https://download.pytorch.org/whl/torch/
20+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
21+
torch-version: [1.11.0, 1.12.0, 1.13.0, 2.0.0]
22+
cuda-version: ['cu113', 'cu115', 'cu116', 'cu117', 'cu118']
23+
exclude:
24+
- torch-version: 1.11.0
25+
python-version: '3.11'
26+
- torch-version: 1.11.0
27+
cuda-version: 'cu116'
28+
- torch-version: 1.11.0
29+
cuda-version: 'cu117'
30+
- torch-version: 1.11.0
31+
cuda-version: 'cu118'
32+
33+
- torch-version: 1.12.0
34+
python-version: '3.11'
35+
- torch-version: 1.12.0
36+
cuda-version: 'cu115'
37+
- torch-version: 1.12.0
38+
cuda-version: 'cu117'
39+
- torch-version: 1.12.0
40+
cuda-version: 'cu118'
41+
42+
- torch-version: 1.13.0
43+
cuda-version: 'cu102'
44+
- torch-version: 1.13.0
45+
cuda-version: 'cu113'
46+
- torch-version: 1.13.0
47+
cuda-version: 'cu115'
48+
- torch-version: 1.13.0
49+
cuda-version: 'cu118'
50+
51+
- torch-version: 2.0.0
52+
python-version: '3.7'
53+
- torch-version: 2.0.0
54+
cuda-version: 'cu102'
55+
- torch-version: 2.0.0
56+
cuda-version: 'cu113'
57+
- torch-version: 2.0.0
58+
cuda-version: 'cu115'
59+
- torch-version: 2.0.0
60+
cuda-version: 'cu116'
61+
62+
- os: windows-2019
63+
cuda-version: 'cu102'
64+
- os: windows-2019
65+
torch-version: 1.13.0
66+
python-version: '3.11'
67+
68+
# - os: windows-2019
69+
# torch-version: 1.13.0
70+
# cuda-version: 'cu117'
71+
# python-version: '3.9'
72+
73+
74+
75+
steps:
76+
- uses: actions/checkout@v3
77+
with:
78+
submodules: 'recursive'
79+
80+
- name: Set up Python ${{ matrix.python-version }}
81+
uses: actions/setup-python@v4
82+
with:
83+
python-version: ${{ matrix.python-version }}
84+
85+
- name: Upgrade pip
86+
run: |
87+
pip install --upgrade setuptools
88+
pip install ninja
89+
90+
- name: Free up disk space
91+
if: ${{ runner.os == 'Linux' }}
92+
run: |
93+
sudo rm -rf /usr/share/dotnet
94+
95+
- name: Install CUDA ${{ matrix.cuda-version }}
96+
if: ${{ matrix.cuda-version != 'cpu' }}
97+
run: |
98+
bash .github/workflows/cuda/${{ runner.os }}.sh ${{ matrix.cuda-version }}
99+
100+
- name: Install PyTorch ${{ matrix.torch-version }}+${{ matrix.cuda-version }}
101+
run: |
102+
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/${{ matrix.cuda-version }}
103+
python -c "import torch; print('PyTorch:', torch.__version__)"
104+
python -c "import torch; print('CUDA:', torch.version.cuda)"
105+
python -c "import torch; print('CUDA Available:', torch.cuda.is_available())"
106+
107+
- name: Patch PyTorch static constexpr on Windows
108+
if: ${{ runner.os == 'Windows' }}
109+
run: |
110+
Torch_DIR=`python -c 'import os; import torch; print(os.path.dirname(torch.__file__))'`
111+
sed -i '31,38c\
112+
TORCH_API void lazy_init_num_threads();' ${Torch_DIR}/include/ATen/Parallel.h
113+
shell: bash
114+
115+
- name: Set version
116+
if: ${{ runner.os != 'macOS' }}
117+
run: |
118+
VERSION=`sed -n 's/^__version__ = "\(.*\)"/\1/p' gsplat/version.py`
119+
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"`
120+
CUDA_VERSION=`echo ${{ matrix.cuda-version }}`
121+
echo "New version name: $VERSION+$TORCH_VERSION$CUDA_VERSION"
122+
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" gsplat/version.py
123+
shell:
124+
bash
125+
126+
- name: Install main package for CPU
127+
if: ${{ matrix.cuda-version == 'cpu' }}
128+
run: |
129+
BUILD_NO_CUDA=1 pip install .
130+
131+
- name: Build wheel
132+
run: |
133+
pip install wheel
134+
source .github/workflows/cuda/${{ runner.os }}-env.sh ${{ matrix.cuda-version }}
135+
python setup.py bdist_wheel --dist-dir=dist
136+
shell: bash # `source` does not exist in windows powershell
137+
138+
- name: Test wheel
139+
run: |
140+
cd dist
141+
ls -lah
142+
pip install *.whl
143+
python -c "import gsplat; print('gsplat:', gsplat.__version__)"
144+
cd ..
145+
shell: bash # `ls -lah` does not exist in windows powershell

.github/workflows/core_tests.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Core Tests.
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
submodules: 'recursive'
20+
21+
- name: Set up Python 3.8.12
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: "3.8.12"
25+
- name: Install dependencies
26+
run: |
27+
pip install black[jupyter]==22.3.0 pytest
28+
pip install torch==2.0.0 --index-url https://download.pytorch.org/whl/cpu
29+
BUILD_NO_CUDA=1 pip install .
30+
- name: Run Black Format Check
31+
run: black . gsplat/ tests/ examples/ profiling/ --check
32+
- name: Run Tests.
33+
run: pytest tests/

.github/workflows/cuda/Linux-env.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Took from https://github.com/pyg-team/pyg-lib/
4+
5+
case ${1} in
6+
cu118)
7+
export CUDA_HOME=/usr/local/cuda-11.8
8+
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
9+
export PATH=${CUDA_HOME}/bin:${PATH}
10+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
11+
;;
12+
cu117)
13+
export CUDA_HOME=/usr/local/cuda-11.7
14+
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
15+
export PATH=${CUDA_HOME}/bin:${PATH}
16+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
17+
;;
18+
cu116)
19+
export CUDA_HOME=/usr/local/cuda-11.6
20+
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
21+
export PATH=${CUDA_HOME}/bin:${PATH}
22+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
23+
;;
24+
cu115)
25+
export CUDA_HOME=/usr/local/cuda-11.5
26+
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
27+
export PATH=${CUDA_HOME}/bin:${PATH}
28+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
29+
;;
30+
cu113)
31+
export CUDA_HOME=/usr/local/cuda-11.3
32+
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
33+
export PATH=${CUDA_HOME}/bin:${PATH}
34+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
35+
;;
36+
cu102)
37+
export CUDA_HOME=/usr/local/cuda-10.2
38+
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
39+
export PATH=${CUDA_HOME}/bin:${PATH}
40+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5"
41+
;;
42+
*)
43+
;;
44+
esac

.github/workflows/cuda/Linux.sh

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
# Took from https://github.com/pyg-team/pyg-lib/
4+
5+
OS=ubuntu2004
6+
7+
case ${1} in
8+
cu118)
9+
CUDA=11.8
10+
APT_KEY=${OS}-${CUDA/./-}-local
11+
FILENAME=cuda-repo-${APT_KEY}_${CUDA}.0-520.61.05-1_amd64.deb
12+
URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.0/local_installers
13+
;;
14+
cu117)
15+
CUDA=11.7
16+
APT_KEY=${OS}-${CUDA/./-}-local
17+
FILENAME=cuda-repo-${APT_KEY}_${CUDA}.1-515.65.01-1_amd64.deb
18+
URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.1/local_installers
19+
;;
20+
cu116)
21+
CUDA=11.6
22+
APT_KEY=${OS}-${CUDA/./-}-local
23+
FILENAME=cuda-repo-${APT_KEY}_${CUDA}.2-510.47.03-1_amd64.deb
24+
URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.2/local_installers
25+
;;
26+
cu115)
27+
CUDA=11.5
28+
APT_KEY=${OS}-${CUDA/./-}-local
29+
FILENAME=cuda-repo-${APT_KEY}_${CUDA}.2-495.29.05-1_amd64.deb
30+
URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.2/local_installers
31+
;;
32+
cu113)
33+
CUDA=11.3
34+
APT_KEY=${OS}-${CUDA/./-}-local
35+
FILENAME=cuda-repo-${APT_KEY}_${CUDA}.0-465.19.01-1_amd64.deb
36+
URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.0/local_installers
37+
;;
38+
cu102)
39+
CUDA=10.2
40+
APT_KEY=${CUDA/./-}-local-${CUDA}.89-440.33.01
41+
FILENAME=cuda-repo-${OS}-${APT_KEY}_1.0-1_amd64.deb
42+
URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}/Prod/local_installers
43+
;;
44+
*)
45+
echo "Unrecognized CUDA_VERSION=${1}"
46+
exit 1
47+
;;
48+
esac
49+
50+
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
51+
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
52+
wget -nv ${URL}/${FILENAME}
53+
sudo dpkg -i ${FILENAME}
54+
55+
if [ "${1}" = "cu117" ] || [ "${1}" = "cu118" ]; then
56+
sudo cp /var/cuda-repo-${APT_KEY}/cuda-*-keyring.gpg /usr/share/keyrings/
57+
else
58+
sudo apt-key add /var/cuda-repo-${APT_KEY}/7fa2af80.pub
59+
fi
60+
61+
sudo apt-get update
62+
sudo apt-get -y install cuda
63+
64+
rm -f ${FILENAME}

.github/workflows/cuda/Windows-env.sh

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Took from https://github.com/pyg-team/pyg-lib/
4+
5+
case ${1} in
6+
cu118)
7+
CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.8
8+
PATH=${CUDA_HOME}/bin:$PATH
9+
PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH
10+
export TORCH_CUDA_ARCH_LIST="6.0+PTX"
11+
;;
12+
cu117)
13+
CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.7
14+
PATH=${CUDA_HOME}/bin:$PATH
15+
PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH
16+
export TORCH_CUDA_ARCH_LIST="6.0+PTX"
17+
;;
18+
cu116)
19+
CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.6
20+
PATH=${CUDA_HOME}/bin:$PATH
21+
PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH
22+
export TORCH_CUDA_ARCH_LIST="6.0+PTX"
23+
;;
24+
cu115)
25+
CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.5
26+
PATH=${CUDA_HOME}/bin:$PATH
27+
PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH
28+
export TORCH_CUDA_ARCH_LIST="6.0+PTX"
29+
;;
30+
cu113)
31+
CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.3
32+
PATH=${CUDA_HOME}/bin:$PATH
33+
PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH
34+
export TORCH_CUDA_ARCH_LIST="6.0+PTX"
35+
;;
36+
*)
37+
;;
38+
esac

0 commit comments

Comments
 (0)