chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
Constants.
|
||||
|
||||
Contains constants used to setup collective groups.
|
||||
"""
|
||||
import hashlib
|
||||
import os
|
||||
from enum import Enum, auto
|
||||
|
||||
|
||||
def get_store_name(group_name: str):
|
||||
"""Generate the unique name for the NCCLUniqueID store (named actor).
|
||||
|
||||
Args:
|
||||
group_name: unique user name for the store.
|
||||
|
||||
Returns:
|
||||
SHA256-hexlified name for the store.
|
||||
"""
|
||||
if not group_name:
|
||||
raise ValueError("group_name is None.")
|
||||
hexlified_name = hashlib.sha256(group_name.encode()).hexdigest()
|
||||
return hexlified_name
|
||||
|
||||
|
||||
class ENV(Enum):
|
||||
"""ray.util.collective environment variables."""
|
||||
|
||||
NCCL_USE_MULTISTREAM = auto(), lambda v: (v or "True") == "True"
|
||||
|
||||
@property
|
||||
def val(self):
|
||||
"""Return the output of the lambda against the system's env value."""
|
||||
_, default_fn = self.value
|
||||
return default_fn(os.getenv(self.name))
|
||||
Reference in New Issue
Block a user