-
Notifications
You must be signed in to change notification settings - Fork 499
140 lines (126 loc) · 5.26 KB
/
build.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
135
136
137
138
139
140
name: Build Flashlight
on: [push, pull_request]
jobs:
build_core:
name: "Build on ${{ matrix.os }} | tensor: ${{ matrix.backend }} | autograd: ${{ matrix.autograd_backend }} | distributed: ${{ matrix.distributed_backend }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macOS-12]
backend: [ArrayFire, oneDNN, Stub]
autograd_backend: [oneDNN]
distributed_backend: [Stub]
exclude:
# no Gloo support on macOS and Windows
- os: macOS-12
distributed_backend: Gloo
- os: windows-2022
distributed_backend: Gloo
include:
- os: ubuntu-22.04
backend: oneDNN
autograd_backend: oneDNN
distributed_backend: Gloo
# Configuration using only stubs and no autograd backend
- os: ubuntu-22.04
backend: Stub
distributed_backend: Stub
defaults:
run:
shell: bash -l {0}
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install_core_deps
with:
backend: ${{ matrix.backend }}
autograd_backend: ${{ matrix.autograd_backend }}
distributed_backend: ${{ matrix.distributed_backend }}
- name: "Configure Flashlight"
run: |
cmake -S . -B build -DBUILD_SHARED_LIBS=ON \
-DFL_USE_ARRAYFIRE=${{ matrix.backend == 'ArrayFire' && 'ON' || 'OFF' }} \
-DFL_ARRAYFIRE_USE_CPU=${{ matrix.backend == 'ArrayFire' && 'ON' || 'OFF' }} \
-DFL_USE_ONEDNN=${{ (matrix.backend == 'oneDNN' || matrix.autograd_backend == 'oneDNN') && 'ON' || 'OFF' }} \
-DFL_USE_TENSOR_STUB=${{ matrix.backend == 'Stub' && 'ON' || 'OFF' }} \
-DFL_USE_NCCL=OFF \
-DFL_USE_GLOO=${{ matrix.distributed_backend == 'Gloo' && 'ON' || 'OFF' }} \
-DFL_USE_BACKWARD_CPP=ON
- name: "Build Flashlight"
run: |
cmake --build build --parallel 2
- name: "Upload checkout artifact"
uses: actions/upload-artifact@v3
with:
name: core-checkout-${{ matrix.os }}-${{ matrix.backend }}-${{ matrix.autograd_backend }}
path: .
retention-days: 3
# Test
# - name: "Run Flashlight tests"
# run: |
# cd build
# ctest --output-on-failure -j 4
# if: matrix.backend == 'ArrayFire' && matrix.autograd_backend == 'oneDNN'
# build_pkg:
# name: "Build Flashlight ${{ matrix.pkg }} Package on ${{ matrix.os }} | tensor: ${{ matrix.backend }} | autograd: ${{ matrix.autograd_backend }}"
# runs-on: ${{ matrix.os }}
# needs: build_core # TODO: this won't work until Github Actions enables specific matrix dependencies
# strategy:
# matrix:
# os: [ubuntu-22.04, macOS-12]
# backend: [ArrayFire]
# autograd_backend: [oneDNN]
# pkg: [runtime, speech, vision, text]
# defaults:
# run:
# shell: bash -l {0}
# if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'pull_request'
# steps:
# # get persisted checkout from core build
# - uses: ./.github/actions/install_core_deps
# with:
# backend: ${{ matrix.backend }}
# autograd_backend: ${{ matrix.autograd_backend }}
# - uses: ./.github/actions/install_pkg_deps
# with:
# pkg: ${{ matrix.pkg }}
# - name: "Download checkout artifact"
# uses: actions/download-artifact@v3
# with:
# name: core-checkout-${{ matrix.os }}-${{ matrix.backend }}-${{ matrix.autograd_backend }}
# - name: "Configure Flashlight"
# run: |
# cmake -S . -B build -DBUILD_SHARED_LIBS=ON \
# -DFL_BUILD_PKG_RUNTIME=ON \
# -DFL_BUILD_PKG_SPEECH=${{ matrix.pkg == 'speech' && 'ON' || 'OFF' }} \
# -DFL_BUILD_PKG_VISION=${{ matrix.pkg == 'vision' && 'ON' || 'OFF' }} \
# -DFL_BUILD_PKG_TEXT=${{ matrix.pkg == 'text' && 'ON' || 'OFF' }}
# - name: "Build Flashlight"
# run: |
# cmake --build build --parallel 2
build_core_wasm:
name: "Build WebAssembly libraries with Emscripten compilers + Flashlight core + stub backend"
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- name: "Download and setup Emscripten"
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
- name: "Build the Flashlight stub backend with Emscripten C compilers"
# TODO: build and run tests with wasm once we have a runnable backend
run: |
source ./emsdk/emsdk_env.sh # TODO: move me to setup step
emcmake cmake -S . -B build \
-DFL_USE_TENSOR_STUB=ON \
-DFL_USE_ARRAYFIRE=OFF \
-DFL_USE_ONEDNN=OFF \
-DFL_USE_CUDNN=OFF \
-DFL_BUILD_DISTRIBUTED=OFF \
-DFL_BUILD_EXAMPLES=ON