class_docstr: The class that represents a stream pool associated with a GPU.
  
  When multistream is enabled, we will allocate a pool of streams for each
  GPU, and get available stream from this pool when a collective kernel is
  initialized. This enables overlapping computation/communication kernels
  using multiple CUDA streams, given that the streams a appropriately
  synchronized. The class is thread-safe.
  
  
  Args:
      device_idx: the absolute index of the device for this pool.
class_docstr_tok: ["The","class","that","represents","a","stream","pool","associated","with","a","GPU",".","When","multistream","is","enabled",",","we","will","allocate","a","pool","of","streams","for","each","GPU",",","and","get","available","stream","from","this","pool","when","a","collective","kernel","is","initialized",".","This","enables","overlapping","computation\/communication","kernels","using","multiple","CUDA","streams",",","given","that","the","streams","a","appropriately","synchronized",".","The","class","is","thread-safe",".","Args",":","device_idx",":","the","absolute","index","of","the","device","for","this","pool","."]
code: def __init__(self, device_idx):
      self.device_idx = device_idx
  
      self._initialized = False
      self._initialized_lock = threading.Lock()
  
      self._pool = [None] * NCCL_STREAM_POOL_SIZE
      self._counter = 0
      self._pool_lock = threading.Lock()
  
file_path: ray/python/ray/util/collective/collective_group/cuda_stream.py
imports: import logging
  import threading
  import cupy
  from ray.util.collective.collective_group import nccl_util
  from ray.util.collective.const import ENV
label_desc: Use image node_id 1 to create a new StreamPool object  with example: obj = StreamPool(device_idx)