Skip to content

Commit f30bf52

Browse files
authored
Merge pull request #331 from janhq/feat/add-windows-cuda-13
test: cuda13 windows llamacpp build
2 parents be04195 + 38ce6f3 commit f30bf52

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM mcr.microsoft.com/windows/server:ltsc2022
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"]
4+
5+
ARG RUNNER_VERSION=2.311.0
6+
7+
RUN Invoke-WebRequest \
8+
-Uri 'https://aka.ms/install-powershell.ps1' \
9+
-OutFile install-powershell.ps1; \
10+
powershell -ExecutionPolicy Unrestricted -File ./install-powershell.ps1 -AddToPath
11+
12+
RUN Invoke-WebRequest \
13+
-Uri https://github.com/actions/runner/releases/download/v$env:RUNNER_VERSION/actions-runner-win-x64-$env:RUNNER_VERSION.zip \
14+
-OutFile runner.zip; \
15+
Expand-Archive -Path C:/runner.zip -DestinationPath C:/actions-runner; \
16+
Remove-Item -Path C:\runner.zip; \
17+
setx /M PATH $(${Env:PATH} + \";${Env:ProgramFiles}\Git\bin\")
18+
19+
# Install Chocolatey
20+
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \
21+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \
22+
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
23+
24+
# Upgrade Git
25+
RUN choco install git -y; \
26+
git --version
27+
28+
# Install 7zip
29+
RUN choco install 7zip -y; \
30+
7z --help
31+
32+
# Install cmake and add to path
33+
RUN choco install cmake.install -y --installargs '"ADD_CMAKE_TO_PATH=System"'
34+
35+
RUN cmake --version
36+
37+
# Install MSBuild and add to path
38+
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"'
39+
40+
RUN choco install gzip -y;
41+
42+
# Install CUDA Toolkit 13.0.2 directly from NVIDIA
43+
RUN Invoke-WebRequest -Uri 'https://developer.download.nvidia.com/compute/cuda/13.0.2/local_installers/cuda_13.0.2_windows.exe' -OutFile cuda_installer.exe; \
44+
Start-Process -FilePath .\cuda_installer.exe -ArgumentList '-s' -Wait -NoNewWindow; \
45+
Remove-Item -Path .\cuda_installer.exe
46+
47+
# Copy integrated tools to MSBuild
48+
RUN Copy-Item -Path 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\extras\visual_studio_integration\MSBuildExtensions\*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations'
49+
50+
ADD runner.ps1 C:/runner.ps1
51+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
52+
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=amd64", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
53+
CMD ["powershell.exe", "-ExecutionPolicy", "Unrestricted", "-File", ".\\runner.ps1"]

.github/workflows/menlo-build.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656

5757
build-and-test:
5858
runs-on: ${{ matrix.runs-on }}
59-
needs: [create-draft-release]
59+
# needs: [create-draft-release]
6060
timeout-minutes: 270
6161
strategy:
6262
fail-fast: false
@@ -342,6 +342,14 @@ jobs:
342342
vulkan: false
343343
ccache: true
344344
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
345+
- os: "win"
346+
name: "cuda-13-common_cpus-x64"
347+
runs-on: "windows-cuda-13-0"
348+
cmake-flags: "-DLLAMA_CURL=OFF -DGGML_CUDA=ON -DGGML_NATIVE=OFF -DCMAKE_CUDA_ARCHITECTURES='75;80;86;87;89;120;121' -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
349+
run-e2e: false
350+
vulkan: false
351+
ccache: true
352+
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
345353
- os: "win"
346354
name: "vulkan-common_cpus-x64"
347355
runs-on: "windows-cuda-11-7"
@@ -592,6 +600,7 @@ jobs:
592600
wget https://minio.menlo.ai:9000/cicd/dist/cuda-dependencies/13.0/linux/cuda.tar.gz -O /tmp/cudart-llama-bin-linux-cu13.0-x64.tar.gz
593601
wget https://minio.menlo.ai:9000/cicd/dist/cuda-dependencies/12.0/linux/cuda.tar.gz -O /tmp/cudart-llama-bin-linux-cu12.0-x64.tar.gz
594602
wget https://minio.menlo.ai:9000/cicd/dist/cuda-dependencies/11.7/linux/cuda.tar.gz -O /tmp/cudart-llama-bin-linux-cu11.7-x64.tar.gz
603+
wget https://minio.menlo.ai:9000/cicd/dist/cuda-dependencies/13.0/windows/cuda.tar.gz -O /tmp/cudart-llama-bin-win-cu13.0-x64.tar.gz
595604
wget https://minio.menlo.ai:9000/cicd/dist/cuda-dependencies/12.0/windows/cuda.tar.gz -O /tmp/cudart-llama-bin-win-cu12.0-x64.tar.gz
596605
wget https://minio.menlo.ai:9000/cicd/dist/cuda-dependencies/11.7/windows/cuda.tar.gz -O /tmp/cudart-llama-bin-win-cu11.7-x64.tar.gz
597606
@@ -634,6 +643,12 @@ jobs:
634643
echo " sha512: >-" >> checksum.yml
635644
echo " $(sha512sum /tmp/cudart-llama-bin-win-cu12.0-x64.tar.gz | awk '{ print $1 }')" >> checksum.yml
636645
echo " size: $(stat -c%s /tmp/cudart-llama-bin-win-cu12.0-x64.tar.gz)" >> checksum.yml
646+
647+
echo "- url: cudart-llama-bin-win-cu13.0-x64.tar.gz" >> checksum.yml
648+
echo " sha512: >-" >> checksum.yml
649+
echo " $(sha512sum /tmp/cudart-llama-bin-win-cu13.0-x64.tar.gz | awk '{ print $1 }')" >> checksum.yml
650+
echo " size: $(stat -c%s /tmp/cudart-llama-bin-win-cu13.0-x64.tar.gz)" >> checksum.yml
651+
637652
cat checksum.yml
638653
639654
- name: Upload checksum.yml to GitHub Release
@@ -680,6 +695,17 @@ jobs:
680695
asset_name: cudart-llama-bin-linux-cu11.7-x64.tar.gz
681696
asset_content_type: application/gzip
682697

698+
- name: upload cudart-llama-bin-win-cu13.0-x64.tar.gz to Github Release
699+
uses: actions/upload-release-asset@v1
700+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
701+
env:
702+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
703+
with:
704+
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
705+
asset_path: /tmp/cudart-llama-bin-win-cu13.0-x64.tar.gz
706+
asset_name: cudart-llama-bin-win-cu13.0-x64.tar.gz
707+
asset_content_type: application/gzip
708+
683709
- name: upload cudart-llama-bin-win-cu12.0-x64.tar.gz to Github Release
684710
uses: actions/upload-release-asset@v1
685711
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')

0 commit comments

Comments
 (0)