From 46a1a5d2b024bab95ce4e44a0653c2c1f44faefe Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 3 Jan 2024 17:17:31 +0700 Subject: [PATCH 01/10] Add build nitro multi cuda version on windows and linux --- .github/workflows/build.yml | 644 +++++++++++++++++++----------------- 1 file changed, 332 insertions(+), 312 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1beca90c7..929b66ccc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,7 +86,7 @@ jobs: echo "Version: $NEW_VERSION" ubuntu-amd64-build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' permissions: @@ -145,12 +145,21 @@ jobs: asset_content_type: application/gzip ubuntu-amd64-cuda-build: - runs-on: linux-gpu + runs-on: ubuntu-20.04 needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' permissions: contents: write + strategy: + matrix: + cuda: ['12.0.1', '11.4.4'] + steps: + - uses: Jimver/cuda-toolkit@v0.2.11 + id: cuda-toolkit + with: + cuda: ${{ matrix.cuda }} + method: 'network' - name: Clone id: checkout uses: actions/checkout@v3 @@ -183,225 +192,236 @@ jobs: uses: actions/upload-artifact@v2 if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' with: - name: nitro-linux-amd64-cuda + name: nitro-linux-amd64-cuda-${{ matrix.cuda }} path: ./nitro - - name: Run e2e testing - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} + # - name: Run e2e testing + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + # 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: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-cuda.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-cuda-${{ matrix.cuda }}.tar.gz asset_content_type: application/gzip - macOS-M-build: - runs-on: mac-silicon - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Dependencies - id: depends - continue-on-error: true - run: | - brew update - brew install cmake - - - name: Build - id: cmake_build - run: | - ./install_deps.sh - mkdir build && cd build - cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - CC=gcc-8 make -j $(sysctl -n hw.ncp) - ls -la + # macOS-M-build: + # runs-on: mac-silicon + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # permissions: + # contents: write + # steps: + # - name: Clone + # id: checkout + # uses: actions/checkout@v3 + # with: + # submodules: recursive + + # - name: Dependencies + # id: depends + # continue-on-error: true + # run: | + # brew update + # brew install cmake + + # - name: Build + # id: cmake_build + # run: | + # ./install_deps.sh + # mkdir build && cd build + # cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + # CC=gcc-8 make -j $(sysctl -n hw.ncp) + # ls -la - - name: Package - shell: bash - run: | - mkdir -p nitro - cp llama.cpp/ggml-metal.metal nitro/ - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - name: nitro-mac-arm64 - path: ./nitro - - - name: Run e2e testing - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} - - - 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: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-arm64.tar.gz - asset_content_type: application/gzip - - macOS-Intel-build: - runs-on: macos-latest - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Dependencies - id: depends - continue-on-error: true - run: | - brew update - - - name: Build - id: cmake_build - run: | - ./install_deps.sh - mkdir build && cd build - cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_METAL=OFF .. - CC=gcc-8 make -j $(sysctl -n hw.ncp) - ls -la + # - name: Package + # shell: bash + # run: | + # mkdir -p nitro + # cp llama.cpp/ggml-metal.metal nitro/ + # cp build/nitro nitro/ + # tar -czvf nitro.tar.gz nitro + + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + # with: + # name: nitro-mac-arm64 + # path: ./nitro + + # - name: Run e2e testing + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} + + # - 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: ./nitro.tar.gz + # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-arm64.tar.gz + # asset_content_type: application/gzip + + # macOS-Intel-build: + # runs-on: macos-latest + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # permissions: + # contents: write + # steps: + # - name: Clone + # id: checkout + # uses: actions/checkout@v3 + # with: + # submodules: recursive + + # - name: Dependencies + # id: depends + # continue-on-error: true + # run: | + # brew update + + # - name: Build + # id: cmake_build + # run: | + # ./install_deps.sh + # mkdir build && cd build + # cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_METAL=OFF .. + # CC=gcc-8 make -j $(sysctl -n hw.ncp) + # ls -la - - name: Package - shell: bash - run: | - mkdir -p nitro - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - name: nitro-mac-amd64 - path: ./nitro - - - name: Run e2e testing - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} - - - 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: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64.tar.gz - asset_content_type: application/gzip - - windows-amd64-build: - runs-on: windows-latest - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - - steps: - - name: Clone + # - name: Package + # shell: bash + # run: | + # mkdir -p nitro + # cp build/nitro nitro/ + # tar -czvf nitro.tar.gz nitro + + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + # with: + # name: nitro-mac-amd64 + # path: ./nitro + + # - name: Run e2e testing + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} + + # - 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: ./nitro.tar.gz + # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64.tar.gz + # asset_content_type: application/gzip + + # windows-amd64-build: + # runs-on: windows-latest + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # permissions: + # contents: write + + # steps: + # - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup VSWhere.exe - uses: warrenbuckley/Setup-VSWhere@v1 - with: - version: latest - silent: true - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true + # id: checkout + # uses: actions/checkout@v3 + # with: + # submodules: recursive + + # - name: Setup VSWhere.exe + # uses: warrenbuckley/Setup-VSWhere@v1 + # with: + # version: latest + # silent: true + # env: + # ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: actions-setup-cmake - uses: jwlawson/actions-setup-cmake@v1.14.1 - - - name: Build - id: cmake_build - shell: cmd - run: | - cmake -S ./nitro_deps -B ./build_deps/nitro_deps - cmake --build ./build_deps/nitro_deps --config Release - mkdir -p build - cd build - cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} - 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 - 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\* - 7z a -tgzip nitro.tar.gz temp.tar - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - name: nitro-win-amd64 - path: ./build/Release - - - name: Run e2e testing - shell: cmd - run: | - cd .\build\Release - ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} - - - 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: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64.tar.gz - asset_content_type: application/gzip + # - name: actions-setup-cmake + # uses: jwlawson/actions-setup-cmake@v1.14.1 + + # - name: Build + # id: cmake_build + # shell: cmd + # run: | + # cmake -S ./nitro_deps -B ./build_deps/nitro_deps + # cmake --build ./build_deps/nitro_deps --config Release + # mkdir -p build + # cd build + # cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} + # 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 + # 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\* + # 7z a -tgzip nitro.tar.gz temp.tar + + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + # with: + # name: nitro-win-amd64 + # path: ./build/Release + + # - name: Run e2e testing + # shell: cmd + # run: | + # cd .\build\Release + # ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} + + # - 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: ./nitro.tar.gz + # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64.tar.gz + # asset_content_type: application/gzip windows-amd64-cuda-build: - runs-on: windows-nvidia + runs-on: windows-latest needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' permissions: contents: write + strategy: + matrix: + cuda: ['12.0.1', '11.4.4'] + 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: Clone id: checkout uses: actions/checkout@v3 @@ -445,16 +465,16 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' with: - name: nitro-win-amd64-cuda + name: nitro-win-amd64-cuda-${{ matrix.cuda }} path: ./build/Release - - name: run e2e testing - shell: cmd - run: | - cd .\build\Release - ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} + # - name: run e2e testing + # shell: cmd + # run: | + # cd .\build\Release + # ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -463,114 +483,114 @@ jobs: with: 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_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-cuda-${{ matrix.cuda }}.tar.gz asset_content_type: application/gzip - windows-amd64-cuda-package: - runs-on: windows-latest - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write + # windows-amd64-cuda-package: + # runs-on: windows-latest + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # 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 + # 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, windows-amd64-cuda-package] - permissions: - contents: write - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - noti-discord-nightly: - if: always() && github.event_name == 'schedule' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-M-build.result == 'success' && needs.macOS-Intel-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' - needs: [create-draft-release, ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: "0" - token: ${{ secrets.PAT_SERVICE_ACCOUNT }} - - name: Notify Discord - uses: Ilshidur/action-discord@master - with: - args: "Nightly build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - - name: Update README.md with artifact URL - run: | - sed -i "s|||" README.md - git config --global user.email "service@jan.ai" - git config --global user.name "Service Account" - git add README.md - git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" - git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main - env: - GITHUB_RUN_ID: ${{ github.run_id }} - - noti-discord-manual: - if: always() && github.event_name == 'workflow_dispatch' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-M-build.result == 'success' && needs.macOS-Intel-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' - needs: [create-draft-release, ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: "0" - token: ${{ secrets.PAT_SERVICE_ACCOUNT }} - - name: Notify Discord - uses: Ilshidur/action-discord@master - with: - args: "Manual build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - # Update README.md with artifact URL if manual build from main branch - - name: Update README.md with artifact URL - if: github.ref == 'refs/heads/main' - run: | - sed -i "s|||" README.md - git config --global user.email "service@jan.ai" - git config --global user.name "Service Account" - git add README.md - git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" - git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main - env: - GITHUB_RUN_ID: ${{ github.run_id }} \ No newline at end of file + # 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, windows-amd64-cuda-package] + # permissions: + # contents: write + # pull-requests: write + # runs-on: ubuntu-latest + # steps: + # - uses: release-drafter/release-drafter@v5 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # noti-discord-nightly: + # if: always() && github.event_name == 'schedule' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-M-build.result == 'success' && needs.macOS-Intel-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' + # needs: [create-draft-release, ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] + # runs-on: ubuntu-latest + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + # with: + # fetch-depth: "0" + # token: ${{ secrets.PAT_SERVICE_ACCOUNT }} + # - name: Notify Discord + # uses: Ilshidur/action-discord@master + # with: + # args: "Nightly build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" + # env: + # DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + # - name: Update README.md with artifact URL + # run: | + # sed -i "s|||" README.md + # git config --global user.email "service@jan.ai" + # git config --global user.name "Service Account" + # git add README.md + # git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" + # git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main + # env: + # GITHUB_RUN_ID: ${{ github.run_id }} + + # noti-discord-manual: + # if: always() && github.event_name == 'workflow_dispatch' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-M-build.result == 'success' && needs.macOS-Intel-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' + # needs: [create-draft-release, ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] + # runs-on: ubuntu-latest + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + # with: + # fetch-depth: "0" + # token: ${{ secrets.PAT_SERVICE_ACCOUNT }} + # - name: Notify Discord + # uses: Ilshidur/action-discord@master + # with: + # args: "Manual build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" + # env: + # DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + # # Update README.md with artifact URL if manual build from main branch + # - name: Update README.md with artifact URL + # if: github.ref == 'refs/heads/main' + # run: | + # sed -i "s|||" README.md + # git config --global user.email "service@jan.ai" + # git config --global user.name "Service Account" + # git add README.md + # git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" + # git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main + # env: + # GITHUB_RUN_ID: ${{ github.run_id }} \ No newline at end of file From 781afe94d3e55d24037136e3e5200e2cbf46a48c Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 3 Jan 2024 18:11:36 +0700 Subject: [PATCH 02/10] check github runner glibc version --- .github/workflows/build.yml | 56 +++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 929b66ccc..c701853c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,7 @@ jobs: - name: Get latest release id: version_update run: | + ldd --version if [[ ${{ github.event_name }} == push && ${{ github.ref }} == refs/tags/* ]]; then echo "VERSION=${GITHUB_REF#refs/tags/}" NEW_VERSION="${VERSION#v}" @@ -107,6 +108,7 @@ jobs: - name: Build id: make_build run: | + ldd --version ./install_deps.sh mkdir build && cd build cmake -DDEBUG=ON -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. @@ -134,15 +136,15 @@ jobs: cd nitro chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} - - 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: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64.tar.gz - asset_content_type: application/gzip + # - 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: ./nitro.tar.gz + # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64.tar.gz + # asset_content_type: application/gzip ubuntu-amd64-cuda-build: runs-on: ubuntu-20.04 @@ -202,15 +204,15 @@ jobs: # cd nitro # chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} - - 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: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-cuda-${{ matrix.cuda }}.tar.gz - asset_content_type: application/gzip + # - 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: ./nitro.tar.gz + # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-cuda-${{ matrix.cuda }}.tar.gz + # asset_content_type: application/gzip # macOS-M-build: # runs-on: mac-silicon @@ -476,15 +478,15 @@ jobs: # cd .\build\Release # ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} - - 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: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-cuda-${{ matrix.cuda }}.tar.gz - asset_content_type: application/gzip + # - 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: ./nitro.tar.gz + # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-cuda-${{ matrix.cuda }}.tar.gz + # asset_content_type: application/gzip # windows-amd64-cuda-package: # runs-on: windows-latest From 8515b97fa01d3db007500e39092602db971df2c6 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 3 Jan 2024 21:17:09 +0700 Subject: [PATCH 03/10] Add dockerfile for windows container runner --- ...ctions-runner-windows-cuda-11-4.dockerfile | 51 +++++ ...ctions-runner-windows-cuda-12-0.dockerfile | 51 +++++ .github/runners/runner.ps1 | 2 + .github/workflows/build.yml | 208 +++++++++--------- 4 files changed, 213 insertions(+), 99 deletions(-) create mode 100644 .github/runners/actions-runner-windows-cuda-11-4.dockerfile create mode 100644 .github/runners/actions-runner-windows-cuda-12-0.dockerfile create mode 100644 .github/runners/runner.ps1 diff --git a/.github/runners/actions-runner-windows-cuda-11-4.dockerfile b/.github/runners/actions-runner-windows-cuda-11-4.dockerfile new file mode 100644 index 000000000..d25b14890 --- /dev/null +++ b/.github/runners/actions-runner-windows-cuda-11-4.dockerfile @@ -0,0 +1,51 @@ +FROM mcr.microsoft.com/windows/server:ltsc2022 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"] + +ARG RUNNER_VERSION=2.298.2 + +RUN Invoke-WebRequest \ + -Uri 'https://aka.ms/install-powershell.ps1' \ + -OutFile install-powershell.ps1; \ + powershell -ExecutionPolicy Unrestricted -File ./install-powershell.ps1 -AddToPath + +RUN Invoke-WebRequest \ + -Uri https://github.com/actions/runner/releases/download/v$env:RUNNER_VERSION/actions-runner-win-x64-$env:RUNNER_VERSION.zip \ + -OutFile runner.zip; \ + Expand-Archive -Path C:/runner.zip -DestinationPath C:/actions-runner; \ + Remove-Item -Path C:\runner.zip; \ + setx /M PATH $(${Env:PATH} + \";${Env:ProgramFiles}\Git\bin\") + +# Install Chocolatey +RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \ + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + +# Upgrade Git +RUN choco install git -y; \ + git --version + +# Install 7zip +RUN choco install 7zip -y; \ + 7z --help + +# Install cmake and add to path +RUN choco install cmake.install -y --installargs '"ADD_CMAKE_TO_PATH=System"' + +RUN cmake --version + +# Install MSBuild and add to path +RUN choco install visualstudio2022buildtools -y --package-parameters '"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.Component.VC.14.29.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.MFC --add Microsoft.VisualStudio.Component.VC.14.29.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VCRedist.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VSTools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.ASAN --add Microsoft.VisualStudio.Component.VC.14.29.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.VC.FxCop --add Microsoft.VisualStudio.Component.VC.14.29.VC.MFC --add Microsoft.VisualStudio.Component.VC.14.29.VC.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.VCUnitTest --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VisualStudioCppSDK --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win10 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.LegacyBuildTools --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.DiagnosticTools --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.VC.Llvm.Cmake --add Microsoft.VisualStudio.Component.VC.Llvm.Llvm --add Microsoft.VisualStudio.Component.VC.Llvm.Toolset --add Microsoft.VisualStudio.Component.VC.MFC --add Microsoft.VisualStudio.Component.VC.MSBuild --add Microsoft.VisualStudio"' + +RUN choco install gzip -y; + +# Install cuda toolkit 12.0.4 +RUN choco install cuda --version=11.4.2.47141 -y + +# Copy integrated tools to MSBuild +RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations' +RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations' + + +ADD runner.ps1 C:/runner.ps1 +CMD ["pwsh", "-ExecutionPolicy", "Unrestricted", "-File", ".\\runner.ps1"] \ No newline at end of file diff --git a/.github/runners/actions-runner-windows-cuda-12-0.dockerfile b/.github/runners/actions-runner-windows-cuda-12-0.dockerfile new file mode 100644 index 000000000..7f55c8bad --- /dev/null +++ b/.github/runners/actions-runner-windows-cuda-12-0.dockerfile @@ -0,0 +1,51 @@ +FROM mcr.microsoft.com/windows/server:ltsc2022 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"] + +ARG RUNNER_VERSION=2.298.2 + +RUN Invoke-WebRequest \ + -Uri 'https://aka.ms/install-powershell.ps1' \ + -OutFile install-powershell.ps1; \ + powershell -ExecutionPolicy Unrestricted -File ./install-powershell.ps1 -AddToPath + +RUN Invoke-WebRequest \ + -Uri https://github.com/actions/runner/releases/download/v$env:RUNNER_VERSION/actions-runner-win-x64-$env:RUNNER_VERSION.zip \ + -OutFile runner.zip; \ + Expand-Archive -Path C:/runner.zip -DestinationPath C:/actions-runner; \ + Remove-Item -Path C:\runner.zip; \ + setx /M PATH $(${Env:PATH} + \";${Env:ProgramFiles}\Git\bin\") + +# Install Chocolatey +RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \ + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + +# Upgrade Git +RUN choco install git -y; \ + git --version + +# Install 7zip +RUN choco install 7zip -y; \ + 7z --help + +# Install cmake and add to path +RUN choco install cmake.install -y --installargs '"ADD_CMAKE_TO_PATH=System"' + +RUN cmake --version + +# Install MSBuild and add to path +RUN choco install visualstudio2022buildtools -y --package-parameters '"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.Component.VC.14.29.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.MFC --add Microsoft.VisualStudio.Component.VC.14.29.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VCRedist.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VSTools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.ASAN --add Microsoft.VisualStudio.Component.VC.14.29.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.VC.FxCop --add Microsoft.VisualStudio.Component.VC.14.29.VC.MFC --add Microsoft.VisualStudio.Component.VC.14.29.VC.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.VCUnitTest --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VisualStudioCppSDK --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win10 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.LegacyBuildTools --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.DiagnosticTools --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.VC.Llvm.Cmake --add Microsoft.VisualStudio.Component.VC.Llvm.Llvm --add Microsoft.VisualStudio.Component.VC.Llvm.Toolset --add Microsoft.VisualStudio.Component.VC.MFC --add Microsoft.VisualStudio.Component.VC.MSBuild --add Microsoft.VisualStudio"' + +RUN choco install gzip -y; + +# Install cuda toolkit 12.0.4 +RUN choco install cuda --version=12.0.1.52833 -y + +# Copy integrated tools to MSBuild +RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations' +RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations' + + +ADD runner.ps1 C:/runner.ps1 +CMD ["pwsh", "-ExecutionPolicy", "Unrestricted", "-File", ".\\runner.ps1"] \ No newline at end of file diff --git a/.github/runners/runner.ps1 b/.github/runners/runner.ps1 new file mode 100644 index 000000000..e5aa5af30 --- /dev/null +++ b/.github/runners/runner.ps1 @@ -0,0 +1,2 @@ +.\actions-runner\config.cmd --unattended --replace --url https://github.com/${env:RUNNER_REPO} --token $env:RUNNER_TOKEN --runnergroup $env:RUNNER_GROUP --labels $env:RUNNER_LABEL --name $env:RUNNER_NAME --work $env:RUNNER_WORKDIR; +.\actions-runner\run.cmd; \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c701853c9..46b181867 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,55 +86,55 @@ jobs: fi echo "Version: $NEW_VERSION" - ubuntu-amd64-build: - runs-on: ubuntu-20.04 - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive + # ubuntu-amd64-build: + # runs-on: ubuntu-20.04 + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # permissions: + # contents: write + # steps: + # - name: Clone + # id: checkout + # uses: actions/checkout@v3 + # with: + # submodules: recursive - # - name: Dependencies - # id: depends - # run: | - # sudo apt-get update - # sudo apt-get install build-essential gcc-8 + # # - name: Dependencies + # # id: depends + # # run: | + # # sudo apt-get update + # # sudo apt-get install build-essential gcc-8 - - name: Build - id: make_build - run: | - ldd --version - ./install_deps.sh - mkdir build && cd build - cmake -DDEBUG=ON -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - CC=gcc-8 make -j $(nproc) - ls -la - - - name: Package - shell: bash - run: | - mkdir -p nitro - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro + # - name: Build + # id: make_build + # run: | + # ldd --version + # ./install_deps.sh + # mkdir build && cd build + # cmake -DDEBUG=ON -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + # CC=gcc-8 make -j $(nproc) + # ls -la - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - name: nitro-linux-amd64 - path: ./nitro + # - name: Package + # shell: bash + # run: | + # mkdir -p nitro + # cp build/nitro nitro/ + # tar -czvf nitro.tar.gz nitro - - name: Run e2e testing - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + # with: + # name: nitro-linux-amd64 + # path: ./nitro + + # - name: Run e2e testing + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} # - uses: actions/upload-release-asset@v1.0.1 # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -146,56 +146,56 @@ jobs: # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64.tar.gz # asset_content_type: application/gzip - ubuntu-amd64-cuda-build: - runs-on: ubuntu-20.04 - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - strategy: - matrix: - cuda: ['12.0.1', '11.4.4'] + # ubuntu-amd64-cuda-build: + # runs-on: ubuntu-20.04 + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # permissions: + # contents: write + # strategy: + # matrix: + # cuda: ['12.0.1', '11.4.4'] - steps: - - uses: Jimver/cuda-toolkit@v0.2.11 - id: cuda-toolkit - with: - cuda: ${{ matrix.cuda }} - method: 'network' - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive + # steps: + # - uses: Jimver/cuda-toolkit@v0.2.11 + # id: cuda-toolkit + # with: + # cuda: ${{ matrix.cuda }} + # method: 'network' + # - name: Clone + # id: checkout + # uses: actions/checkout@v3 + # with: + # submodules: recursive - # - name: Dependencies - # id: depends - # run: | - # sudo apt-get update - # sudo apt-get install build-essential gcc-8 uuid-dev + # # - name: Dependencies + # # id: depends + # # run: | + # # sudo apt-get update + # # sudo apt-get install build-essential gcc-8 uuid-dev - - name: Build - id: make_build - run: | - ./install_deps.sh - mkdir build && cd build - cmake -DDEBUG=ON -DLLAMA_CUBLAS=ON -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - CC=gcc-8 make -j $(nproc) - ls -la - - - name: Package - shell: bash - run: | - mkdir -p nitro - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro + # - name: Build + # id: make_build + # run: | + # ./install_deps.sh + # mkdir build && cd build + # cmake -DDEBUG=ON -DLLAMA_CUBLAS=ON -DLLAMA_NATIVE=OFF -DBUILD_SHARED_LIBS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + # CC=gcc-8 make -j $(nproc) + # ls -la - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - name: nitro-linux-amd64-cuda-${{ matrix.cuda }} - path: ./nitro + # - name: Package + # shell: bash + # run: | + # mkdir -p nitro + # cp build/nitro nitro/ + # tar -czvf nitro.tar.gz nitro + + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + # with: + # name: nitro-linux-amd64-cuda-${{ matrix.cuda }} + # path: ./nitro # - name: Run e2e testing # shell: bash @@ -335,7 +335,7 @@ jobs: # asset_content_type: application/gzip # windows-amd64-build: - # runs-on: windows-latest + # runs-on: windows-container # needs: [create-draft-release, set-nitro-version] # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' # permissions: @@ -406,7 +406,7 @@ jobs: # asset_content_type: application/gzip windows-amd64-cuda-build: - runs-on: windows-latest + runs-on: windows-container needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' permissions: @@ -414,16 +414,26 @@ jobs: strategy: matrix: - cuda: ['12.0.1', '11.4.4'] + cuda: ['12.0'] build: ['cublas'] steps: - - uses: Jimver/cuda-toolkit@v0.2.11 - id: cuda-toolkit + - name: Setup VSWhere.exe + uses: warrenbuckley/Setup-VSWhere@v1 with: - cuda: ${{ matrix.cuda }} - method: 'network' - sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' + version: latest + silent: true + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: actions-setup-cmake + uses: jwlawson/actions-setup-cmake@v1.14.1 + # - 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: Clone id: checkout uses: actions/checkout@v3 From 373e0483fbf6da13433db9d0fb05117d3383c8d9 Mon Sep 17 00:00:00 2001 From: Hien To Date: Thu, 4 Jan 2024 12:16:52 +0700 Subject: [PATCH 04/10] Add Dockerfile for linux github runner agent --- ...actions-runner-ubuntu-cuda-11-4.dockerfile | 100 ++++++ ...actions-runner-ubuntu-cuda-12-0.dockerfile | 100 ++++++ .github/runners/start.sh | 21 ++ .github/workflows/build.yml | 308 +++++++++--------- 4 files changed, 375 insertions(+), 154 deletions(-) create mode 100644 .github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile create mode 100644 .github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile create mode 100644 .github/runners/start.sh diff --git a/.github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile b/.github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile new file mode 100644 index 000000000..037aa68a3 --- /dev/null +++ b/.github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile @@ -0,0 +1,100 @@ +# Use NVIDIA CUDA 12.0.0 development image with Ubuntu 18.04 as the base +FROM nvidia/cuda:11.4.3-devel-ubuntu18.04 + +ARG RUNNER_VERSION=2.298.2 +# Docker and Docker Compose arguments + +# Use 1001 and 121 for compatibility with GitHub-hosted runners +ARG RUNNER_UID=1000 +ARG DOCKER_GID=1001 + +ENV DEBIAN_FRONTEND=noninteractive + +# Install necessary packages +RUN apt-get update -y \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:git-core/ppa \ + && apt-get update -y \ + && apt-get install -y --no-install-recommends \ + build-essential \ + curl \ + ca-certificates \ + dnsutils \ + ftp \ + git \ + uuid-dev \ + iproute2 \ + iputils-ping \ + jq \ + libunwind8 \ + locales \ + netcat \ + openssh-client \ + parallel \ + python3-pip \ + rsync \ + shellcheck \ + sudo \ + telnet \ + time \ + tzdata \ + unzip \ + upx \ + wget \ + lsb-release \ + openssl \ + manpages-dev \ + zip \ + zstd \ + && ln -sf /usr/bin/python3 /usr/bin/python \ + && ln -sf /usr/bin/pip3 /usr/bin/pip \ + && rm -rf /var/lib/apt/lists/* + +# Add Kitware's APT repository for CMake +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \ + apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" && \ + apt-get update && \ + apt-get install -y cmake + +# Add PPA for newer versions of GCC +RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \ + apt-get update && \ + apt-get install -y gcc-11 g++-11 cpp-11 && \ + # Clean up + apt-get clean + +# Update alternatives for GCC and related tools +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-11 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-11 \ + --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \ + --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 && \ + update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-11 110 + +# Download latest git-lfs version +RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ + apt-get install -y --no-install-recommends git-lfs + +RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \ + && groupadd docker --gid $DOCKER_GID \ + && usermod -aG sudo runner \ + && usermod -aG docker runner \ + && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ + && echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers + +ENV HOME=/home/runner + +# cd into the user directory, download and unzip the github actions runner +RUN cd /home/runner && mkdir actions-runner && cd actions-runner \ + && curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ + && tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz + +RUN chown -R runner:runner /home/runner && /home/runner/actions-runner/bin/installdependencies.sh + +ADD start.sh start.sh + +RUN chmod +x start.sh + +USER runner + +ENTRYPOINT ["./start.sh"] \ No newline at end of file diff --git a/.github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile b/.github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile new file mode 100644 index 000000000..a10a8bf95 --- /dev/null +++ b/.github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile @@ -0,0 +1,100 @@ +# Use NVIDIA CUDA 12.0.0 development image with Ubuntu 18.04 as the base +FROM nvidia/cuda:12.0.0-devel-ubuntu18.04 + +ARG RUNNER_VERSION=2.298.2 +# Docker and Docker Compose arguments + +# Use 1001 and 121 for compatibility with GitHub-hosted runners +ARG RUNNER_UID=1000 +ARG DOCKER_GID=1001 + +ENV DEBIAN_FRONTEND=noninteractive + +# Install necessary packages +RUN apt-get update -y \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:git-core/ppa \ + && apt-get update -y \ + && apt-get install -y --no-install-recommends \ + build-essential \ + curl \ + ca-certificates \ + dnsutils \ + ftp \ + git \ + uuid-dev \ + iproute2 \ + iputils-ping \ + jq \ + libunwind8 \ + locales \ + netcat \ + openssh-client \ + parallel \ + python3-pip \ + rsync \ + shellcheck \ + sudo \ + telnet \ + time \ + tzdata \ + unzip \ + upx \ + wget \ + lsb-release \ + openssl \ + manpages-dev \ + zip \ + zstd \ + && ln -sf /usr/bin/python3 /usr/bin/python \ + && ln -sf /usr/bin/pip3 /usr/bin/pip \ + && rm -rf /var/lib/apt/lists/* + +# Add Kitware's APT repository for CMake +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \ + apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" && \ + apt-get update && \ + apt-get install -y cmake + +# Add PPA for newer versions of GCC +RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \ + apt-get update && \ + apt-get install -y gcc-11 g++-11 cpp-11 && \ + # Clean up + apt-get clean + +# Update alternatives for GCC and related tools +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-11 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-11 \ + --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \ + --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 && \ + update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-11 110 + +# Download latest git-lfs version +RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ + apt-get install -y --no-install-recommends git-lfs + +RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \ + && groupadd docker --gid $DOCKER_GID \ + && usermod -aG sudo runner \ + && usermod -aG docker runner \ + && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ + && echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers + +ENV HOME=/home/runner + +# cd into the user directory, download and unzip the github actions runner +RUN cd /home/runner && mkdir actions-runner && cd actions-runner \ + && curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ + && tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz + +RUN chown -R runner:runner /home/runner && /home/runner/actions-runner/bin/installdependencies.sh + +ADD start.sh start.sh + +RUN chmod +x start.sh + +USER runner + +ENTRYPOINT ["./start.sh"] \ No newline at end of file diff --git a/.github/runners/start.sh b/.github/runners/start.sh new file mode 100644 index 000000000..f02e20d23 --- /dev/null +++ b/.github/runners/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +RUNNER_REPO=$RUNNER_REPO +RUNNER_TOKEN=$RUNNER_TOKEN +RUNNER_GROUP=$RUNNER_GROUP +RUNNER_LABELS=$RUNNER_LABELS +RUNNER_NAME=$RUNNER_NAME + +cd /home/runner/actions-runner + +./config.sh --unattended --url https://github.com/${RUNNER_REPO} --token ${RUNNER_TOKEN} --name ${RUNNER_NAME} --runnergroup ${RUNNER_GROUP} --labels ${RUNNER_LABELS} --work /home/runner/actions-runner/_work + +cleanup() { + echo "Removing runner..." + ./config.sh remove --unattended --token ${RUNNER_TOKEN} +} + +trap 'cleanup; exit 130' INT +trap 'cleanup; exit 143' TERM + +./run.sh & wait $! \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46b181867..84c442c38 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,48 +86,48 @@ jobs: fi echo "Version: $NEW_VERSION" - # ubuntu-amd64-build: - # runs-on: ubuntu-20.04 - # needs: [create-draft-release, set-nitro-version] - # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - # permissions: - # contents: write - # steps: - # - name: Clone - # id: checkout - # uses: actions/checkout@v3 - # with: - # submodules: recursive - - # # - name: Dependencies - # # id: depends - # # run: | - # # sudo apt-get update - # # sudo apt-get install build-essential gcc-8 + ubuntu-amd64-build: + runs-on: linux-container + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive - # - name: Build - # id: make_build - # run: | - # ldd --version - # ./install_deps.sh - # mkdir build && cd build - # cmake -DDEBUG=ON -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - # CC=gcc-8 make -j $(nproc) - # ls -la + # - name: Dependencies + # id: depends + # run: | + # sudo apt-get update + # sudo apt-get install build-essential gcc-8 - # - name: Package - # shell: bash - # run: | - # mkdir -p nitro - # cp build/nitro nitro/ - # tar -czvf nitro.tar.gz nitro + - name: Build + id: make_build + run: | + ldd --version + ./install_deps.sh + mkdir build && cd build + cmake -DDEBUG=ON -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + make -j $(nproc) + ls -la + + - name: Package + shell: bash + run: | + mkdir -p nitro + cp build/nitro nitro/ + tar -czvf nitro.tar.gz nitro - # - name: Upload Artifact - # uses: actions/upload-artifact@v2 - # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - # with: - # name: nitro-linux-amd64 - # path: ./nitro + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + with: + name: nitro-linux-amd64 + path: ./nitro # - name: Run e2e testing # shell: bash @@ -146,56 +146,56 @@ jobs: # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64.tar.gz # asset_content_type: application/gzip - # ubuntu-amd64-cuda-build: - # runs-on: ubuntu-20.04 - # needs: [create-draft-release, set-nitro-version] - # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - # permissions: - # contents: write - # strategy: - # matrix: - # cuda: ['12.0.1', '11.4.4'] - - # steps: - # - uses: Jimver/cuda-toolkit@v0.2.11 - # id: cuda-toolkit - # with: - # cuda: ${{ matrix.cuda }} - # method: 'network' - # - name: Clone - # id: checkout - # uses: actions/checkout@v3 - # with: - # submodules: recursive + ubuntu-amd64-cuda-build: + runs-on: linux-container + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + strategy: + matrix: + cuda: ['12.0'] - # # - name: Dependencies - # # id: depends - # # run: | - # # sudo apt-get update - # # sudo apt-get install build-essential gcc-8 uuid-dev + steps: + # - uses: Jimver/cuda-toolkit@v0.2.11 + # id: cuda-toolkit + # with: + # cuda: ${{ matrix.cuda }} + # method: 'network' + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive - # - name: Build - # id: make_build - # run: | - # ./install_deps.sh - # mkdir build && cd build - # cmake -DDEBUG=ON -DLLAMA_CUBLAS=ON -DLLAMA_NATIVE=OFF -DBUILD_SHARED_LIBS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - # CC=gcc-8 make -j $(nproc) - # ls -la + # - name: Dependencies + # id: depends + # run: | + # sudo apt-get update + # sudo apt-get install build-essential gcc-8 uuid-dev - # - name: Package - # shell: bash - # run: | - # mkdir -p nitro - # cp build/nitro nitro/ - # tar -czvf nitro.tar.gz nitro + - name: Build + id: make_build + run: | + ./install_deps.sh + mkdir build && cd build + cmake -DDEBUG=ON -DLLAMA_CUBLAS=ON -DLLAMA_NATIVE=OFF -DBUILD_SHARED_LIBS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + make -j $(nproc) + ls -la + + - name: Package + shell: bash + run: | + mkdir -p nitro + cp build/nitro nitro/ + tar -czvf nitro.tar.gz nitro - # - name: Upload Artifact - # uses: actions/upload-artifact@v2 - # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - # with: - # name: nitro-linux-amd64-cuda-${{ matrix.cuda }} - # path: ./nitro + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + with: + name: nitro-linux-amd64-cuda-${{ matrix.cuda }} + path: ./nitro # - name: Run e2e testing # shell: bash @@ -405,82 +405,82 @@ jobs: # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64.tar.gz # asset_content_type: application/gzip - windows-amd64-cuda-build: - runs-on: windows-container - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write + # windows-amd64-cuda-build: + # runs-on: windows-container + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # permissions: + # contents: write - strategy: - matrix: - cuda: ['12.0'] - build: ['cublas'] + # strategy: + # matrix: + # cuda: ['12.0'] + # build: ['cublas'] - steps: - - name: Setup VSWhere.exe - uses: warrenbuckley/Setup-VSWhere@v1 - with: - version: latest - silent: true - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true + # steps: + # - name: Setup VSWhere.exe + # uses: warrenbuckley/Setup-VSWhere@v1 + # with: + # version: latest + # silent: true + # env: + # ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: actions-setup-cmake - uses: jwlawson/actions-setup-cmake@v1.14.1 - # - 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: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive + # - name: actions-setup-cmake + # uses: jwlawson/actions-setup-cmake@v1.14.1 + # # - 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: Clone + # id: checkout + # uses: actions/checkout@v3 + # with: + # submodules: recursive - - name: Setup VSWhere.exe - uses: warrenbuckley/Setup-VSWhere@v1 - with: - version: latest - silent: true - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true + # - name: Setup VSWhere.exe + # uses: warrenbuckley/Setup-VSWhere@v1 + # with: + # version: latest + # silent: true + # env: + # ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' + # - uses: actions/setup-dotnet@v3 + # with: + # dotnet-version: '6.0.x' - - name: Build - id: cmake_build - shell: cmd - run: | - cmake -S ./nitro_deps -B ./build_deps/nitro_deps - cmake --build ./build_deps/nitro_deps --config Release - mkdir -p build - cd build - cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} - cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - - - name: Pack artifacts - id: pack_artifacts - 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 - 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\* - 7z a -tgzip nitro.tar.gz temp.tar + # - name: Build + # id: cmake_build + # shell: cmd + # run: | + # cmake -S ./nitro_deps -B ./build_deps/nitro_deps + # cmake --build ./build_deps/nitro_deps --config Release + # mkdir -p build + # cd build + # cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} + # cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - - name: Upload Artifact - uses: actions/upload-artifact@v2 - # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - name: nitro-win-amd64-cuda-${{ matrix.cuda }} - path: ./build/Release + # - name: Pack artifacts + # id: pack_artifacts + # 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 + # 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\* + # 7z a -tgzip nitro.tar.gz temp.tar + + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + # with: + # name: nitro-win-amd64-cuda-${{ matrix.cuda }} + # path: ./build/Release # - name: run e2e testing # shell: cmd From d3d7d3d13f8bc019c95cd5f354953b9a01b63280 Mon Sep 17 00:00:00 2001 From: Hien To Date: Thu, 4 Jan 2024 13:38:30 +0700 Subject: [PATCH 05/10] Add Dockerfile for linux github runner agent --- .github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile | 3 +++ .github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile b/.github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile index 037aa68a3..d2a1ad064 100644 --- a/.github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile +++ b/.github/runners/actions-runner-ubuntu-cuda-11-4.dockerfile @@ -95,6 +95,9 @@ ADD start.sh start.sh RUN chmod +x start.sh +# Add /usr/local/cuda-11.4/compat to LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=/usr/local/cuda-11.4/compat${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + USER runner ENTRYPOINT ["./start.sh"] \ No newline at end of file diff --git a/.github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile b/.github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile index a10a8bf95..79b46d1d6 100644 --- a/.github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile +++ b/.github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile @@ -95,6 +95,9 @@ ADD start.sh start.sh RUN chmod +x start.sh +# Add /usr/local/cuda-12.0/compat to LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=/usr/local/cuda-12.0/compat${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + USER runner ENTRYPOINT ["./start.sh"] \ No newline at end of file From d2cba72ccc98c7c07b235fe294009378985a60ab Mon Sep 17 00:00:00 2001 From: Hien To Date: Thu, 4 Jan 2024 13:39:25 +0700 Subject: [PATCH 06/10] Add Dockerfile for linux github runner agent --- .github/runners/runner.ps1 | 2 +- .github/runners/start.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/runners/runner.ps1 b/.github/runners/runner.ps1 index e5aa5af30..a08f3725b 100644 --- a/.github/runners/runner.ps1 +++ b/.github/runners/runner.ps1 @@ -1,2 +1,2 @@ -.\actions-runner\config.cmd --unattended --replace --url https://github.com/${env:RUNNER_REPO} --token $env:RUNNER_TOKEN --runnergroup $env:RUNNER_GROUP --labels $env:RUNNER_LABEL --name $env:RUNNER_NAME --work $env:RUNNER_WORKDIR; +.\actions-runner\config.cmd --unattended --replace --url https://github.com/${env:RUNNER_REPO} --pat $env:RUNNER_PAT --runnergroup $env:RUNNER_GROUP --labels $env:RUNNER_LABELS --name $env:RUNNER_NAME --work $env:RUNNER_WORKDIR; .\actions-runner\run.cmd; \ No newline at end of file diff --git a/.github/runners/start.sh b/.github/runners/start.sh index f02e20d23..d31babf4c 100644 --- a/.github/runners/start.sh +++ b/.github/runners/start.sh @@ -1,18 +1,18 @@ #!/bin/bash RUNNER_REPO=$RUNNER_REPO -RUNNER_TOKEN=$RUNNER_TOKEN +RUNNER_PAT=$RUNNER_PAT RUNNER_GROUP=$RUNNER_GROUP RUNNER_LABELS=$RUNNER_LABELS RUNNER_NAME=$RUNNER_NAME cd /home/runner/actions-runner -./config.sh --unattended --url https://github.com/${RUNNER_REPO} --token ${RUNNER_TOKEN} --name ${RUNNER_NAME} --runnergroup ${RUNNER_GROUP} --labels ${RUNNER_LABELS} --work /home/runner/actions-runner/_work +./config.sh --unattended --replace --url https://github.com/${RUNNER_REPO} --pat ${RUNNER_PAT} --name ${RUNNER_NAME} --runnergroup ${RUNNER_GROUP} --labels ${RUNNER_LABELS} --work /home/runner/actions-runner/_work cleanup() { echo "Removing runner..." - ./config.sh remove --unattended --token ${RUNNER_TOKEN} + ./config.sh remove --unattended --pat ${RUNNER_PAT} } trap 'cleanup; exit 130' INT From 6fa467ab1477798333af5947ca81fd379e066d41 Mon Sep 17 00:00:00 2001 From: Hien To Date: Thu, 4 Jan 2024 17:46:42 +0700 Subject: [PATCH 07/10] remove unuse job --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c9d860ce..54fb5b442 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -477,7 +477,7 @@ jobs: 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, windows-amd64-cuda-package] + needs: [ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] permissions: contents: write pull-requests: write From 4e21366a25631a805ffbf148249bcaa80d36952a Mon Sep 17 00:00:00 2001 From: Hien To Date: Thu, 4 Jan 2024 17:54:53 +0700 Subject: [PATCH 08/10] uncomment condition CI --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54fb5b442..5cdf3a272 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -188,7 +188,7 @@ jobs: # chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} - uses: actions/upload-release-asset@v1.0.1 - # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -454,7 +454,7 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v2 - # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' with: name: nitro-win-amd64-cuda-${{ matrix.cuda }} path: ./build/Release From 343364c66e9ce32df81dec37dbbaeebfb3c4d8dd Mon Sep 17 00:00:00 2001 From: Hien To Date: Thu, 4 Jan 2024 18:08:59 +0700 Subject: [PATCH 09/10] correct MSBuild for cuda 11-4 --- .../actions-runner-windows-cuda-11-4.dockerfile | 6 +++--- .github/workflows/build.yml | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/runners/actions-runner-windows-cuda-11-4.dockerfile b/.github/runners/actions-runner-windows-cuda-11-4.dockerfile index d25b14890..03b0f63a9 100644 --- a/.github/runners/actions-runner-windows-cuda-11-4.dockerfile +++ b/.github/runners/actions-runner-windows-cuda-11-4.dockerfile @@ -35,7 +35,7 @@ RUN choco install cmake.install -y --installargs '"ADD_CMAKE_TO_PATH=System"' RUN cmake --version # Install MSBuild and add to path -RUN choco install visualstudio2022buildtools -y --package-parameters '"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.Component.VC.14.29.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.MFC --add Microsoft.VisualStudio.Component.VC.14.29.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VCRedist.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VSTools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.ASAN --add Microsoft.VisualStudio.Component.VC.14.29.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.VC.FxCop --add Microsoft.VisualStudio.Component.VC.14.29.VC.MFC --add Microsoft.VisualStudio.Component.VC.14.29.VC.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.VCUnitTest --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VisualStudioCppSDK --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win10 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.LegacyBuildTools --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.DiagnosticTools --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.VC.Llvm.Cmake --add Microsoft.VisualStudio.Component.VC.Llvm.Llvm --add Microsoft.VisualStudio.Component.VC.Llvm.Toolset --add Microsoft.VisualStudio.Component.VC.MFC --add Microsoft.VisualStudio.Component.VC.MSBuild --add Microsoft.VisualStudio"' +RUN choco install visualstudio2019buildtools -y --package-parameters '"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.Component.VC.14.29.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.MFC --add Microsoft.VisualStudio.Component.VC.14.29.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VCRedist.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VSTools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.ASAN --add Microsoft.VisualStudio.Component.VC.14.29.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.14.29.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.14.29.VC.FxCop --add Microsoft.VisualStudio.Component.VC.14.29.VC.MFC --add Microsoft.VisualStudio.Component.VC.14.29.VC.MSBuild --add Microsoft.VisualStudio.Component.VC.14.29.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.VCUnitTest --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64 --add Microsoft.VisualStudio.Component.VC.14.29.VC.x86.x64.Latest --add Microsoft.VisualStudio.Component.VC.14.29.VisualStudioCppSDK --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win10 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.LegacyBuildTools --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.DiagnosticTools --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.VC.Llvm.Cmake --add Microsoft.VisualStudio.Component.VC.Llvm.Llvm --add Microsoft.VisualStudio.Component.VC.Llvm.Toolset --add Microsoft.VisualStudio.Component.VC.MFC --add Microsoft.VisualStudio.Component.VC.MSBuild --add Microsoft.VisualStudio"' RUN choco install gzip -y; @@ -43,8 +43,8 @@ RUN choco install gzip -y; RUN choco install cuda --version=11.4.2.47141 -y # Copy integrated tools to MSBuild -RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations' -RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations' +RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v150\BuildCustomizations' +RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations' ADD runner.ps1 C:/runner.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5cdf3a272..82e803654 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -372,11 +372,11 @@ jobs: name: nitro-win-amd64 path: ./build/Release - - name: Run e2e testing - shell: cmd - run: | - cd .\build\Release - ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} + # - name: Run e2e testing + # shell: cmd + # run: | + # cd .\build\Release + # ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') From 4dcfe7a79e5d66cff719951e6c9019b2144a75f1 Mon Sep 17 00:00:00 2001 From: Hien To Date: Thu, 4 Jan 2024 21:22:38 +0700 Subject: [PATCH 10/10] Correct msbuild and cuda 11-4 --- .github/runners/actions-runner-windows-cuda-11-4.dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/runners/actions-runner-windows-cuda-11-4.dockerfile b/.github/runners/actions-runner-windows-cuda-11-4.dockerfile index 03b0f63a9..4d8bc5bce 100644 --- a/.github/runners/actions-runner-windows-cuda-11-4.dockerfile +++ b/.github/runners/actions-runner-windows-cuda-11-4.dockerfile @@ -39,11 +39,10 @@ RUN choco install visualstudio2019buildtools -y --package-parameters '"--add Mic RUN choco install gzip -y; -# Install cuda toolkit 12.0.4 +# Install cuda toolkit 11.4.4 RUN choco install cuda --version=11.4.2.47141 -y # Copy integrated tools to MSBuild -RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v150\BuildCustomizations' RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations'