-
Notifications
You must be signed in to change notification settings - Fork 22
154 lines (137 loc) · 5.31 KB
/
linux-precompile-x86_64-cuda-gnu.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
name: linux-precompile-x86_64-cuda-gnu
on:
push:
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
x86_64-linux-gnu-cuda:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- container: nvidia/cuda:11.8.0-devel-ubuntu20.04
cuda_ver: "11.8.0"
cuda_id: "11"
cudnn_id: "8"
cudnn_tarball: "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-9.2.0.82_cuda11-archive.tar.xz"
- container: nvidia/cuda:12.5.0-devel-ubuntu20.04
cuda_ver: "12.5.0"
cuda_id: "12"
cudnn_id: "8"
cudnn_tarball: "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-9.2.0.82_cuda12-archive.tar.xz"
- container: nvidia/cuda:11.8.0-devel-ubuntu20.04
cuda_ver: "11.8.0"
cuda_id: "11"
cudnn_id: "9"
cudnn_tarball: "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-9.2.0.82_cuda11-archive.tar.xz"
- container: nvidia/cuda:12.5.0-devel-ubuntu20.04
cuda_ver: "12.5.0"
cuda_id: "12"
cudnn_id: "9"
cudnn_tarball: "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-9.2.0.82_cuda12-archive.tar.xz"
container: ${{ matrix.container }}
env:
# container env vars
# ref link: https://github.com/elixir-nx/xla/blob/main/.github/workflows/release.yml
ImageOS: ubuntu20
LANG: en_US.UTF-8
LANGUAGE: en_US:en
LC_ALL: en_US.UTF-8
DEBIAN_FRONTEND: noninteractive
# evision related env vars
MIX_ENV: prod
OPENCV_VER: "4.10.0"
ELIXIR_VERSION: "1.15.2"
OTP_VERSION: "25"
NIF_VERSION: "2.16"
EVISION_PREFER_PRECOMPILED: "false"
EVISION_GENERATE_LANG: "erlang,elixir"
EVISION_ENABLE_CUDA: "true"
PKG_CONFIG_PATH: "/usr/lib/x86_64-linux-gnu/pkgconfig"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system dependencies
run: |
apt-get update
apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip curl git libssl-dev gzip python3 ca-certificates \
locales curl wget cmake libeigen3-dev
echo "${LANG} UTF-8" >> /etc/locale.gen
locale-gen
update-locale LANG=${LANG}
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Download and install cudnn
run: |
curl -fSL "${{ matrix.cudnn_tarball }}" -o cudnn.tar.xz
mkdir -p cudnn
tar -xvf cudnn.tar.xz -C cudnn --strip-components=1
rm -f cudnn.tar.xz
cp -a cudnn/include/* /usr/local/cuda/include/
if [ -d "$(pwd)/cudnn/lib" ]; then
cp -a cudnn/lib/* /usr/local/cuda/lib64/
fi
if [ -d "$(pwd)/cudnn/lib64" ]; then
cp -a cudnn/lib64/* /usr/local/cuda/lib64/
fi
rm -rf cudnn
- name: Cache mix packages
id: cache-mix-deps
uses: actions/cache@v4
with:
key: deps-${{ hashFiles('mix.lock') }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}
path: |
./deps
- name: Get mix deps
if: steps.cache-mix-deps.outputs.cache-hit != 'true'
run: |
mix deps.get
- name: Cache OpenCV
id: cache-opencv
uses: actions/cache@v4
with:
key: opencv-with-contrib-${{ env.OPENCV_VER }}
path: |
./3rd_party
- name: Download OpenCV
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
bash scripts/download_opencv.sh ${OPENCV_VER} 3rd_party/cache 3rd_party/opencv/
bash scripts/download_opencv_contrib.sh ${OPENCV_VER} 3rd_party/cache 3rd_party/opencv/
- name: Compile OpenCV
run: |
mix compile_opencv
- name: Mix Compile
run: |
rm -f _build/${{ env.MIX_ENV }}/lib/evision/priv/evision.so
mix compile
ls -la ./lib/generated
- name: Create precompiled library
run: |
export PKG_NAME=evision-nif_${{ env.NIF_VERSION }}-x86_64-linux-gnu-contrib-cuda${{ matrix.cuda_id }}-cudnn${{ matrix.cudnn_id }}-${GITHUB_REF##*/v}
mkdir -p "${PKG_NAME}"
export PRIV_DIR="$(pwd)/_build/${MIX_ENV}/lib/evision/priv"
mv "${PRIV_DIR}/include" /tmp/include
cp -a "${PRIV_DIR}" "${PKG_NAME}"
cp -a lib/generated "${PKG_NAME}/elixir_generated"
cp -a src/generated "${PKG_NAME}/erlang_generated"
tar -czf "${PKG_NAME}.tar.gz" "${PKG_NAME}"
rm -rf "${PKG_NAME}"
ls -lah "${PKG_NAME}.tar.gz"
mkdir -p artifacts
mv "${PKG_NAME}.tar.gz" artifacts
cd artifacts
sha256sum "${PKG_NAME}.tar.gz" | tee "${PKG_NAME}.tar.gz.sha256"
mv /tmp/include "${PRIV_DIR}/include"
- name: Upload precompiled library
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*.tar.gz
artifacts/*.sha256