docstr: query nvidia gpu count, available on Windows and Linux
docstr_tok: ["query","nvidia","gpu","count",",","available","on","Windows","and","Linux"]
code: def from_system(cls) -> list[int]:
      """
      query nvidia gpu count, available on Windows and Linux
      """
      import pynvml  # type: ignore
  
      try:
          pynvml.nvmlInit()
          device_count = pynvml.nvmlDeviceGetCount()
          return list(range(device_count))
      except (pynvml.NVMLError_LibraryNotFound, OSError):
          logger.debug(
              "GPU not detected. Unable to initialize pynvml lib."
          )
          return []
      finally:
          try:
              pynvml.nvmlShutdown()
          except Exception:  # pylint: disable=broad-except
              pass
  
imports: from __future__ import annotations
  import functools
  import logging
  import math
  import os
  import re
  import typing
  from abc import ABC
  from abc import abstractmethod
  import psutil
  from ..exceptions import BentoMLConfigException
label_desc: Use image node_id 2 for calling the NvidiaGpuResource obj's underlying member method code with example usage: obj.from_system(cls) and returns: list, list