class_docstr: Packs workers together but does not guarantee balanced hosts.
  
  Will use the current placement group if one is available.
class_docstr_tok: ["Packs","workers","together","but","does","not","guarantee","balanced","hosts",".","Will","use","the","current","placement","group","if","one","is","available","."]
code: def __init__(
      self,
      *,
      settings,
      num_workers,
      use_gpu,
      cpus_per_worker,
      gpus_per_worker,
      placement_group=None,
      force_create_placement_group=False,
  ):
      self.settings = settings
      self._num_workers = num_workers
      self.cpus_per_worker = cpus_per_worker
      self.gpus_per_worker = gpus_per_worker or 1
      self.use_gpu = use_gpu
      if force_create_placement_group:
          self.placement_group = None
      else:
          self.placement_group = (
              placement_group or get_current_placement_group()
          )
      self._placement_group_bundles = (
          self.placement_group.bundle_specs
          if self.placement_group
          else None
      )
      self._created_placement_group = False
  
imports: from collections import defaultdict
  import logging
  from typing import Dict
  import ray
  from ray.util.placement_group import get_current_placement_group
  from horovod.ray.utils import map_blocking
  from horovod.ray.worker import BaseHorovodWorker
label_desc: Use image node_id 1 to create a new PGStrategy object from inherited base classes: BaseStrategy with example: obj = PGStrategy()