code: def num_fitting_processes(
      cpus_per_process: float = 2, memory_per_process: float = 16
  ) -> int:
      """
      Returns the number of processes that can be fitted onto the machine when
      using a particular number of CPUs and a particular amount of memory for
      every process.
  
      Args:
          cpus_per_process: The number of CPUs that every process requires.
          memory_per_process: The memory in GiB that every process needs.
  
      Returns:
          The number of processes to use.
      """
      num_processes_cpu = math.floor(
          cast(int, os.cpu_count()) / cpus_per_process
      )
  
      available_gib = psutil.virtual_memory().total / (1024**3)
      num_processes_memory = math.floor(
          available_gib / memory_per_process
      )
  
      return min(num_processes_cpu, num_processes_memory)
  
file_path: gluonts/src/gluonts/nursery/tsbench/src/tsbench/analysis/utils/multiprocessing.py
imports: import math
  import multiprocessing
  import os
  from multiprocessing.pool import ThreadPool
  from queue import Empty
  from typing import Any, Callable, cast, List, TypeVar
  import psutil
  from tqdm.auto import tqdm
label_desc: Use image node_id 1 for calling a global function with example usage: num_fitting_processes(cpus_per_process, memory_per_process) and returns: min