code: def _raw_device_count_nvml() -> int:
      """Return number of devices as reported by NVML or negative value if NVML discovery/initialization failed."""
      from ctypes import CDLL, byref, c_int
  
      nvml_h = CDLL("libnvidia-ml.so.1")
      rc = nvml_h.nvmlInit()
      if rc != 0:
          warnings.warn("Can't initialize NVML")
          return -1
      dev_count = c_int(-1)
      rc = nvml_h.nvmlDeviceGetCount_v2(byref(dev_count))
      if rc != 0:
          warnings.warn("Can't get nvml device count")
          return -1
      del nvml_h
      return dev_count.value
  
imports: import os
  import warnings
  from contextlib import contextmanager
  from functools import lru_cache
  from typing import Generator, List, Optional, Union, cast
  import torch
  from typing_extensions import override
  from lightning.fabric.accelerators.accelerator import Accelerator
  from lightning.fabric.accelerators.registry import _AcceleratorRegistry
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.fabric.utilities.rank_zero import rank_zero_info
label_desc: Use image node_id 7 for calling a global function with example usage: _raw_device_count_nvml() and returns: dev_count, unknown, unknown