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
20478c4d
Unverified
Commit
20478c4d
authored
Mar 19, 2024
by
Simon Mo
Committed by
GitHub
Mar 19, 2024
Browse files
Use lru_cache for some environment detection utils (#3508)
parent
63e8b28a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
vllm/utils.py
vllm/utils.py
+5
-1
No files found.
vllm/utils.py
View file @
20478c4d
...
...
@@ -11,7 +11,7 @@ from packaging.version import parse, Version
import
psutil
import
torch
import
asyncio
from
functools
import
partial
from
functools
import
partial
,
lru_cache
from
typing
import
(
Awaitable
,
Callable
,
...
...
@@ -120,6 +120,7 @@ def is_hip() -> bool:
return
torch
.
version
.
hip
is
not
None
@
lru_cache
(
maxsize
=
None
)
def
is_neuron
()
->
bool
:
try
:
import
transformers_neuronx
...
...
@@ -128,6 +129,7 @@ def is_neuron() -> bool:
return
transformers_neuronx
is
not
None
@
lru_cache
(
maxsize
=
None
)
def
get_max_shared_memory_bytes
(
gpu
:
int
=
0
)
->
int
:
"""Returns the maximum shared memory per thread block in bytes."""
# NOTE: This import statement should be executed lazily since
...
...
@@ -151,6 +153,7 @@ def random_uuid() -> str:
return
str
(
uuid
.
uuid4
().
hex
)
@
lru_cache
(
maxsize
=
None
)
def
in_wsl
()
->
bool
:
# Reference: https://github.com/microsoft/WSL/issues/4071
return
"microsoft"
in
" "
.
join
(
uname
()).
lower
()
...
...
@@ -225,6 +228,7 @@ def set_cuda_visible_devices(device_ids: List[int]) -> None:
os
.
environ
[
"CUDA_VISIBLE_DEVICES"
]
=
","
.
join
(
map
(
str
,
device_ids
))
@
lru_cache
(
maxsize
=
None
)
def
get_nvcc_cuda_version
()
->
Optional
[
Version
]:
cuda_home
=
os
.
environ
.
get
(
'CUDA_HOME'
)
if
not
cuda_home
:
...
...
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