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","."]
docstr: Initialize the stream pool only for once.
docstr_tok: ["Initialize","the","stream","pool","only","for","once","."]
code: def _init_once(self):
      """Initialize the stream pool only for once."""
      with nccl_util.Device(self.device_idx):
          for i in range(NCCL_STREAM_POOL_SIZE):
              # this is the only place where self._pool will be written.
              if ENV.NCCL_USE_MULTISTREAM.val:
                  logger.debug("NCCL multistream enabled.")
                  self._pool[i] = cupy.cuda.Stream(
                      null=False, non_blocking=False
                  )
              else:
                  logger.debug("NCCL multistream disabled.")
                  self._pool[i] = cupy.cuda.Stream.null
      self._init_flag = True
  
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 3 for calling the StreamPool obj's underlying member method code with example usage: obj._init_once() without return types