Skip to content

Commit 4fc20b9

Browse files
committed
remove try except case
Signed-off-by: Isotr0py <2037008807@qq.com>
1 parent ad1c5a4 commit 4fc20b9

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

vllm/distributed/device_communicators/cpu_communicator.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
import torch
77
from torch.distributed import ProcessGroup
88

9-
from vllm.logger import init_logger
109
from vllm.platforms import current_platform
1110
from vllm.platforms.interface import CpuArchEnum
1211

1312
from .base_device_communicator import DeviceCommunicatorBase
1413

15-
logger = init_logger(__name__)
16-
1714

1815
class CpuCommunicator(DeviceCommunicatorBase):
1916

@@ -25,13 +22,9 @@ def __init__(self,
2522
super().__init__(cpu_group, device, device_group, unique_name)
2623
self.dist_module = torch.distributed
2724

28-
if current_platform.get_cpu_architecture() == CpuArchEnum.X86:
29-
try:
30-
self.dist_module = _CPUSHMDistributed(self)
31-
except AttributeError:
32-
logger.warning_once(
33-
"CPUSHM is unavailable for non-avx512 CPUs yet. "
34-
"Falling back to torch native CPU communicator.")
25+
if (current_platform.get_cpu_architecture() == CpuArchEnum.X86) \
26+
and hasattr(torch.ops._C, "init_shm_manager"):
27+
self.dist_module = _CPUSHMDistributed(self)
3528

3629
def all_reduce(self, input_):
3730
self.dist_module.all_reduce(input_, group=self.device_group)

0 commit comments

Comments
 (0)