code: def test_sync(self):
      # test the case when datasize is a multiple of batchsize
      iterator = chainermn.iterators.create_synchronized_iterator(
          chainer.iterators.SerialIterator(
              self.dataset, batch_size=4, shuffle=True
          ),
          self.communicator,
      )
  
      for e in range(3):
          self.assertEqual(e, iterator.epoch)
  
          while True:
              batch = np.array(iterator.next(), dtype=np.float32)
              if self.communicator.rank == 0:
                  for rank_from in range(1, self.communicator.size):
                      _batch = self.communicator.recv(rank_from, tag=0)
                      chainer.testing.assert_allclose(batch, _batch)
              else:
                  self.communicator.send(batch, dest=0, tag=0)
  
              if iterator.is_new_epoch:
                  break
  
file_path: chainer/tests/chainermn_tests/iterators_tests/test_synchronized_iterator.py
imports: import chainer
  import chainer.testing
  import chainermn
  import numpy
  import pytest
  import unittest
label_desc: Use image node_id 2 for calling the TestSynchronizedIterator obj's underlying member method code with example usage: obj.test_sync() without return types