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
93ea9240
Unverified
Commit
93ea9240
authored
Aug 27, 2024
by
Daniel Hiltgen
Committed by
GitHub
Aug 27, 2024
Browse files
Move ollama executable out of bin dir (#6535)
parent
d13c3daa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
10 deletions
+21
-10
app/ollama.iss
app/ollama.iss
+4
-4
envconfig/config.go
envconfig/config.go
+10
-1
gpu/amd_common.go
gpu/amd_common.go
+3
-1
gpu/amd_windows.go
gpu/amd_windows.go
+1
-1
gpu/gpu.go
gpu/gpu.go
+1
-1
scripts/build_windows.ps1
scripts/build_windows.ps1
+2
-2
No files found.
app/ollama.iss
View file @
93ea9240
...
@@ -87,7 +87,7 @@ DialogFontSize=12
...
@@ -87,7 +87,7 @@ 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}
\bin
"; Flags: ignoreversion 64bit
Source: "..\ollama.exe"; DestDir: "{app}"; Flags: ignoreversion 64bit
Source: "..\dist\windows-{#ARCH}\lib\ollama\runners\*"; DestDir: "{app}\lib\ollama\runners"; Flags: ignoreversion 64bit recursesubdirs
Source: "..\dist\windows-{#ARCH}\lib\ollama\runners\*"; DestDir: "{app}\lib\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
...
@@ -99,7 +99,7 @@ Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilen
...
@@ -99,7 +99,7 @@ Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilen
Name: "{userprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
Name: "{userprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
[Run]
[Run]
Filename: "{cmd}"; Parameters: "/C set PATH={app}
\bin
;%PATH% & ""{app}\{#MyAppExeName}"""; Flags: postinstall nowait runhidden
Filename: "{cmd}"; Parameters: "/C set PATH={app};%PATH% & ""{app}\{#MyAppExeName}"""; Flags: postinstall nowait runhidden
[UninstallRun]
[UninstallRun]
; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ''{#MyAppExeName}'' /f /t"; Flags: runhidden
; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ''{#MyAppExeName}'' /f /t"; Flags: runhidden
...
@@ -134,8 +134,8 @@ SetupAppRunningError=Another Ollama installer is running.%n%nPlease cancel or fi
...
@@ -134,8 +134,8 @@ SetupAppRunningError=Another Ollama installer is running.%n%nPlease cancel or fi
[Registry]
[Registry]
Root: HKCU; Subkey: "Environment"; \
Root: HKCU; Subkey: "Environment"; \
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}
\bin
"; \
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; \
Check: NeedsAddPath('{app}
\bin
')
Check: NeedsAddPath('{app}')
[Code]
[Code]
...
...
envconfig/config.go
View file @
93ea9240
...
@@ -190,7 +190,7 @@ func RunnersDir() (p string) {
...
@@ -190,7 +190,7 @@ func RunnersDir() (p string) {
}
}
var
paths
[]
string
var
paths
[]
string
for
_
,
root
:=
range
[]
string
{
filepath
.
Dir
(
exe
),
filepath
.
Join
(
filepath
.
Dir
(
exe
),
".."
),
cwd
}
{
for
_
,
root
:=
range
[]
string
{
filepath
.
Dir
(
exe
),
filepath
.
Join
(
filepath
.
Dir
(
exe
),
LibRelativeToExe
()
),
cwd
}
{
paths
=
append
(
paths
,
paths
=
append
(
paths
,
root
,
root
,
filepath
.
Join
(
root
,
runtime
.
GOOS
+
"-"
+
runtime
.
GOARCH
),
filepath
.
Join
(
root
,
runtime
.
GOOS
+
"-"
+
runtime
.
GOARCH
),
...
@@ -282,3 +282,12 @@ func Values() map[string]string {
...
@@ -282,3 +282,12 @@ func Values() map[string]string {
func
Var
(
key
string
)
string
{
func
Var
(
key
string
)
string
{
return
strings
.
Trim
(
strings
.
TrimSpace
(
os
.
Getenv
(
key
)),
"
\"
'"
)
return
strings
.
Trim
(
strings
.
TrimSpace
(
os
.
Getenv
(
key
)),
"
\"
'"
)
}
}
// On windows, we keep the binary at the top directory, but
// other platforms use a "bin" directory, so this returns ".."
func
LibRelativeToExe
()
string
{
if
runtime
.
GOOS
==
"windows"
{
return
"."
}
return
".."
}
gpu/amd_common.go
View file @
93ea9240
...
@@ -9,6 +9,8 @@ import (
...
@@ -9,6 +9,8 @@ import (
"path/filepath"
"path/filepath"
"runtime"
"runtime"
"strings"
"strings"
"github.com/ollama/ollama/envconfig"
)
)
// Determine if the given ROCm lib directory is usable by checking for existence of some glob patterns
// Determine if the given ROCm lib directory is usable by checking for existence of some glob patterns
...
@@ -54,7 +56,7 @@ func commonAMDValidateLibDir() (string, error) {
...
@@ -54,7 +56,7 @@ func commonAMDValidateLibDir() (string, error) {
// Installer payload location if we're running the installed binary
// Installer payload location if we're running the installed binary
exe
,
err
:=
os
.
Executable
()
exe
,
err
:=
os
.
Executable
()
if
err
==
nil
{
if
err
==
nil
{
rocmTargetDir
:=
filepath
.
Join
(
filepath
.
Dir
(
exe
),
".."
,
"lib"
,
"ollama"
)
rocmTargetDir
:=
filepath
.
Join
(
filepath
.
Dir
(
exe
),
envconfig
.
LibRelativeToExe
()
,
"lib"
,
"ollama"
)
if
rocmLibUsable
(
rocmTargetDir
)
{
if
rocmLibUsable
(
rocmTargetDir
)
{
slog
.
Debug
(
"detected ROCM next to ollama executable "
+
rocmTargetDir
)
slog
.
Debug
(
"detected ROCM next to ollama executable "
+
rocmTargetDir
)
return
rocmTargetDir
,
nil
return
rocmTargetDir
,
nil
...
...
gpu/amd_windows.go
View file @
93ea9240
...
@@ -153,7 +153,7 @@ func AMDValidateLibDir() (string, error) {
...
@@ -153,7 +153,7 @@ func AMDValidateLibDir() (string, error) {
// Installer payload (if we're running from some other location)
// Installer payload (if we're running from some other location)
localAppData
:=
os
.
Getenv
(
"LOCALAPPDATA"
)
localAppData
:=
os
.
Getenv
(
"LOCALAPPDATA"
)
appDir
:=
filepath
.
Join
(
localAppData
,
"Programs"
,
"Ollama"
)
appDir
:=
filepath
.
Join
(
localAppData
,
"Programs"
,
"Ollama"
)
rocmTargetDir
:=
filepath
.
Join
(
appDir
,
".."
,
"lib"
,
"ollama"
)
rocmTargetDir
:=
filepath
.
Join
(
appDir
,
envconfig
.
LibRelativeToExe
()
,
"lib"
,
"ollama"
)
if
rocmLibUsable
(
rocmTargetDir
)
{
if
rocmLibUsable
(
rocmTargetDir
)
{
slog
.
Debug
(
"detected ollama installed ROCm at "
+
rocmTargetDir
)
slog
.
Debug
(
"detected ollama installed ROCm at "
+
rocmTargetDir
)
return
rocmTargetDir
,
nil
return
rocmTargetDir
,
nil
...
...
gpu/gpu.go
View file @
93ea9240
...
@@ -653,7 +653,7 @@ func LibraryDir() string {
...
@@ -653,7 +653,7 @@ func LibraryDir() string {
slog
.
Warn
(
"failed to lookup working directory"
,
"error"
,
err
)
slog
.
Warn
(
"failed to lookup working directory"
,
"error"
,
err
)
}
}
// Scan for any of our dependeices, and pick first match
// Scan for any of our dependeices, and pick first match
for
_
,
root
:=
range
[]
string
{
filepath
.
Dir
(
appExe
),
filepath
.
Join
(
filepath
.
Dir
(
appExe
),
".."
),
cwd
}
{
for
_
,
root
:=
range
[]
string
{
filepath
.
Dir
(
appExe
),
filepath
.
Join
(
filepath
.
Dir
(
appExe
),
envconfig
.
LibRelativeToExe
()
),
cwd
}
{
libDep
:=
filepath
.
Join
(
"lib"
,
"ollama"
)
libDep
:=
filepath
.
Join
(
"lib"
,
"ollama"
)
if
_
,
err
:=
os
.
Stat
(
filepath
.
Join
(
root
,
libDep
));
err
==
nil
{
if
_
,
err
:=
os
.
Stat
(
filepath
.
Join
(
root
,
libDep
));
err
==
nil
{
return
filepath
.
Join
(
root
,
libDep
)
return
filepath
.
Join
(
root
,
libDep
)
...
...
scripts/build_windows.ps1
View file @
93ea9240
...
@@ -122,8 +122,8 @@ function buildOllama() {
...
@@ -122,8 +122,8 @@ function buildOllama() {
/csp
"Google Cloud KMS Provider"
/kc
${env:KEY_CONTAINER}
ollama.exe
/csp
"Google Cloud KMS Provider"
/kc
${env:KEY_CONTAINER}
ollama.exe
if
(
$LASTEXITCODE
-ne
0
)
{
exit
(
$LASTEXITCODE
)}
if
(
$LASTEXITCODE
-ne
0
)
{
exit
(
$LASTEXITCODE
)}
}
}
New-Item
-ItemType
Directory
-Path
.
\dist\windows-
${script:TARGET_ARCH}
\
bin\
-Force
New-Item
-ItemType
Directory
-Path
.
\dist\windows-
${script:TARGET_ARCH}
\
-Force
cp
.
\ollama.exe
.
\dist\windows-
${script:TARGET_ARCH}
\
bin\
cp
.
\ollama.exe
.
\dist\windows-
${script:TARGET_ARCH}
\
}
}
function
buildApp
()
{
function
buildApp
()
{
...
...
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