fix zig #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |