code: def set_cuda_visible_devices(
      actors: List[ray.actor.ActorHandle],
      actor_ips: List[str],
      ip_to_gpus: Dict[str, set],
  ):
      assert len(actors) == len(actor_ips)
  
      def set_env(key: str, val: str):
          os.environ[key] = val
  
      futures = []
      for actor, ip in zip(actors, actor_ips):
          assert ip in ip_to_gpus
  
          gpu_str = ",".join(
              [str(device) for device in sorted(ip_to_gpus[ip])]
          )
          future = actor.run_fn.remote(
              set_env, "CUDA_VISIBLE_DEVICES", gpu_str
          )
          futures.append(future)
  
      ray.get(futures)
  
imports: import os
  import socket
  import subprocess
  from collections import defaultdict
  from contextlib import closing
  from pathlib import Path
  from ray.air.util.node import _force_on_node
  import ray
  from typing import Any, List, Dict, Union, Callable
label_desc: Use image node_id 12 for calling a global function with example usage: set_cuda_visible_devices(actors, actor_ips, ip_to_gpus) without return types