Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
96624aa4
Unverified
Commit
96624aa4
authored
Jun 19, 2024
by
Daniel Hiltgen
Committed by
GitHub
Jun 19, 2024
Browse files
Merge pull request #5072 from dhiltgen/windows_path
Move libraries out of users path
parents
10f33b85
b2799f11
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
26 deletions
+41
-26
app/ollama.iss
app/ollama.iss
+6
-1
gpu/gpu.go
gpu/gpu.go
+8
-2
llm/generate/gen_windows.ps1
llm/generate/gen_windows.ps1
+18
-14
llm/payload.go
llm/payload.go
+2
-2
llm/server.go
llm/server.go
+2
-2
scripts/build_windows.ps1
scripts/build_windows.ps1
+5
-5
No files found.
app/ollama.iss
View file @
96624aa4
...
@@ -88,10 +88,15 @@ DialogFontSize=12
...
@@ -88,10 +88,15 @@ DialogFontSize=12
[Files]
[Files]
Source: ".\app.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}" ; Flags: ignoreversion 64bit
Source: ".\app.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}" ; Flags: ignoreversion 64bit
Source: "..\ollama.exe"; DestDir: "{app}"; Flags: ignoreversion 64bit
Source: "..\ollama.exe"; DestDir: "{app}"; Flags: ignoreversion 64bit
Source: "..\dist\windows-{#ARCH}\*.dll"; DestDir: "{app}"; Flags: ignoreversion 64bit
Source: "..\dist\windows-{#ARCH}\ollama_runners\*"; DestDir: "{app}\ollama_runners"; Flags: ignoreversion 64bit recursesubdirs
Source: "..\dist\windows-{#ARCH}\ollama_runners\*"; DestDir: "{app}\ollama_runners"; Flags: ignoreversion 64bit recursesubdirs
Source: "..\dist\ollama_welcome.ps1"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\dist\ollama_welcome.ps1"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\assets\app.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\assets\app.ico"; DestDir: "{app}"; Flags: ignoreversion
#if DirExists("..\dist\windows-amd64\cuda")
Source: "..\dist\windows-amd64\cuda\*"; DestDir: "{app}\cuda\"; Flags: ignoreversion recursesubdirs
#endif
#if DirExists("..\dist\windows-amd64\oneapi")
Source: "..\dist\windows-amd64\oneapi\*"; DestDir: "{app}\oneapi\"; Flags: ignoreversion recursesubdirs
#endif
#if DirExists("..\dist\windows-amd64\rocm")
#if DirExists("..\dist\windows-amd64\rocm")
Source: "..\dist\windows-amd64\rocm\*"; DestDir: "{app}\rocm\"; Flags: ignoreversion recursesubdirs
Source: "..\dist\windows-amd64\rocm\*"; DestDir: "{app}\rocm\"; Flags: ignoreversion recursesubdirs
#endif
#endif
...
...
gpu/gpu.go
View file @
96624aa4
...
@@ -231,7 +231,7 @@ func GetGPUInfo() GpuInfoList {
...
@@ -231,7 +231,7 @@ func GetGPUInfo() GpuInfoList {
// On windows we bundle the nvidia library one level above the runner dir
// On windows we bundle the nvidia library one level above the runner dir
depPath
:=
""
depPath
:=
""
if
runtime
.
GOOS
==
"windows"
&&
envconfig
.
RunnersDir
!=
""
{
if
runtime
.
GOOS
==
"windows"
&&
envconfig
.
RunnersDir
!=
""
{
depPath
=
filepath
.
Dir
(
envconfig
.
RunnersDir
)
depPath
=
filepath
.
Join
(
filepath
.
Dir
(
envconfig
.
RunnersDir
)
,
"cuda"
)
}
}
// Load ALL libraries
// Load ALL libraries
...
@@ -282,6 +282,12 @@ func GetGPUInfo() GpuInfoList {
...
@@ -282,6 +282,12 @@ func GetGPUInfo() GpuInfoList {
// Intel
// Intel
if
envconfig
.
IntelGpu
{
if
envconfig
.
IntelGpu
{
oHandles
=
initOneAPIHandles
()
oHandles
=
initOneAPIHandles
()
// On windows we bundle the oneapi library one level above the runner dir
depPath
=
""
if
runtime
.
GOOS
==
"windows"
&&
envconfig
.
RunnersDir
!=
""
{
depPath
=
filepath
.
Join
(
filepath
.
Dir
(
envconfig
.
RunnersDir
),
"oneapi"
)
}
for
d
:=
range
oHandles
.
oneapi
.
num_drivers
{
for
d
:=
range
oHandles
.
oneapi
.
num_drivers
{
if
oHandles
.
oneapi
==
nil
{
if
oHandles
.
oneapi
==
nil
{
// shouldn't happen
// shouldn't happen
...
@@ -306,7 +312,7 @@ func GetGPUInfo() GpuInfoList {
...
@@ -306,7 +312,7 @@ func GetGPUInfo() GpuInfoList {
gpuInfo
.
FreeMemory
=
uint64
(
memInfo
.
free
)
gpuInfo
.
FreeMemory
=
uint64
(
memInfo
.
free
)
gpuInfo
.
ID
=
C
.
GoString
(
&
memInfo
.
gpu_id
[
0
])
gpuInfo
.
ID
=
C
.
GoString
(
&
memInfo
.
gpu_id
[
0
])
gpuInfo
.
Name
=
C
.
GoString
(
&
memInfo
.
gpu_name
[
0
])
gpuInfo
.
Name
=
C
.
GoString
(
&
memInfo
.
gpu_name
[
0
])
// TODO dependency p
ath
?
gpuInfo
.
DependencyPath
=
depP
ath
oneapiGPUs
=
append
(
oneapiGPUs
,
gpuInfo
)
oneapiGPUs
=
append
(
oneapiGPUs
,
gpuInfo
)
}
}
}
}
...
...
llm/generate/gen_windows.ps1
View file @
96624aa4
...
@@ -295,10 +295,12 @@ function build_cuda() {
...
@@ -295,10 +295,12 @@ function build_cuda() {
sign
sign
install
install
write-host
"copying CUDA dependencies to
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\"
rm
-ea
0
-recurse
-force
-path
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\cuda\"
cp
"
${script:CUDA_LIB_DIR}
\cudart64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\"
md
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\cuda\"
-ea
0
>
$null
cp
"
${script:CUDA_LIB_DIR}
\cublas64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\"
write-host
"copying CUDA dependencies to
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\cuda\"
cp
"
${script:CUDA_LIB_DIR}
\cublasLt64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\"
cp
"
${script:CUDA_LIB_DIR}
\cudart64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\cuda\"
cp
"
${script:CUDA_LIB_DIR}
\cublas64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\cuda\"
cp
"
${script:CUDA_LIB_DIR}
\cublasLt64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\cuda\"
}
else
{
}
else
{
write-host
"Skipping CUDA generation step"
write-host
"Skipping CUDA generation step"
}
}
...
@@ -332,16 +334,18 @@ function build_oneapi() {
...
@@ -332,16 +334,18 @@ function build_oneapi() {
sign
sign
install
install
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\libirngmd.dll"
"
${script:distDir}
"
rm
-ea
0
-recurse
-force
-path
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\libmmd.dll"
"
${script:distDir}
"
md
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
-ea
0
>
$null
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\pi_level_zero.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\libirngmd.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\pi_unified_runtime.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\libmmd.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\pi_win_proxy_loader.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\pi_level_zero.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\svml_dispmd.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\pi_unified_runtime.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\sycl7.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\pi_win_proxy_loader.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\mkl\latest\bin\mkl_core.2.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\svml_dispmd.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\mkl\latest\bin\mkl_sycl_blas.4.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\compiler\latest\bin\sycl7.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\mkl\latest\bin\mkl_tbb_thread.2.dll"
"
${script:distDir}
"
cp
"
${env:ONEAPI_ROOT}
\mkl\latest\bin\mkl_core.2.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\mkl\latest\bin\mkl_sycl_blas.4.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
cp
"
${env:ONEAPI_ROOT}
\mkl\latest\bin\mkl_tbb_thread.2.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\oneapi\"
}
else
{
}
else
{
Write-Host
"Skipping oneAPI generation step"
Write-Host
"Skipping oneAPI generation step"
}
}
...
...
llm/payload.go
View file @
96624aa4
...
@@ -58,7 +58,7 @@ func availableServers() map[string]string {
...
@@ -58,7 +58,7 @@ func availableServers() map[string]string {
}
}
// glob payloadsDir for files that start with ollama_
// glob payloadsDir for files that start with ollama_
pattern
:=
filepath
.
Join
(
payloadsDir
,
"*"
)
pattern
:=
filepath
.
Join
(
payloadsDir
,
"*"
,
"ollama_*"
)
files
,
err
:=
filepath
.
Glob
(
pattern
)
files
,
err
:=
filepath
.
Glob
(
pattern
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -69,7 +69,7 @@ func availableServers() map[string]string {
...
@@ -69,7 +69,7 @@ func availableServers() map[string]string {
servers
:=
make
(
map
[
string
]
string
)
servers
:=
make
(
map
[
string
]
string
)
for
_
,
file
:=
range
files
{
for
_
,
file
:=
range
files
{
slog
.
Debug
(
"availableServers : found"
,
"file"
,
file
)
slog
.
Debug
(
"availableServers : found"
,
"file"
,
file
)
servers
[
filepath
.
Base
(
file
)]
=
file
servers
[
filepath
.
Base
(
file
path
.
Dir
(
file
))]
=
filepath
.
Dir
(
file
)
}
}
return
servers
return
servers
...
...
llm/server.go
View file @
96624aa4
...
@@ -274,8 +274,8 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
...
@@ -274,8 +274,8 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
if
runtime
.
GOOS
==
"windows"
{
if
runtime
.
GOOS
==
"windows"
{
pathEnv
=
"PATH"
pathEnv
=
"PATH"
}
}
// prepend the server directory to LD_LIBRARY_PATH/PATH
// prepend the server directory to LD_LIBRARY_PATH/PATH
and the parent dir for common dependencies
libraryPaths
:=
[]
string
{
dir
}
libraryPaths
:=
[]
string
{
dir
,
filepath
.
Dir
(
dir
)
}
if
libraryPath
,
ok
:=
os
.
LookupEnv
(
pathEnv
);
ok
{
if
libraryPath
,
ok
:=
os
.
LookupEnv
(
pathEnv
);
ok
{
// Append our runner directory to the path
// Append our runner directory to the path
...
...
scripts/build_windows.ps1
View file @
96624aa4
...
@@ -103,19 +103,19 @@ function buildApp() {
...
@@ -103,19 +103,19 @@ function buildApp() {
function
gatherDependencies
()
{
function
gatherDependencies
()
{
write-host
"Gathering runtime dependencies"
write-host
"Gathering runtime dependencies"
cd
"
${script:SRC_DIR}
"
cd
"
${script:SRC_DIR}
"
md
"
${script:DEPS_DIR}
"
-ea
0
>
$null
md
"
${script:DEPS_DIR}
\ollama_runners
"
-ea
0
>
$null
# TODO - this varies based on host build system and MSVC version - drive from dumpbin output
# TODO - this varies based on host build system and MSVC version - drive from dumpbin output
# currently works for Win11 + MSVC 2019 + Cuda V11
# currently works for Win11 + MSVC 2019 + Cuda V11
cp
"
${env:VCToolsRedistDir}
\x64\Microsoft.VC*.CRT\msvcp140.dll"
"
${script:DEPS_DIR}
\"
cp
"
${env:VCToolsRedistDir}
\x64\Microsoft.VC*.CRT\msvcp140.dll"
"
${script:DEPS_DIR}
\
ollama_runners\
"
cp
"
${env:VCToolsRedistDir}
\x64\Microsoft.VC*.CRT\vcruntime140.dll"
"
${script:DEPS_DIR}
\"
cp
"
${env:VCToolsRedistDir}
\x64\Microsoft.VC*.CRT\vcruntime140.dll"
"
${script:DEPS_DIR}
\
ollama_runners\
"
cp
"
${env:VCToolsRedistDir}
\x64\Microsoft.VC*.CRT\vcruntime140_1.dll"
"
${script:DEPS_DIR}
\"
cp
"
${env:VCToolsRedistDir}
\x64\Microsoft.VC*.CRT\vcruntime140_1.dll"
"
${script:DEPS_DIR}
\
ollama_runners\
"
cp
"
${script:SRC_DIR}
\app\ollama_welcome.ps1"
"
${script:SRC_DIR}
\dist\"
cp
"
${script:SRC_DIR}
\app\ollama_welcome.ps1"
"
${script:SRC_DIR}
\dist\"
if
(
"
${env:KEY_CONTAINER}
"
)
{
if
(
"
${env:KEY_CONTAINER}
"
)
{
write-host
"about to sign"
write-host
"about to sign"
foreach
(
$file
in
(
get-childitem
"
${script:DEPS_DIR}
/
cu*.dll"
)
+
@(
"
${script:SRC_DIR}
\dist\ollama_welcome.ps1"
)){
foreach
(
$file
in
(
get-childitem
"
${script:DEPS_DIR}
\cuda\
cu*.dll"
)
+
@(
"
${script:SRC_DIR}
\dist\ollama_welcome.ps1"
)){
write-host
"signing
$file
"
write-host
"signing
$file
"
&
"
${script:SignTool}
"
sign
/v
/fd
sha256
/t
http://timestamp.digicert.com
/f
"
${script:OLLAMA_CERT}
"
`
&
"
${script:SignTool}
"
sign
/v
/fd
sha256
/t
http://timestamp.digicert.com
/f
"
${script:OLLAMA_CERT}
"
`
/csp
"Google Cloud KMS Provider"
/kc
${env:KEY_CONTAINER}
$file
/csp
"Google Cloud KMS Provider"
/kc
${env:KEY_CONTAINER}
$file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment