code: def _gpus():
      if not SETTINGS.HOST_INFO.INCLUDE_GPU_INFO:
          return
  
      try:
          xml = subprocess.check_output(
              ["nvidia-smi", "-q", "-x"]
          ).decode("utf-8", "replace")
      except (
          FileNotFoundError,
          OSError,
          subprocess.CalledProcessError,
      ) as e:
          raise IgnoreHostInfo() from e
  
      gpu_info = {"gpus": []}
      for child in ElementTree.fromstring(xml):
          if child.tag == "driver_version":
              gpu_info["driver_version"] = child.text
          if child.tag != "gpu":
              continue
          fb_memory_usage = (
              child.find("fb_memory_usage").find("total").text
          )
          if fb_memory_usage == "Insufficient Permissions":
              # for Multi-Instance GPU (MIG) instances
              mig = child.find("mig_devices").find("mig_device")
              fb_memory_usage = (
                  mig.find("fb_memory_usage").find("total").text
              )
          gpu = {
              "model": child.find("product_name").text,
              "total_memory": int(fb_memory_usage.split()[0]),
              "persistence_mode": (
                  child.find("persistence_mode").text == "Enabled"
              ),
          }
          gpu_info["gpus"].append(gpu)
  
      return gpu_info
  
imports: import os
  import platform
  import re
  import subprocess
  from xml.etree import ElementTree
  import warnings
  from typing import List
  import cpuinfo
  from sacred.utils import optional_kwargs_decorator
  from sacred.settings import SETTINGS
label_desc: Use image node_id 9 for calling a global function with example usage: _gpus() and returns: gpu_info