@@ -89,7 +89,7 @@ def __getattr__(self, key: str):
8989 return None
9090
9191 @classmethod
92- def clear_cublas_workspaces (cls ):
92+ def clear_cublas_workspaces (cls ) -> None :
9393 raise NotImplementedError
9494
9595 @classmethod
@@ -98,16 +98,33 @@ def get_vllm_worker_class(cls):
9898 raise NotImplementedError
9999
100100 @classmethod
101- def set_allocator_settings (cls ):
101+ def set_allocator_settings (cls ) -> None :
102102 """Configure memory allocator settings based on the device type."""
103103 raise NotImplementedError
104104
105105 @classmethod
106106 def get_custom_env_vars (cls ) -> dict :
107+ """
108+ Return custom environment variables specific to the platform.
109+
110+ Returns:
111+ dict: A dictionary of environment variable key-value pairs.
112+ """
107113 raise NotImplementedError
108114
109115 @classmethod
110- def update_env_vars_for_visible_devices (cls , env_vars : dict , gpu_ranks : list ):
116+ def update_env_vars_for_visible_devices (cls , env_vars : dict , gpu_ranks : list ) -> None :
117+ """
118+ Update environment variables to control device visibility.
119+
120+ Args:
121+ env_vars (dict): Dictionary of current environment variables to modify.
122+ gpu_ranks (list): List of device IDs to expose to the process.
123+
124+ Behavior:
125+ - Sets the platform-specific visibility environment variable.
126+ - Sets the corresponding Ray experimental flag if needed.
127+ """
111128 visible_devices_env_vars = {
112129 cls .device_control_env_var : "," .join (map (str , gpu_ranks )),
113130 cls .ray_experimental_noset : "1" ,
@@ -116,6 +133,12 @@ def update_env_vars_for_visible_devices(cls, env_vars: dict, gpu_ranks: list):
116133
117134 @classmethod
118135 def get_visible_gpus (cls ) -> list :
136+ """
137+ Return the list of currently visible device IDs.
138+
139+ Returns:
140+ list: A list of device ID strings parsed from the visibility environment variable.
141+ """
119142 if cls .device_control_env_var is not None :
120143 return os .environ .get (cls .device_control_env_var , "" ).split ("," )
121144 return []
0 commit comments