class_docstr: Launches processes that run a given function in parallel on XLA supported hardware, and joins them all at the
  end.
  
  The main process in which this launcher is invoked creates N so-called worker processes (using the
  `torch_xla` :func:`xmp.spawn`) that run the given function.
  Worker processes have a rank that ranges from 0 to N - 1.
  
  Note:
      - This launcher requires all objects to be pickleable.
      - It is important that the entry point to the program/script is guarded by ``if __name__ == "__main__"``.
  
  Args:
      strategy: A reference to the strategy that is used together with this launcher
code: def _wrapping_function(
      self,
      # XLA's multiprocessing returns the global index, not the local index as torch's multiprocessing
      # https://github.com/pytorch/xla/blob/v1.13.0/torch_xla/distributed/xla_multiprocessing.py#L321
      process_idx: int,
      function: Callable,
      args: Any,
      kwargs: Any,
      return_queue: Union[mp.SimpleQueue, queue.Queue],
      global_states: Optional[_GlobalStateSnapshot] = None,
  ) -> None:
      import torch_xla.core.xla_model as xm
  
      if len(xm.get_xla_supported_devices()) > 1:
          # `get_xla_supported_devices` in the spawned process returns the logical devices (2 for v2/v3 and 1 for v4)
          # so when there's more than one (multithreading), objects need to be deep-copied
          import copy
  
          function, args, kwargs = copy.deepcopy(
              (function, args, kwargs)
          )
  
      results = function(*args, **kwargs)
  
      if self._strategy.local_rank == 0:
          return_queue.put(move_data_to_device(results, "cpu"))
  
      _rank_teardown(self._strategy.local_rank)
  
file_path: pytorch-lightning/src/lightning/fabric/strategies/launchers/xla.py
imports: import queue
  import time
  from typing import TYPE_CHECKING, Any, Callable, Optional, Union
  import torch.multiprocessing
  from typing_extensions import override
  from lightning.fabric.accelerators.xla import _XLA_AVAILABLE
  from lightning.fabric.strategies.launchers.launcher import _Launcher
  from lightning.fabric.strategies.launchers.multiprocessing import _GlobalStateSnapshot
  from lightning.fabric.utilities.apply_func import move_data_to_device
label_desc: Use image node_id 4 for calling the _XLALauncher obj's underlying member method code with example usage: obj._wrapping_function(process_idx, function, args, kwargs, return_queue, global_states) without return types