code: def get_default_device(default=0):
      from warnings import warn
  
      warn(
          "get_default_device() is deprecated; "
          "use make_default_context() instead",
          DeprecationWarning,
      )
  
      from pycuda.driver import Device
      import os
  
      dev = os.environ.get("CUDA_DEVICE")
  
      if dev is None:
          try:
              dev = (
                  open(
                      os.path.join(
                          os.path.expanduser("~"), ".cuda_device"
                      )
                  )
                  .read()
                  .strip()
              )
          except Exception:
              pass
  
      if dev is None:
          dev = default
  
      try:
          dev = int(dev)
      except TypeError:
          raise TypeError(
              "CUDA device number (CUDA_DEVICE or ~/.cuda-device) "
              "must be an integer"
          )
  
      return Device(dev)
  
imports: import pycuda.driver
  import pycuda._driver
  import numpy
  from pycuda.compyte.dtypes import register_dtype, get_or_register_dtype, _fill_dtype_registry, dtype_to_ctype
label_desc: Use image node_id 1 for calling a global function with example usage: get_default_device(default) and returns: Device