code: def _get_compatible_gpus_v01(
      micro_batches,
      max_acceptable_batch_size,
      min_gpus=None,
      max_gpus=None,
      prefer_larger=True,
  ):
      """We use two heuristics to compute the batch size
          1. We use the Lowest Common Multiple of the micro-batches
      as the base batch size and scale it by a HCN such that the result is
      the largest batch size less than the max_acceptable batch size
          2. We use each of the micro batches as a base and scale it
      by a HCN such that the result is the largest batch size less than the
      max_acceptable batch size.
  
      We then use brute force to count the number of compatible GPU count for
      each of the aforementioned cases, and return the batch size with the most number of
      compatible GPU counts in the min-max GPU range if provided, other wise
      we return the batch size with the most number of total compatible GPU counts.
  
      Returns:
          final_batch_size
          valid_gpus
      """
      min_gpus = min_gpus or 1
      max_gpus = max_gpus or max_acceptable_batch_size // min(
          micro_batches
      )
  
      if not all(
          mb <= max_acceptable_batch_size for mb in micro_batches
      ):
          raise ValueError(
              f"All micro batches must be less than \
              or equal to max_acceptable_batch_size: {max_acceptable_batch_size}"
          )
  
      lcm = np.lcm.reduce(micro_batches)
  
      base_list = []
      base_list.extend(micro_batches)
      base_list.append(lcm)
  
      candidate_batch_sizes = get_candidate_batch_sizes(
          base_list, max_acceptable_batch_size
      )
  
      final_batch_size, valid_gpus = get_best_candidates(
          candidate_batch_sizes,
          micro_batches,
          min_gpus,
          max_gpus,
          prefer_larger,
      )
  
      return final_batch_size, valid_gpus
  
file_path: DeepSpeed/deepspeed/elasticity/elasticity.py
imports: import os
  import json
  import numpy
  import math
  from packaging import version
  from .config import ElasticityConfig, ElasticityConfigError, ElasticityError, ElasticityIncompatibleWorldSize
  from .constants import ELASTICITY, ENABLED, ENABLED_DEFAULT, LATEST_ELASTICITY_VERSION, MINIMUM_DEEPSPEED_VERSION, DEEPSPEED_ELASTICITY_CONFIG
  from ..git_version_info import version
  from ..utils import logger
label_desc: Use image node_id 4 for calling a global function with example usage: _get_compatible_gpus_v01(micro_batches, max_acceptable_batch_size, min_gpus, max_gpus, prefer_larger) and returns: final_batch_size,  valid_gpus