code: def _get_cuda_gpus():
      """
      Returns a list of dictionaries, with the following keys:
      - index (integer, device index of the GPU)
      - name (str, GPU name)
      - memory_free (float, free memory in MiB)
      - memory_total (float, total memory in MiB)
      """
      import subprocess
  
      try:
          output = subprocess.check_output(
              [
                  "nvidia-smi",
                  "--query-gpu=index,gpu_name,memory.free,memory.total",
                  "--format=csv,noheader,nounits",
              ],
              universal_newlines=True,
          )
      except OSError:
          return []
      except subprocess.CalledProcessError:
          return []
  
      gpus = []
      for gpu_line in output.split("\n"):
          if gpu_line:
              (
                  index,
                  gpu_name,
                  memory_free,
                  memory_total,
              ) = gpu_line.split(", ")
              index = int(index)
              memory_free = float(memory_free)
              memory_total = float(memory_total)
              gpus.append(
                  {
                      "index": index,
                      "name": gpu_name,
                      "memory_free": memory_free,
                      "memory_total": memory_total,
                  }
              )
      return gpus
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import os
  import urllib
  import re
  import itertools
  import uuid
  import datetime
  import sys
  from ._sframe_generation import generate_random_sframe
  from ._sframe_generation import generate_random_regression_sframe
  from ._sframe_generation import generate_random_classification_sframe
  from ._type_checks import _raise_error_if_not_of_type
  from ._type_checks import _is_non_string_iterable
  from ._progress_table_printer import ProgressTablePrinter
label_desc: Use image node_id 18 for calling a global function with example usage: _get_cuda_gpus() and returns: gpus, list, list