diff --git a/.github/tools/linux-arm64-install-cuda.sh b/.github/tools/linux-arm64-install-cuda.sh new file mode 100755 index 0000000..f47a782 --- /dev/null +++ b/.github/tools/linux-arm64-install-cuda.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +if [ -z "${CUDA}" ]; then + echo "CUDA variable empty" + exit 1 +fi + +OS=$(lsb_release -r | cut -f 2 | tr -d .) +sudo wget -qO /etc/apt/preferences.d/cuda-repository-pin-600 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${OS}/sbsa/cuda-ubuntu${OS}.pin +sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu${OS}/sbsa/7fa2af80.pub +sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu${OS}/sbsa/ /" + +sudo apt update +sudo apt install -y cuda-toolkit-${CUDA/./-} diff --git a/.github/tools/linux-arm64-install-vulkan.sh b/.github/tools/linux-arm64-install-vulkan.sh new file mode 100755 index 0000000..e5310e3 --- /dev/null +++ b/.github/tools/linux-arm64-install-vulkan.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +OS=$(lsb_release -c | cut -f 2) + +sudo apt update + +sudo apt install libvulkan-dev +sudo apt install glslang-dev +sudo apt install spirv-tools +sudo apt remove libllvm12 + +VULKAN_VERSION=$(dpkg -s vulkan-sdk | awk '/^Version:/ {split($2, a, /\./); printf "%d.%d.%d", a[1], a[2], a[3]}') +echo "VULKAN_VERSION=$VULKAN_VERSION" >> $GITHUB_ENV diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4966d9f..594154e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -230,7 +230,7 @@ jobs: path: ${{ env.VULKAN_ROOT_LOCATION }}/macOS/lib/libvulkan.1.dylib macos-m1: - runs-on: self-hosted + runs-on: [self-hosted, macos] steps: - uses: actions/checkout@v2 @@ -307,9 +307,60 @@ jobs: name: macos-m1 path: ${{ env.VULKAN_ROOT_LOCATION }}/macOS/lib/libvulkan.1.dylib + linux-arm64: + runs-on: [self-hosted, linux] + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - run: cmake -DSPACEMESH_ARCH_ARM64=ON . + + - run: make + + - name: Copy library + run: cp src/libgpu-setup.so test/libgpu-setup.so + + - name: Unit tests - Golden vectors + run: test/gpu-setup-test --test-vector-check + + - name: Unit tests - hash and bitstream + run: test/gpu-setup-test --unit-tests + + - name: Unit tests - PoW + run: test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202 + + - name: Unit tests - label lengths + run: test/gpu-setup-test -il + + - name: Unit tests - labels count + run: test/gpu-setup-test -in + + - name: Integration tests - concurrency test + run: test/gpu-setup-test -ip + + - name: Integration tests - cancelation test + run: test/gpu-setup-test -ic + + - uses: actions/upload-artifact@v2 + with: + name: linux-arm64 + path: src/libgpu-setup.so + + - uses: actions/upload-artifact@v2 + with: + name: linux-arm64 + path: test/gpu-setup-test + + - uses: actions/upload-artifact@v2 + with: + name: linux-arm64 + path: include/api.h + release: runs-on: ubuntu-latest - needs: [linux, windows, macos, macos-m1] + needs: [linux, windows, macos, macos-m1, linux-arm64] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} if: startsWith(github.ref, 'refs/tags/v') @@ -360,6 +411,9 @@ jobs: - name: Archive MacOS-M1 Library run: zip --junk-paths libgpu-setup-macos-m1-${{ env.VERSION }}.zip macos-m1/* + - name: Archive Linux ARM64 Library + run: zip --junk-paths libgpu-setup-linux-arm64-${{ env.VERSION }}.zip linux-arm64/* + - name: Release uses: softprops/action-gh-release@v1 with: @@ -369,5 +423,6 @@ jobs: libgpu-setup-windows-${{ env.VERSION }}.zip libgpu-setup-macos-${{ env.VERSION }}.zip libgpu-setup-macos-m1-${{ env.VERSION }}.zip + libgpu-setup-linux-arm64-${{ env.VERSION }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/vulkan/gen/CMakeLists.txt b/src/vulkan/gen/CMakeLists.txt index 4ac035a..c1a9676 100644 --- a/src/vulkan/gen/CMakeLists.txt +++ b/src/vulkan/gen/CMakeLists.txt @@ -30,7 +30,11 @@ if(WIN32) elseif(APPLE) target_link_libraries(shaders-gen -L$ENV{VULKAN_SDK}/lib -lvulkan shaderc_combined) elseif(UNIX) - target_link_libraries(shaders-gen -L$ENV{VULKAN_SDK}/lib -lvulkan shaderc_combined) + if (SPACEMESH_ARCH_ARM64) + target_link_libraries(shaders-gen vulkan glslang OSDependent OGLCompiler HLSL SPIRV SPIRV-Tools SPIRV-Tools-opt) + else() + target_link_libraries(shaders-gen -L$ENV{VULKAN_SDK}/lib -lvulkan shaderc_combined) + endif() endif() target_link_libraries(shaders-gen zlibstatic)