class_docstr: Provides GPU information: a) used memory percentage, b) gpu utilization percentage values as Metric
  on each iterations.
  
  .. Note ::
  
      In case if gpu utilization reports "N/A" on a given GPU, corresponding metric value is not set.
  
  Examples:
      .. code-block:: python
  
          # Default GPU measurements
          GpuInfo().attach(trainer, name='gpu')  # metric names are 'gpu:X mem(%)', 'gpu:X util(%)'
  
          # Logging with TQDM
          ProgressBar(persist=True).attach(trainer, metric_names=['gpu:0 mem(%)', 'gpu:0 util(%)'])
          # Progress bar will looks like
          # Epoch [2/10]: [12/24]  50%|█████      , gpu:0 mem(%)=79, gpu:0 util(%)=59 [00:17<1:23]
  
          # Logging with Tensorboard
          tb_logger.attach(trainer,
                           log_handler=OutputHandler(tag="training", metric_names='all'),
                           event_name=Events.ITERATION_COMPLETED)
class_docstr_tok: ["Provides","GPU","information",":","a",")","used","memory","percentage",",","b",")","gpu","utilization","percentage","values","as","Metric","on","each","iterations",".","..","Note",":",":","In","case","if","gpu","utilization","reports","``","N\/A","''","on","a","given","GPU",",","corresponding","metric","value","is","not","set",".","Examples",":","..","code-block",":",":","python","#","Default","GPU","measurements","GpuInfo","(",")",".attach","(","trainer",",","name='gpu","'",")","#","metric","names","are","'gpu",":","X","mem","(","%",")","'",",","'gpu",":","X","util","(","%",")","'","#","Logging","with","TQDM","ProgressBar","(","persist=True",")",".attach","(","trainer",",","metric_names=","[","'gpu:0","mem","(","%",")","'",",","'gpu:0","util","(","%",")","'","]",")","#","Progress","bar","will","looks","like","#","Epoch","[","2\/10","]",":","[","12\/24","]","50","%","|\u2588\u2588\u2588\u2588\u2588",",","gpu:0","mem","(","%",")","=79",",","gpu:0","util","(","%",")","=59","[","00:17","<","1:23","]","#","Logging","with","Tensorboard","tb_logger.attach","(","trainer",",","log_handler=OutputHandler","(","tag=","''","training","''",",","metric_names='all","'",")",",","event_name=Events.ITERATION_COMPLETED",")"]
code: def __init__(self) -> None:
      try:
          from pynvml.smi import nvidia_smi
      except ImportError:
          raise ModuleNotFoundError(
              "This contrib module requires pynvml to be installed. "
              "Please install it with command: \n pip install pynvml"
          )
          # Let's check available devices
      if not torch.cuda.is_available():
          raise RuntimeError(
              "This contrib module requires available GPU"
          )
  
      # Let it fail if no libnvidia drivers or NMVL library found
      self.nvsmi = nvidia_smi.getInstance()
      super(GpuInfo, self).__init__()
  
file_path: ignite/ignite/contrib/metrics/gpu_info.py
imports: import warnings
  from typing import Any, Dict, List, Tuple, Union
  import torch
  from ignite.engine import Engine, EventEnum, Events
  from ignite.metrics import Metric
label_desc: Use image node_id 1 to create a new GpuInfo object from inherited base classes: Metric with example: obj = GpuInfo()