code: def _log_device_info(trainer: "pl.Trainer") -> None:
      if CUDAAccelerator.is_available():
          gpu_available = True
          gpu_type = " (cuda)"
      elif MPSAccelerator.is_available():
          gpu_available = True
          gpu_type = " (mps)"
      else:
          gpu_available = False
          gpu_type = ""
  
      gpu_used = isinstance(
          trainer.accelerator, (CUDAAccelerator, MPSAccelerator)
      )
      rank_zero_info(
          f"GPU available: {gpu_available}{gpu_type}, used: {gpu_used}"
      )
  
      num_tpu_cores = (
          trainer.num_devices
          if isinstance(trainer.accelerator, XLAAccelerator)
          else 0
      )
      rank_zero_info(
          f"TPU available: {XLAAccelerator.is_available()}, using: {num_tpu_cores} TPU cores"
      )
  
      if _graphcore_available_and_importable():
          from lightning_graphcore import IPUAccelerator
  
          num_ipus = (
              trainer.num_devices
              if isinstance(trainer.accelerator, IPUAccelerator)
              else 0
          )
          ipu_available = IPUAccelerator.is_available()
      else:
          num_ipus = 0
          ipu_available = False
      rank_zero_info(
          f"IPU available: {ipu_available}, using: {num_ipus} IPUs"
      )
  
      if _habana_available_and_importable():
          from lightning_habana import HPUAccelerator
  
          num_hpus = (
              trainer.num_devices
              if isinstance(trainer.accelerator, HPUAccelerator)
              else 0
          )
          hpu_available = HPUAccelerator.is_available()
      else:
          num_hpus = 0
          hpu_available = False
      rank_zero_info(
          f"HPU available: {hpu_available}, using: {num_hpus} HPUs"
      )
  
      if (
          CUDAAccelerator.is_available()
          and not isinstance(trainer.accelerator, CUDAAccelerator)
          or MPSAccelerator.is_available()
          and not isinstance(trainer.accelerator, MPSAccelerator)
      ):
          rank_zero_warn(
              "GPU available but not used. You can set it by doing `Trainer(accelerator='gpu')`.",
              category=PossibleUserWarning,
          )
  
      if XLAAccelerator.is_available() and not isinstance(
          trainer.accelerator, XLAAccelerator
      ):
          rank_zero_warn(
              "TPU available but not used. You can set it by doing `Trainer(accelerator='tpu')`."
          )
  
      if _graphcore_available_and_importable():
          from lightning_graphcore import IPUAccelerator
  
          if IPUAccelerator.is_available() and not isinstance(
              trainer.accelerator, IPUAccelerator
          ):
              rank_zero_warn(
                  "IPU available but not used. You can set it by doing `Trainer(accelerator='ipu')`."
              )
  
      if _habana_available_and_importable():
          from lightning_habana import HPUAccelerator
  
          if HPUAccelerator.is_available() and not isinstance(
              trainer.accelerator, HPUAccelerator
          ):
              rank_zero_warn(
                  "HPU available but not used. You can set it by doing `Trainer(accelerator='hpu')`."
              )
  
file_path: pytorch-lightning/src/lightning/pytorch/trainer/setup.py
imports: from typing import Optional, Union
  import lightning.pytorch
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch.accelerators import CUDAAccelerator, MPSAccelerator, XLAAccelerator
  from lightning.pytorch.loggers.logger import DummyLogger
  from lightning.pytorch.profilers import AdvancedProfiler, PassThroughProfiler, Profiler, PyTorchProfiler, SimpleProfiler, XLAProfiler
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.imports import _graphcore_available_and_importable, _habana_available_and_importable
  from lightning.pytorch.utilities.rank_zero import rank_zero_info, rank_zero_warn
label_desc: Use image node_id 4 for calling a global function with example usage: _log_device_info(trainer) without return types