Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Mar 25, 2024
2 parents 204f59d + 0a57be7 commit 5e500ea
Show file tree
Hide file tree
Showing 7 changed files with 276 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OpenSplat (Docker)
name: OpenSplat (Docker CUDA)

on:
push:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ jobs:
-DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON
ninja
- name: Save Converted Artifacts
- name: Save Artifacts
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.rocm-version == '5.7.1' && matrix.torch-version == '2.2.1' && matrix.cmake-build-type == 'Release' }}
uses: actions/upload-artifact@v4
with:
path: |
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: OpenSplat (MacOS X86 and ARM)

on:
push:
branches:
- main
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [ published, edited ]

jobs:
build:
name: ${{ matrix.os }}-${{ matrix.arch }}-torch-${{ matrix.torch-version }}-${{ matrix.cmake-build-type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-13] # [macos-14, macos-13, macos-12, macos-11]
arch: [arm64, x86_64] # [arm64, x86_64]
torch-version: [2.2.1, 2.1.2] # [2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.0, 1.13.0, 1.12.0]
cmake-build-type: [Release] # [Debug, ClangTidy]
exclude:
- os: macos-14
arch: x86_64
- os: macos-14
arch: arm64
torch-version: 2.1.2
- os: macos-13
arch: arm64
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CL: /MP
CMAKE_GENERATOR: Ninja
CMAKE_GENERATOR_PLATFORM: ${{matrix.arch}}
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup MacOS
run: |
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
# brew install in macos-13 runner image is broken
# https://github.com/actions/runner-images/issues/9471
brew unlink [email protected]
brew unlink [email protected]
brew uninstall --force azure-cli
brew uninstall --force aws-sam-cli
brew uninstall --force pipx
brew uninstall --force [email protected]
brew uninstall --force [email protected]
rm -f '/usr/local/bin/2to3'
rm -f '/usr/local/bin/2to3-3.12'
rm -f '/usr/local/bin/idle3'
rm -f '/usr/local/bin/idle3.12'
rm -f '/usr/local/bin/pydoc3'
rm -f '/usr/local/bin/pydoc3.12'
rm -f '/usr/local/bin/python3'
rm -f '/usr/local/bin/python3-config'
rm -f '/usr/local/bin/python3.12'
rm -f '/usr/local/bin/python3.12-config'
fi
brew install \
ccache \
cmake \
ninja \
opencv
- name: Restore LibTorch Cache
uses: actions/cache@v4
id: libtorch-cache
with:
key: libtorch-${{ matrix.torch-version }}-macos-${{ matrix.arch }}
path: |
${{ github.workspace }}/libtorch
- name: Install LibTorch
if: ${{ steps.libtorch-cache.outputs.cache-hit != 'true' }}
run: |
TORCH_VER_FULL=${{ matrix.torch-version }}
TORCH_VER_ARR=($(echo ${TORCH_VER_FULL} | tr "." " "))
TORCH_VER="${TORCH_VER_ARR[0]}.${TORCH_VER_ARR[1]}"
if [[ "${TORCH_VER}" == "2.2" ]]; then
wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cpu/libtorch-macos-${{ matrix.arch }}-${{ matrix.torch-version }}.zip -O libtorch.zip
else
wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cpu/libtorch-macos-${{ matrix.torch-version }}.zip -O libtorch.zip
fi
unzip -q ${{ github.workspace }}/libtorch.zip -d ${{ github.workspace }}/
rm ${{ github.workspace }}/libtorch.zip
- name: Cache Build
uses: actions/cache@v4
id: cache-builds
with:
key: ${{ matrix.os }}-${{ matrix.arch }}-torch-${{ matrix.cmake-build-type }}-ccache-${{ github.run_id }}
restore-keys: ${{ matrix.os }}-cpu-torch-${{ matrix.cmake-build-type }}-ccache-
path: ${{ env.CCACHE_DIR }}

- name: Configure And Build
run: |
set -x
mkdir build
cd build
cmake .. \
-G${CMAKE_GENERATOR} \
-DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} \
-DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/libtorch \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
-DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON
ninja
ls -l .
- name: Save Artifacts
if: ${{ matrix.os == 'macos-14' && matrix.arch == 'arm64' && matrix.torch-version == '2.2.1' && matrix.cmake-build-type == 'Release' }}
uses: actions/upload-artifact@v4
with:
path: |
build/libgsplat_cpu.a
build/opensplat
build/simple_trainer
- name: Clean Compiler Cache
run: |
set -x
ccache --show-stats
ccache --evict-older-than 7d
ccache -s
ccache --show-stats
109 changes: 109 additions & 0 deletions .github/workflows/ubuntu-cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: OpenSplat (Ubuntu CPU)

on:
push:
branches:
- main
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [ published, edited ]

jobs:
build:
name: ${{ matrix.os }}-cpu-torch-${{ matrix.torch-version }}-${{ matrix.cmake-build-type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04] # [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
arch: [x64] # [x64, x86]
torch-version: [2.1.2, 2.2.1] # [1.12.0, 1.13.0, 2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1]
cmake-build-type: [Release] # [Debug, ClangTidy]
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CL: /MP
CMAKE_GENERATOR: Ninja
CMAKE_GENERATOR_PLATFORM: ${{matrix.arch}}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Ubuntu
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
libopencv-dev \
wget
wget -nv https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-linux-x86_64.tar.xz
sudo tar xf ccache-4.9.1-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.9.1-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
ccache --version
- name: Sudo Tar Wrapper
run: |
# Workaround: https://github.com/containers/podman/discussions/17868
sudo mv -fv /usr/bin/tar /usr/bin/tar.orig
echo -e '#!/bin/sh\n\nsudo /usr/bin/tar.orig "$@"' | sudo tee -a /usr/bin/tar
sudo chmod +x /usr/bin/tar
- name: Restore LibTorch Cache
uses: actions/cache@v4
id: libtorch-cache
with:
key: libtorch-${{ matrix.torch-version }}-cpu-ubuntu
path: |
${{ github.workspace }}/libtorch
- name: Install LibTorch
if: ${{ steps.libtorch-cache.outputs.cache-hit != 'true' }}
run: |
wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${{ matrix.torch-version }}%2Bcpu.zip -O libtorch.zip
unzip -q ${{ github.workspace }}/libtorch.zip -d ${{ github.workspace }}/
rm ${{ github.workspace }}/libtorch.zip
- name: Cache Build
uses: actions/cache@v4
id: cache-builds
with:
key: ${{ matrix.os }}-cpu-torch-${{ matrix.cmake-build-type }}-ccache-${{ github.run_id }}
restore-keys: ${{ matrix.os }}-cpu-torch-${{ matrix.cmake-build-type }}-ccache-
path: ${{ env.CCACHE_DIR }}

- name: Configure And Build
run: |
set -x
mkdir build
cd build
cmake .. \
-G${CMAKE_GENERATOR} \
-DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} \
-DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/libtorch \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
-DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON
ninja
- name: Save Artifacts
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.torch-version == '2.2.1' && matrix.cmake-build-type == 'Release' }}
uses: actions/upload-artifact@v4
with:
path: |
build/libgsplat_cpu.a
build/opensplat
build/simple_trainer
- name: Clean Compiler Cache
run: |
set -x
ccache --show-stats
ccache --evict-older-than 7d
ccache -s
ccache --show-stats
14 changes: 12 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OpenSplat (Ubuntu)
name: OpenSplat (Ubuntu CUDA)

on:
push:
Expand Down Expand Up @@ -122,9 +122,19 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/libtorch \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME
-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME \
-DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON
ninja
- name: Save Artifacts
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.cuda-version == '12.1.1' && matrix.torch-version == '2.2.1' && matrix.cmake-build-type == 'Release' }}
uses: actions/upload-artifact@v4
with:
path: |
build/libgsplat.a
build/opensplat
build/simple_trainer
- name: Clean Compiler Cache
run: |
set -x
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OpenSplat (Windows)
name: OpenSplat (Windows CUDA)

on:
push:
Expand Down Expand Up @@ -136,9 +136,19 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache `
-DCMAKE_PREFIX_PATH=${{ github.workspace }}\libtorch `
-DOPENCV_DIR=${{ github.workspace }}\OpenCV\opencv\build `
-DTORCH_CUDA_ARCH_LIST="${{ env.TORCH_CUDA_ARCH_LIST }}"
-DTORCH_CUDA_ARCH_LIST="${{ env.TORCH_CUDA_ARCH_LIST }}" `
-DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON
cmake --build . --parallel --config ${{ matrix.cmake-build-type }}
- name: Save Artifacts
if: ${{ matrix.os == 'windows-2022' && matrix.torch-version == '2.2.1' && matrix.cmake-build-type == 'Release' }}
uses: actions/upload-artifact@v4
with:
path: |
build/libgsplat.so
build/opensplat
build/simple_trainer
- name: Clean Compiler Cache
shell: pwsh
run: |
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ add_executable(opensplat opensplat.cpp point_io.cpp nerfstudio.cpp model.cpp kdt
set_property(TARGET opensplat PROPERTY CXX_STANDARD 17)
target_include_directories(opensplat PRIVATE ${PROJECT_SOURCE_DIR}/vendor/glm ${GPU_INCLUDE_DIRS})
target_link_libraries(opensplat PUBLIC ${STDPPFS_LIBRARY} ${GPU_LIBRARIES} ${GSPLAT_LIBS} ${TORCH_LIBRARIES} ${OpenCV_LIBS})
if (NOT WIN32)
target_link_libraries(opensplat PUBLIC pthread)
endif()
if(GPU_RUNTIME STREQUAL "HIP")
target_compile_definitions(opensplat PRIVATE USE_HIP __HIP_PLATFORM_AMD__)
elseif(GPU_RUNTIME STREQUAL "CUDA")
Expand All @@ -96,6 +99,9 @@ if(OPENSPLAT_BUILD_SIMPLE_TRAINER)
add_executable(simple_trainer simple_trainer.cpp project_gaussians.cpp rasterize_gaussians.cpp cv_utils.cpp)
target_include_directories(simple_trainer PRIVATE ${PROJECT_SOURCE_DIR}/vendor/glm ${GPU_INCLUDE_DIRS})
target_link_libraries(simple_trainer PUBLIC ${GPU_LIBRARIES} ${GSPLAT_LIBS} ${TORCH_LIBRARIES} ${OpenCV_LIBS})
if (NOT WIN32)
target_link_libraries(simple_trainer PUBLIC pthread)
endif()
set_property(TARGET simple_trainer PROPERTY CXX_STANDARD 17)
if(GPU_RUNTIME STREQUAL "HIP")
target_compile_definitions(simple_trainer PRIVATE USE_HIP __HIP_PLATFORM_AMD__)
Expand Down

0 comments on commit 5e500ea

Please sign in to comment.