code: def distributed(request, local_rank, world_size):
      if request.param in ("nccl", "gloo_cpu", "gloo"):
          if "gloo" in request.param and sys.platform.startswith("win"):
              temp_file = tempfile.NamedTemporaryFile(delete=False)
              # can't use backslashes in f-strings
              backslash = "\\"
              init_method = (
                  f'file:///{temp_file.name.replace(backslash, "/")}'
              )
          else:
              temp_file = None
              free_port = _setup_free_port(local_rank)
              init_method = f"tcp://localhost:{free_port}"
  
          dist_info = {
              "world_size": world_size,
              "rank": local_rank,
              "init_method": init_method,
          }
  
          if request.param == "nccl":
              dist_info["backend"] = "nccl"
          else:
              dist_info["backend"] = "gloo"
              from datetime import timedelta
  
              dist_info["timeout"] = timedelta(seconds=60)
          yield _create_dist_context(dist_info, local_rank)
          _destroy_dist_context()
          if temp_file:
              temp_file.close()
  
      elif request.param == "horovod":
          request.node.stash[is_horovod_stash_key] = True
          yield None
  
      elif request.param in ("single_device_xla", "xla_nprocs"):
          request.node.stash[is_xla_stash_key] = True
          request.node.stash[is_xla_single_device_stash_key] = (
              request.param == "single_device_xla"
          )
          yield {
              "xla_index": -1
          } if request.param == "xla_nprocs" else None
      else:
          raise RuntimeError(
              f"Invalid parameter value for `distributed` fixture, given {request.param}"
          )
  
imports: import functools
  import os
  import shutil
  import sys
  import tempfile
  import time
  from pathlib import Path
  import pytest
  import torch
  import torch.distributed
  import ignite.distributed
label_desc: Use image node_id 26 for calling a global function with example usage: distributed(request, local_rank, world_size) without return types