-
Notifications
You must be signed in to change notification settings - Fork 87
134 lines (123 loc) · 4.57 KB
/
macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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 install --overwrite [email protected]
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
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
export GPU_RUNTIME=MPS
else
export GPU_RUNTIME=CPU
fi
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 \
-DGPU_RUNTIME=${GPU_RUNTIME} \
-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/libgsplat_cpu.a
build/opensplat
build/simple_trainer
build/default.metallib
- name: Clean Compiler Cache
run: |
set -x
ccache --show-stats
ccache --evict-older-than 7d
ccache -s
ccache --show-stats