code: def try_set_default_device(
      new_default_device, acquire_device_lock=False
  ):
      """
      Tries to set the specified device as the globally default, optionally
      acquiring an exclusive (cooperative) lock on the device (only a GPU device
      can be locked).
  
      Args:
          new_default_device (:class:`~cntk.device.DeviceDescriptor`): a
           descriptor of the device to be used as a globally default.
          acquire_device_lock (bool, defaults to `False`): whether or not a lock
           should be acquired for the specified device.
  
      The default device can only be changed if it has not yet been frozen by
      being implicitly used in any previous CNTK operation.
  
      CNTK uses cooperative locking for the device access, whereby only a single
      process can acquire a device lock. This locking mechanism allows CNTK
      processes to avoid device oversubscription only if they collectively
      choose so. In other words, the device locked by one CNTK process, can
      still be accessed by another CNTK process without acquiring any locks
      (i.e, the existing device lock can be ignored by other CNTK processes).
      This cooperative locking mechanism does not guarantee any kind of
      exclusive access to the device. The proper way to ensure exclusivity  is
      to use tools provided by NVIDIA (nvidia smi).
  
      Returns: `False` if
          * the specified device appears in the list of excluded devices;
          * `acquire_device_lock` is `True` and another process already holds a lock on the device;
          * `acquire_device_lock` is `True` and `new_default_device` corresponds to a CPU device
            (which cannot be locked).
      """
      return cntk_py.DeviceDescriptor.try_set_default_device(
          new_default_device, acquire_device_lock
      )
  
file_path: CNTK/bindings/python/cntk/device.py
imports: from enum import Enum, unique
  from .None import cntk_py
  from cntk.internal import typemap
label_desc: Use image node_id 5 for calling a global function with example usage: try_set_default_device(new_default_device, acquire_device_lock) and returns: cntk_py