def __init__(self, iterators, optimizer, converter=convert.concat_examples, devices=None, auto_new_epoch=True):
    if (not MultiprocessParallelUpdater.available()):
        raise Exception('NCCL is not enabled. MultiprocessParallelUpdater requires NCCL.\nPlease reinstall CuPy after you install NCCL.\n(see https://docs-cupy.chainer.org/en/latest/install.html)')
    try:
        cuda.cupy.cuda.driver.ctxGetCurrent()
        _cuda_initialized = True
    except cuda.cupy.cuda.driver.CUDADriverError:
        _cuda_initialized = False
    if _cuda_initialized:
        raise RuntimeError('The CUDA context has been already initialized. MultiprocessParallelUpdater assumes the context is uninitialized. Please do not call CUDA API before MultiprocessParallelUpdater creates processes.')
    assert (len(iterators) == len(devices))
    for iterator in iterators[1:]:
        assert (len(iterator.dataset) == len(iterators[0].dataset))
    optim = optimizer.__class__.__name__
    if (optim in ('Adam', 'AdaGrad', 'RMSprop')):
        optimizer.eps *= len(devices)
        warnings.warn('optimizer.eps is changed to {} by MultiprocessParallelUpdater for new batch size.'.format(optimizer.eps))
    elif (optim in ('RMSpropGraves', 'AdaDelta')):
        optimizer.eps *= (len(devices) ** 2)
        warnings.warn('optimizer.eps is changed to {} by MultiprocessParallelUpdater for new batch size.'.format(optimizer.eps))
    elif hasattr(optimizer, 'lr'):
        optimizer.lr /= len(devices)
        warnings.warn('optimizer.lr is changed to {} by MultiprocessParallelUpdater for new batch size.'.format(optimizer.lr))
    super(MultiprocessParallelUpdater, self).__init__(iterator=iterators[0], optimizer=optimizer, converter=converter, auto_new_epoch=auto_new_epoch)
    if isinstance(devices, dict):
        devices = devices.copy()
        main = devices.pop('main')
        devices = list(six.itervalues(devices))
        devices = ([main] + devices)
    elif isinstance(devices, (list, tuple)):
        devices = list(devices)
    else:
        raise ValueError('devices argument should be either dict, list or tuple, but {} was given.'.format(type(devices)))
    if ((devices is None) or any(((device is None) for device in devices))):
        raise ValueError('must specify GPU devices')
    self._master = optimizer.target
    self._devices = devices
    self._mpu_iterators = iterators
    self._initialized = False
    self._pipes = []
    self._workers = []
    self.comm = None
def __init__(self, iterators, optimizer, converter=convert.concat_examples, devices=None, auto_new_epoch=True):
    if (not MultiprocessParallelUpdater.available()):
        raise Exception('NCCL is not enabled. MultiprocessParallelUpdater requires NCCL.\nPlease reinstall CuPy after you install NCCL.\n(see https://docs-cupy.chainer.org/en/latest/install.html)')
    try:
        cuda.cupy.cuda.driver.ctxGetCurrent()
        _cuda_initialized = True
    except cuda.cupy.cuda.driver.CUDADriverError:
        _cuda_initialized = False
    if _cuda_initialized:
        raise RuntimeError('The CUDA context has been already initialized. MultiprocessParallelUpdater assumes the context is uninitialized. Please do not call CUDA API before MultiprocessParallelUpdater creates processes.')
    assert (len(iterators) == len(devices))
    for iterator in iterators[1:]:
        assert (len(iterator.dataset) == len(iterators[0].dataset))
    optim = optimizer.__class__.__name__
    if (optim in ('Adam', 'AdaGrad', 'RMSprop')):
        optimizer.eps *= len(devices)
        warnings.warn('optimizer.eps is changed to {} by MultiprocessParallelUpdater for new batch size.'.format(optimizer.eps))
    elif (optim in ('RMSpropGraves', 'AdaDelta')):
        optimizer.eps *= (len(devices) ** 2)
        warnings.warn('optimizer.eps is changed to {} by MultiprocessParallelUpdater for new batch size.'.format(optimizer.eps))
    elif hasattr(optimizer, 'lr'):
        optimizer.lr /= len(devices)
        warnings.warn('optimizer.lr is changed to {} by MultiprocessParallelUpdater for new batch size.'.format(optimizer.lr))
    super(MultiprocessParallelUpdater, self).__init__(iterator=iterators[0], optimizer=optimizer, converter=converter, auto_new_epoch=auto_new_epoch)
    if isinstance(devices, dict):
        devices = devices.copy()
        main = devices.pop('main')
        devices = list(six.itervalues(devices))
        devices = ([main] + devices)
    elif isinstance(devices, (list, tuple)):
        devices = list(devices)
    else:
        raise ValueError('devices argument should be either dict, list or tuple, but {} was given.'.format(type(devices)))
    if ((devices is None) or any(((device is None) for device in devices))):
        raise ValueError('must specify GPU devices')
    self._master = optimizer.target
    self._devices = devices
    self._mpu_iterators = iterators
    self._initialized = False
    self._pipes = []
    self._workers = []
    self.comm = None