Unverified Commit a1e5d781 authored by Xiaoyu Zhang's avatar Xiaoyu Zhang Committed by GitHub
Browse files

fix parallel_state.py `current_platform` bug (#9919)

parent b7361cc4
...@@ -43,6 +43,7 @@ from sglang.srt.utils import ( ...@@ -43,6 +43,7 @@ from sglang.srt.utils import (
direct_register_custom_op, direct_register_custom_op,
get_bool_env_var, get_bool_env_var,
get_int_env_var, get_int_env_var,
is_cpu,
is_cuda_alike, is_cuda_alike,
is_hip, is_hip,
is_npu, is_npu,
...@@ -51,6 +52,7 @@ from sglang.srt.utils import ( ...@@ -51,6 +52,7 @@ from sglang.srt.utils import (
) )
_is_npu = is_npu() _is_npu = is_npu()
_is_cpu = is_cpu()
IS_ONE_DEVICE_PER_PROCESS = get_bool_env_var("SGLANG_ONE_DEVICE_PER_PROCESS") IS_ONE_DEVICE_PER_PROCESS = get_bool_env_var("SGLANG_ONE_DEVICE_PER_PROCESS")
...@@ -1643,7 +1645,7 @@ def cleanup_dist_env_and_memory(shutdown_ray: bool = False): ...@@ -1643,7 +1645,7 @@ def cleanup_dist_env_and_memory(shutdown_ray: bool = False):
ray.shutdown() ray.shutdown()
gc.collect() gc.collect()
if not current_platform.is_cpu(): if not _is_cpu:
if hasattr(torch, "cuda") and torch.cuda.is_available(): if hasattr(torch, "cuda") and torch.cuda.is_available():
torch.cuda.empty_cache() torch.cuda.empty_cache()
if hasattr(torch._C, "_host_emptyCache"): if hasattr(torch._C, "_host_emptyCache"):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment