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
cc4915e2
Unverified
Commit
cc4915e2
authored
Jan 26, 2024
by
Daniel Hiltgen
Committed by
GitHub
Jan 26, 2024
Browse files
Merge pull request #2214 from dhiltgen/reject_cuda_without_avx
Detect lack of AVX and fallback to CPU mode
parents
e054ebe0
667a2ba1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
gpu/gpu.go
gpu/gpu.go
+9
-3
No files found.
gpu/gpu.go
View file @
cc4915e2
...
...
@@ -122,9 +122,15 @@ func GetGPUInfo() GpuInfo {
initGPUHandles
()
}
// All our GPU builds have AVX enabled, so fallback to CPU if we don't detect at least AVX
cpuVariant
:=
GetCPUVariant
()
if
cpuVariant
==
""
{
slog
.
Warn
(
"CPU does not have AVX or AVX2, disabling GPU support."
)
}
var
memInfo
C
.
mem_info_t
resp
:=
GpuInfo
{}
if
gpuHandles
.
cuda
!=
nil
{
if
gpuHandles
.
cuda
!=
nil
&&
cpuVariant
!=
""
{
C
.
cuda_check_vram
(
*
gpuHandles
.
cuda
,
&
memInfo
)
if
memInfo
.
err
!=
nil
{
slog
.
Info
(
fmt
.
Sprintf
(
"error looking up CUDA GPU memory: %s"
,
C
.
GoString
(
memInfo
.
err
)))
...
...
@@ -143,7 +149,7 @@ func GetGPUInfo() GpuInfo {
slog
.
Info
(
fmt
.
Sprintf
(
"CUDA GPU is too old. Falling back to CPU mode. Compute Capability detected: %d.%d"
,
cc
.
major
,
cc
.
minor
))
}
}
}
else
if
gpuHandles
.
rocm
!=
nil
{
}
else
if
gpuHandles
.
rocm
!=
nil
&&
cpuVariant
!=
""
{
C
.
rocm_check_vram
(
*
gpuHandles
.
rocm
,
&
memInfo
)
if
memInfo
.
err
!=
nil
{
slog
.
Info
(
fmt
.
Sprintf
(
"error looking up ROCm GPU memory: %s"
,
C
.
GoString
(
memInfo
.
err
)))
...
...
@@ -185,7 +191,7 @@ func GetGPUInfo() GpuInfo {
if
resp
.
Library
==
""
{
C
.
cpu_check_ram
(
&
memInfo
)
resp
.
Library
=
"cpu"
resp
.
Variant
=
GetCPU
Variant
()
resp
.
Variant
=
cpu
Variant
}
if
memInfo
.
err
!=
nil
{
slog
.
Info
(
fmt
.
Sprintf
(
"error looking up CPU memory: %s"
,
C
.
GoString
(
memInfo
.
err
)))
...
...
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