From 8feb97dc0df434e0c5d1e6508aa4f29643e6376c Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Thu, 25 Apr 2024 22:02:10 -0700 Subject: [PATCH] Move cuda/rocm dependency gathering into generate script This will make it simpler for CI to accumulate artifacts from prior steps --- .github/workflows/release.yaml | 2 -- app/ollama.iss | 8 ++------ llm/generate/gen_windows.ps1 | 13 +++++++++++++ scripts/build_windows.ps1 | 12 ------------ 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7217faf7..4adab4f8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -331,8 +331,6 @@ jobs: $env:CMAKE_SYSTEM_VERSION="10.0.22621.0" $env:PATH="$gopath;$env:PATH" $env:OLLAMA_SKIP_GENERATE="1" - $env:NVIDIA_DIR=$(resolve-path ".\dist\deps") - $env:HIP_PATH=$(resolve-path ".\dist\deps") & .\scripts\build_windows.ps1 - uses: actions/upload-artifact@v4 with: diff --git a/app/ollama.iss b/app/ollama.iss index f77742dc..ffeace81 100644 --- a/app/ollama.iss +++ b/app/ollama.iss @@ -92,12 +92,8 @@ Source: "..\dist\windows-amd64\*.dll"; DestDir: "{app}"; Flags: ignoreversion 64 Source: "..\dist\windows-amd64\ollama_runners\*"; DestDir: "{app}\ollama_runners"; Flags: ignoreversion 64bit recursesubdirs Source: "..\dist\ollama_welcome.ps1"; DestDir: "{app}"; Flags: ignoreversion Source: ".\assets\app.ico"; DestDir: "{app}"; Flags: ignoreversion -; Assumes v5.7, may need adjustments for v6 -#if GetEnv("HIP_PATH") != "" - Source: "{#GetEnv('HIP_PATH')}\bin\hipblas.dll"; DestDir: "{app}\rocm\"; Flags: ignoreversion - Source: "{#GetEnv('HIP_PATH')}\bin\rocblas.dll"; DestDir: "{app}\rocm\"; Flags: ignoreversion - ; amdhip64.dll dependency comes from the driver and must be installed already - Source: "{#GetEnv('HIP_PATH')}\bin\rocblas\library\*"; DestDir: "{app}\rocm\rocblas\library\"; Flags: ignoreversion +#if DirExists("..\dist\windows-amd64\rocm") + Source: "..\dist\windows-amd64\rocm\*"; DestDir: "{app}\rocm\"; Flags: ignoreversion recursesubdirs #endif diff --git a/llm/generate/gen_windows.ps1 b/llm/generate/gen_windows.ps1 index 737cbbee..fc7fb255 100644 --- a/llm/generate/gen_windows.ps1 +++ b/llm/generate/gen_windows.ps1 @@ -252,6 +252,11 @@ if ($null -ne $script:CUDA_LIB_DIR) { build sign install + + write-host "copying CUDA dependencies to ${script:SRC_DIR}\dist\windows-${script:ARCH}\" + cp "${script:CUDA_LIB_DIR}\cudart64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\" + cp "${script:CUDA_LIB_DIR}\cublas64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\" + cp "${script:CUDA_LIB_DIR}\cublasLt64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\" } if ($null -ne $env:HIP_PATH) { @@ -295,6 +300,14 @@ if ($null -ne $env:HIP_PATH) { } sign install + + # Assumes v5.7, may need adjustments for v6 + rm -ea 0 -recurse -force -path "${script:SRC_DIR}\dist\windows-${script:ARCH}\rocm\" + md "${script:SRC_DIR}\dist\windows-${script:ARCH}\rocm\rocblas\library\" -ea 0 > $null + cp "${env:HIP_PATH}\bin\hipblas.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\rocm\" + cp "${env:HIP_PATH}\bin\rocblas.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\rocm\" + # amdhip64.dll dependency comes from the driver and must be installed on the host to use AMD GPUs + cp "${env:HIP_PATH}\bin\rocblas\library\*" "${script:SRC_DIR}\dist\windows-${script:ARCH}\rocm\rocblas\library\" } diff --git a/scripts/build_windows.ps1 b/scripts/build_windows.ps1 index a9aade8c..1131de37 100644 --- a/scripts/build_windows.ps1 +++ b/scripts/build_windows.ps1 @@ -109,9 +109,6 @@ function gatherDependencies() { cp "${env:VCToolsRedistDir}\x64\Microsoft.VC*.CRT\vcruntime140.dll" "${script:DEPS_DIR}\" cp "${env:VCToolsRedistDir}\x64\Microsoft.VC*.CRT\vcruntime140_1.dll" "${script:DEPS_DIR}\" - cp "${script:NVIDIA_DIR}\cudart64_*.dll" "${script:DEPS_DIR}\" - cp "${script:NVIDIA_DIR}\cublas64_*.dll" "${script:DEPS_DIR}\" - cp "${script:NVIDIA_DIR}\cublasLt64_*.dll" "${script:DEPS_DIR}\" cp "${script:SRC_DIR}\app\ollama_welcome.ps1" "${script:SRC_DIR}\dist\" if ("${env:KEY_CONTAINER}") { @@ -123,15 +120,6 @@ function gatherDependencies() { if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)} } } - if ($null -ne $env:HIP_PATH) { - # Assumes v5.7, may need adjustments for v6 - rm -ea 0 -recurse -force -path "${script:DEPS_DIR}\rocm\" - md "${script:DEPS_DIR}\rocm\rocblas\library\" -ea 0 > $null - cp "${env:HIP_PATH}\bin\hipblas.dll" "${script:DEPS_DIR}\rocm\" - cp "${env:HIP_PATH}\bin\rocblas.dll" "${script:DEPS_DIR}\rocm\" - # amdhip64.dll dependency comes from the driver and must be installed on the host to use AMD GPUs - cp "${env:HIP_PATH}\bin\rocblas\library\*" "${script:DEPS_DIR}\rocm\rocblas\library\" - } } function buildInstaller() {