Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
d67cc21b
Unverified
Commit
d67cc21b
authored
Feb 17, 2025
by
Isotr0py
Committed by
GitHub
Feb 16, 2025
Browse files
[Bugfix][Platform][CPU] Fix cuda platform detection on CPU backend edge case (#13358)
Signed-off-by:
Isotr0py
<
2037008807@qq.com
>
parent
e18227b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
vllm/platforms/__init__.py
vllm/platforms/__init__.py
+9
-2
No files found.
vllm/platforms/__init__.py
View file @
d67cc21b
...
...
@@ -33,12 +33,19 @@ def cuda_platform_plugin() -> Optional[str]:
is_cuda
=
False
try
:
from
importlib.metadata
import
version
from
vllm.utils
import
import_pynvml
pynvml
=
import_pynvml
()
pynvml
.
nvmlInit
()
try
:
if
pynvml
.
nvmlDeviceGetCount
()
>
0
:
is_cuda
=
True
# NOTE: Edge case: vllm cpu build on a GPU machine.
# Third-party pynvml can be imported in cpu build,
# we need to check if vllm is built with cpu too.
# Otherwise, vllm will always activate cuda plugin
# on a GPU machine, even if in a cpu build.
is_cuda
=
(
pynvml
.
nvmlDeviceGetCount
()
>
0
and
"cpu"
not
in
version
(
"vllm"
))
finally
:
pynvml
.
nvmlShutdown
()
except
Exception
as
e
:
...
...
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