def _update_params(param_arrays, grad_arrays, updater, num_device, kvstore=
    None, param_names=None):
    """Perform update of param_arrays from grad_arrays not on kvstore."""
    updates = [[] for _ in range(num_device)]
    for i, pair in enumerate(zip(param_arrays, grad_arrays)):
        arg_list, grad_list = pair
        if grad_list[0] is None:
            continue
        index = i
        if kvstore:
            name = param_names[index]
            kvstore.push(name, grad_list, priority=-index)
            kvstore.pull(name, grad_list, priority=-index)
        for k, p in enumerate(zip(arg_list, grad_list)):
            w, g = p
            updates[k].append((index * num_device + k, g, w))
    for dev_updates in updates:
        if dev_updates:
            i, w, g = zip(*dev_updates)
            updater(i, w, g)
