From f873bd0262eb7a88ec891fc167cf6eb5604798bd Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 3 Jul 2024 12:17:06 +0100 Subject: [PATCH] fix x86_64-linux-gnu-cuda ci --- .../linux-precompile-x86_64-cuda-gnu.yml | 79 +++++++------------ 1 file changed, 28 insertions(+), 51 deletions(-) diff --git a/.github/workflows/linux-precompile-x86_64-cuda-gnu.yml b/.github/workflows/linux-precompile-x86_64-cuda-gnu.yml index b0996fa3..577463c4 100644 --- a/.github/workflows/linux-precompile-x86_64-cuda-gnu.yml +++ b/.github/workflows/linux-precompile-x86_64-cuda-gnu.yml @@ -16,30 +16,26 @@ jobs: fail-fast: false matrix: include: - - container: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 + - container: nvidia/cuda:11.8.0-devel-ubuntu20.04 cuda_ver: "11.8.0" cuda_id: "11" cudnn_id: "8" - OTP_VERSION: "25" - NIF_VERSION: "2.16" - - container: nvidia/cuda:12.5.0-cudnn8-devel-ubuntu20.04 - cuda_ver: "12.1.0" + 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" - OTP_VERSION: "25" - NIF_VERSION: "2.16" - - container: nvidia/cuda:11.8.0-cudnn9-devel-ubuntu20.04 + 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" - OTP_VERSION: "25" - NIF_VERSION: "2.16" - - container: nvidia/cuda:12.5.0-cudnn9-devel-ubuntu20.04 - cuda_ver: "12.1.0" + 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" - OTP_VERSION: "25" - NIF_VERSION: "2.16" + 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: @@ -54,6 +50,8 @@ jobs: 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" @@ -74,14 +72,27 @@ jobs: - uses: erlef/setup-beam@v1 with: - otp-version: ${{ matrix.OTP_VERSION }} + 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 + 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 + - name: Cache mix packages id: cache-mix-deps uses: actions/cache@v4 with: - key: deps-${{ hashFiles('mix.lock') }}-${{ matrix.OTP_VERSION }}-${{ env.ELIXIR_VERSION }} + key: deps-${{ hashFiles('mix.lock') }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }} path: | ./deps @@ -116,7 +127,7 @@ jobs: - name: Create precompiled library run: | - export PKG_NAME=evision-nif_${{ matrix.NIF_VERSION }}-x86_64-linux-gnu-contrib-cuda${{ matrix.cuda_id }}-cudnn${{ matrix.cudnn_id }}-${GITHUB_REF##*/v} + 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" @@ -139,37 +150,3 @@ jobs: files: | artifacts/*.tar.gz artifacts/*.sha256 - - - name: Mix Compile for Gleam (experimental) - run: | - export GLEAM_EVISION=true - rm -f _build/${{ env.MIX_ENV }}/lib/evision/priv/evision.so - mix compile - - - name: Create precompiled library for gleam (experimental) - run: | - export PKG_NAME=gleam_evision-nif_${{ matrix.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 gleam_src "${PKG_NAME}/gleam_generated" - cp -a src/evision_highgui.erl "${PKG_NAME}/gleam_generated/" - cp -a src/evision_internal_structurise.erl "${PKG_NAME}/gleam_generated/" - cp -a src/evision_windows_fix.erl "${PKG_NAME}/gleam_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 for gleam (experimental) - uses: softprops/action-gh-release@v2 - with: - files: | - artifacts/gleam_evision*.tar.gz - artifacts/gleam_evision*.sha256