forked from elixir-nx/xla
-
Notifications
You must be signed in to change notification settings - Fork 0
235 lines (229 loc) · 8.77 KB
/
release.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
create_draft_release:
if: github.ref_type == 'tag'
permissions:
contents: write
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Create draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! gh release list | grep -q ${{ github.ref_name }}; then
gh release create --title ${{ github.ref_name }} --draft ${{ github.ref_name }}
fi
linux:
name: "x86_64-linux-gnu-{cpu,tpu}"
needs: [create_draft_release]
permissions:
contents: write
# We intentionally build on ubuntu 20 to compile against
# an older version of glibc
runs-on: ubuntu-large-20.04
steps:
- name: Install libtool-bin
run: |
sudo apt-get update && sudo apt-get install -y libtool-bin
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "6.1.2"
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archives
- run: mix deps.get
- run: .github/scripts/compile_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
macos:
name: "x86_64-darwin-cpu"
needs: [create_draft_release]
runs-on: macos-latest-large
steps:
- uses: actions/checkout@v3
- run: brew install elixir
- run: mix local.hex --force
- name: use macos static
run: |
mv extension/static-lib-mac.bzl extension/static-lib.bzl
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "6.1.2"
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
macos_arm:
name: "aarch64-darwin-cpu (cross-compiled)"
needs: [create_draft_release]
runs-on: macos-latest-large
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- run: brew install elixir
- run: mix local.hex --force
- name: use macos static
run: |
mv extension/static-lib-mac.bzl extension/static-lib.bzl
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "6.1.2"
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
XLA_TARGET_PLATFORM: "aarch64-darwin"
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=macos_arm64"
CC: gcc-9
linux_cuda:
# Currently the build takes longer than the job time limit (6h),
# so we always build these off-CI
name: "x86_64-linux-gnu-${{ matrix.xla_target }}"
permissions:
contents: write
needs: [create_draft_release]
runs-on: ubuntu-large-20.04
strategy:
fail-fast: false
matrix:
include:
- container: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
xla_target: cuda118
cuda_version: "11.8.0"
cuda_version_short: "11.8"
cudnn_version: "8.6.0"
python: "3.11"
cudnn_long_version: "8.6.0.163"
- container: nvidia/cuda:12.0.0-cudnn8-devel-ubuntu20.04
xla_target: cuda120
cuda_version: "12.0.0"
cuda_version_short: "12.0"
cudnn_version: "8.8.0"
python: "3.11"
cudnn_long_version: "8.8.0.121"
container: ${{ matrix.container }}
env:
# Set the missing UTF-8 locale, otherwise Elixir warns
LC_ALL: C.UTF-8
# Make sure installing packages (like tzdata) doesn't prompt for configuration
DEBIAN_FRONTEND: noninteractive
ImageOS: 'ubuntu20'
steps:
# The base images are minimalistic, so we bring a few necessary system packages
- name: Install system packages
run: |
# We need to install "add-apt-repository" first
apt-get update && apt-get install -y software-properties-common
# Add repository with the latest git version for action/checkout to properly clone the repo
add-apt-repository ppa:git-core/ppa
# We run as root, so sudo is not necessary per se, but some actions (like setup-bazel) make use of it
apt-get update && apt-get install -y ca-certificates curl git sudo unzip wget libtool-bin
# Install GitHub CLI used by our scripts
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
apt-get update && apt-get install -y gh
# Install a specific cuDNN version over the default one
cuda_version="${{ matrix.cuda_version }}"
cudnn_version="${{ matrix.cudnn_version }}"
cuda_version_short="${{ matrix.cuda_version_short }}"
cudnn_long_version="${{matrix.cudnn_long_version}}"
wget "https://developer.download.nvidia.com/compute/redist/cudnn/v${cudnn_version}/local_installers/${cuda_version_short}/cudnn-local-repo-ubuntu2204-${cudnn_long_version}_1.0-1_amd64.deb"
dpkg -i "cudnn-local-repo-ubuntu2204-${cudnn_long_version}_1.0-1_amd64.deb"
cp /var/cudnn-local-repo-ubuntu2204-${cudnn_long_version}/*.gpg /usr/share/keyrings/
apt-get update
apt-get install -y --allow-downgrades --allow-change-held-packages libcudnn8-dev libcudnn8
# Prevent git from checking the repository owner and erroring with "dubious ownership"
- run: git config --global --add safe.directory '*'
# Proceed with the regular steps
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "6.1.2"
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
env:
# Avoid permission errors for /github/home, in this case the directory
# is used for pip cache and is not relevant either way
HOME: /root
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: ${{ matrix.xla_target }}
linux_arm:
name: "aarch64-linux-gnu-cpu (cross-compiled)"
needs: [create_draft_release]
permissions:
contents: write
# We intentionally build on ubuntu 20 to compile against
# an older version of glibc
runs-on: ubuntu-large-20.04
steps:
- name: Install libtool-bin
run: |
sudo apt-get update && sudo apt-get install -y libtool-bin
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "6.1.2"
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archives
- run: mix deps.get
# Hide system OpenSSL as suggested in https://github.com/tensorflow/tensorflow/issues/48401#issuecomment-818377995
- run: sudo mv /usr/include/openssl /usr/include/openssl.original
- run: .github/scripts/compile_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
XLA_TARGET_PLATFORM: "aarch64-linux-gnu"
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=elinux_aarch64"
CC: gcc-9