Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
044036e2
Commit
044036e2
authored
Feb 28, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix count_vulkan_devices to correctly count GPU devices and exclude CPU devices
parent
a62cb69d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
coderai
coderai
+18
-14
No files found.
coderai
View file @
044036e2
...
...
@@ -625,22 +625,26 @@ class VulkanBackend(ModelBackend):
def
count_vulkan_devices
(
self
):
"""Count the number of Vulkan GPU devices available."""
# llama.cpp filters out some devices (like CPU llvmpipe), so we need to
# count only the devices that llama.cpp will actually use
try
:
from
llama_cpp
import
llama_get_devices
devices
=
llama_get_devices
()
return
len
(
devices
)
import
subprocess
result
=
subprocess
.
run
([
'vulkaninfo'
,
'--summary'
],
capture_output
=
True
,
text
=
True
)
if
result
.
returncode
==
0
:
# Count GPU0, GPU1, etc. entries (these are actual GPUs, not CPU)
import
re
gpu_matches
=
re
.
findall
(
r'^GPU\d+:'
,
result
.
stdout
,
re
.
MULTILINE
)
# Filter out CPU devices (llvmpipe)
non_cpu_gpus
=
0
for
i
,
match
in
enumerate
(
gpu_matches
):
# Check if this GPU is a CPU device
gpu_section
=
result
.
stdout
.
split
(
match
)[
1
]
.
split
(
'
\n
GPU'
)[
0
]
if
i
<
len
(
gpu_matches
)
-
1
else
result
.
stdout
.
split
(
match
)[
1
]
if
'llvmpipe'
not
in
gpu_section
and
'CPU'
not
in
gpu_section
:
non_cpu_gpus
+=
1
return
max
(
non_cpu_gpus
,
1
)
except
:
# Fallback: try to parse vulkaninfo
try
:
import
subprocess
result
=
subprocess
.
run
([
'vulkaninfo'
,
'--summary'
],
capture_output
=
True
,
text
=
True
)
if
result
.
returncode
==
0
:
# Count GPU devices in output
gpu_count
=
result
.
stdout
.
count
(
'GPU'
)
+
result
.
stdout
.
count
(
'device'
)
return
max
(
gpu_count
,
1
)
except
:
pass
return
2
# Default to 2 if we can't detect
pass
return
2
# Default to 2 (common for NVIDIA + AMD setups)
def
load_model
(
self
,
model_name
:
str
,
**
kwargs
)
->
None
:
"""Load a GGUF model using llama-cpp-python."""
...
...
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