code: def test_reduce_scatter(seed, division, 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)
      devices = comm_nccl_opts.devices
      n_devices = len(comm_nccl_opts.devices)
  
      # Variables
      rng = np.random.RandomState(seed)
      x_list = []
      x_data_list = []
      for i in devices:
          x_data = rng.rand(3, 4)
          x_data_list.append(x_data)
          x = nn.Variable(x_data.shape)
          x.d = x_data * (device_id + 1)
          x_list.append(x)
  
      # Reduce Scatter
      x = nn.Variable((3, 4))
      comm.reduce_scatter(
          [x.data for x in x_list], x.data, division=division
      )
  
      # Ref
      refs = ref_reduce_scatter(x_data_list, n_devices, division)
  
      # Check
      assert_allclose(x.d, refs[device_id], rtol=1e-3, atol=1e-6)
  
file_path: nnabla/python/test/communicator/test_reduce_scatter.py
imports: import pytest
  import nnabla
  import nnabla.parametric_functions
  import numpy
  from nnabla.testing import assert_allclose
  from six.moves import reduce
label_desc: Use image node_id 2 for calling a global function with example usage: test_reduce_scatter(seed, division, comm_nccl_opts) without return types