def test_sellar_parallel(self):

        top = set_as_top(SellarMDF())

        top.driver.max_iteration = 25
        top.driver.add_parameter('C2.y1', low=-1e99, high=1e99)
        top.driver.add_constraint('C1.y1 = C2.y1')
        top.driver.add_parameter('C1.y2', low=-1.e99, high=1.e99)
        top.driver.add_constraint('C2.y2 = C1.y2')

        expected = { 'C1.y1': 3.1598617768014536, 'C2.y2': 3.7551999159927316 }

        top.run()

        # gather the values back to the rank 0 process and compare to expected
        dist_answers = top._system.mpi.comm.gather([(k[0],v) for k,v in top._system.vec['u'].items()],
                                                   root=0)
        if self.comm.rank == 0:
            for answers in dist_answers:
                for name, val in answers:
                    if name in expected:
                        #print self.comm.rank, name, val[0]
                        assert_rel_error(self, val[0], expected[name], 0.001)
                        del expected[name]

            if expected:
                self.fail(expected.keys() % "expected values %s were not found")

        # Piggyback testing of the is_variable_local function.
        system = top.driver.workflow._system

        # Only lowest rank has vars that are on all proceses
        if self.comm.rank == 0:
            self.assertTrue(system.is_variable_local('_pseudo_0.out0'))

            # Params on lowest rank
            self.assertTrue(system.is_variable_local('C1.y2'))
            self.assertTrue(system.is_variable_local('C2.y1'))
        else:
            self.assertFalse(system.is_variable_local('_pseudo_0.out0'))
            self.assertFalse(system.is_variable_local('C1.y2'))
            self.assertFalse(system.is_variable_local('C2.y1'))

        # Exclusive or - you either got C2 or C3 on a given process.
        self.assertTrue(system.is_variable_local('C1.y1') != system.is_variable_local('C2.y2'))
        self.assertTrue(system.is_variable_local('C1.exec_count') != system.is_variable_local('C2.exec_count'))
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/contrib/testmpi/test_mpi.py/MPITests2.test_sellar_parallel/swapped operands of `%`