From e479642aba7f67250bbbb9c2dcaa453945264b2c Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 09:33:24 -0400 Subject: [PATCH 01/12] Add CPU build pipeline --- .github/workflows/docker.yml | 2 +- .github/workflows/ubuntu-cpu.yml | 99 ++++++++++++++++++++++++++++++++ .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows.yml | 2 +- 4 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ubuntu-cpu.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 10fd510..77d047f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: OpenSplat (Docker) +name: OpenSplat (Docker CUDA) on: push: diff --git a/.github/workflows/ubuntu-cpu.yml b/.github/workflows/ubuntu-cpu.yml new file mode 100644 index 0000000..eb588a6 --- /dev/null +++ b/.github/workflows/ubuntu-cpu.yml @@ -0,0 +1,99 @@ +name: OpenSplat (Ubuntu CPU) + +on: + push: + branches: + - cpu-build + pull_request: + types: [ assigned, opened, synchronize, reopened ] + release: + types: [ published, edited ] + +jobs: + build: + name: ${{ matrix.os }}-cuda-${{ matrix.cuda-version }}-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 }}-${{env.CUDA_VER_SHORT}}-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-shared-with-deps-${{ matrix.torch-version }}%2B$cpu.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 + ninja + + - name: Clean Compiler Cache + run: | + set -x + ccache --show-stats + ccache --evict-older-than 7d + ccache -s + ccache --show-stats diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 23d02f3..1144d32 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,4 +1,4 @@ -name: OpenSplat (Ubuntu) +name: OpenSplat (Ubuntu CUDA) on: push: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 85aef52..d824563 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,4 +1,4 @@ -name: OpenSplat (Windows) +name: OpenSplat (Windows CUDA) on: push: From 52f8cc8350d456d4d058553abe8073c7010dfea5 Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 09:36:36 -0400 Subject: [PATCH 02/12] Fix CPU libtorch download link --- .github/workflows/ubuntu-cpu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-cpu.yml b/.github/workflows/ubuntu-cpu.yml index eb588a6..9c69ce7 100644 --- a/.github/workflows/ubuntu-cpu.yml +++ b/.github/workflows/ubuntu-cpu.yml @@ -11,7 +11,7 @@ on: jobs: build: - name: ${{ matrix.os }}-cuda-${{ matrix.cuda-version }}-torch-${{ matrix.torch-version }}-${{ matrix.cmake-build-type }} + name: ${{ matrix.os }}-cpu-torch-${{ matrix.torch-version }}-${{ matrix.cmake-build-type }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -64,7 +64,7 @@ jobs: - name: Install LibTorch if: ${{ steps.libtorch-cache.outputs.cache-hit != 'true' }} run: | - wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-${{ matrix.torch-version }}%2B$cpu.zip -O libtorch.zip + 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 From 90a33771a400e7cea8c58e167312bfec1e86566b Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 10:15:37 -0400 Subject: [PATCH 03/12] Add pthread for unix platform --- .github/workflows/ubuntu-cpu.yml | 11 ++++++++++- CMakeLists.txt | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-cpu.yml b/.github/workflows/ubuntu-cpu.yml index 9c69ce7..fac2f11 100644 --- a/.github/workflows/ubuntu-cpu.yml +++ b/.github/workflows/ubuntu-cpu.yml @@ -87,9 +87,18 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \ -DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \ -DCMAKE_PREFIX_PATH=${{ github.workspace }}/libtorch \ - -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \ + -DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON ninja + - name: Save Artifacts + uses: actions/upload-artifact@v4 + with: + path: | + build/libgsplat.a + build/opensplat + build/simple_trainer + - name: Clean Compiler Cache run: | set -x diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e5f4b8..606a7d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") @@ -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__) From 4318ccb602ccfbdb4bb4eec91356c99c3729e92e Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 10:44:22 -0400 Subject: [PATCH 04/12] Save the build artifacts (latest versions) across all platforms --- .github/workflows/hip.yml | 3 ++- .github/workflows/ubuntu-cpu.yml | 4 +++- .github/workflows/ubuntu.yml | 12 +++++++++++- .github/workflows/windows.yml | 12 +++++++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hip.yml b/.github/workflows/hip.yml index 2ffc4c7..962631d 100644 --- a/.github/workflows/hip.yml +++ b/.github/workflows/hip.yml @@ -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: | diff --git a/.github/workflows/ubuntu-cpu.yml b/.github/workflows/ubuntu-cpu.yml index fac2f11..0a9b2fe 100644 --- a/.github/workflows/ubuntu-cpu.yml +++ b/.github/workflows/ubuntu-cpu.yml @@ -90,12 +90,14 @@ jobs: -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \ -DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON ninja + ls -l . - 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.a + build/libgsplat_cpu.a build/opensplat build/simple_trainer diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 1144d32..fcb91b4 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d824563..46baeb6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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: | From 9db47fdb569a1fb99bb0ab1ff391aabd7d244a3d Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 10:51:12 -0400 Subject: [PATCH 05/12] Switch ci tigger back to the main branch --- .github/workflows/ubuntu-cpu.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-cpu.yml b/.github/workflows/ubuntu-cpu.yml index 0a9b2fe..1d50701 100644 --- a/.github/workflows/ubuntu-cpu.yml +++ b/.github/workflows/ubuntu-cpu.yml @@ -3,7 +3,7 @@ name: OpenSplat (Ubuntu CPU) on: push: branches: - - cpu-build + - main pull_request: types: [ assigned, opened, synchronize, reopened ] release: @@ -90,7 +90,6 @@ jobs: -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \ -DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON ninja - ls -l . - name: Save Artifacts if: ${{ matrix.os == 'ubuntu-22.04' && matrix.torch-version == '2.2.1' && matrix.cmake-build-type == 'Release' }} From 99525c683f33cf6c4778e2f63412fa183b6dc815 Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 11:08:44 -0400 Subject: [PATCH 06/12] Format the cache key for CPU libtorch --- .github/workflows/ubuntu-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-cpu.yml b/.github/workflows/ubuntu-cpu.yml index 1d50701..98cba0c 100644 --- a/.github/workflows/ubuntu-cpu.yml +++ b/.github/workflows/ubuntu-cpu.yml @@ -57,7 +57,7 @@ jobs: uses: actions/cache@v4 id: libtorch-cache with: - key: libtorch-${{ matrix.torch-version }}-${{env.CUDA_VER_SHORT}}-ubuntu + key: libtorch-${{ matrix.torch-version }}-cpu-ubuntu path: | ${{ github.workspace }}/libtorch From 5f527eee5e86d4b670389dfdbcc8de30393d48cf Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 12:39:28 -0400 Subject: [PATCH 07/12] Add MacOS build pipeline (arm64 and x86_64) --- .github/workflows/macos.yml | 107 ++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/macos.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..3d0ea55 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,107 @@ +name: OpenSplat (MacOS X86 and ARM) + +on: + push: + branches: + - macos-build + 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-14, macos-13, macos-12, macos-11] + arch: [arm64] # [arm64, x86_64] + torch-version: [2.2.1] # [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] + 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 MacOS + run: | + brew install \ + cmake \ + ninja \ + opencv + wget -nv https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-darwin.tar.gz + sudo tar xzf ccache-4.9.1-darwin.tar.gz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.9.1-darwin/ccache + rm -f ccache-*-darwin.tar.gz + 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 }}-macos-${{ matrix.arch }} + 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-macos-${{ matrix.arch }}-${{ matrix.torch-version }}.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 }}-${{ 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.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 From 69801147d6afe83a8e776321f08f747375f365f8 Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 12:44:46 -0400 Subject: [PATCH 08/12] Offload ccache setup to brew install --- .github/workflows/macos.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 3d0ea55..7ebf1df 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -35,13 +35,10 @@ jobs: - name: Setup MacOS run: | brew install \ + ccache \ cmake \ ninja \ opencv - wget -nv https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-darwin.tar.gz - sudo tar xzf ccache-4.9.1-darwin.tar.gz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.9.1-darwin/ccache - rm -f ccache-*-darwin.tar.gz - ccache --version - name: Sudo Tar Wrapper run: | From 508683fec5c8f04969eacb5cda8d3e3d8abcdca6 Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 12:52:13 -0400 Subject: [PATCH 09/12] MacOS runner path (/usr/bin) is read-only --- .github/workflows/macos.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7ebf1df..86a5441 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -40,13 +40,6 @@ jobs: ninja \ opencv - - 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 From b08688a08ce71808d51bd1fa826530dfcc8258d4 Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 13:42:42 -0400 Subject: [PATCH 10/12] Test macos-13 with x86_64 --- .github/workflows/macos.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 86a5441..a5cc89c 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -16,10 +16,18 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-14] # [macos-14, macos-13, macos-12, macos-11] - arch: [arm64] # [arm64, x86_64] - torch-version: [2.2.1] # [2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.0, 1.13.0, 1.12.0] + 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 }} @@ -34,6 +42,8 @@ jobs: - name: Setup MacOS run: | + brew update || brew update-reset && + brew upgrade && brew install \ ccache \ cmake \ @@ -51,6 +61,14 @@ jobs: - 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 wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cpu/libtorch-macos-${{ matrix.arch }}-${{ matrix.torch-version }}.zip -O libtorch.zip unzip -q ${{ github.workspace }}/libtorch.zip -d ${{ github.workspace }}/ rm ${{ github.workspace }}/libtorch.zip @@ -84,7 +102,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: | - build/libgsplat.a + build/libgsplat_cpu.a build/opensplat build/simple_trainer From df1f3a214bfba523137cfca67e6363e2729ba272 Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 14:09:21 -0400 Subject: [PATCH 11/12] Fix macos-13 brew install issue --- .github/workflows/macos.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a5cc89c..00c00d8 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -34,6 +34,7 @@ jobs: CL: /MP CMAKE_GENERATOR: Ninja CMAKE_GENERATOR_PLATFORM: ${{matrix.arch}} + HOMEBREW_NO_AUTO_UPDATE: 1 steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -42,8 +43,27 @@ jobs: - name: Setup MacOS run: | - brew update || brew update-reset && - brew upgrade && + 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 python@3.11 + brew unlink python@3.12 + brew uninstall --force azure-cli + brew uninstall --force aws-sam-cli + brew uninstall --force pipx + brew uninstall --force python@3.11 + brew uninstall --force python@3.12 + 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 \ From c24308324342e1b949c3ffb4f22d3e0fa5e72f2d Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 14:23:33 -0400 Subject: [PATCH 12/12] Switch ci tigger back to the main branch --- .github/workflows/macos.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 00c00d8..ccae9d1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -3,7 +3,7 @@ name: OpenSplat (MacOS X86 and ARM) on: push: branches: - - macos-build + - main pull_request: types: [ assigned, opened, synchronize, reopened ] release: @@ -89,7 +89,6 @@ jobs: else wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cpu/libtorch-macos-${{ matrix.torch-version }}.zip -O libtorch.zip fi - wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cpu/libtorch-macos-${{ matrix.arch }}-${{ matrix.torch-version }}.zip -O libtorch.zip unzip -q ${{ github.workspace }}/libtorch.zip -d ${{ github.workspace }}/ rm ${{ github.workspace }}/libtorch.zip