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
82b9b329
Unverified
Commit
82b9b329
authored
Nov 24, 2023
by
Jing Zhang
Committed by
GitHub
Nov 24, 2023
Browse files
windows CUDA support (#1262)
* Support cuda build in Windows * Enable dynamic NumGPU allocation for Windows
parent
12e8c12d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
.gitignore
.gitignore
+1
-0
llm/llama.cpp/generate_windows.go
llm/llama.cpp/generate_windows.go
+8
-0
llm/llama.go
llm/llama.go
+2
-1
No files found.
.gitignore
View file @
82b9b329
...
@@ -7,3 +7,4 @@ dist
...
@@ -7,3 +7,4 @@ dist
ollama
ollama
ggml-metal.metal
ggml-metal.metal
.cache
.cache
*.exe
llm/llama.cpp/generate_windows.go
View file @
82b9b329
...
@@ -14,3 +14,11 @@ package llm
...
@@ -14,3 +14,11 @@ package llm
//go:generate cmake -S gguf -B gguf/build/cpu -DLLAMA_K_QUANTS=on -DLLAMA_NATIVE=off -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off
//go:generate cmake -S gguf -B gguf/build/cpu -DLLAMA_K_QUANTS=on -DLLAMA_NATIVE=off -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off
//go:generate cmake --build gguf/build/cpu --target server --config Release
//go:generate cmake --build gguf/build/cpu --target server --config Release
//go:generate cmd /c move gguf\build\cpu\bin\Release\server.exe gguf\build\cpu\bin\Release\ollama-runner.exe
//go:generate cmd /c move gguf\build\cpu\bin\Release\server.exe gguf\build\cpu\bin\Release\ollama-runner.exe
//go:generate cmake -S ggml -B ggml/build/cuda -DLLAMA_CUBLAS=on -DLLAMA_ACCELERATE=on -DLLAMA_K_QUANTS=on
//go:generate cmake --build ggml/build/cuda --target server --config Release
//go:generate cmd /c move ggml\build\cuda\bin\Release\server.exe ggml\build\cuda\bin\Release\ollama-runner.exe
//go:generate cmake -S gguf -B gguf/build/cuda -DLLAMA_CUBLAS=on -DLLAMA_ACCELERATE=on -DLLAMA_K_QUANTS=on -DLLAMA_NATIVE=off -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off
//go:generate cmake --build gguf/build/cuda --target server --config Release
//go:generate cmd /c move gguf\build\cuda\bin\Release\server.exe gguf\build\cuda\bin\Release\ollama-runner.exe
llm/llama.go
View file @
82b9b329
...
@@ -84,6 +84,7 @@ func chooseRunners(workDir, runnerType string) []ModelRunner {
...
@@ -84,6 +84,7 @@ func chooseRunners(workDir, runnerType string) []ModelRunner {
case
"windows"
:
case
"windows"
:
// TODO: select windows GPU runner here when available
// TODO: select windows GPU runner here when available
runners
=
[]
ModelRunner
{
runners
=
[]
ModelRunner
{
{
Path
:
path
.
Join
(
buildPath
,
"cuda"
,
"bin"
,
"Release"
,
"ollama-runner.exe"
),
Accelerated
:
true
},
{
Path
:
path
.
Join
(
buildPath
,
"cpu"
,
"bin"
,
"Release"
,
"ollama-runner.exe"
)},
{
Path
:
path
.
Join
(
buildPath
,
"cpu"
,
"bin"
,
"Release"
,
"ollama-runner.exe"
)},
}
}
default
:
default
:
...
@@ -269,7 +270,7 @@ func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
...
@@ -269,7 +270,7 @@ func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
if
opts
.
NumGPU
!=
-
1
{
if
opts
.
NumGPU
!=
-
1
{
return
opts
.
NumGPU
return
opts
.
NumGPU
}
}
if
runtime
.
GOOS
==
"linux"
{
if
runtime
.
GOOS
==
"linux"
||
runtime
.
GOOS
==
"windows"
{
freeBytes
,
err
:=
CheckVRAM
()
freeBytes
,
err
:=
CheckVRAM
()
if
err
!=
nil
{
if
err
!=
nil
{
if
!
errors
.
Is
(
err
,
errNvidiaSMI
)
{
if
!
errors
.
Is
(
err
,
errNvidiaSMI
)
{
...
...
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