def setup_sizes(self):
        """Calculate the local sizes of all relevant variables
        and share those across all processes in the communicator.
        """
        # find all local systems
        sys_stack = [self._system]
        loc_comps = []

        while sys_stack:
            system = sys_stack.pop()
            loc_comps.extend([s.name for s in system.simple_subsystems()
                                    if s._comp is not None])
            sys_stack.extend(system.local_subsystems())
            if isinstance(system, OpaqueSystem):
                sys_stack.append(system._inner_system)

        loc_comps = set(loc_comps)
        loc_comps.add(None)

        # loop over all component inputs and boundary outputs and
        # set them to their sources so that they'll be sized properly
        for node, data in self._reduced_graph.nodes_iter(data=True):
            if 'comp' not in data:
                src = node[0]
                scomp = src.split('.', 1)[0] if '.' in src else None
                dist_src = False
                ssys = None
                if scomp and scomp in self._reduced_graph:
                    ssys = self._reduced_graph.node[scomp]['system']

                sval, idx = get_val_and_index(self, src)
                if isinstance(sval, ndarray):
                    dests = node[1]
                    for dest in dests:
                        dcomp = dest.split('.',1)[0] if '.' in dest else None
                        if dcomp in loc_comps:
                            if dcomp:
                                dsys = self._reduced_graph.node[dcomp]['system']
                                # don't overwrite inputs if they have distrib_idxs declared, because those
                                # determine the size
                                if dsys.is_distrib_var(node):
                                    continue
                                elif ssys and ssys.is_distrib_var(node):
                                    continue
                            dval, didx = get_val_and_index(self, dest)
                            if isinstance(dval, ndarray):
                                if sval.shape != dval.shape:
                                    self.set(dest, sval)

        # this will calculate sizes for all subsystems
        self._system.setup_sizes()
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/assembly.py/Assembly.setup_sizes/original