code: def test_all_gather(seed, comm_nccl_opts):
      if comm_nccl_opts is None:
          pytest.skip(
              "Communicator test is disabled. You can turn it on by an option `--test-communicator`."
          )
      if len(comm_nccl_opts.devices) < 2:
          pytest.skip(
              "Communicator test is disabled. Use more than 1 gpus."
          )
  
      comm = comm_nccl_opts.comm
      device_id = int(comm_nccl_opts.device_id)
      n_devices = len(comm_nccl_opts.devices)
  
      # Variables
      rng = np.random.RandomState(seed)
      x_data = rng.rand(3, 4)
      x = nn.Variable(x_data.shape)
      x.d = x_data * device_id
      y_list = []
      for i in range(n_devices):
          y = nn.Variable(x_data.shape)
          y_list.append(y)
  
      # AllGahter
      comm.all_gather(x.data, [y.data for y in y_list])
  
      # Ref
      refs = ref_all_gather(x_data, n_devices)
  
      # Check
      for y, ref in zip(y_list, refs):
          assert_allclose(y.d, ref, rtol=1e-3, atol=1e-6)
  
imports: import pytest
  import nnabla
  import nnabla.parametric_functions
  import numpy
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 2 for calling a global function with example usage: test_all_gather(seed, comm_nccl_opts) without return types