fix: hide amd-smi console popups on Windows, guard torch.distributed.is_initialized for ROCm #5301
This commit is contained in:
parent
bafb3f54df
commit
2de2c29d3a
2 changed files with 4 additions and 1 deletions
|
|
@ -13,10 +13,12 @@ import math
|
|||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import Any, Optional
|
||||
|
||||
from loggers import get_logger
|
||||
from utils.native_path_leases import child_env_without_native_path_secret
|
||||
from utils.subprocess_compat import windows_hidden_subprocess_kwargs
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
|
@ -30,6 +32,7 @@ def _run_amd_smi(*args: str, timeout: int = 5) -> Optional[Any]:
|
|||
text = True,
|
||||
timeout = timeout,
|
||||
env = child_env_without_native_path_secret(),
|
||||
**windows_hidden_subprocess_kwargs(),
|
||||
)
|
||||
except (OSError, subprocess.TimeoutExpired) as e:
|
||||
logger.warning("amd-smi query failed: %s", e)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ def _get_env_int(keys):
|
|||
|
||||
|
||||
def _infer_distributed_ranks():
|
||||
if torch.distributed.is_available() and torch.distributed.is_initialized():
|
||||
if torch.distributed.is_available() and getattr(torch.distributed, "is_initialized", lambda: False)():
|
||||
try:
|
||||
return torch.distributed.get_rank(), torch.distributed.get_world_size()
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue