code: def distribute_over_gpus(
      sweep_config: DictConfig | ListConfig, folder: str | None = None
  ):
      """Distribute metric collection over all available GPUs. This is done by splitting the list of configurations."""
      with ProcessPoolExecutor(
          max_workers=torch.cuda.device_count(),
          mp_context=multiprocessing.get_context("spawn"),
      ) as executor:
          run_configs = list(get_run_config(sweep_config.grid_search))
          jobs = []
          for device_id, run_split in enumerate(
              range(
                  0,
                  len(run_configs),
                  math.ceil(
                      len(run_configs) / torch.cuda.device_count()
                  ),
              )
          ):
              jobs.append(
                  executor.submit(
                      compute_on_gpu,
                      run_configs[
                          run_split : run_split
                          + math.ceil(
                              len(run_configs)
                              / torch.cuda.device_count()
                          )
                      ],
                      device_id + 1,
                      sweep_config.seed,
                      sweep_config.writer,
                      folder,
                      sweep_config.compute_openvino,
                  )
              )
          for job in jobs:
              try:
                  job.result()
              except Exception as exc:
                  raise Exception(
                      f"Error occurred while computing benchmark on GPU {job}"
                  ) from exc
  
imports: from __future__ import annotations
  import functools
  import io
  import logging
  import math
  import multiprocessing
  import sys
  import time
  import warnings
  from argparse import ArgumentParser
  from concurrent.futures import ProcessPoolExecutor, as_completed
  from datetime import datetime
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import cast
  import torch
  from omegaconf import DictConfig, ListConfig, OmegaConf
  from pytorch_lightning import Trainer, seed_everything
  from utils import upload_to_comet, upload_to_wandb, write_metrics
  from anomalib.config import get_configurable_parameters, update_input_size_config
  from anomalib.data import get_datamodule
  from anomalib.deploy import export
  from anomalib.deploy.export import ExportMode
  from anomalib.models import get_model
  from anomalib.utils.loggers import configure_logger
  from anomalib.utils.sweep import get_openvino_throughput, get_run_config, get_sweep_callbacks, get_torch_throughput, set_in_nested_config
label_desc: Use image node_id 5 for calling a global function with example usage: distribute_over_gpus(sweep_config, folder) without return types