From f33a72b150a040c5157f65e3777ff7b87ea1dade Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 11 Dec 2023 17:35:56 +0700 Subject: [PATCH 1/2] feat(ci): Add packaging job for cudard runtime --- .github/workflows/build.yml | 70 +++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 477df5f92..4a843b795 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -296,7 +296,7 @@ jobs: strategy: matrix: include: - - build: 'normal' + - build: 'openblas' defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"' steps: @@ -315,6 +315,18 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Download OpenBLAS + id: get_openblas + if: ${{ matrix.build == 'openblas' }} + run: | + curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip" + curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE" + mkdir $env:RUNNER_TEMP/openblas + tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas + $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath) + $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim())) + $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe') + & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll - name: actions-setup-cmake uses: jwlawson/actions-setup-cmake@v1.14.1 @@ -327,7 +339,7 @@ jobs: cmake --build ./build_deps/nitro_deps --config Release mkdir -p build cd build - cmake .. + cmake .. ${{ matrix.defines }} cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - name: Pack artifacts @@ -371,11 +383,6 @@ jobs: permissions: contents: write - strategy: - matrix: - cuda: ['12.2.0'] - build: ['cublas'] - steps: - name: Clone id: checkout @@ -390,7 +397,7 @@ jobs: silent: true env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - + - uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' @@ -403,7 +410,7 @@ jobs: cmake --build ./build_deps/nitro_deps --config Release mkdir -p build cd build - cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON + cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=ON cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - name: Pack artifacts @@ -439,11 +446,52 @@ jobs: upload_url: ${{ needs.create-draft-release.outputs.upload_url }} asset_path: ./nitro.tar.gz asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-cuda.tar.gz - asset_content_type: application/gzip + asset_content_type: application/gzip + + windows-amd64-cuda-package: + runs-on: windows-latest + needs: create-draft-release + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') + permissions: + contents: write + + strategy: + matrix: + cuda: ['12.2.0', '11.7.1'] + build: ['cublas'] + + steps: + - uses: Jimver/cuda-toolkit@v0.2.11 + id: cuda-toolkit + with: + cuda: ${{ matrix.cuda }} + method: 'network' + sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' + + - name: Copy and Pack CUDA runtime + id: pack_artifacts + shell: cmd + run: | + echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}" + mkdir -p build + $dst='.\build\' + robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll + 7z a -ttar temp.tar $dst\* + 7z a -tgzip cudart.tar.gz temp.tar + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./cudart.tar.gz + asset_name: cudart-bin-win-cu${{ matrix.cuda }}-x64.tar.gz + asset_content_type: application/gzip update_release_draft: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - needs: [ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] + needs: [ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build, windows-amd64-cuda-package] permissions: contents: write pull-requests: write From 80d9ffd0aa8dd7df7434875dbf8b285b84860d8a Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 11 Dec 2023 22:15:14 +0700 Subject: [PATCH 2/2] fix: CI update windows build --- .github/workflows/build.yml | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a843b795..29a1720a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -288,17 +288,6 @@ jobs: permissions: contents: write - env: - OPENBLAS_VERSION: 0.3.23 - OPENCL_VERSION: 2023.04.17 - CLBLAST_VERSION: 1.6.0 - - strategy: - matrix: - include: - - build: 'openblas' - defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"' - steps: - name: Clone @@ -315,19 +304,6 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Download OpenBLAS - id: get_openblas - if: ${{ matrix.build == 'openblas' }} - run: | - curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip" - curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE" - mkdir $env:RUNNER_TEMP/openblas - tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas - $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath) - $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim())) - $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe') - & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll - - name: actions-setup-cmake uses: jwlawson/actions-setup-cmake@v1.14.1 @@ -339,15 +315,15 @@ jobs: cmake --build ./build_deps/nitro_deps --config Release mkdir -p build cd build - cmake .. ${{ matrix.defines }} + cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - name: Pack artifacts id: pack_artifacts shell: cmd run: | - robocopy build_deps\_install\bin .\build\Release zlib.dll - robocopy build\bin\Release .\build\Release llama.dll + robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll + robocopy build\bin\Release\ .\build\Release\ llama.dll dotnet tool install --global AzureSignTool azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" 7z a -ttar temp.tar .\build\Release\* @@ -418,8 +394,8 @@ jobs: shell: cmd run: | set PATH=%PATH%;C:\Program Files\7-Zip\ - robocopy build_deps\_install\bin .\build\Release zlib.dll - robocopy build\bin\Release .\build\Release llama.dll + robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll + robocopy build\bin\Release\ .\build\Release\ llama.dll dotnet tool install --global AzureSignTool %USERPROFILE%\.dotnet\tools\azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" 7z a -ttar temp.tar .\build\Release\*