code: def _test_distrib_barrier(device):
      t = torch.tensor(
          [idist.get_rank()], device=device, dtype=torch.float
      )
      true_res = sum([i for i in range(idist.get_world_size())])
  
      if idist.get_rank() == 0:
          t += 10.0
      idist.barrier()
  
      tt = idist.all_reduce(t)
      assert tt.item() == true_res + 10.0
  
file_path: ignite/tests/ignite/distributed/utils/__init__.py
imports: import pytest
  import torch
  import torch.distributed
  import ignite.distributed
  from ignite.distributed.utils import sync
  from ignite.engine import Engine, Events
label_desc: Use image node_id 10 for calling a global function with example usage: _test_distrib_barrier(device) without return types