Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import torchada # noqa: F401
|
|||||||
# isort: on
|
# isort: on
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
|
from sglang.multimodal_gen import envs
|
||||||
from sglang.multimodal_gen.runtime.platforms.interface import (
|
from sglang.multimodal_gen.runtime.platforms.interface import (
|
||||||
AttentionBackendEnum,
|
AttentionBackendEnum,
|
||||||
DeviceCapability,
|
DeviceCapability,
|
||||||
@@ -70,6 +71,10 @@ class MusaPlatformBase(Platform):
|
|||||||
dispatch_key: str = "MUSA"
|
dispatch_key: str = "MUSA"
|
||||||
device_control_env_var: str = "MUSA_VISIBLE_DEVICES"
|
device_control_env_var: str = "MUSA_VISIBLE_DEVICES"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_local_torch_device(cls) -> torch.device:
|
||||||
|
return torch.device(f"musa:{envs.LOCAL_RANK}")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_device_capability(cls, device_id: int = 0) -> DeviceCapability | None:
|
def get_device_capability(cls, device_id: int = 0) -> DeviceCapability | None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@@ -120,6 +125,9 @@ class MusaPlatformBase(Platform):
|
|||||||
if empty_cache:
|
if empty_cache:
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
|
if torch.distributed.is_initialized():
|
||||||
|
device_id = torch.distributed.get_rank()
|
||||||
|
|
||||||
device_props = torch.cuda.get_device_properties(device_id)
|
device_props = torch.cuda.get_device_properties(device_id)
|
||||||
if device_props.is_integrated:
|
if device_props.is_integrated:
|
||||||
free_gpu_memory = psutil.virtual_memory().available
|
free_gpu_memory = psutil.virtual_memory().available
|
||||||
|
|||||||
Reference in New Issue
Block a user