Add reconstruction normalization after each step (#136) #101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ubuntu | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [ assigned, opened, synchronize, reopened ] | |
release: | |
types: [ published, edited ] | |
jobs: | |
build: | |
name: ${{ matrix.config.os }} ${{ matrix.config.cmakeBuildType }} ${{ matrix.config.cudaEnabled && 'CUDA' || '' }} ${{ matrix.config.asanEnabled && 'ASan' || '' }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: [ | |
{ | |
os: ubuntu-22.04, | |
cmakeBuildType: Release, | |
asanEnabled: false, | |
cudaEnabled: false, | |
checkCodeFormat: true, | |
}, | |
{ | |
os: ubuntu-22.04, | |
cmakeBuildType: Release, | |
asanEnabled: false, | |
cudaEnabled: true, | |
checkCodeFormat: false, | |
}, | |
{ | |
os: ubuntu-22.04, | |
cmakeBuildType: Release, | |
asanEnabled: true, | |
cudaEnabled: false, | |
checkCodeFormat: false, | |
}, | |
{ | |
os: ubuntu-22.04, | |
cmakeBuildType: ClangTidy, | |
asanEnabled: false, | |
cudaEnabled: false, | |
checkCodeFormat: false, | |
}, | |
] | |
env: | |
COMPILER_CACHE_VERSION: 1 | |
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache | |
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache | |
CCACHE_BASEDIR: ${{ github.workspace }} | |
CTCACHE_DIR: ${{ github.workspace }}/compiler-cache/ctcache | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
id: cache-builds | |
with: | |
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}-${{ github.run_id }}-${{ github.run_number }} | |
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }} | |
path: ${{ env.COMPILER_CACHE_DIR }} | |
- name: Install compiler cache | |
run: | | |
mkdir -p "$CCACHE_DIR" "$CTCACHE_DIR" | |
echo "$COMPILER_CACHE_DIR/bin" >> $GITHUB_PATH | |
if [ -f "$COMPILER_CACHE_DIR/bin/ccache" ]; then | |
exit 0 | |
fi | |
set -x | |
wget https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz | |
echo "0b33f39766fe9db67f40418aed6a5b3d7b2f4f7fab025a8213264b77a2d0e1b1 ccache-4.8.2-linux-x86_64.tar.xz" | sha256sum --check | |
tar xfv ccache-4.8.2-linux-x86_64.tar.xz | |
mkdir -p "$COMPILER_CACHE_DIR/bin" | |
mv ./ccache-4.8.2-linux-x86_64/ccache "$COMPILER_CACHE_DIR/bin" | |
ctcache_commit_id="66c3614175fc650591488519333c411b2eac15a3" | |
wget https://github.com/matus-chochlik/ctcache/archive/${ctcache_commit_id}.zip | |
echo "108b087f156a9fe7da0c796de1ef73f5855d2a33a27983769ea39061359a40fc ${ctcache_commit_id}.zip" | sha256sum --check | |
unzip "${ctcache_commit_id}.zip" | |
mv ctcache-${ctcache_commit_id}/clang-tidy* "$COMPILER_CACHE_DIR/bin" | |
- name: Check code format | |
if: matrix.config.checkCodeFormat | |
run: | | |
set +x -euo pipefail | |
sudo apt-get update && sudo apt-get install -y clang-format-14 black | |
./scripts/format/clang_format.sh | |
git diff --name-only | |
git diff --exit-code || (echo "Code formatting failed" && exit 1) | |
- name: Setup Ubuntu | |
run: | | |
sudo apt-get update && sudo apt-get install -y \ | |
build-essential \ | |
cmake \ | |
ninja-build \ | |
libboost-program-options-dev \ | |
libboost-filesystem-dev \ | |
libboost-graph-dev \ | |
libboost-system-dev \ | |
libeigen3-dev \ | |
libsuitesparse-dev \ | |
libceres-dev \ | |
libflann-dev \ | |
libfreeimage-dev \ | |
libmetis-dev \ | |
libgoogle-glog-dev \ | |
libgtest-dev \ | |
libgmock-dev \ | |
libsqlite3-dev \ | |
libglew-dev \ | |
qtbase5-dev \ | |
libqt5opengl5-dev \ | |
libcgal-dev \ | |
libcgal-qt5-dev \ | |
libgl1-mesa-dri \ | |
libunwind-dev \ | |
xvfb | |
if [ "${{ matrix.config.cudaEnabled }}" == "true" ]; then | |
if [ "${{ matrix.config.os }}" == "ubuntu-20.04" ]; then | |
sudo apt-get install -y \ | |
nvidia-cuda-toolkit \ | |
nvidia-cuda-toolkit-gcc | |
echo "CC=/usr/bin/cuda-gcc" >> $GITHUB_ENV | |
echo "CXX=/usr/bin/cuda-g++" >> $GITHUB_ENV | |
elif [ "${{ matrix.config.os }}" == "ubuntu-22.04" ]; then | |
sudo apt-get install -y \ | |
nvidia-cuda-toolkit \ | |
nvidia-cuda-toolkit-gcc \ | |
gcc-10 g++-10 | |
echo "CC=/usr/bin/gcc-10" >> $GITHUB_ENV | |
echo "CXX=/usr/bin/g++-10" >> $GITHUB_ENV | |
echo "CUDAHOSTCXX=/usr/bin/g++-10" >> $GITHUB_ENV | |
fi | |
fi | |
if [ "${{ matrix.config.asanEnabled }}" == "true" ]; then | |
sudo apt-get install -y clang-15 libomp-15-dev | |
echo "CC=/usr/bin/clang-15" >> $GITHUB_ENV | |
echo "CXX=/usr/bin/clang++-15" >> $GITHUB_ENV | |
fi | |
if [ "${{ matrix.config.cmakeBuildType }}" == "ClangTidy" ]; then | |
sudo apt-get install -y clang-15 clang-tidy-15 libomp-15-dev | |
echo "CC=/usr/bin/clang-15" >> $GITHUB_ENV | |
echo "CXX=/usr/bin/clang++-15" >> $GITHUB_ENV | |
fi | |
- name: Upgrade CMake | |
run: | | |
CMAKE_VERSION=3.28.6 | |
CMAKE_DIR=cmake-${CMAKE_VERSION}-linux-x86_64 | |
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_DIR}.tar.gz | |
tar -xzf ${CMAKE_DIR}.tar.gz | |
sudo cp -r ${CMAKE_DIR}/* /usr/local/ | |
rm -rf ${CMAKE_DIR}* | |
- name: Configure and build | |
run: | | |
set -x | |
cmake --version | |
mkdir build | |
cd build | |
cmake .. \ | |
-GNinja \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.cmakeBuildType }} \ | |
-DCMAKE_INSTALL_PREFIX=./install \ | |
-DCMAKE_CUDA_ARCHITECTURES=50 \ | |
-DTESTS_ENABLED=ON \ | |
-DASAN_ENABLED=${{ matrix.config.asanEnabled }} | |
ninja -k 10000 | |
- name: Run tests | |
if: ${{ matrix.config.cmakeBuildType != 'ClangTidy' }} | |
run: | | |
export DISPLAY=":99.0" | |
export QT_QPA_PLATFORM="offscreen" | |
Xvfb :99 & | |
sleep 3 | |
cd build | |
ctest --output-on-failure -E .+colmap_.* | |
- name: Cleanup compiler cache | |
run: | | |
set -x | |
ccache --show-stats --verbose | |
ccache --evict-older-than 1d | |
ccache --show-stats --verbose | |
echo "Size of ctcache before: $(du -sh $CTCACHE_DIR)" | |
echo "Number of ctcache files before: $(find $CTCACHE_DIR | wc -l)" | |
# Delete cache older than 10 days. | |
find "$CTCACHE_DIR"/*/ -mtime +10 -print0 | xargs -0 rm -rf | |
echo "Size of ctcache after: $(du -sh $CTCACHE_DIR)" | |
echo "Number of ctcache files after: $(find $CTCACHE_DIR | wc -l)"'' |