From f6286b0573a14a0ecbda4bb639af85855c2e6cfb Mon Sep 17 00:00:00 2001 From: Cocoa Date: Wed, 3 Jul 2024 03:19:12 +0100 Subject: [PATCH] build aarch64-linux-gnu-cuda with self-hosted-aarch64-linux-gnu --- .../linux-precompile-aarch64-cuda-gnu.yml | 114 ++---------------- 1 file changed, 12 insertions(+), 102 deletions(-) diff --git a/.github/workflows/linux-precompile-aarch64-cuda-gnu.yml b/.github/workflows/linux-precompile-aarch64-cuda-gnu.yml index da55d481..2657e5ae 100644 --- a/.github/workflows/linux-precompile-aarch64-cuda-gnu.yml +++ b/.github/workflows/linux-precompile-aarch64-cuda-gnu.yml @@ -13,124 +13,34 @@ jobs: aarch64-linux-gnu-cuda: runs-on: ${{ matrix.pair.runner }} env: - OPENCV_VER: "4.10.0" - MIX_ENV: prod - ELIXIR_VERSION: "1.16" - OTP_VERSION: "25" - NIF_VERSION: "2.16" - EVISION_PREFER_PRECOMPILED: "false" - EVISION_GENERATE_LANG: "erlang,elixir" - EVISION_ENABLE_CUDA: "true" - EVISION_ENABLE_CONTRIB: "true" + OTP_VERSION: "25.3.2.12" + ELIXIR_VERSION: "1.16.1" + TRIPLET: "aarch64-linux-gnu" strategy: fail-fast: false matrix: include: - pair: arch: aarch64-linux-gnu - cmake_toolchain_file: "cc_toolchain/aarch64-linux-gnu.cmake" - c_compiler: aarch64-linux-gnu-gcc - cpp_compiler: aarch64-linux-gnu-g++ - runner: ubuntu-22.04 + runner: self-hosted-aarch64-linux-gnu cuda_id: "12" cudnn_id: "9" - cuda_local_installer: "https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda-repo-cross-aarch64-ubuntu2204-12-5-local_12.5.1-1_all.deb" - cudnn_local_installer: "https://developer.download.nvidia.com/compute/cudnn/9.2.0/local_installers/cudnn-local-repo-cross-aarch64-ubuntu2204-9.2.0_1.0-1_all.deb" + cuda_pin: "https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/sbsa/cuda-ubuntu2004.pin" + cuda_deb: "https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda-repo-ubuntu2004-12-5-local_12.5.1-555.42.06-1_arm64.deb" + cuda_toolkit: "cuda-toolkit-12-5" + cudnn_deb: "https://developer.download.nvidia.com/compute/cudnn/9.2.0/local_installers/cudnn-local-repo-ubuntu2004-9.2.0_1.0-1_arm64.deb" + cudnn_package: "cudnn-cuda-12" name: aarch64-linux-gnu-cuda${{ matrix.pair.cuda_id }}-cudnn${{ matrix.pair.cudnn_id }} steps: - name: Checkout uses: actions/checkout@v4 - - uses: erlef/setup-beam@v1 - with: - otp-version: ${{ env.OTP_VERSION }} - elixir-version: ${{ env.ELIXIR_VERSION }} - - - name: Download CUDA and cudnn Installer for Linux Ubuntu aarch64-jetson - run: | - curl -fSL "${{ matrix.pair.cuda_local_installer }}" -o cuda-repo-cross-aarch64-all.deb - sudo dpkg -i cuda-repo-cross-aarch64-all.deb - sudo cp /var/cuda-repo-cross-aarch64*/cuda-*-keyring.gpg /usr/share/keyrings/ - sudo apt-get update -q - sudo apt-get -y install cuda-cross-aarch64 - sudo rm -rf cuda-repo-cross-aarch64-all.deb - - curl -fSL "${{ matrix.pair.cudnn_local_installer }}" -o cudnn-local-repo-cross-aarch64-all.deb - sudo dpkg -i cudnn-local-repo-cross-aarch64-all.deb - sudo cp /var/cudnn-local-repo-cross-aarch64-*/cudnn-*-keyring.gpg /usr/share/keyrings/ - sudo apt-get update -q - sudo apt-get -y install cudnn-cross-aarch64 - sudo rm -rf cudnn-local-repo-cross-aarch64-all.deb - - - name: Install system dependencies - run: | - sudo apt-get update -q - sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip curl git gzip python3 ca-certificates libncurses5-dev libssl-dev libeigen3-dev - - - name: Cache mix packages - id: cache-mix-deps - uses: actions/cache@v4 - with: - key: deps-${{ hashFiles('mix.lock') }}-${{ matrix.pair.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 source code - id: cache-opencv - uses: actions/cache@v4 - with: - key: opencv-with-contrib-${{ env.OPENCV_VER }} - path: | - ./3rd_party - - - name: Download OpenCV source code - 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 (with contrib modules) - run: | - if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then - export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}" - fi - rm -rf "./_build/${{ env.MIX_ENV }}/lib/evision" - mix compile_opencv - - name: Mix compile (with contrib modules) run: | - if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then - export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}" - fi - rm -f _build/${MIX_ENV}/lib/evision/priv/evision.so - rm -rf lib/generated && rm -rf src/generated - mkdir -p lib/generated && mkdir -p src/generated - mix compile - - - name: Create precompiled library (with contrib modules) - run: | - export PKG_NAME=evision-nif_${{ matrix.pair.NIF_VERSION }}-${{ matrix.pair.arch }}-contrib-cuda${{ matrix.pair.cuda_id }}-cudnn${{ matrix.pair.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" + cp .github/scripts/*.sh . + chmod +x *.sh + ./script-to-build-gnu.sh "${{ matrix.pair.cuda_pin }}" "${{ matrix.pair.cuda_deb }}" "${{ matrix.pair.cuda_toolkit }}" "${{ matrix.pair.cuda_id }}" "${{ matrix.pair.cudnn_deb }}" "${{ matrix.pair.cudnn_package }}" "${{ matrix.pair.cudnn_id }}" "${{ env.OTP_VERSION }}" "${{ env.ELIXIR_VERSION }}" "${{ env.TRIPLET }}" "${GITHUB_REF}" - uses: softprops/action-gh-release@v2 with: